Exemplo n.º 1
0
 internal void CallNativeContract(string name)
 {
     if (!NativeContract.GetContract(name).Invoke(this))
     {
         throw new InvalidOperationException();
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
 protected internal void CallNativeContract(string name)
 {
     NativeContract.GetContract(name).Invoke(this);
 }
Exemplo n.º 7
0
 public void TestGetContract()
 {
     Assert.IsTrue(NativeContract.NEO == NativeContract.GetContract(NativeContract.NEO.Id));
     Assert.IsTrue(NativeContract.NEO == NativeContract.GetContract(NativeContract.NEO.Hash));
 }
Exemplo n.º 8
0
 public void TestGetContract()
 {
     Assert.IsTrue(NativeContract.Vauth == NativeContract.GetContract(NativeContract.Vauth.Hash));
 }