gleeth/deploy
Contract deployment helpers.
Build deployment transactions from bytecode and optional constructor arguments, broadcast them, and extract the deployed contract address from the receipt.
Examples
// Deploy with no constructor args
let assert Ok(address) =
deploy.deploy(provider, wallet, bytecode, "0x100000", 1)
// Deploy with constructor args
let assert Ok(address) =
deploy.deploy_with_args(
provider, wallet, bytecode,
[#(types.Uint(256), types.UintValue(1_000_000))],
"0x200000", 1,
)
Values
pub fn deploy(
provider: provider.Provider,
w: wallet.Wallet,
bytecode: String,
gas_limit: String,
chain_id: Int,
) -> Result(String, types.GleethError)
Deploy a contract with no constructor arguments. Returns the deployed contract address.
pub fn deploy_with_args(
provider: provider.Provider,
w: wallet.Wallet,
bytecode: String,
constructor_args: List(#(types.AbiType, types.AbiValue)),
gas_limit: String,
chain_id: Int,
) -> Result(String, types.GleethError)
Deploy a contract with ABI-encoded constructor arguments appended to the bytecode. Returns the deployed contract address.