Last active
May 19, 2020 09:17
-
-
Save dvush/191b6960d4d520734bd334241f416734 to your computer and use it in GitHub Desktop.
mint function
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
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