Loading

evm_prepare_deployment

Scalar function

Creates deployment payloads by combining bytecode with constructor arguments.

1
-- Wrap init code for a CREATE deployment
2
WITH prepared AS (
3
SELECT evm_prepare_deployment(counter_bytecode, counter_abi) AS deployment
4
)
5
SELECT json_extract_string((deployment).tx, '$.data') AS init_code
6
FROM prepared;
Notebook ready in readonly mode.

evm_prepare_deployment(BYTES, JSON, ANY)

Parameters

Name Type
bytecode BYTES
abi JSON
constructor_args ANY

Returns

Name Type
deployment SIGNABLE

evm_prepare_deployment(BYTES, JSON, JSON, ANY)

Adds value/create2 metadata and nested tx overrides through a JSON options object.

Parameters

Name Type
bytecode BYTES
abi JSON
options JSON
constructor_args ANY

Returns

Name Type
deployment SIGNABLE
1
-- Predict a CREATE2 deployment inside DuckDB
2
SELECT (deployment).deployed_address AS predicted
3
FROM (
4
SELECT evm_prepare_deployment(
5
vault_bytecode,
6
vault_abi,
7
json('{
8
"create2": true,
9
"salt": "0x0000000000000000000000000000000000000000000000000000000000000042",
10
"deployer": "0x0000000000000000000000000000000000000006"
11
}'),
12
owner::ADDRESS
13
) AS deployment
14
);
Notebook ready in readonly mode.