TermRepoCollateralManager.sol
This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract enforces margin maintenance rules for adding/withdrawing, and liquidating tokens.
TermRepoCollateralManager
This contract enforces margin maintenance rules for adding/withdrawing, repurchasing and liquidating collateral
This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment
ADMIN_ROLE
AUCTION_LOCKER
DEVOPS_ROLE
INITIALIZER_ROLE
SERVICER_ROLE
ROLLOVER_MANAGER
ROLLOVER_TARGET_AUCTIONEER_ROLE
termRepoId
liquidationsPaused
termContractPaired
numOfAcceptedCollateralTokens
deMinimisMarginThreshold
liquidateDamangesDueToProtocol
netExposureCapOnLiquidation
termRepoServicer
purchaseToken
termPriceOracle
termRepoLocker
termController
emitter
collateralTokens
encumberedCollateralBalances
maintenanceCollateralRatios
initialCollateralRatios
liquidatedDamages
lockedCollateralLedger
isCollateralTokenAccepted
whileLiquidationsNotPaused
notTermContractPaired
constructor
initialize
pairTermContracts
externalLockCollateral
Parameters
Name | Type | Description |
---|---|---|
collateralToken | address | The address of the collateral token to lock |
amount | uint256 | The amount of collateral token to lock |
externalUnlockCollateral
Parameters
Name | Type | Description |
---|---|---|
collateralToken | address | The address of the collateral token to unlock |
amount | uint256 | The amount of collateral token to unlock |
batchLiquidation
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
closureAmounts | uint256[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |
batchLiquidationWithRepoToken
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
closureRepoTokenAmounts | uint256[] | An array specifying the amounts of Term Repo Tokens the liquidator proposes to cover borrower repo exposure in liquidation; an amount is required to be specified for each collateral token |
batchDefault
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
closureAmounts | uint256[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |
calculateMintableExposure
Parameters
Name | Type | Description |
---|---|---|
collateralToken | address | The collateral token address of tokens locked |
amountToLock | uint256 | The amount of collateral tokens to lock |
getCollateralBalances
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
Return Values
Name | Type | Description |
---|---|---|
[0] | address[] | An array of collateral token addresses |
[1] | uint256[] | An array collateral token balances locked on behalf of borrower |
getCollateralBalance
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
collateralToken | address | The collateral token address to query |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 The amount of collateralToken locked on behalf of borrower |
encumberedCollateralRemaining
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool A boolean that tests whether any encumbered collateral remains locked |
auctionLockCollateral
Parameters
Name | Type | Description |
---|---|---|
bidder | address | The bidder's address |
collateralToken | address | The address of the token to be used as collateral |
amount | uint256 | The amount of the token to lock |
auctionUnlockCollateral
Parameters
Name | Type | Description |
---|---|---|
bidder | address | The bidder's address |
collateralToken | address | The address of the token used as collateral |
amount | uint256 | The amount of collateral tokens to unlock |
acceptRolloverCollateral
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
collateralToken | address | The address of a collateral token |
amount | uint256 | The amount of collateral tokens to lock |
transferRolloverCollateral
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The borrower's address |
rolloverProportion | uint256 | The proportion of the collateral to be unlocked, equal to the proportion of the collateral repaid |
rolloverTermRepoLocker | address | The address of the new TermRepoLocker contract to roll into |
Return Values
Name | Type | Description |
---|---|---|
[0] | address[] | An array representing a list of accepted collateral token addresses |
[1] | uint256[] | An array containing the amount of collateral tokens to pairoff and transfer to new TermRepoLocker to roll into |
approveRolloverAuction
Parameters
Name | Type | Description |
---|---|---|
rolloverAuction | address | The address of the rollover auction |
unlockCollateralOnRepurchase
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
journalBidCollateralToCollateralManager
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
collateralTokenAddresses | address[] | Collateral token addresses |
collateralTokenAmounts | uint256[] | Collateral token amounts |
mintOpenExposureLockCollateral
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
collateralToken | address | Collateral token addresse |
amount | uint256 | Collateral token amount |
reopenToNewAuction
Parameters
Name | Type | Description |
---|---|---|
termAuctionGroup | struct TermAuctionGroup | A struct of auction contracts |
pauseLiquidations
unpauseLiquidations
isBorrowerInShortfall
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | Boolean testing whether the given borrower is in shortfall or margin deficit |
getCollateralMarketValue
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The market value of borrower's locked collateral denominated in USD |
_lockCollateral
_unlockCollateral
_partialUnlockCollateral
_validateBatchLiquidationForFullLiquidation
A helper function to validate various conditions required to liquidate
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | A boolean for whether borrower position eligible for full liquidation |
_unencumberRemainingBorrowerCollateralOnZeroObligation
_withinNetExposureCapOnLiquidation
_collateralSeizureAmounts
returns total amount of collateral seized in liquidation and the amount of that total going protocol
_transferLiquidationCollateral
A helper function to transfer tokens and update relevant state variables and mappings
_isAcceptedCollateralToken
_usdValueOfBalances
_authorizeUpgrade
required override by the OpenZeppelin UUPS module
Parameters
Name | Type | Description |
---|---|---|
impl | address | new impl address for proxy upgrade |
Last updated