Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions script/interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ task("depositERC20", "Deposit erc20 token to zkLink on testnet")
const erc20Factory = await hardhat.ethers.getContractFactory('ERC20');
const erc20 = erc20Factory.attach(token);
const tokenBalance = await erc20.connect(sender).balanceOf(sender.address);
console.log('sender token balance', hardhat.ethers.formatEther(tokenBalance, decimals));
console.log('sender token balance', hardhat.ethers.formatUnits(tokenBalance, decimals));

const zkLinkFactory = await hardhat.ethers.getContractFactory('ZkLink');
const zkLink = zkLinkFactory.attach(zkLinkProxy);
const amountInWei = hardhat.ethers.parseUnits(amount, decimals);
const allowance = await erc20.connect(sender).allowance(sender.address, zkLink);
const allowance = await erc20.connect(sender).allowance(sender.address, zkLinkProxy);
if (allowance === 0n) {
console.log('add unlimited allowance');
const tx = await erc20.connect(sender).approve(zkLink, hardhat.ethers.MaxUint256);
const tx = await erc20.connect(sender).approve(zkLinkProxy, hardhat.ethers.MaxUint256);
await tx.wait();
console.log('approve tx hash', tx.hash);
}
Expand Down Expand Up @@ -514,4 +514,4 @@ task("setL2GatewayToZkLink", "set gateway address to zklink")
const tx = await zkLink.connect(governor).setGateway(gatewayAddr);
await tx.wait();
console.log("tx:", tx.hash);
})
})