contracts library

Library to interact with ethereum smart contracts. Handles encoding and decoding of the solidity contact ABI and creating transactions for calls on smart contracts.

Classes

AbiType<T>
A type that can be encoded and decoded as specified in the solidity ABI, available at https://solidity.readthedocs.io/en/develop/abi-spec.html
AddressType
Solidity address type
BaseArrayType<T>
Base class for (non-byte) arrays in solidity.
BoolType
Solidity bool type
CompositeFunctionParameter
A function parameter that includes other named parameter instead of just wrapping single types.
ContractAbi
Defines the abi of a deployed Ethereum contract. The abi contains information about the functions defined in that contract.
ContractEvent
An event that can be emitted by a smart contract during a transaction.
ContractFunction
A function defined in the ABI of an compiled contract.
DecodingResult<T>
DeployedContract
Helper class that defines a contract with a known ABI that has been deployed on a Ethereum blockchain.
DynamicBytes
The solidity bytes type, which decodes byte arrays of arbitrary length.
DynamicLengthArray<T>
The solidity T[] type for arrays with an dynamic length.
EncodingLengthInfo
Information about whether the length of an encoding depends on the data (dynamic) or is fixed (static). If it's static, also contains information about the length of the encoding.
EventComponent<T>
A FunctionParameter that is a component of an event. Contains additional information about whether the parameter is indexed.
FixedBytes
The bytes
FixedLengthArray<T>
The solidity T[k] type for arrays whose length is known.
FunctionParameter<T>
The parameter of a function with its name and the expected type.
FunctionType
GeneratedContract
Base classes for generated contracts.
IntType
The solidity int
StringType
The solidity string type, which utf-8 encodes strings
TupleType
UintType
The solidity uint

Enums

ContractFunctionType
StateMutability
The state mutability of a contract function defines how that function interacts with the blockchain.

Constants

sizeUnitBytes → const int
The length of the encoding of a solidity type is always a multiplicative of this unit size.

Functions

calculatePadLength(int bodyLength, {bool allowEmpty = false}) int
Calculates the amount of padding bytes needed so that the length of the padding plus the bodyLength is a multiplicative of sizeUnitBytes. If allowEmpty (defaults to false) is true, an empty length is allowed. Otherwise an empty bodyLength will be given a full sizeUnitBytes padding.
parseAbiType(String name) AbiType
Parses an ABI type from its AbiType.name.