deploy_contract

Documentation for eth_defi.deploy.deploy_contract function.

deploy_contract(web3, contract, deployer, *constructor_args)[source]

Deploys a new contract from ABI file.

A generic helper function to deploy any contract.

Example:

token = deploy_contract(web3, deployer, "ERC20Mock.json", name, symbol, supply)
print(f"Deployed ERC-20 token at {token.address}")
Parameters
  • web3 (web3.main.Web3) – Web3 instance

  • contract (Union[str, web3.contract.Contract]) – Contract file path as string or contract proxy class

  • deployer (str) – Deployer account

  • constructor_args – Other arguments to pass to the contract’s constructor

Returns

Contract instance

Return type

web3.contract.Contract