JBDelegatesRegistry
This contract is used to register deployers of Juicebox Delegates. It is the deployer's responsibility to register their delegates in this registry and make sure their delegate implements IERC165
.
Mainnet: 0x7A53cAA1dC4d752CAD283d039501c0Ee45719FaC
Goerli: 0xCe3Ebe8A7339D1f7703bAF363d26cD2b15D23C23
Inherits: IJBDelegatesRegistry
Mostly for front-end integration purposes. The delegate address is computed from the deployer address and the nonce used to deploy the delegate.
State Variables
deployerOf
Track which deployer deployed a delegate, based on a proactive deployer update
mapping(address => address) public override deployerOf;
Functions
addDelegate
Add a delegate to the registry (needs to implement erc165, a delegate type and deployed using create)
frontend might retrieve the correct nonce, for both contract and eoa, using ethers provider.getTransactionCount(address) or web3js web3.eth.getTransactionCount just before the delegate deployment (if adding a delegate at a later time, manual nonce counting might be needed)
function addDelegate(address _deployer, uint256 _nonce) external override;
Parameters
Name | Type | Description |
---|---|---|
_deployer | address | The address of the deployer of a given delegate |
_nonce | uint256 | The nonce used to deploy the delegate |
addDelegateCreate2
Add a delegate to the registry (needs to implement erc165, a delegate type and deployed using create2)
_salt is based on the delegate deployer own internal logic while the deployment bytecode can be retrieved in the deployment transaction (off-chain) or via abi.encodePacked(type(delegateContract).creationCode, abi.encode(constructorArguments)) (on-chain)
function addDelegateCreate2(address _deployer, bytes32 _salt, bytes calldata _bytecode) external override;
Parameters
Name | Type | Description |
---|---|---|
_deployer | address | The address of the contract deployer |
_salt | bytes32 | An unique salt used to deploy the delegate |
_bytecode | bytes | The deployment bytecode used to deploy the delegate (ie including constructor and its arguments) |