-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.ts
More file actions
48 lines (37 loc) · 1.21 KB
/
test.ts
File metadata and controls
48 lines (37 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import ethers from "ethers"
import abi from "./abi.json"
const privateKey = process.env.PRIVATE_KEY
if (!privateKey) {
throw new Error("PRIVATE_KEY is not set")
}
const provider = new ethers.providers.JsonRpcProvider("https://base-sepolia.blockpi.network/v1/rpc/public")
const wallet = new ethers.Wallet(privateKey, provider)
const signer = wallet.connect(provider)
const contract = new ethers.Contract("0xA5952d568977ba0a0659Bde57559Ecf1FCD06FDe", abi, signer)
async function main() {
const result = await contract.weth()
console.log({ result })
const [salt, predictedAddress] = await contract.generateSalt(
signer.address,
"ABHI",
"ABHI",
1000000000000000000000000n,
)
console.log({ salt, predictedAddress })
const creation = await contract.deployToken(
"ABHI",
"ABHI",
1000000000000000000000000n,
signer.address,
100000000000000000000000n,
-53000,
10000,
salt,
100000000000000000000000n,
"0xe1e7581a239e3f0021bb65d1d58fd61a4488191f72a1b6d255083884835374b3"
)
console.log(creation.hash)
const receipt = await creation.wait()
console.log(receipt.transactionHash)
}
main()