예제 #1
0
 /// <summary>
 /// Create Default Contract manifest
 /// </summary>
 /// <param name="hash">Hash</param>
 /// <returns>Return default manifest for this contract</returns>
 public static ContractManifest CreateDefault(UInt160 hash)
 {
     return(new ContractManifest()
     {
         Permissions = new[] { ContractPermission.DefaultPermission },
         Abi = new ContractAbi()
         {
             Hash = hash,
             EntryPoint = ContractMethodDescriptor.DefaultEntryPoint,
             Events = new ContractEventDescriptor[0],
             Methods = new ContractMethodDescriptor[0]
         },
         Features = ContractFeatures.NoProperty,
         Groups = new ContractGroup[0],
         SafeMethods = WildCardContainer <string> .Create(),
         Trusts = WildCardContainer <UInt160> .Create()
     });
 }
예제 #2
0
        private void DeserializeFromJson(JObject json)
        {
            Abi         = ContractAbi.FromJson(json["abi"]);
            Groups      = ((JArray)json["groups"]).Select(u => ContractGroup.FromJson(u)).ToArray();
            Features    = ContractFeatures.NoProperty;
            Permissions = ((JArray)json["permissions"]).Select(u => ContractPermission.FromJson(u)).ToArray();
            Trusts      = WildCardContainer <UInt160> .FromJson(json["trusts"], u => UInt160.Parse(u.AsString()));

            SafeMethods = WildCardContainer <string> .FromJson(json["safeMethods"], u => u.AsString());

            if (json["features"]["storage"].AsBoolean())
            {
                Features |= ContractFeatures.HasStorage;
            }
            if (json["features"]["payable"].AsBoolean())
            {
                Features |= ContractFeatures.Payable;
            }
        }