Skip to main content

DelegateEscrowFactory

Git Source

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

NameTypeDescription
gohm_address

create​

creates a new escrow contract for a delegate.

function create(address delegate) external returns (DelegateEscrow escrow);

Parameters

NameTypeDescription
delegateaddress

Returns

NameTypeDescription
escrowDelegateEscrow

logDelegate​

Emit a global event when a new loan request is created.

function logDelegate(
address caller,
address onBehalfOf,
int256 delegationAmountDelta
) external onlyFromFactory;

Parameters

NameTypeDescription
calleraddress
onBehalfOfaddress
delegationAmountDeltaint256

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

NameTypeDescription
calleraddress
delegateaddress
escrowaddress

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

NameTypeDescription
escrowaddress
calleraddress
onBehalfOfaddress
delegationAmountDeltaint256

Errors​

NotFromFactory​

error NotFromFactory();