Skip to content

Latest commit

 

History

History
796 lines (507 loc) · 24.3 KB

built-in-functions.rst

File metadata and controls

796 lines (507 loc) · 24.3 KB

function, built-in;

Built in Functions

Vyper provides a collection of built in functions available in the global namespace of all contracts.

Bitwise Operations

Chain Interaction

Note

It is very important that the deployed contract at target is code you know and trust, and does not implement the selfdestruct opcode as this will affect the operation of the forwarder contract.

  • target: Address of the contract to duplicate
  • value: The wei value to send to the new contract address (Optional, default 0)
  • salt: A bytes32 value utilized by the CREATE2 opcode (Optional, if supplied deterministic deployment is done via CREATE2)

Returns the address of the duplicated contract.

@external
def foo(_target: address) -> address:
    return create_forwarder_to(_target)

Cryptography

Data Manipulation

Math

Note

Performance note: for the native word types of the EVM uint256 and int256, this will compile to a single ADD instruction, since the EVM natively wraps addition on 256-bit words.

Note

Performance note: for the native word types of the EVM uint256 and int256, this will compile to a single SUB instruction, since the EVM natively wraps subtraction on 256-bit words.

Note

Performance note: for the native word types of the EVM uint256 and int256, this will compile to a single MUL instruction, since the EVM natively wraps multiplication on 256-bit words.

Note

Performance note: this will compile to a single SDIV or DIV instruction, depending on if the inputs are signed or unsigned (respectively).

Utilities