Skip to content

Instantly share code, notes, and snippets.

@farukterzioglu
Created September 1, 2019 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farukterzioglu/5427454d0214137e4b3a99d2b504c356 to your computer and use it in GitHub Desktop.
Save farukterzioglu/5427454d0214137e4b3a99d2b504c356 to your computer and use it in GitHub Desktop.
Erc20-5
[Test]
public async Task GetBalance()
{
string contractAddress = "0xD267808D8fB2F2D6b02074DAC2F00036D5FcB3EE";
string ownerAddress = "0x228cD92AA7E3e2B4353597ec0B767B856d03E489";
string receiverAddress = "0x576077aCC546d475845a4178ECF0B467CC7D7e10";
var balanceHandler = _web3.Eth.GetContractQueryHandler<BalanceOfFunction>();
var ownerBalance = await balanceHandler.QueryAsync<BigInteger>(contractAddress, new BalanceOfFunction() { Owner = ownerAddress });
Assert.AreEqual(10, (int) ownerBalance);
var receiverBalance = await balanceHandler.QueryAsync<BigInteger>(contractAddress, new BalanceOfFunction() { Owner = receiverAddress });
Assert.AreEqual(0, (int) receiverBalance);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment