Example #1
0
 internal void CallNativeContract(string name)
 {
     if (!NativeContract.GetContract(name).Invoke(this))
     {
         throw new InvalidOperationException();
     }
 }
Example #2
0
        protected internal void CallNativeContract(string name)
        {
            NativeContract contract = NativeContract.GetContract(name);

            if (contract is null || contract.ActiveBlockIndex > Snapshot.PersistingBlock.Index)
            {
                throw new InvalidOperationException();
            }
            contract.Invoke(this);
        }
        protected internal void CallNativeContract(int id)
        {
            NativeContract contract = NativeContract.GetContract(id);

            if (contract is null || contract.ActiveBlockIndex > Snapshot.Height)
            {
                throw new InvalidOperationException();
            }
            contract.Invoke(this);
        }
Example #4
0
        protected internal void CallNativeContract(byte version)
        {
            NativeContract contract = NativeContract.GetContract(CurrentScriptHash);

            if (contract is null)
            {
                throw new InvalidOperationException("It is not allowed to use \"System.Contract.CallNative\" directly.");
            }
            contract.Invoke(this, version);
        }
Example #5
0
        protected internal void CallNativeContract(byte version)
        {
            NativeContract contract = NativeContract.GetContract(CurrentScriptHash);

            if (contract is null)
            {
                throw new InvalidOperationException("It is not allowed to use \"System.Contract.CallNative\" directly.");
            }
            uint activeIndex = ProtocolSettings.NativeUpdateHistory[contract.Name][0];

            if (activeIndex > NativeContract.Ledger.CurrentIndex(Snapshot))
            {
                throw new InvalidOperationException($"The native contract {contract.Name} is not active.");
            }
            contract.Invoke(this, version);
        }
Example #6
0
 protected internal void CallNativeContract(string name)
 {
     NativeContract.GetContract(name).Invoke(this);
 }
Example #7
0
 public void TestGetContract()
 {
     Assert.IsTrue(NativeContract.NEO == NativeContract.GetContract(NativeContract.NEO.Id));
     Assert.IsTrue(NativeContract.NEO == NativeContract.GetContract(NativeContract.NEO.Hash));
 }
 public void TestGetContract()
 {
     Assert.IsTrue(NativeContract.Vauth == NativeContract.GetContract(NativeContract.Vauth.Hash));
 }