コード例 #1
0
        public DebugSession(IExecutionEngine engine, Contract contract, ContractArgument[] arguments, ReadOnlyMemory <string> returnTypes)
        {
            this.engine      = engine;
            this.returnTypes = returnTypes;
            Contract         = contract;

            using var builder = contract.BuildInvokeScript(arguments);
            engine.LoadScript(builder.ToArray());
        }
コード例 #2
0
        /// <summary>
        /// Runs the script on the VM.
        /// </summary>
        /// <returns>The invocation script on vm.</returns>
        /// <param name="invocationScript">Invocation script.</param>
        private InvocationResult RunInvocationOnVM(byte[] invocationScript)
        {
            _executionEngine.LoadScript(invocationScript);
            _executionEngine.Execute();

            var resultList = new List <object>();

            foreach (var stackItem in _executionEngine.ResultStack)
            {
                using (stackItem)
                {
                    resultList.Add(stackItem.GetRawObject());
                }
            }

            var invocationResult = new InvocationResult(invocationScript, _executionEngine.State,
                                                        _executionEngine.ConsumedGas, resultList.ToArray());

            return(invocationResult);
        }