public static T LoadFieldFromStorage <T>(StorageContext storage, NativeContractKind kind, string fieldName)
        {
            var contractName = kind.GetContractName();
            var key          = GetKeyForField(contractName, fieldName, true);

            if (storage.Has(key))
            {
                return(storage.Get <T>(key));
            }

            return(default(T));
        }
 public static Address GetAddressForNative(NativeContractKind kind)
 {
     return(GetAddressForName(kind.GetName()));
 }
 public static string GetContractName(this NativeContractKind nativeContract)
 {
     return(nativeContract.ToString().ToLower());
 }
 public static IContract GetContract(this IRuntime runtime, NativeContractKind nativeContract)
 {
     return(runtime.GetContract(nativeContract.GetContractName()));
 }
 public static VMObject CallNativeContext(this IRuntime runtime, NativeContractKind nativeContract, string methodName, params object[] args)
 {
     return(runtime.CallContext(nativeContract.GetContractName(), 0, methodName, args));
 }
 public static TriggerResult InvokeTrigger(this IRuntime runtime, bool allowThrow, byte[] script, NativeContractKind contextName, ContractInterface abi, string triggerName, params object[] args)
 {
     return(runtime.InvokeTrigger(allowThrow, script, contextName.ToString().ToLower(), abi, triggerName, args));
 }
 public static ScriptBuilder CallContract(this ScriptBuilder sb, NativeContractKind contractKind, string method, params object[] args)
 {
     return(sb.CallContract(contractKind.ToString().ToLower(), method, args));
 }
 public static byte[] GetKeyForField(NativeContractKind nativeContract, string fieldName, bool isProtected)
 {
     return(GetKeyForField(nativeContract.GetContractName(), fieldName, isProtected));
 }
 public static Address GetContractAddress(this IRuntime runtime, NativeContractKind nativeContract)
 {
     return(Address.FromHash(nativeContract.GetName()));
 }
Exemple #10
0
 public VMObject InvokeContract(StorageContext storage, NativeContractKind nativeContract, string methodName, params object[] args)
 {
     return(InvokeContract(storage, nativeContract.GetContractName(), methodName, args));
 }