function, built-in;
Vyper provides a collection of built in functions available in the global namespace of all contracts.
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 duplicatevalue
: The wei value to send to the new contract address (Optional, default 0)salt
: Abytes32
value utilized by theCREATE2
opcode (Optional, if supplied deterministic deployment is done viaCREATE2
)Returns the address of the duplicated contract.
@external def foo(_target: address) -> address: return create_forwarder_to(_target)
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).