示例#1
0
        private void ScanForAssetName(Transaction tx, bool logFailure)
        {
            var name = NamedIssuance.Extract(tx);

            if (name != null)
            {
                var result = Runtime.Repository.SetAssetName(name);
                if (result == Repository.SetNameResult.Success)
                {
                    Logs.Explorer.LogInformation($"Name {name.Name} claimed by {name.AssetId}");
                }
                else
                if (logFailure)
                {
                    Logs.Explorer.LogInformation($"Name {name.Name} failed to be claimed by {name.AssetId}, cause: {result}");
                }
            }
        }
示例#2
0
 public SetNameResult SetAssetName(NamedIssuance issuance)
 {
     using (var tx = _Engine.GetTransaction())
     {
         byte[] a;
         bool   b;
         tx.Insert("AssetNameById", issuance.AssetId.ToString(), issuance.Name, out a, out b, true);
         if (b)
         {
             return(SetNameResult.AssetIdAlreadyClaimedAName);
         }
         tx.Insert("AssetIdByName", issuance.Name, issuance.AssetId.ToString(), out a, out b, true);
         if (b)
         {
             return(SetNameResult.AssetNameAlreadyExist);
         }
         tx.Commit();
         return(SetNameResult.Success);
     }
 }