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

podCurrentOwedFees

function podCurrentOwedFees(address pod) public view returns (uint256)

Get the current amount of fees owed by a Pod

Parameters

Return Values

podOwedFees

function podOwedFees(address pod) public view returns (uint256)

Get the stored amount of fees owed by a Pod

Parameters

Return Values

getAllPods

function getAllPods() external view returns (address[])

Get all Pods created by this contract

Return Values

getAllOwnerPods

function getAllOwnerPods(address account) external view returns (address[])

Get the list of Pods owned by a given account

Parameters

Return Values

isPodLiquidable

function isPodLiquidable(address pod) public view returns (bool)

Check if the given Pod is liquidable

Parameters

Return Values

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

Return Values

createPod

function createPod(address collateral) external returns (address)

Create a new Pod

Clone the Pod implementation, initialize it & store the paremeters

Parameters

Return Values

updateGlobalState

function updateGlobalState() external returns (bool)

Update the global state

Return Values

updatePodState

function updatePodState(address pod) external returns (bool)

Update a Pod state

Parameters

Return Values

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

Return Values

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

Return Values

updatePodDelegation

function updatePodDelegation(address pod) public

Update the delegator of a Pod

Parameters

updateMultiplePodsDelegation

function updateMultiplePodsDelegation(address[] podList) external

Update the delegator for a list of Pods

Parameters

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

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

Return Values

notifyStkAaveClaim

function notifyStkAaveClaim(uint256 claimedAmount) external

Notify the Vault for claimed rewards from the Safety Module for a Pod

Parameters

notifyPayFee

function notifyPayFee(uint256 feeAmount) external

Notify fees paid by a Pod

Parameters

notifyMintingFee

function notifyMintingFee(uint256 feeAmount) external

Notify minting fees paid by a Pod

Parameters

_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

Return Values

_accruedIndex

function _accruedIndex() internal view returns (uint256)

Calculate the index accrual based on the current fee per second

Return Values

_updateGlobalState

function _updateGlobalState() internal returns (bool)

Update the global state by updating the fee index

Return Values

_updatePodState

function _updatePodState(address podAddress) internal returns (bool)

Update a Pod's state & accrued owed fees based on the last updated index

Parameters

Return Values

_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

updatePodRegistry

function updatePodRegistry(address pod) public

Update the Registry for a given Pod

Parameters

updateMultiplePodsRegistry

function updateMultiplePodsRegistry(address[] podList) external

Update the Registry for a given list of Pods

Parameters

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

updateCollateral

function updateCollateral(address collateral, bool allowed) external

Update a collateral for Pod creation

Parameters

updateFeeChest

function updateFeeChest(address newFeeChest) external

Uodate the FeeChest

Parameters

updateRegistry

function updateRegistry(address newRegistry) external

Uodate the Registry

Parameters

updateFeeModule

function updateFeeModule(address newModule) external

Uodate the Fee Module

Parameters

updateOracleModule

function updateOracleModule(address newModule) external

Uodate the Oracle Module

Parameters

updateDiscountCalculator

function updateDiscountCalculator(address newCalculator) external

Uodate the Discount Calculator Module

Parameters

updateMintFeeRatio

function updateMintFeeRatio(uint256 newRatio) external

Uodate the mint fee ratio parameter

Parameters

updateProtocolFeeRatio

function updateProtocolFeeRatio(uint256 newRatio) external

Uodate the protocol fee ratio parameter

Parameters

updateExtraLiquidationRatio

function updateExtraLiquidationRatio(uint256 newRatio) external

Uodate the extra liquidation ratio parameter

Parameters

updateProcessThreshold

function updateProcessThreshold(uint256 newThreshold) external

Uodate the process threshold parameter

Parameters

safe96

function safe96(uint256 n) internal pure returns (uint96)

Last updated