예제 #1
0
 /// <summary>
 /// Parse ContractPermission from json
 /// </summary>
 /// <param name="json">Json</param>
 /// <returns>Return ContractPermission</returns>
 public static ContractPermission FromJson(JObject json)
 {
     return(new ContractPermission
     {
         Contract = ContractPermissionDescriptor.FromJson(json["contract"]),
         Methods = WildCardContainer <string> .FromJson(json["methods"], u => u.AsString()),
     });
 }
예제 #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;
            }
        }