Пример #1
0
        public async Task Deploy_Contract_And_Transfer_Tokens_Test()
        {
            EthNetwork.UseDefaultTestNet();

            var ownerAccount   = new Account(EthNetwork.Instance.PrefundedPrivateKey);
            var holderAccount1 = EthAccountFactory.Create();

            // Create the ERC20 token...
            var contract = new AlgoTokenV1(EthNetwork.Instance.GetWeb3(ownerAccount), EthNetwork.Instance.GasPriceProvider);
            await contract.DeployAsync();

            // Ensure that the initial supply is allocated to the owner...
            Assert.Equal(INITIAL_SUPPLY.Algo(), await contract.BalanceOfAsync(ownerAccount.Address));

            // Perform a transfer...
            await contract.TransferAsync(holderAccount1.Address, 2.Algo());

            // Ensure the receiver got the tokens...
            Assert.Equal(2.Algo(), await contract.BalanceOfAsync(holderAccount1.Address));
        }