LiquidityManager
The LiquidityManager contract is the main component of Athena's decentralized cover protocol. It serves as the core liquidity and cover management system, enabling users to provide liquidity, purchase cover, and participate in the protocol's risk-sharing mechanism.
The diamond proxy pattern is used to access its computation and storage manipulation libraries. Its VirtualPool library allows it to manage several liquidity layers within its storage in order to handle cross-pool liquidity distribution.
Structs info
CoverRead
PositionRead
Position
PoolOverlap
VPoolRead
State variables info
positionToken
coverToken
ecclesiaDao
strategyManager
claimManager
yieldRewarder
withdrawDelay
The delay after commiting before a position can be withdrawn
maxLeverage
The maximum amount of pools a position can supply liquidity to
leverageFeePerPool
The fee paid out to the DAO for each leveraged pool in a position
arePoolCompatible
coverToPool
Maps a cover ID to the ID of the pool storing the cover data
nextCompensationId
The ID of the next claim to be
nextPoolId
The token ID position data
Read Functions info
positions
positionInfo
Returns the up to date position data of a token
Parameters:
Return values:
coverInfo
Returns the up to date cover data of a token
Parameters:
Return values:
poolInfo
Returns the virtual pool's storage
Parameters:
Return values:
positionInfos
Returns the up to date data of an array of positions
Moved to LiquidityManager since cannot pass array of storage pointers in memory
Parameters:
Return values:
coverInfos
Returns up to date data for an array of covers
Parameters:
Return values:
poolInfos
Returns up to date data for an array of pools
Parameters:
Return values:
isCoverActive
Returns if the cover is still active or has expired
Parameters:
Return values:
poolOverlaps
Returns amount liquidity overlap between two pools
The overlap is always stored in the pool with the lowest ID
Parameters:
Return values:
Write Functions info
openPosition
Creates a new LP position
Wrapped tokens are tokens representing a position in a strategy, it allows the user to reinvest DeFi liquidity without having to withdraw
Parameters:
addLiquidity
Increases the position's provided liquidity
Wrapped tokens are tokens representing a position in a strategy, it allows the user to reinvest DeFi liquidity without having to withdraw
Parameters:
takeInterests
Takes the interests of a position
Parameters:
commitRemoveLiquidity
Commits to withdraw the position's liquidity
Ongoing claims must be resolved before being able to commit
Parameters:
uncommitRemoveLiquidity
Cancels a position's commit to withdraw its liquidity
Parameters:
removeLiquidity
Closes a position and withdraws its liquidity
The position must be committed and the delay elapsed to withdrawal
Parameters:
openCover
Buys a cover
Parameters:
updateCover
Updates or closes a cover
If premiumsToRemove_ is max uint256 then withdraw premiums & closes the cover
Parameters:
Events info
PoolCreated
Emitted when a new pool is created
PositionOpenned
Emitted when a position is opened
InterestsTaken
Emitted when a position's liquidity is updated
PositionLiquidityUpdated
Emitted when a position's liquidity is updated
CoverOpenned
Emits when a new cover is bought
CoverUpdated
Emits when a cover is updated
CoverClosed
Emits when a cover is closed
CompensationPaid
Compensation is paid out for a claim
Last updated