Пример #1
0
            private object[] Call(BlockHeader parentHeader, AbiFunctionDescription function, Address sender, params object[] arguments)
            {
                var result  = CallRaw(parentHeader, function, sender, arguments);
                var objects = _contract.AbiEncoder.Decode(function.GetReturnInfo(), result);

                return(objects);
            }
Пример #2
0
        /// <summary>
        /// Calls the function in contract, state modification is allowed.
        /// </summary>
        /// <param name="header">Header in which context the call is done.</param>
        /// <param name="function">Function in contract that is being called.</param>
        /// <param name="sender">Sender of the transaction - caller of the function.</param>
        /// <param name="arguments">Arguments to the function.</param>
        /// <returns>Deserialized return value of the <see cref="function"/> based on its definition.</returns>
        protected object[] Call(BlockHeader header, AbiFunctionDescription function, Address sender, params object[] arguments)
        {
            var transaction = GenerateTransaction <SystemTransaction>(function, sender, arguments);
            var result      = Call(header, transaction);
            var objects     = AbiEncoder.Decode(function.GetReturnInfo(), result);

            return(objects);
        }
Пример #3
0
        /// <summary>
        /// Same as <see cref="Call(Nethermind.Core.BlockHeader,AbiFunctionDescription,Address,object[])"/> but returns false instead of throwing <see cref="AuRaException"/>.
        /// </summary>
        /// <param name="header">Header in which context the call is done.</param>
        /// <param name="function">Function in contract that is being called.</param>
        /// <param name="sender">Sender of the transaction - caller of the function.</param>
        /// <param name="result">Deserialized return value of the <see cref="function"/> based on its definition.</param>
        /// <param name="arguments">Arguments to the function.</param>
        /// <returns>true if function was <see cref="StatusCode.Success"/> otherwise false.</returns>
        protected bool TryCall(BlockHeader header, AbiFunctionDescription function, Address sender, out object[] result, params object[] arguments)
        {
            var transaction = GenerateTransaction <SystemTransaction>(function, sender, arguments);

            if (TryCall(header, transaction, out var bytes))
            {
                result = AbiEncoder.Decode(function.GetReturnInfo(), bytes);
                return(true);
            }

            result = null;
            return(false);
        }