CoolerComposites
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
Name | Type | Description |
---|---|---|
authorization | IMonoCooler.Authorization | Authorization info. Set the account field to the zero address to indicate that authorization has already been provided through IMonoCooler.setAuthorization() . |
signature | IMonoCooler.Signature | Off-chain auth signature. Ignored if authorization_.account is the zero address. |
collateralAmount | uint128 | Amount of gOHM collateral to deposit |
borrowAmount | uint128 | Amount of USDS to borrow |
delegationRequests | IDLGTEv1.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
Name | Type | Description |
---|---|---|
authorization | IMonoCooler.Authorization | Authorization info. Set the account field to the zero address to indicate that authorization has already been provided through IMonoCooler.setAuthorization() . |
signature | IMonoCooler.Signature | Off-chain auth signature. Ignored if authorization_.account is the zero address. |
repayAmount | uint128 | Amount of USDS to repay |
collateralAmount | uint128 | Amount of gOHM collateral to withdraw |
delegationRequests | IDLGTEv1.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
Name | Type | Description |
---|---|---|
<none> | bytes |
disable
Disables the contract
Implementing contracts should implement permissioning logic
function disable(bytes calldata) external onlyEnabled onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
<none> | bytes |