Пример #1
0
        public void TestCanCall()
        {
            var temp = new ContractState()
            {
                Manifest = TestUtils.CreateDefaultManifest()
            };

            Assert.AreEqual(true, temp.CanCall(new ContractState()
            {
                Hash = UInt160.Zero, Manifest = TestUtils.CreateDefaultManifest()
            }, "AAA"));
        }
Пример #2
0
        public void TestCanCall()
        {
            var temp = new ContractState()
            {
                Manifest = TestUtils.CreateDefaultManifest()
            };

            temp.Manifest.SafeMethods = WildcardContainer <string> .Create(new string[] { "AAA" });

            Assert.AreEqual(true, temp.CanCall(new ContractState()
            {
                Hash = UInt160.Zero, Manifest = TestUtils.CreateDefaultManifest()
            }, "AAA"));
        }
Пример #3
0
        public MethodCallback(ApplicationEngine engine, UInt160 hash, string method)
            : base(ApplicationEngine.System_Contract_Call, false)
        {
            if (method.StartsWith('_'))
            {
                throw new ArgumentException();
            }
            this.contract = engine.Snapshot.Contracts[hash];
            ContractState currentContract = engine.Snapshot.Contracts.TryGet(engine.CurrentScriptHash);

            if (currentContract?.CanCall(this.contract, method) == false)
            {
                throw new InvalidOperationException();
            }
            this.method = this.contract.Manifest.Abi.Methods.First(p => p.Name == method);
        }