Comment on page
RiskFund
Contract with basic features to track/hold different assets for different Comptrollers.
Initializes the deployer to owner.
function initialize(address pancakeSwapRouter_, uint256 minAmountToConvert_, address convertibleBaseAsset_, address accessControlManager_, uint256 loopsLimit_) external
Parameters
Name | Type | Description |
---|---|---|
pancakeSwapRouter_ | address | Address of the PancakeSwap router |
minAmountToConvert_ | uint256 | Minimum amount assets must be worth to convert into base asset |
convertibleBaseAsset_ | address | Address of the base asset |
accessControlManager_ | address | Address of the access control contract |
loopsLimit_ | uint256 | Limit for the loops in the contract to avoid DOS |
❌ Errors
- ZeroAddressNotAllowed is thrown when PCS router address is zero
- ZeroAddressNotAllowed is thrown when convertible base asset address is zero
Pool registry setter
function setPoolRegistry(address poolRegistry_) external
Parameters
Name | Type | Description |
---|---|---|
poolRegistry_ | address | Address of the pool registry |
❌ Errors
- ZeroAddressNotAllowed is thrown when pool registry address is zero
Shortfall contract address setter
function setShortfallContractAddress(address shortfallContractAddress_) external
Parameters
Name | Type | Description |
---|---|---|
shortfallContractAddress_ | address | Address of the auction contract |
❌ Errors
- ZeroAddressNotAllowed is thrown when shortfall contract address is zero
PancakeSwap router address setter
function setPancakeSwapRouter(address pancakeSwapRouter_) external
Parameters
Name | Type | Description |
---|---|---|
pancakeSwapRouter_ | address | Address of the PancakeSwap router |
❌ Errors
- ZeroAddressNotAllowed is thrown when PCS router address is zero
Min amount to convert setter
function setMinAmountToConvert(uint256 minAmountToConvert_) external
Parameters
Name | Type | Description |
---|---|---|
minAmountToConvert_ | uint256 | Min amount to convert. |
Sets a new convertible base asset
function setConvertibleBaseAsset(address _convertibleBaseAsset) external
Parameters
Name | Type | Description |
---|---|---|
_convertibleBaseAsset | address | Address for new convertible base asset. |
Swap array of pool assets into base asset's tokens of at least a minimum amount
function swapPoolsAssets(address[] markets, uint256[] amountsOutMin, address[][] paths, uint256 deadline) external returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
markets | address[] | Array of vTokens whose assets to swap for base asset |
amountsOutMin | uint256[] | Minimum amount to receive for swap |
paths | address[][] | A path consisting of PCS token pairs for each swap |
deadline | uint256 | Deadline for the swap |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | Number of swapped tokens |
❌ Errors
- ZeroAddressNotAllowed is thrown if PoolRegistry contract address is not configured
Transfer tokens for auction.
function transferReserveForAuction(address comptroller, uint256 amount) external returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
comptroller | address | Comptroller of the pool. |
amount | uint256 | Amount to be transferred to auction contract. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | Number reserved tokens. |
Set the limit for the loops can iterate to avoid the DOS
function setMaxLoopsLimit(uint256 limit) external
Parameters
Name | Type | Description |
---|---|---|
limit | uint256 | Limit for the max loops can execute at a time |
Get the Amount of the Base asset in the risk fund for the specific pool.
function getPoolsBaseAssetReserves(address comptroller) external view returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
comptroller | address | Comptroller address(pool). |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | Base Asset's reserve in risk fund. |
Update the reserve of the asset for the specific pool after transferring to risk fund.
function updateAssetsState(address comptroller, address asset) public
Parameters
Name | Type | Description |
---|---|---|
comptroller | address | Comptroller address(pool). |
asset | address | Asset address. |
Last modified 1mo ago