pnpm installnpm install -g @forge/cli
foundryuppnpm compileIf you prefer one over the other, you can use the tooling-specific commands:
pnpm compile:forgepnpm compile:hardhatSimilarly to the contract compilation, we support both hardhat and forge tests. By default, the test command will
execute both:
pnpm testIf you prefer one over the other, you can use the tooling-specific commands:
pnpm test:forge
pnpm test:hardhatSet up deployer wallet/account:
- Rename
.env.example->.env - Choose your preferred means of setting up your deployer wallet/account:
MNEMONIC="test test test test test test test test test test test junk"
or...
PRIVATE_KEY="0xabc...def"
npx hardhat 尝试使用全局安装的 Hardhat,但 Hardhat 需要在本地项目中安装才能正常工作
pnpm install --save-dev hardhat
npx hardhat export-abinpx hardhat deploy --network bscMainnetTest --tags Timelocknpx hardhat deploy --network bscMainnetTest --tags WithdrawVaultnpx hardhat deploy --network bscMainnetTest --tags Earnnpx hardhat deploy --network bscMainnetTest --tags TimelockVerifynpx hardhat deploy --network bscMainnetTest --tags WithdrawVaultVerifynpx hardhat deploy --network bscMainnetTest --tags EarnVerifyhardhat deploy --network bscMainnetTest --tags WithdrawVaultImplementationhardhat deploy --network bscMainnetTest --tags EarnImplementationnpx hardhat deploy --network bscMainnetTest --tags AsBTC验证合约
npx hardhat deploy --network bscMainnetTest --tags AsBTCVerifynpx hardhat upgrade:WithdrawVault --network bscMainnetTestnpx hardhat upgrade:Earn --network bscMainnetTestgrantRole: 把 Earn合约地址加到 MINTER_AND_BURN_ROLE 角色下 approve: 授权spender(Earn合约地址)使用多少数量的token
approve: 授权spender(Earn合约地址)使用多少数量的token
grantRole: 把 bot(后端发起交易地址)地址加到 BOT_ROLE 角色下
grantRole: 把 Earn合约地址加到 TRANSFER_ROLE 角色下
[Earn 合约] grantRole: 把 bot(后端发起交易地址)地址加到 BOT_ROLE 角色下 更改address 为bot地址
npx hardhat grantRole:earn --network bscMainnetTest[WithdrawVault 合约] grantRole: 把 Earn合约地址加到 TRANSFER_ROLE 角色下
npx hardhat grantRole:transfer_role --network bscMainnetTest更改 const contract='AsBTC' 变量值
npx hardhat grantRole:minter_and_burn_role --network bscMainnetTest[{"assTokenAddress":"0x3f41a2d00D9D294B4097B68EbFBE7dfE955fc3Cc","assToSourceExchangeRate":"100000000","exchangeRateExpiredTimestamp":"1735660800"}]
[{"assTokenAddress":"0x3f41a2d00D9D294B4097B68EbFBE7dfE955fc3Cc","sourceTokenAmount":"100000000000000000","requestWithdrawNo":1,"receipt":"0xf4903f4544558515b26ec4C6D6e91D2293b27275"}]
[{"assTokenAddress":"0xbb8f7E2321c4a7D8b9B432792103A5d48A74ace8","sourceTokenAmount":"10000000000000000","requestWithdrawNo":2,"receipt":"0xf4903f4544558515b26ec4C6D6e91D2293b27275"}]
跨链部署文档 https://docs.layerzero.network/v2/developers/evm/create-lz-oapp/start 查看交易 https://testnet.layerzeroscan.com/address/0xf4903f4544558515b26ec4c6d6e91d2293b27275 链上跟踪交易 https://dashboard.tenderly.co/tx/bnb-testnet/0xeb394f04f8a578d1bbecbdee25093f98bff892c9289cf7d064a37ab04d36c1cb
npx hardhat deploy --network bscTestnet --tags AssUSDCnpx hardhat deploy --network sepoliaTestnet --tags AssUSDCnpx hardhat deploy --network bscTestnet --tags AssUSDCVerifynpx hardhat deploy --network sepoliaTestnet --tags AssUSDCVerifynpx hardhat lz:oapp:config:init --contract-name AssXXX --oapp-config testnet.layerzero.config.tsnpx hardhat lz:oapp:wire --oapp-config testnet.layerzero.config.ts[{"dstEid":40161,"maxDailyTransferAmount":"1000000000000000000000000000","singleTransferUpperLimit":"10000000000000000000000000","singleTransferLowerLimit":"0","dailyTransferAmountPerAddress":"100000000000000000000000000","dailyTransferAttemptPerAddress":"10000000"}]
[{"dstEid":40102,"maxDailyTransferAmount":"1000000000000000000000000000","singleTransferUpperLimit":"10000000000000000000000000","singleTransferLowerLimit":"0","dailyTransferAmountPerAddress":"100000000000000000000000000","dailyTransferAttemptPerAddress":"10000000"}]
const toBytes32Value = arrayToBytes32(ethers.utils.zeroPad('0xf4903f4544558515b26ec4C6D6e91D2293b27275', 32));
console.log(toBytes32Value); const extraOptions = Options.newOptions().addExecutorLzReceiveOption(600000, 0).toHex().toString()
console.log(extraOptions)
