Last active
November 27, 2023 15:21
-
-
Save Olanetsoft/666a2d028820a3f29039f155d8fc3dd4 to your computer and use it in GitHub Desktop.
Deploy token manager on Base Goerli testnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Axelar chains config https://github.com/axelarnetwork/axelar-contract-deployments/blob/d4b2a6ad23d3a24eaf5e94a5a2406e4a27c91431/axelar-chains-config/info/testnet.json#L1059 | |
// Base Goerli test | |
const hre = require("hardhat"); | |
const crypto = require("crypto"); | |
const ITSContractABI = require("../utils/its/abi"); | |
const tokenManagerMintBurnABI = require("../utils/its/tokenManagerMintBurnABI"); | |
const MINT_BURN = 0; | |
const LOCK_UNLOCK = 2; | |
const tokenAddress = "0x22C0e915197C90CF2147eA002123066c084cbE7d"; | |
const ITSContractAddress = "0xa4A9965149388c86E62CDDDd6C95EFe9c294005a"; | |
const tokenManagerMintBurnAddress = | |
"0xaA82eE3cC9EcA484fCcDD38d83190f823A79F482"; | |
const tokenManagerMintBurnFromAddress = | |
"0xfaF9cefE974572f6eBB83B48714F3c30cC07bBBB"; | |
// Deploy if you don't have tokenId yet, you can use the tokenId to retrieve the tokenMangerAddress later on ITS | |
// async function main() { | |
// const [owner] = await ethers.getSigners(); | |
// const salt = "0x" + crypto.randomBytes(32).toString("hex"); | |
// const ITSContract = new ethers.Contract( | |
// ITSContractAddress, | |
// ITSContractABI, | |
// owner | |
// ); | |
// console.log("salt: ", salt); | |
// const txn = await ITSContract.interchainTokenId(owner.address, salt); | |
// console.log("tokenId: ", txn); | |
// // salt: 0xcff4fb4e5481934ddc306eeed4683153342de8e6882200310b8532427d041beb | |
// // tokenId 0x025e1668d14a34188773252fbf78ebd371243918c075a564e202b8dda2895709 | |
// } | |
async function main() { | |
const [owner] = await ethers.getSigners(); | |
const TMMintBurnContract = new ethers.Contract( | |
tokenManagerMintBurnAddress, | |
tokenManagerMintBurnABI, | |
owner | |
); | |
const params = await TMMintBurnContract.params(owner.address, tokenAddress); | |
console.log("params: ", params); | |
const ITSContract = new ethers.Contract( | |
ITSContractAddress, | |
ITSContractABI, | |
owner | |
); | |
const txn = await ITSContract.deployTokenManager( | |
"0xcff4fb4e5481934ddc306eeed4683153342de8e6882200310b8532427d041beb", | |
"", | |
MINT_BURN, | |
params, | |
0 | |
); | |
console.log("txn: ", txn); | |
// Token Manager hash 0x22d1a86ab20265b32c1a8c13d609ff92fedeb2968e103d07425f4bcbd9a811d8 | |
// https://goerli.basescan.org/tx/0x22d1a86ab20265b32c1a8c13d609ff92fedeb2968e103d07425f4bcbd9a811d8 | |
// Params 0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000022c0e915197c90cf2147ea002123066c084cbe7d0000000000000000000000000000000000000000000000000000000000000014510e5ea32386b7c48c4deeac80e86859b5e2416c000000000000000000000000 | |
} | |
// We recommend this pattern to be able to use async/await everywhere | |
// and properly handle errors. | |
main().catch((error) => { | |
console.error(error); | |
process.exitCode = 1; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment