Comment on page
DullahanPodManager
uint256 UNIT
1e18 scale
uint256 MAX_BPS
Max value for BPS - 100%
struct Pod {
address podAddress;
address podOwner;
address collateral;
uint96 lastUpdate;
uint256 lastIndex;
uint256 rentedAmount;
uint256 accruedFees;
}
address vault
Address of the Dullahan Vault
address rewardsStaking
Address of the Dullahan Staking contract
address podImplementation
Address of the Pod implementation
address protocolFeeChest
Address of the Chest to receive fees
address registry
Address of the Dullahan Registry
mapping(address => bool) allowedCollaterals
Allowed token to be used as collaterals
mapping(address => address) aTokenForCollateral
Address of aToken from the Aave Market for each collateral
mapping(address => struct DullahanPodManager.Pod) pods
State for Pods
address[] allPods
List of all created Pods
mapping(address => address[]) ownerPods
List of Pods created by an user
address feeModule
Address of the Fee Module
address oracleModule
Address of the Oracle Module
address discountCalculator
Address of the Discount Calculator Module
uint256 lastUpdatedIndex
Last updated value of the Index
uint256 lastIndexUpdate
Last update timestamp for the Index
uint256 extraLiquidationRatio
Extra ratio applied during liquidations
uint256 mintFeeRatio
Ratio of minted amount taken as minting fees
uint256 protocolFeeRatio
Ratio of renting fees taken as protocol fees
uint256 reserveAmount
Total amount set as reserve (holding Vault renting fees)
uint256 processThreshold
Min amount in the reserve to be processed
event PodCreation(address collateral, address podOwner, address pod)
Event emitted when a new Pod is created
event FreedStkAave(address pod, uint256 pullAmount)
Event emitted when stkAAVE is clawed back from a Pod
event RentedStkAave(address pod, uint256 rentAmount)
Event emitted when stkAAVE is rented to a Pod
event LiquidatedPod(address pod, address collateral, uint256 collateralAmount, uint256 receivedFeeAmount)
Event emitted when a Pod is liquidated
event PaidFees(address pod, uint256 feeAmount)
Event emitted when renting fees are paid
event MintingFees(address pod, uint256 feeAmount)
Event emitted when minting fees are paid
event ReserveProcessed(uint256 stakingRewardsAmount)
Event emitted when the Reserve is processed
event NewCollateral(address collateral, address aToken)
Event emitted when a new collateral is added
event CollateralUpdated(address collateral, bool allowed)
Event emitted when a colalteral is updated
event RegistryUpdated(address oldRegistry, address newRegistry)
Event emitted when the Registry is updated
event FeeModuleUpdated(address oldMoldule, address newModule)
Event emitted when the Fee Module is updated
event OracleModuleUpdated(address oldMoldule, address newModule)
Event emitted when the Oracle Module is updated
event DiscountCalculatorUpdated(address oldCalculator, address newCalculator)
Event emitted when the Discount Calculator Module is updated
event FeeChestUpdated(address oldFeeChest, address newFeeChest)
Event emitted when the Fee Chest is updated
event MintFeeRatioUpdated(uint256 oldRatio, uint256 newRatio)
Event emitted when the Mint Fee Ratio is updated
event ProtocolFeeRatioUpdated(uint256 oldRatio, uint256 newRatio)
Event emitted when the Protocol Fee Ratio is updated
event ExtraLiquidationRatioUpdated(uint256 oldRatio, uint256 newRatio)
Event emitted when the Extra Liquidation Ratio is updated
event ProcessThresholdUpdated(uint256 oldThreshold, uint256 newThreshold)
Event emitted when the Mint Fee Ratio is updated
modifier isValidPod()
Check that the caller is a valid Pod
constructor(address _vault, address _rewardsStaking, address _protocolFeeChest, address _podImplementation, address _registry, address _feeModule, address _oracleModule, address _discountCalculator) public
function getCurrentIndex() public view returns (uint256)
Get the current fee index
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : Current index |
function podCurrentOwedFees(address pod) public view returns (uint256)
Get the current amount of fees owed by a Pod
Name | Type | Description |
---|---|---|
pod | address | Address of the Pod |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : Current amount of fees owed |
function podOwedFees(address pod) public view returns (uint256)
Get the stored amount of fees owed by a Pod
Name | Type | Description |
---|---|---|
pod | address | Address of the Pod |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : Stored amount of fees owed |
function getAllPods() external view returns (address[])
Get all Pods created by this contract
Name | Type | Description |
---|---|---|
[0] | address[] | address[] : List of Pods |
function getAllOwnerPods(address account) external view returns (address[])
Get the list of Pods owned by a given account
Name | Type | Description |
---|---|---|
account | address | Address of the Pods owner |
Name | Type | Description |
---|---|---|
[0] | address[] | address[] : List of Pods |
function isPodLiquidable(address pod) public view returns (bool)
Check if the given Pod is liquidable
Name | Type | Description |
---|---|---|
pod | address | Address of the Pod |
Name | Type | Description |
---|---|---|
[0] | bool | bool : True if liquidable |
function estimatePodLiquidationexternal(address pod) external view returns (uint256 feeAmount, uint256 collateralAmount)
Estimate the amount of fees to repay to liquidate a Pod & the amount of collaterla to receive after liquidation
Name | Type | Description |
---|---|---|
pod | address | Address of the Pod |
Name | Type | Description |
---|---|---|
feeAmount | uint256 | - uint256 : Amount of fees to pay to liquidate |
collateralAmount | uint256 | - uint256 : Amount of collateral to receive after liquidation |
function createPod(address collateral) external returns (address)
Create a new Pod
Clone the Pod implementation, initialize it & store the paremeters
Name | Type | Description |
---|---|---|
collateral | address | Address of the collateral for the new Pod |
Name | Type | Description |
---|---|---|
[0] | address | address : Address of the newly deployed Pod |
function updateGlobalState() external returns (bool)
Update the global state
Name | Type | Description |
---|---|---|
[0] | bool | bool : Success |
function updatePodState(address pod) external returns (bool)
Update a Pod state
Name | Type | Description |
---|---|---|
pod | address | Address of the Pod |
Name | Type | Description |
---|---|---|
[0] | bool | bool : Success |
function freeStkAave(address pod) external returns (bool)
Free all stkAAVE not currently needed by a Pod
Calculate the needed amount of stkAAVE for a Pod & free any extra stkAAVE held by the Pod
Name | Type | Description |
---|---|---|
pod | address | Address of the Pod |
Name | Type | Description |
---|---|---|
[0] | bool | bool : Success |
function liquidatePod(address pod) external returns (bool)
Liquidate a Pod that owes fees & has no GHO debt
Repay the fees owed by the Pod & receive some of the Pod colleteral (with an extra ratio)
Name | Type | Description |
---|---|---|
pod | address | Address of the Pod |
Name | Type | Description |
---|---|---|
[0] | bool | bool : Success |
function updatePodDelegation(address pod) public
Update the delegator of a Pod
Name | Type | Description |
---|---|---|
pod | address | Address of the Pod |
function updateMultiplePodsDelegation(address[] podList) external
Update the delegator for a list of Pods
Name | Type | Description |
---|---|---|
podList | address[] | List of Pod addresses |
function processReserve() external returns (bool)
Process the Reserve
Send the Reserve to the staking contract to be queued for distribution & take a part as protocol fees
Name | Type | Description |
---|---|---|
[0] | bool | bool : Success |
function getStkAave(uint256 amountToMint) external returns (bool)
Get the needed amount of stkAAVE for a Pod based on the GHO amount minted
Calculate the amount of stkAAVE a Pod need based on its GHO debt & amount ot be minted & request the needed amount to the Vault for renting
Name | Type | Description |
---|---|---|
amountToMint | uint256 | Amount of GHO to be minted |
Name | Type | Description |
---|---|---|
[0] | bool | bool : Success |
function notifyStkAaveClaim(uint256 claimedAmount) external
Notify the Vault for claimed rewards from the Safety Module for a Pod
Name | Type | Description |
---|---|---|
claimedAmount | uint256 | Amount of rewards claimed |
function notifyPayFee(uint256 feeAmount) external
Notify fees paid by a Pod
Name | Type | Description |
---|---|---|
feeAmount | uint256 | Amount of fees paid |
function notifyMintingFee(uint256 feeAmount) external
Notify minting fees paid by a Pod
Name | Type | Description |
---|---|---|
feeAmount | uint256 | Amount of fees paid |
function _calculatedNeededStkAave(address pod, uint256 addedDebtAmount) internal view returns (uint256)
Calculates the amount of stkAAVE needed by a Pod based on its GHO debt & the amount of GHO to be minted
Name | Type | Description |
---|---|---|
pod | address | Address of the Pod |
addedDebtAmount | uint256 | Amount of GHO to be minted |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : Amount of stkAAVE needed |
function _accruedIndex() internal view returns (uint256)
Calculate the index accrual based on the current fee per second
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : index accrual |
function _updateGlobalState() internal returns (bool)
Update the global state by updating the fee index
Name | Type | Description |
---|---|---|
[0] | bool | bool : Success |
function _updatePodState(address podAddress) internal returns (bool)
Update a Pod's state & accrued owed fees based on the last updated index
Name | Type | Description |
---|---|---|
podAddress | address | Address of the Pod |
Name | Type | Description |
---|---|---|
[0] | bool | bool : Success |
function _processReserve() internal returns (bool)