예제 #1
0
        public bool InvokeTriggerOnAccount(Address address, AccountTrigger trigger, params object[] args)
        {
            if (address.IsNull)
            {
                return(false);
            }

            if (address.IsUser)
            {
                //var accountScript = Nexus.LookUpAddressScript(RootStorage, address);
                var accountScript = OptimizedAddressScriptLookup(address);

                //Expect(accountScript.SequenceEqual(accountScript2), "different account scripts");
                return(InvokeTrigger(accountScript, trigger.ToString(), args));
            }

            if (address.IsSystem)
            {
                var contract = Nexus.GetContractByAddress(RootStorage, address);
                if (contract != null)
                {
                    var triggerName = trigger.ToString();
                    if (contract.HasInternalMethod(triggerName))
                    {
                        CallContext(contract.Name, triggerName, args);
                    }
                }

                return(true);
            }

            return(true);
        }
예제 #2
0
        public bool InvokeTriggerOnAccount(Address address, AccountTrigger trigger, params object[] args)
        {
            if (address.IsNull)
            {
                return(false);
            }

            if (address.IsUser)
            {
                var accountScript = Nexus.LookUpAddressScript(this.changeSet, address);
                return(InvokeTrigger(accountScript, trigger.ToString(), args));
            }

            if (address.IsSystem)
            {
                var contract = Nexus.GetContractByAddress(address);
                if (contract != null)
                {
                    var        triggerName = trigger.ToString();
                    BigInteger gasCost;
                    if (contract.HasInternalMethod(triggerName, out gasCost))
                    {
                        CallContext(contract.Name, triggerName, args);
                    }
                }

                return(true);
            }

            return(true);
        }
예제 #3
0
        public static bool InvokeTriggerOnAccount(this IRuntime runtime, Address address, AccountTrigger trigger, params object[] args)
        {
            if (address.IsNull)
            {
                return(false);
            }

            if (address.IsUser)
            {
                var accountScript = runtime.GetAddressScript(address);
                return(runtime.InvokeTrigger(accountScript, trigger.ToString(), args));
            }

            return(true);
        }
예제 #4
0
        public static bool InvokeTriggerOnAccount(RuntimeVM runtimeVM, Address address, AccountTrigger trigger, params object[] args)
        {
            if (address.IsNull)
            {
                return(false);
            }

            if (address.IsUser)
            {
                var accountScript = runtimeVM.Nexus.LookUpAddressScript(address);
                return(InvokeTrigger(runtimeVM, accountScript, trigger.ToString(), args));
            }

            return(true);
        }