Pool
This contract manages a pool of assets, allowing for the creation and redemption of bond and leverage tokens. It also handles distribution periods and interacts with an oracle for price information.
The Pool is the core contract for the Plaza protocol. The pool holds all underlying assets for a particular set of programmable derivatives and handles the issuance and burn of all programmable derivatives related to its specific strategy or underlying. The first pool on Plaza has a mix of Ethereum liquid staking and liquid restaking tokens as the underlying assets and splits the total return of those ETH-related assets into two products targeted at different investor profiles, bondETH - a stabilized profile that received a coupon in USDC every quarter, and levETH - levered exposure to ETH. In this case, the pool contract holds all the ETH-related assets and issues the bondETH and levETH tokens.
Inherits: Initializable, PausableUpgradeable, ReentrancyGuardUpgradeable, OracleReader, Validator
State Variables
POINT_EIGHT
POINT_TWO
COLLATERAL_THRESHOLD
PRECISION
BOND_TARGET_PRICE
COMMON_DECIMALS
SECONDS_PER_YEAR
MIN_LIQUIDATION_THRESHOLD
poolFactory
Pool factory contract
fee
Fee amount
feeBeneficiary
Fee beneficiary address
lastFeeClaimTime
Last fee claim time
liquidationThreshold
Liquidation threshold denoting the maximum percentage of reserve tokens that can be sold in an auction.
reserveToken
Reserve token address
bondToken
Bond token contract
lToken
Leverage token contract
couponToken
Coupon token address
sharesPerToken
Shares per bond token
distributionPeriod
Distribution period in seconds
auctionPeriod
Auction period in seconds
lastDistribution
Last distribution timestamp in seconds
auctions
Mapping to store auction addresses by their index
Functions
constructor
Note: oz-upgrades-unsafe-allow: constructor
initialize
Initializes the contract with the given parameters.
Parameters
setLiquidationThreshold
Sets the liquidation threshold. Cannot be set below 90%.
Parameters
create
Creates new tokens by depositing reserve tokens.
Parameters
Returns
create
Creates new tokens by depositing reserve tokens, with additional parameters for deadline and onBehalfOf for router support.
Parameters
Returns
_create
Creates new tokens by depositing reserve tokens, with additional parameters for deadline and onBehalfOf for router support.
Parameters
Returns
simulateCreate
Simulates the creation of new tokens without actually minting them.
Parameters
Returns
getCreateAmount
Calculates the amount of new tokens to create based on the current pool state and oracle price.
Parameters
Returns
redeem
Redeems tokens for reserve tokens.
Parameters
Returns
redeem
Redeems tokens for reserve tokens, with additional parameters.
Parameters
Returns
_redeem
Redeems tokens for reserve tokens, with additional parameters.
Parameters
Returns
simulateRedeem
Simulates the redemption of tokens without actually burning them.
Parameters
Returns
getRedeemAmount
Calculates the amount of reserve tokens to be redeemed for a given amount of bond or leverage tokens.
Parameters
Returns
startAuction
Starts an auction for the current period.
transferReserveToAuction
Transfers reserve tokens to the current auction.
Parameters
distribute
Distributes coupon tokens to bond token holders. Can only be called after the distribution period has passed.
getPoolInfo
Returns the current pool information.
Returns
setDistributionPeriod
Sets the distribution period.
Parameters
setAuctionPeriod
Sets the auction period.
Parameters
setSharesPerToken
Sets the shares per token.
Parameters
setFee
Sets the fee for the pool.
Parameters
setFeeBeneficiary
Sets the fee beneficiary for the pool.
Parameters
claimFees
Allows the fee beneficiary to claim the accumulated protocol fees.
getFeeAmount
Returns the amount of fees to be claimed.
Returns
pause
Pauses the contract. Reverts any interaction except upgrade.
unpause
Unpauses the contract.
onlyRole
Modifier to check if the caller has the specified role.
Parameters
NotInAuction
Modifier to prevent a function from being called during an ongoing auction.
Events
SharesPerTokenChanged
Emitted when the shares per token value is changed.
Parameters
Distributed
Emitted when the distribution period is over and the shares have been distributed to the distributor.
Parameters
AuctionPeriodChanged
Emitted when the auction period is changed.
Parameters
DistributionRollOver
Emitted when the distribution period is rolled over. This happens when the auction did not acquire the required amount of coupon tokens for the corresponding number of underlying assets.
Parameters
DistributionPeriodChanged
Emitted when the distribution period is changed.
Parameters
TokensCreated
Emitted when new Plaza derivatives are created.
Parameters
TokensRedeemed
Emitted when Plaza derivatives are redeemed.
Parameters
FeeClaimed
Emitted when fees are claimed.
Parameters
FeeChanged
Emitted when the fee amount is changed.
Parameters
LiquidationThresholdChanged
Emitted when the liquidation threshold is changed.
Parameters
Errors
MinAmount
Error thrown when amount is below minimum required
ZeroAmount
Error thrown when amount is zero
FeeTooHigh
Error thrown when fee is set too high
AccessDenied
Error thrown when caller doesn't have required access
NoFeesToClaim
Error thrown when there are no fees to claim
NotBeneficiary
Error thrown when caller is not the beneficiary
ZeroDebtSupply
Error thrown when debt supply is zero
AuctionIsOngoing
Error thrown when auction is currently ongoing
ZeroLeverageSupply
Error thrown when leverage supply is zero
CallerIsNotAuction
Error thrown when caller is not the auction contract
DistributionPeriod
Error thrown when distribution period is invalid
AuctionPeriodPassed
Error thrown when auction period has passed
AuctionNotSucceeded
Error thrown when auction has not succeeded
AuctionAlreadyStarted
Error thrown when auction has already started
LiquidationThresholdTooLow
Error thrown when liquidation threshold is set too low
DistributionPeriodNotPassed
Error thrown when distribution period has not passed yet
Structs
PoolInfo
Struct containing information about the pool's current state.
Enums
TokenType
Enum representing the types of tokens that can be created or redeemed.
Last updated