DelegateEscrowFactory
Title: Delegate Escrow Factory.
The Delegate Escrow Factory creates new escrow contracts, each holding the delegated gOHM from other accounts
This contract uses Clones (https://github.com/wighawag/clones-with-immutable-args) to save gas on deployment.
Constants
escrowImplementation
Reference implementation (deployed on creation to clone from).
DelegateEscrow public immutable escrowImplementation;
State Variables
created
Mapping to validate deployed escrows.
mapping(address => bool) public created;
escrowFor
Mapping to query escrows for a given delegate.
mapping(address => DelegateEscrow) public escrowFor;
Functions
constructor
constructor(address gohm_);
Parameters
| Name | Type | Description |
|---|---|---|
| gohm_ | address |
create
creates a new escrow contract for a delegate.
function create(address delegate) external returns (DelegateEscrow escrow);
Parameters
| Name | Type | Description |
|---|---|---|
| delegate | address |
Returns
| Name | Type | Description |
|---|---|---|
| escrow | DelegateEscrow |
logDelegate
Emit a global event when a new loan request is created.
function logDelegate(
address caller,
address onBehalfOf,
int256 delegationAmountDelta
) external onlyFromFactory;
Parameters
| Name | Type | Description |
|---|---|---|
| caller | address | |
| onBehalfOf | address | |
| delegationAmountDelta | int256 |
onlyFromFactory
Ensure that the called is a Cooler.
modifier onlyFromFactory();
Events
DelegateEscrowCreated
A caller has created a new escrow for a delegate
event DelegateEscrowCreated(
address indexed caller,
address indexed delegate,
address indexed escrow
);
Parameters
| Name | Type | Description |
|---|---|---|
| caller | address | |
| delegate | address | |
| escrow | address |
Delegate
A caller has (un)delegated their gOHM amount from escrow on behalf of a user
delegationAmountDelta > 0: It has been delegated to this escrow delegationAmountDelta < 0: It has been undelegated from this escrow
event Delegate(
address indexed escrow,
address indexed caller,
address indexed onBehalfOf,
int256 delegationAmountDelta
);
Parameters
| Name | Type | Description |
|---|---|---|
| escrow | address | |
| caller | address | |
| onBehalfOf | address | |
| delegationAmountDelta | int256 |
Errors
NotFromFactory
error NotFromFactory();