Beispiel #1
0
 public ApplicationEngine(TriggerType trigger, IScriptContainer container, IScriptTable table, InteropService service, Fixed8 gas, bool testMode = false)
     : base(container, Cryptography.Crypto.Default, table, service)
 {
     this.gas_amount = gas_free + gas.GetData();
     this.testMode   = testMode;
     this.Trigger    = trigger;
 }
Beispiel #2
0
 public ExecutionEngine(IScriptContainer container, ICryptography crypto, IScriptTable table = null, InteropService service = null)
 {
     this.ScriptContainer = container;
     this.Crypto          = crypto;
     this.table           = table;
     this.Service         = service ?? new InteropService();
 }
 public ExecutionEngine(IScriptContainer container, ICrypto crypto, int max_steps, IScriptTable table = null, InteropService service = null)
 {
     this.ScriptContainer = container;
     this.Crypto          = crypto;
     this.table           = table;
     this.service         = service ?? new InteropService();
     this.max_steps       = max_steps;
 }
Beispiel #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="e">Arguments</param>
        protected IExecutionEngine(ExecutionEngineArgs e)
        {
            if (e == null)
            {
                return;
            }

            InteropService  = e.InteropService;
            ScriptTable     = e.ScriptTable;
            MessageProvider = e.MessageProvider;
            Trigger         = e.Trigger;
            Logger          = e.Logger;
        }
        public void Reset(byte[] inputScript, ABI ABI, string methodName, IScriptTable table = null)
        {
            if (ContractByteCode == null || ContractByteCode.Length == 0)
            {
                throw new Exception("Contract bytecode is not set yet!");
            }

            if (lastState.state == DebuggerState.State.Reset)
            {
                return;
            }

            if (currentTransaction == null)
            {
                //throw new Exception("Transaction not set");
                currentTransaction = new API.Transaction(this.blockchain.currentBlock);
            }

            usedGas         = 0;
            usedOpcodeCount = 0;

            currentTransaction.emulator = this;
            engine = new ExecutionEngine(currentTransaction, table, interop);
            engine.LoadScript(ContractByteCode);
            engine.LoadScript(inputScript);

            this.currentMethod = methodName;

            /*foreach (var output in currentTransaction.outputs)
             * {
             *  if (output.hash == this.currentHash)
             *  {
             *      output.hash = engine.CurrentContext.ScriptHash;
             *  }
             * }*/

            foreach (var pos in _breakpoints)
            {
                engine.AddBreakPoint((uint)pos);
            }

            //engine.Reset();

            lastState          = new DebuggerState(DebuggerState.State.Reset, 0);
            currentTransaction = null;

            _variables.Clear();
            this._ABI = ABI;
        }
Beispiel #6
0
 public ExecutionEngine(IScriptContainer container, IScriptTable table = null, InteropService service = null)
 {
     this.ScriptContainer = container;
     this.table           = table;
     this.service         = service ?? new InteropService();
 }
 public SCTrackerExecutionEngine(RichTextBox LogOutput, IScriptContainer container, ICrypto crypto, IScriptTable table = null, InteropService service = null)
     : base(container, crypto, table, service)
 {
     this.Logger = LogOutput;
 }
Beispiel #8
0
 public NeoEngine(TriggerType trigger, IScriptContainer container, IScriptTable table, InteropService service, Fixed8 gas, bool testMode = false)
     : base(trigger, container, table, service, gas, testMode)
 {
 }
Beispiel #9
0
 public ApplicationEngine(IScriptContainer container, IScriptTable table, StateMachine state, Fixed8 gas)
     : base(container, Cryptography.Crypto.Default, table, state)
 {
     this.gas = gas_free + gas.GetData();
 }
Beispiel #10
0
 public ContractScriptTable(IScriptTable scriptTable)
 {
     _scriptTable = scriptTable;
 }