ソースを参照

промежуточное

Rimmon 3 年 前
コミット
ee513908f5
2 ファイル変更14 行追加1 行削除
  1. 13 0
      Models/Blockchain.cs
  2. 1 1
      Models/SmartContract.cs

+ 13 - 0
Models/Blockchain.cs

@@ -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()
         {
             string answer = "no";

+ 1 - 1
Models/SmartContract.cs

@@ -155,7 +155,7 @@ namespace HyperCube.Models
                 var expert_value = article_value * verifier.GetRatingExpert() * edits;
                 var initiator_value = article_value * initiator.GetRatingProspector();
 
-                Console.WriteLine($"article_value {article_value} expert_value {expert_value} initiator_value {initiator_value} ");
+                Console.WriteLine($"article_value {article_value} expert_value {expert_value} initiator_value {initiator_value} CharCount {newArticle.CharCount} Keywords count {newArticle.Keywords.Split(",").Length} ");
 
                 //init notifications 2DEVS
                 return "none";