DullahanPodManager
UNIT
uint256 UNIT
1e18 scale
MAX_BPS
uint256 MAX_BPS
Max value for BPS - 100%
Pod
struct Pod {
address podAddress;
address podOwner;
address collateral;
uint96 lastUpdate;
uint256 lastIndex;
uint256 rentedAmount;
uint256 accruedFees;
}
vault
address vault
Address of the Dullahan Vault
rewardsStaking
address rewardsStaking
Address of the Dullahan Staking contract
podImplementation
address podImplementation
Address of the Pod implementation
protocolFeeChest
address protocolFeeChest
Address of the Chest to receive fees
registry
address registry
Address of the Dullahan Registry
allowedCollaterals
mapping(address => bool) allowedCollaterals
Allowed token to be used as collaterals
aTokenForCollateral
mapping(address => address) aTokenForCollateral
Address of aToken from the Aave Market for each collateral
pods
mapping(address => struct DullahanPodManager.Pod) pods
State for Pods
allPods
address[] allPods
List of all created Pods
ownerPods
mapping(address => address[]) ownerPods
List of Pods created by an user
feeModule
address feeModule
Address of the Fee Module
oracleModule
address oracleModule
Address of the Oracle Module
discountCalculator
address discountCalculator
Address of the Discount Calculator Module
lastUpdatedIndex
uint256 lastUpdatedIndex
Last updated value of the Index
lastIndexUpdate
uint256 lastIndexUpdate
Last update timestamp for the Index
extraLiquidationRatio
uint256 extraLiquidationRatio
Extra ratio applied during liquidations
mintFeeRatio
uint256 mintFeeRatio
Ratio of minted amount taken as minting fees
protocolFeeRatio
uint256 protocolFeeRatio
Ratio of renting fees taken as protocol fees
reserveAmount
uint256 reserveAmount
Total amount set as reserve (holding Vault renting fees)
processThreshold
uint256 processThreshold
Min amount in the reserve to be processed
PodCreation
event PodCreation(address collateral, address podOwner, address pod)
Event emitted when a new Pod is created
FreedStkAave
event FreedStkAave(address pod, uint256 pullAmount)
Event emitted when stkAAVE is clawed back from a Pod
RentedStkAave
event RentedStkAave(address pod, uint256 rentAmount)
Event emitted when stkAAVE is rented to a Pod
LiquidatedPod
event LiquidatedPod(address pod, address collateral, uint256 collateralAmount, uint256 receivedFeeAmount)
Event emitted when a Pod is liquidated
PaidFees
event PaidFees(address pod, uint256 feeAmount)
Event emitted when renting fees are paid
MintingFees
event MintingFees(address pod, uint256 feeAmount)
Event emitted when minting fees are paid
ReserveProcessed
event ReserveProcessed(uint256 stakingRewardsAmount)
Event emitted when the Reserve is processed
NewCollateral
event NewCollateral(address collateral, address aToken)
Event emitted when a new collateral is added
CollateralUpdated
event CollateralUpdated(address collateral, bool allowed)
Event emitted when a colalteral is updated
RegistryUpdated
event RegistryUpdated(address oldRegistry, address newRegistry)
Event emitted when the Registry is updated
FeeModuleUpdated
event FeeModuleUpdated(address oldMoldule, address newModule)
Event emitted when the Fee Module is updated
OracleModuleUpdated
event OracleModuleUpdated(address oldMoldule, address newModule)
Event emitted when the Oracle Module is updated
DiscountCalculatorUpdated
event DiscountCalculatorUpdated(address oldCalculator, address newCalculator)
Event emitted when the Discount Calculator Module is updated
FeeChestUpdated
event FeeChestUpdated(address oldFeeChest, address newFeeChest)
Event emitted when the Fee Chest is updated
MintFeeRatioUpdated
event MintFeeRatioUpdated(uint256 oldRatio, uint256 newRatio)
Event emitted when the Mint Fee Ratio is updated
ProtocolFeeRatioUpdated
event ProtocolFeeRatioUpdated(uint256 oldRatio, uint256 newRatio)
Event emitted when the Protocol Fee Ratio is updated
ExtraLiquidationRatioUpdated
event ExtraLiquidationRatioUpdated(uint256 oldRatio, uint256 newRatio)
Event emitted when the Extra Liquidation Ratio is updated
ProcessThresholdUpdated
event ProcessThresholdUpdated(uint256 oldThreshold, uint256 newThreshold)
Event emitted when the Mint Fee Ratio is updated
isValidPod
modifier isValidPod()
Check that the caller is a valid Pod
constructor
constructor(address _vault, address _rewardsStaking, address _protocolFeeChest, address _podImplementation, address _registry, address _feeModule, address _oracleModule, address _discountCalculator) public
getCurrentIndex
function getCurrentIndex() public view returns (uint256)
Get the current fee index
Return Values
[0]
uint256
uint256 : Current index
podCurrentOwedFees
function podCurrentOwedFees(address pod) public view returns (uint256)
Get the current amount of fees owed by a Pod
Parameters
pod
address
Address of the Pod
Return Values
[0]
uint256
uint256 : Current amount of fees owed
podOwedFees
function podOwedFees(address pod) public view returns (uint256)
Get the stored amount of fees owed by a Pod
Parameters
pod
address
Address of the Pod
Return Values
[0]
uint256
uint256 : Stored amount of fees owed
getAllPods
function getAllPods() external view returns (address[])
Get all Pods created by this contract
Return Values
[0]
address[]
address[] : List of Pods
getAllOwnerPods
function getAllOwnerPods(address account) external view returns (address[])
Get the list of Pods owned by a given account
Parameters
account
address
Address of the Pods owner
Return Values
[0]
address[]
address[] : List of Pods
isPodLiquidable
function isPodLiquidable(address pod) public view returns (bool)
Check if the given Pod is liquidable
Parameters
pod
address
Address of the Pod
Return Values
[0]
bool
bool : True if liquidable
estimatePodLiquidationexternal
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
Parameters
pod
address
Address of the Pod
Return Values
feeAmount
uint256
- uint256 : Amount of fees to pay to liquidate
collateralAmount
uint256
- uint256 : Amount of collateral to receive after liquidation
createPod
function createPod(address collateral) external returns (address)
Create a new Pod
Clone the Pod implementation, initialize it & store the paremeters
Parameters
collateral
address
Address of the collateral for the new Pod
Return Values
[0]
address
address : Address of the newly deployed Pod
updateGlobalState
function updateGlobalState() external returns (bool)
Update the global state
Return Values
[0]
bool
bool : Success
updatePodState
function updatePodState(address pod) external returns (bool)
Update a Pod state
Parameters
pod
address
Address of the Pod
Return Values
[0]
bool
bool : Success
freeStkAave
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
Parameters
pod
address
Address of the Pod
Return Values
[0]
bool
bool : Success
liquidatePod
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)
Parameters
pod
address
Address of the Pod
Return Values
[0]
bool
bool : Success
updatePodDelegation
function updatePodDelegation(address pod) public
Update the delegator of a Pod
Parameters
pod
address
Address of the Pod
updateMultiplePodsDelegation
function updateMultiplePodsDelegation(address[] podList) external
Update the delegator for a list of Pods
Parameters
podList
address[]
List of Pod addresses
processReserve
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
Return Values
[0]
bool
bool : Success
getStkAave
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
Parameters
amountToMint
uint256
Amount of GHO to be minted
Return Values
[0]
bool
bool : Success
notifyStkAaveClaim
function notifyStkAaveClaim(uint256 claimedAmount) external
Notify the Vault for claimed rewards from the Safety Module for a Pod
Parameters
claimedAmount
uint256
Amount of rewards claimed
notifyPayFee
function notifyPayFee(uint256 feeAmount) external
Notify fees paid by a Pod
Parameters
feeAmount
uint256
Amount of fees paid
notifyMintingFee
function notifyMintingFee(uint256 feeAmount) external
Notify minting fees paid by a Pod
Parameters
feeAmount
uint256
Amount of fees paid
_calculatedNeededStkAave
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
Parameters
pod
address
Address of the Pod
addedDebtAmount
uint256
Amount of GHO to be minted
Return Values
[0]
uint256
uint256 : Amount of stkAAVE needed
_accruedIndex
function _accruedIndex() internal view returns (uint256)
Calculate the index accrual based on the current fee per second
Return Values
[0]
uint256
uint256 : index accrual
_updateGlobalState
function _updateGlobalState() internal returns (bool)
Update the global state by updating the fee index
Return Values
[0]
bool
bool : Success
_updatePodState
function _updatePodState(address podAddress) internal returns (bool)
Update a Pod's state & accrued owed fees based on the last updated index
Parameters
podAddress
address
Address of the Pod
Return Values
[0]
bool
bool : Success
_processReserve
function _processReserve() internal returns (bool)
Send the Reserve to the staking contract to be queued for distribution & take a part as protocol fees
Return Values
[0]
bool
bool : Success
updatePodRegistry
function updatePodRegistry(address pod) public
Update the Registry for a given Pod
Parameters
pod
address
Address of the Pod
updateMultiplePodsRegistry
function updateMultiplePodsRegistry(address[] podList) external
Update the Registry for a given list of Pods
Parameters
podList
address[]
List of Pod addresses
updateAllPodsRegistry
function updateAllPodsRegistry() external
Update the Registry for all Pods
pause
function pause() external
Pause the contract
unpause
function unpause() external
Unpause the contract
addCollateral
function addCollateral(address collateral, address aToken) external
Add a new collateral for Pod creation
Parameters
collateral
address
Address of the collateral
aToken
address
Address of the aToken associated to the collateral
updateCollateral
function updateCollateral(address collateral, bool allowed) external
Update a collateral for Pod creation
Parameters
collateral
address
Address of the collateral
allowed
bool
Is the collateral allowed ofr Pod creation
updateFeeChest
function updateFeeChest(address newFeeChest) external
Uodate the FeeChest
Parameters
newFeeChest
address
Address of the new FeeChest
updateRegistry
function updateRegistry(address newRegistry) external
Uodate the Registry
Parameters
newRegistry
address
Address of the new Registry
updateFeeModule
function updateFeeModule(address newModule) external
Uodate the Fee Module
Parameters
newModule
address
Address of the new Module
updateOracleModule
function updateOracleModule(address newModule) external
Uodate the Oracle Module
Parameters
newModule
address
Address of the new Module
updateDiscountCalculator
function updateDiscountCalculator(address newCalculator) external
Uodate the Discount Calculator Module
Parameters
newCalculator
address
Address of the new Calculator
updateMintFeeRatio
function updateMintFeeRatio(uint256 newRatio) external
Uodate the mint fee ratio parameter
Parameters
newRatio
uint256
New ratio value
updateProtocolFeeRatio
function updateProtocolFeeRatio(uint256 newRatio) external
Uodate the protocol fee ratio parameter
Parameters
newRatio
uint256
New ratio value
updateExtraLiquidationRatio
function updateExtraLiquidationRatio(uint256 newRatio) external
Uodate the extra liquidation ratio parameter
Parameters
newRatio
uint256
New ratio value
updateProcessThreshold
function updateProcessThreshold(uint256 newThreshold) external
Uodate the process threshold parameter
Parameters
newThreshold
uint256
New treshold value
safe96
function safe96(uint256 n) internal pure returns (uint96)
Last updated
Was this helpful?