Exemple #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);
        }
Exemple #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);
        }