Skip to content

MiniDeployer ​

A contract that allows deployers to deploy any contract by passing the contract data in bytes

The main objective of this contract is to avoid storing contract addresses in our protocols which requires 160 bits of storage Instead, we can just store the nonce & deployment of this address to calculate the address realtime using "AddressCalcs" library

MiniDeployer__InvalidOperation ​

solidity
error MiniDeployer__InvalidOperation()

Thrown when an invalid operation is attempted

LogContractDeployed ​

solidity
event LogContractDeployed(address contractAddress)

Emitted when a new contract is deployed

constructor ​

solidity
constructor(address owner_) public

Constructor to initialize the contract

Parameters ​

NameTypeDescription
owner_addressThe address of the contract owner

_deploy ​

solidity
function _deploy(bytes bytecode_) internal returns (address address_)

Internal function to deploy a contract

Uses inline assembly for efficient deployment

Parameters ​

NameTypeDescription
bytecode_bytesThe bytecode of the contract to deploy

Return Values ​

NameTypeDescription
address_addressThe address of the deployed contract

deployContract ​

solidity
function deployContract(bytes contractCode_) external returns (address contractAddress_)

Deploys a new contract

Decrements the deployer's allowed deployments count if not the owner

Parameters ​

NameTypeDescription
contractCode_bytesThe bytecode of the contract to deploy

Return Values ​

NameTypeDescription
contractAddress_addressThe address of the deployed contract