Skip to main content

CoolerComposites

Git Source

Inherits: ICoolerComposites, Owned, IEnabler

The CoolerComposites contract enables users to combine multiple operations into a single call

State Variables

isEnabled

Whether the contract is enabled

bool public isEnabled;

COOLER

IMonoCooler public immutable COOLER;

_COLLATERAL_TOKEN

ERC20 internal immutable _COLLATERAL_TOKEN;

_DEBT_TOKEN

ERC20 internal immutable _DEBT_TOKEN;

Functions

constructor

constructor(IMonoCooler cooler_, address owner_) Owned(owner_);

addCollateralAndBorrow

Allow user to add collateral and borrow from Cooler V2

User must provide authorization signature before using function

function addCollateralAndBorrow(
IMonoCooler.Authorization memory authorization,
IMonoCooler.Signature calldata signature,
uint128 collateralAmount,
uint128 borrowAmount,
IDLGTEv1.DelegationRequest[] calldata delegationRequests
) external onlyEnabled;

Parameters

NameTypeDescription
authorizationIMonoCooler.AuthorizationAuthorization info. Set the account field to the zero address to indicate that authorization has already been provided through IMonoCooler.setAuthorization().
signatureIMonoCooler.SignatureOff-chain auth signature. Ignored if authorization_.account is the zero address.
collateralAmountuint128Amount of gOHM collateral to deposit
borrowAmountuint128Amount of USDS to borrow
delegationRequestsIDLGTEv1.DelegationRequest[]Resulting collateral delegation

repayAndRemoveCollateral

Allow user to add collateral and borrow from Cooler V2

User must provide authorization signature before using function

function repayAndRemoveCollateral(
IMonoCooler.Authorization memory authorization,
IMonoCooler.Signature calldata signature,
uint128 repayAmount,
uint128 collateralAmount,
IDLGTEv1.DelegationRequest[] calldata delegationRequests
) external onlyEnabled;

Parameters

NameTypeDescription
authorizationIMonoCooler.AuthorizationAuthorization info. Set the account field to the zero address to indicate that authorization has already been provided through IMonoCooler.setAuthorization().
signatureIMonoCooler.SignatureOff-chain auth signature. Ignored if authorization_.account is the zero address.
repayAmountuint128Amount of USDS to repay
collateralAmountuint128Amount of gOHM collateral to withdraw
delegationRequestsIDLGTEv1.DelegationRequest[]Resulting collateral delegation

collateralToken

Get the collateral token contract address

function collateralToken() external view returns (IERC20);

debtToken

Get the debt token contract address

function debtToken() external view returns (IERC20);

onlyEnabled

modifier onlyEnabled();

enable

Enables the contract

Implementing contracts should implement permissioning logic

function enable(bytes calldata) external onlyOwner;

Parameters

NameTypeDescription
<none>bytes

disable

Disables the contract

Implementing contracts should implement permissioning logic

function disable(bytes calldata) external onlyEnabled onlyOwner;

Parameters

NameTypeDescription
<none>bytes