public async Task Minter_Role_Test() { EthNetwork.UseDefaultTestNet(); var ownerAccount = new Account(EthNetwork.Instance.PrefundedPrivateKey); var holderAccount1 = EthAccountFactory.Create(); var newMinterAccount = EthAccountFactory.Create(); await EthNetwork.Instance.RefillAsync(newMinterAccount); // Create the ERC20 token... var contract = new AlgoTokenV1(EthNetwork.Instance.GetWeb3(ownerAccount), EthNetwork.Instance.GasPriceProvider); await contract.DeployAsync(); // Check the total supply... Assert.Equal(INITIAL_SUPPLY.Algo(), await contract.TotalSupplyAsync()); // Mint more tokens... await contract.MintAsync(holderAccount1.Address, 100.Algo()); // Check the total supply... Assert.Equal((INITIAL_SUPPLY + 100).Algo(), await contract.TotalSupplyAsync()); // Check balance of the target account... Assert.Equal(100.Algo(), await contract.BalanceOfAsync(holderAccount1.Address)); // Add a new minter... await contract.AddMinterAsync(newMinterAccount.Address); // Mint more tokens... contract = new AlgoTokenV1(contract.ContractAddress, EthNetwork.Instance.GetWeb3(newMinterAccount), EthNetwork.Instance.GasPriceProvider); await contract.MintAsync(holderAccount1.Address, 100.Algo()); // Check balance of the target account... Assert.Equal(200.Algo(), await contract.BalanceOfAsync(holderAccount1.Address)); }
protected override async Task <TransactionReceipt> ExecuteAsync(RuntimeContext context, string contractAddress, Web3 web3) { var algoToken = new AlgoTokenV1(contractAddress, web3, context.GasPriceProvider); return(await algoToken.MintAsync(context.ResolveAccountOrContractReference(To), Value)); }