|
@@ -648,6 +648,19 @@ namespace HyperCube.Models
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public async Task<string> BalanceOf(string contractAddress, string holderAddress)
|
|
|
|
+ {
|
|
|
|
+ TransactionObject transObj = new TransactionObject();
|
|
|
|
+ transObj.to = contractAddress;
|
|
|
|
+ transObj.data = await compileFunction($"function balanceOf(address account)");
|
|
|
|
+ if (address != null)
|
|
|
|
+ transObj.data += zerofill(holderAddress, 64, true);
|
|
|
|
+ //answer = await RunFunction2("eth_call", to, AccountModel.Current.GetActualAddress(this));
|
|
|
|
+ var answer = await RunFunction2("eth_call", transObj, "latest");
|
|
|
|
+ tokenBalance = ((double)AccountModel.ConvertBalance(ParseStringAnswer(answer)[0]) / 1000000000000000000.0).ToString();
|
|
|
|
+ return tokenBalance;
|
|
|
|
+ }
|
|
|
|
+
|
|
public async void RunContractRead()
|
|
public async void RunContractRead()
|
|
{
|
|
{
|
|
string answer = "no";
|
|
string answer = "no";
|