Mint ERC20 balance with a button

This commit is contained in:
Oskar Thoren 2021-01-20 13:22:43 +08:00
parent 813ff83878
commit 4f29bce3c2
No known key found for this signature in database
GPG Key ID: BDB55C8C0EF29911
2 changed files with 10 additions and 0 deletions

View File

@ -27,6 +27,10 @@
<p id="aliceERC20Balance"></p> <p id="aliceERC20Balance"></p>
<!-- TODO: Add a button here, show erc20 token balance, etc --> <!-- TODO: Add a button here, show erc20 token balance, etc -->
<form onSubmit="App.mint(); return false;">
<button type="submit" class="btn btn-primary">Mint</button>
</form>
</div> </div>
<div id="aliceSwap"> <div id="aliceSwap">
<h2>Alice Swap</h2> <h2>Alice Swap</h2>

View File

@ -131,6 +131,12 @@ App = {
}).catch(function(error) { }).catch(function(error) {
console.warn(error); console.warn(error);
}); });
},
mint: async function () {
web3.eth.defaultAccount = web3.eth.accounts[0]
var erc20 = await App.contracts.ERC20PresetMinterPauser.deployed()
var foo = await erc20.mint(App.aliceAddress, 10000)
} }
}; };