예제 #1
0
 public InvocationResult(byte[] executedScript, EVMState resultingState, ulong gasCost, object[] executionResult)
 {
     ExecutedScript  = executedScript;
     ResultingState  = resultingState;
     GasCost         = gasCost;
     ExecutionResult = executionResult;
 }
예제 #2
0
        private void ONVMStateChanged(VMBase closedVM, EVMState curState)
        {
            if (!curState.Equals(EVMState.Deactive))
            {
                return;
            }

            StartCloseVM(null);
        }
예제 #3
0
        /// <summary>
        /// Do not call this manually, instead call ActivateUI()
        /// </summary>
        public void Activate()
        {
            _canvas.enabled = true;

            _deactivationController.StopDeactivationListening();

            VMState = EVMState.Active;

            OnActivateCustomActions();
        }
 private void OnVMStateChanged(EVMState state)
 {
     if (state.Equals(EVMState.Active))
     {
         OnIntroTriggered?.Invoke();
     }
     else
     {
         OnOutroTriggered?.Invoke();
     }
 }
예제 #5
0
        public override bool IncreaseGas(ulong gas)
        {
            _gasConsumed = checked (_gasConsumed + gas);

            if (_gasConsumed > _gasAmount)
            {
                _state = EVMState.FaultByGas;
                return(false);
            }

            return(true);
        }
        private void OnVMStateChanged(EVMState state)
        {
            switch (state)
            {
            case EVMState.Active:
                RegisterEvents();
                break;

            case EVMState.Deactive:
                UnregisterEvents();
                break;
            }
        }
예제 #7
0
        public ApplicationEngine(ExecutionEngineArgs args) : base(args)
        {
            _isDisposed  = false;
            _gasConsumed = _gasAmount = 0;
            _state       = EVMState.None;
            _scriptTable = new List <byte[]>();

            _contractScriptTable = new ContractScriptTable(args.ScriptTable);

            _engine = new ExecutionEngine(
                new ScriptContainerWrapper(args.MessageProvider),
                _crypto,
                _contractScriptTable,
                new InteropServiceAdapter(this, args.InteropService));

            _resultStack     = new StackWrapper(_engine.ResultStack);
            _invocationStack = new StackExecutionContextWrapper(_engine.InvocationStack);
        }
예제 #8
0
        public override void StepInto()
        {
            try
            {
                // Log

                if (Logger.Verbosity.HasFlag(ELogVerbosity.StepInto))
                {
                    Logger.RaiseOnStepInto(CurrentContext);
                }

                // Pre checks

                var nextOpCode = _engine.CurrentContext.InstructionPointer >= _engine.CurrentContext.Script.Length ? OpCode.RET : _engine.CurrentContext.NextInstruction;

                if (!PreStepInto(nextOpCode))
                {
                    _state = EVMState.Fault;
                    return;
                }

                // Execute

                _engine.StepInto();
                _state = (EVMState)(_engine.State & ~VMState.BREAK);

                // Post check

                if (_state != EVMState.None)
                {
                    return;
                }
                if (!PostStepInto(nextOpCode))
                {
                    _state = EVMState.Fault;
                    return;
                }
            }
            catch
            {
                // Error
                _state = EVMState.Fault;
            }
        }
예제 #9
0
 public override void Clean(uint iteration = 0)
 {
     _gasConsumed = _gasAmount = 0;
     _state       = EVMState.None;
 }
예제 #10
0
        /// <summary>
        /// Do not call this manually, instead call DeactivateUI()
        /// </summary>
        public void Deactivate()
        {
            _deactivationController.ListenOutroAnimsTriggeredByVM(OnVMStateChanged, OnOutroAnimsFinished);

            VMState = EVMState.Deactive;
        }