You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
abi.decode(bytes memory encodedData, (...)) returns (...): :ref:`ABI <ABI>`-decodes
the provided data. The types are given in parentheses as second argument.
Example: (uint a, uint[2] memory b, bytes memory c) = abi.decode(data, (uint, uint[2], bytes))
abi.encode(...) returns (bytes memory): :ref:`ABI <ABI>`-encodes the given arguments
abi.encodePacked(...) returns (bytes memory): Performs :ref:`packed encoding <abi_packed_mode>` of
the given arguments. Note that this encoding can be ambiguous!
abi.encodeWithSelector(bytes4 selector, ...) returns (bytes memory): :ref:`ABI <ABI>`-encodes
the given arguments starting from the second and prepends the given four-byte selector
abi.encodeCall(function functionPointer, (...)) returns (bytes memory): ABI-encodes a call to functionPointer with the arguments found in the
tuple. Performs a full type-check, ensuring the types match the function signature. Result equals abi.encodeWithSelector(functionPointer.selector, (...))
blockhash(uint blockNumber) returns (bytes32): hash of the given block - only works for 256 most recent blocks
block.basefee (uint): current block's base fee (EIP-3198 and EIP-1559)
block.chainid (uint): current chain id
block.coinbase (address payable): current block miner's address
block.difficulty (uint): current block difficulty (EVM < Paris). For other EVM versions it behaves as a deprecated alias for block.prevrandao that will be removed in the next breaking release
block.gaslimit (uint): current block gaslimit
block.number (uint): current block number
block.prevrandao (uint): random number provided by the beacon chain (EVM >= Paris) (see EIP-4399 )
block.timestamp (uint): current block timestamp in seconds since Unix epoch
gasleft() returns (uint256): remaining gas
msg.data (bytes): complete calldata
msg.sender (address): sender of the message (current call)
msg.sig (bytes4): first four bytes of the calldata (i.e. function identifier)
msg.value (uint): number of wei sent with the message
tx.gasprice (uint): gas price of the transaction
tx.origin (address): sender of the transaction (full call chain)
.. index:: assert, require, revert
Validations and Assertions
assert(bool condition): abort execution and revert state changes if condition is false (use for internal error)
require(bool condition): abort execution and revert state changes if condition is false (use
for malformed input or error in external component)
require(bool condition, string memory message): abort execution and revert state changes if
condition is false (use for malformed input or error in external component). Also provide error message.
revert(): abort execution and revert state changes
revert(string memory message): abort execution and revert state changes providing an explanatory string
keccak256(bytes memory) returns (bytes32): compute the Keccak-256 hash of the input
sha256(bytes memory) returns (bytes32): compute the SHA-256 hash of the input
ripemd160(bytes memory) returns (bytes20): compute the RIPEMD-160 hash of the input
ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address): recover address associated with
the public key from elliptic curve signature, return zero on error
addmod(uint x, uint y, uint k) returns (uint): compute (x + y) % k where the addition is performed with
arbitrary precision and does not wrap around at 2**256. Assert that k != 0 starting from version 0.5.0.
mulmod(uint x, uint y, uint k) returns (uint): compute (x * y) % k where the multiplication is performed
with arbitrary precision and does not wrap around at 2**256. Assert that k != 0 starting from version 0.5.0.
.. index:: this, super, selfdestruct
Contract-related
this (current contract's type): the current contract, explicitly convertible to address or address payable
super: a contract one level higher in the inheritance hierarchy
selfdestruct(address payable recipient): destroy the current contract, sending its funds to the given address