CollateralManager
Inherits: ICollateralManager, Ownable
Author: Sperax Foundation
This contract manages the addition and removal of collateral, configuration of collateral strategies, and allocation percentages.
Collateral Manager interacts with the Vault and various strategies for collateral management.
State Variables
collateralCompositionUsed
VAULT
collaterals
collateralInfo
collateralStrategyInfo
collateralStrategies
Functions
constructor
Constructor to initialize the Collateral Manager
Parameters
Name | Type | Description |
---|---|---|
_vault | address | Address of the Vault contract |
addCollateral
Register a collateral for mint & redeem in USDs
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
_data | CollateralBaseData | Collateral configuration data |
updateCollateralData
Update existing collateral configuration
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
_updateData | CollateralBaseData | Updated configuration for the collateral |
removeCollateral
Un-list a collateral
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
addCollateralStrategy
Add a new strategy to collateral
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
_strategy | address | Address of the strategy |
_allocationCap | uint16 | Allocation capacity |
updateCollateralStrategy
Update existing strategy for collateral
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
_strategy | address | Address of the strategy |
_allocationCap | uint16 | Allocation capacity |
removeCollateralStrategy
Remove an existing strategy from collateral
Ensure all the collateral is removed from the strategy before calling this Otherwise it will create error in collateral accounting
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
_strategy | address | Address of the strategy |
updateCollateralDefaultStrategy
validateAllocation
Validate allocation for a collateral
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
_strategy | address | Address of the desired strategy |
_amount | uint256 | Amount to be allocated. |
Returns
Name | Type | Description |
---|---|---|
bool | True for valid allocation request. |
getFeeCalibrationData
Get the required data for mint
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
Returns
Name | Type | Description |
---|---|---|
uint16 | Base fee config for collateral (baseMintFee, baseRedeemFee, composition, totalCollateral) | |
uint16 | ||
uint16 | ||
uint256 |
getMintParams
Get the required data for mint
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
Returns
Name | Type | Description |
---|---|---|
mintData | CollateralMintData | mintData |
getRedeemParams
Get the required data for USDs redemption
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
Returns
Name | Type | Description |
---|---|---|
redeemData | CollateralRedeemData | redeemData |
getAllCollaterals
Gets a list of all listed collaterals
Returns
Name | Type | Description |
---|---|---|
address[] | List of addresses representing all listed collaterals |
getCollateralStrategies
Gets a list of all strategies linked to a collateral
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
Returns
Name | Type | Description |
---|---|---|
address[] | List of addresses representing available strategies for the collateral |
isValidStrategy
Verifies if a strategy is linked to a collateral
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
_strategy | address | Address of the strategy |
Returns
Name | Type | Description |
---|---|---|
bool | True if the strategy is linked to the collateral, otherwise False |
getCollateralInStrategies
Get the amount of collateral in all Strategies
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
Returns
Name | Type | Description |
---|---|---|
amountInStrategies | uint256 | amountInStrategies |
getCollateralInVault
Get the amount of collateral in vault
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
Returns
Name | Type | Description |
---|---|---|
amountInVault | uint256 | amountInVault |
getCollateralInAStrategy
Get the amount of collateral allocated in a strategy
Parameters
Name | Type | Description |
---|---|---|
_collateral | address | Address of the collateral |
_strategy | address | Address of the strategy |
Returns
Name | Type | Description |
---|---|---|
allocatedAmt | uint256 | Allocated amount |
Events
CollateralAdded
CollateralRemoved
CollateralInfoUpdated
CollateralStrategyAdded
CollateralStrategyUpdated
CollateralStrategyRemoved
Errors
CollateralExists
CollateralDoesNotExist
CollateralStrategyExists
CollateralStrategyMapped
CollateralStrategyNotMapped
CollateralNotSupportedByStrategy
CollateralAllocationPaused
CollateralStrategyInUse
AllocationPercentageLowerThanAllocatedAmt
IsDefaultStrategy
Structs
CollateralData
StrategyData
Last updated