ContractFunction class

A function defined in the ABI of an compiled contract.

Constructors

ContractFunction(String name, List<FunctionParameter> parameters, {List<FunctionParameter> outputs = const [], ContractFunctionType type = ContractFunctionType.function, StateMutability mutability = StateMutability.nonPayable})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
isConstant bool
Returns true if this function is constant, i.e. it cannot modify the state of the blockchain when called. This allows the function to be called without sending Ether or gas as the connected client can compute it locally, no expensive mining will be required.
no setter
isConstructor bool
Returns true if this function is an constructor of the contract it belongs to. Mind that this library does currently not support deploying new contracts on the blockchain, it only supports calling functions of existing contracts.
no setter
isDefault bool
Returns true if this is the default function of a contract, which can be called when no other functions fit to an request.
no setter
isPayable bool
Returns true if this function can be used to send Ether to a smart contract that the contract will actually keep. Normally, all Ether sent with a transaction will be used to pay for gas fees and the rest will be sent back. Here however, the Ether (minus the fees) will be kept by the contract.
no setter
mutability StateMutability
The mutability of this function, determines whether this function is going to read or write to the blockchain when called.
final
name String
The name of the function. Can be empty if it's an constructor or the default function.
final
outputs List<FunctionParameter>
The return types of this function.
final
parameters List<FunctionParameter>
A list of types that represent the parameters required to call this function.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selector Uint8List
The selector of this function, as described by solidity.
no setter
type ContractFunctionType
The type of the contract function, determines whether this isConstant or isConstructor.
final

Methods

decodeReturnValues(String data) List
Uses the known types of the function output to decode the value returned by a contract after making an call to it.
decodeValues(ByteBuffer buffer) List
encodeCall(List params) Uint8List
Encodes a call to this function with the specified parameters for a transaction or a call that can be sent to the network.
encodeName() String
Encodes the name of the function and its required parameters.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited