vyper
vyper copied to clipboard
VIP: add new built-in function `raw_create`
Simple Summary
Expose the opcodes CREATE and CREATE2 via a new built-in function raw_create.
Motivation
Example use case: use Vyper to build generic contract factories.
Specification
raw_create(init_code: Bytes, *args, value: uint256 = 0, raw_args: bool = False, revert_on_failure: bool = True, [, salt: bytes32]) -> address
init_code: Contains the contract creation code. Can already entail the ABI-encoded and appended constructor arguments.*args: Constructor arguments to be appended toinit_code. Ifraw_args = False(default), the arguments are ABI-encoded according to their types. Ifraw_args = True,*argsmust be a singleBytesargument which is directly appended toinit_code. (Optional, default to"").value: The wei value to send during contract creation. Note that ifvalueis non-zero,init_codemust have apayableconstructor. (Optional, default to0).raw_args: IfTrue,*argsmust be a singleBytesargument which is directly appended toinit_code. Alternatively, you can also useconcatin combination with the contract creation bytecode. (Optional, defaultFalse).revert_on_failure: Reverts if the new contract address is equal toempty(address)or is a zero-byte contract. (Optional, defaultTrue).salt: Abytes32value utilised by the deterministicCREATE2opcode (Optional, if not supplied,CREATEis used).
Backwards Compatibility
raw_create is a new built-in function that is not backward-compatible.
Dependencies
N/A.
References
N/A.
Copyright
Copyright and related rights waived via CC0.
This looks great and well-specified