Skip to content

Instantly share code, notes, and snippets.

@dvush
Last active May 19, 2020 09:17
Show Gist options
  • Save dvush/191b6960d4d520734bd334241f416734 to your computer and use it in GitHub Desktop.
Save dvush/191b6960d4d520734bd334241f416734 to your computer and use it in GitHub Desktop.
mint function
async function mintTestnetToken(wallet: Wallet, token: TokenLike) { // Wallet and TokenLike from zksync.js
const tokenAddress = wallet.provider.tokenSet.resolveTokenAddress(token);
const ABI = [{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_to",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "mint",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}]
const erc20Mintable = new ethers.Contract(tokenAddress, ABI, wallet.ethSigner);
return await erc20Mintable.mint(wallet.address(), ethers.utils.parseEther("100"));
}
// example
const tx = await mintTestnetToken(zksyncWallet, "BUSD");
console.log(tx.hash);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment