# Table of Contents - [Addresses | Plaza Finance](#addresses-plaza-finance) - [What are programmable derivatives? | Plaza Finance](#what-are-programmable-derivatives-plaza-finance) - [bondETH - An Ethereum-backed Bond | Plaza Finance](#bondeth-an-ethereum-backed-bond-plaza-finance) - [Create (Buy) | Plaza Finance](#create-buy-plaza-finance) - [levETH - Levered Ethereum | Plaza Finance](#leveth-levered-ethereum-plaza-finance) - [Plaza Overview | Plaza Finance](#plaza-overview-plaza-finance) - [Plaza Points (PP) Overview | Plaza Finance](#plaza-points-pp-overview-plaza-finance) - [Redeem (Sell) | Plaza Finance](#redeem-sell-plaza-finance) - [Coupon Distributions | Plaza Finance](#coupon-distributions-plaza-finance) - [Claiming Coupons | Plaza Finance](#claiming-coupons-plaza-finance) - [Coupon Auction | Plaza Finance](#coupon-auction-plaza-finance) - [BalancerOracleAdapter | Plaza Finance](#balanceroracleadapter-plaza-finance) - [LeverageToken | Plaza Finance](#leveragetoken-plaza-finance) - [PoolFactory | Plaza Finance](#poolfactory-plaza-finance) - [Distributor | Plaza Finance](#distributor-plaza-finance) - [Auction | Plaza Finance](#auction-plaza-finance) - [BondToken | Plaza Finance](#bondtoken-plaza-finance) --- # Addresses | Plaza Finance Below is a list of all the core Plaza contracts and their corresponding addresses on Base Sepolia Testnet. As the testnet upgrades and evolves, new addresses will be added. Core Contracts Contract Address Distributor 0xd32193db54208f3220ecb6642723920a192640cb Pool Factory 0x50bf65f690824e89de9407b476230e6163e94a89 Pool 0x47129e886b44b5b8815e6471fcd7b31515d83242 BondETH 0x1ac493c87a483518642f320ba5b342c7b78154ed LevETH 0x975f67319f9da83b403309108d4a8f84031538a6 Testing Contracts Faucet 0x0c588c112686d9c3606c443854f580f3ff174e70 Faucet USDC 0xf7464321de37bde4c03aaeef6b1e7b71379a9a64 Faucet wstETH 0x13e5fb0b6534bb22cbc59fae339dbbe0dc906871 MockRouter 0xad61d4e5a5c226298549632ffe9998b738865471 [PreviousCoupon Auction](/protocol-mechanics/coupon-auction) [NextPool](/contracts/pool) Last updated 2 months ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) --- # What are programmable derivatives? | Plaza Finance [PreviousPlaza Overview](/) [NextbondETH - An Ethereum-backed Bond](/plaza-assets/bondeth-an-ethereum-backed-bond) Last updated 3 months ago [](#introduction) Introduction ----------------------------------- The Ethereum ecosystem coined the term _programmable money_ to concisely capture the evolution that smart contracts brought to cryptocurrency infrastructure that vastly increased the capabilities of the Ethereum blockchain over earlier blockchains like the Bitcoin network. _**Programmable derivative**_ is a term coined by Plaza Finance to describe a similar leap in cryptocurrency and blockchain architecture that enables better-tailored financial products without the need to trust a centralized authority for transaction execution or custody. [](#overview) Overview --------------------------- Programmable derivatives are tokenized representations of structured asset vaults directly embedded in a blockchain. Any tokenized asset (like ETH, BTC, SOL, tokenized US treasuries, tokenized gold, and more) can serve as the foundational vault asset of a programmable derivative. The total return of that vault asset can be split into an infinite number of structures i.e. a bond, an option, leverage, and more. Once structures are created, users can permissionlessly mint and redeem tokenized representations of those structures, called _programmable derivatives_, on the blockchain. Owners of programmable derivatives can use these assets in any number of applications like exchanges, vaults, and more. Programmable derivatives are always redeemable for some portion of the vault assets, therefore unique structures inherit the liquidity of the vault asset. [](#why-are-they-needed) Why are they needed? -------------------------------------------------- Many decentralized exchanges are working towards the ability to trade any asset permissionlessly via fully synthetic contracts (perpetual futures). These fully synthetic markets have two major downsides: lack of composability and limited liquidity, both solved by programmable derivatives. While it is theoretically possible to create a perpetual future for any asset, the users' exposure and assets are trapped in the exchange. Users must completely entrust the exchange with holding their funds, and they cannot use those assets for other purposes, like borrowing, lending, and depositing for yield and airdrop farming. Programmable derivatives allow users to create any structure, and use the tokenized representation of that structure for any purpose, even hiding those assets away in cold storage if they desire, which is not possible with perpetual futures. Another limitation of perpetual futures is that the liquidity of the synthetic contract for an asset, like ETH, is limited to the synthetic contract's liquidity on the exchange venue. ETH spot liquidity is far deeper than any decentralized exchange's ETH perpetual futures liquidity. With ETH-based programmable derivatives, the liquidity of the structure is only limited by the liquidity of spot ETH, since all tokenized structures on ETH are redeemable back for ETH. Programmable derivatives are fully asset-backed, and not synthetic. [](#use-cases) Use Cases ----------------------------- Programmable derivatives unlock new possibilities not previously seen in decentralized finance. Examples include a fully decentralized ETH-backed bond that pays coupons in USDC, liquidation-proof leverage on BTC with an attractive convexity profile, and many more. There is an infinite array of structures that can be created on any number of assets, all without increasing network complexity and congestion, and without sacrificing liquidity for users. Plaza Finance is a cross-ecosystem hub for programmable derivatives, focused on delivering better financial products for everyone. To stay up to date on Plaza Finance and programmable derivatives, follow [@plaza\_finance](https://x.com/plaza_finance) . ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) ![](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FYRvQTTbio3aL8Tx2Y9c6%252FScreenshot%25202024-06-16%2520at%252011.27.02%25E2%2580%25AFPM.png%3Falt%3Dmedia%26token%3Dc5859b61-e1b6-4b02-b640-ff0c46e1f9cd&width=768&dpr=4&quality=100&sign=88ec8978&sv=2) --- # bondETH - An Ethereum-backed Bond | Plaza Finance ### [](#what-is-bondeth) What is bondETH? bondETH is a bond token issued by a vault containing liquid staked and liquid restake representations of ETH (like wstETH). As a bondETH holder, you're entitled to a fixed quarterly coupon of 2.50 USDC per bondETH (10.00 USDC per bondETH per year), paid out in perpetuity. Enjoy a steady income stream while benefiting from Ethereum staking's security and growth potential. ### [](#how-does-bondeth-work) How does bondETH work? #### [](#creation-of-bondeth) [Creation of bondETH](/protocol-mechanics/create-buy) To create bondETH, deposit ETH related tokens into a smart contract vault on Plaza Finance. The creation price is determined by a conditional Automated Market Maker (cAMM) curve based on the vault's collateral level. * Collateral Level Calculation Collateral Level = (Quantity of ETH related tokens in the vault × Oracle Price of ETH related tokens in the vault ) ÷ (Quantity of bondETH outstanding × 100) * If Collateral Level > 1.2: Creation Price fixed at 100 USDC per bondETH * If Collateral Level ≤ 1.2: Creation Price adjusts to 80% of the vault's collateral value per bondETH #### [](#earning-coupons) Earning Coupons Receive 2.50 USDC every quarter for each bondETH you hold. Coupons are funded by selling a portion of the ETH related tokens in the vault in an [auction](/protocol-mechanics/coupon-auction) . * Coupon Generation Dynamics * The amount of ETH related tokens in the vault sold each period is dependent on the number of bondETH outstanding, the price of ETH, and the amount of ETH related tokens in the pool. * When ETH Price Rises: Fewer ETH related tokens need to be sold to meet coupon payments * When ETH Price Falls: More ETH related tokens in the vault are sold to cover coupons. * The vault never runs out of ETH related tokens because of two key features: * Permissionless Redemptions: holders can and may redeem at any time to delever the protocol and reduce the amount of bond coupons required to be paid by the vault. * If coupons exceed the value of ETH in the vault, the vault pauses coupons until the price of ETH recovers or the pool delevers to a point that supports coupons. #### [](#redemption-of-bondeth) [Redemption of bondETH](/protocol-mechanics/redeem-sell) The redemption price is determined by a conditional Automated Market Maker (cAMM) curve based on the vault's collateral level. You can redeem your bondETH tokens for ETH related tokens at any time. * Redemption Price Calculation Uses the same Collateral Level calculation as creation * If Collateral Level > 1.2: Redemption Price is the lesser of 100 USDC or current market price of bondETH * If Collateral Level ≤ 1.2: Redemption Price adjusts to 80% of vault's collateral value per bondETH or market price, whichever is lower ### [](#interplay-between-leveth-and-bondeth) Interplay between levETH and bondETH **levETH** is another token issued by the same vault, offering leveraged exposure to ETH. While bondETH provides stability and fixed income, levETH is designed for investors seeking higher returns through leverage without liquidation risk. * Shared Vault: Both bondETH and levETH are backed by the same pool of ETH * Allocation of Returns: * bondETH Holders: Receive fixed USDC coupons funded by ETH sales * levETH Holders: Benefit from leveraged exposure to ETH price movements * Risk and Reward Balance: * bondETH: Lower risk, stable returns. Protected by vault's collateral management * levETH: Higher risk, potential for greater returns. Gains amplified due to leverage but exposed to greater price volatility ### [](#why-choose-bondeth) Why Choose bondETH? * Stable Income: Enjoy fixed, predictable income regardless of market volatility * Asset-Backed: Fully backed by ETH LSTs and LRTs, combining Ethereum staking benefits with bond safety * Flexibility and Control: Create and redeem bondETH at any time based on your strategy and risk tolerance * Transparency: All operations are conducted by audited smart contracts on Base, ensuring trust ### [](#getting-started-with-bondeth) Getting Started with bondETH * Access [Plaza Finance](http://plaza.finance) : Visit the platform to interact with the bondETH and levETH vault * Create bondETH or levETH tokens: Choose bondETH for stable income, levETH for leveraged growth, or mix both * Monitor the Vault: Stay informed about collateral levels and market prices for timely decisions… or set it and forget it <3. _Disclaimer: Products like bondETH can result in significant gains or losses. Cryptocurrency investments carry risks. Please perform your own due diligence and consult with a financial advisor if necessary before investing._ [PreviousWhat are programmable derivatives?](/what-are-programmable-derivatives) [NextlevETH - Levered Ethereum](/plaza-assets/leveth-levered-ethereum) Last updated 2 months ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) --- # Create (Buy) | Plaza Finance [PreviousPlaza Points (PP) Overview](/plaza-points-pp/plaza-points-pp-overview) [NextRedeem (Sell)](/protocol-mechanics/redeem-sell) Last updated 2 months ago To create levETH or bondETH, users provide the Plaza Pool with an underlying pool asset, say wstETH, in exchange for either bondETH or levETH as specified by the user. Creations are denoted as a Buy on the Plaza UI. The Plaza Pool calculates the issuance rate for each token based on the following formulas: ### [](#creation-of-bondeth) Creation of [bondETH](/plaza-assets/bondeth-an-ethereum-backed-bond) The creation price is determined by a conditional Automated Market Maker (cAMM) curve based on the vault's collateral level. Collateral Level = (Quantity of ETH related tokens in the vault × Oracle Price of ETH related tokens) ÷ (Quantity of bondETH outstanding × 100) * If Collateral Level > 1.2: Creation Price fixed at 100 USDC per bondETH * If Collateral Level ≤ 1.2: Creation Price adjusts to 80% of the vault's collateral value per bondETH ### [](#creation-of-leveth) Creation of [levETH](/plaza-assets/leveth-levered-ethereum) To create levETH, users deposit wstETH into a smart contract vault on Plaza Finance. The creation price is determined by a **conditional Automated Market Maker (cAMM) curve** based on the vault’s collateral level. Collateral Level = (Quantity of ETH related tokens in the vault × Oracle Price of ETH related tokens) ÷ (Quantity of bondETH outstanding × 100) * If Collateral Level > 1.2: Creation Price = (Total Value of ETH related tokens in the Vault - (100 × Quantity of bondETH outstanding)) ÷ (Quantity of levETH outstanding) * If Collateral Level ≤ 1.2: Adjusts to 20% of the vault’s collateral value per levETH [](#create-flow) Create Flow --------------------------------- Below is an example of the create flow showing the interactions between the pool, the oracle, and the token contracts. ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) ![](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252Fv1ReOtFXTUr60SluhmBg%252FEVM%2520Protocol%2520Architecture%2520%2829%29.png%3Falt%3Dmedia%26token%3D22fafe97-1a20-4695-a7f6-f723d8af4391&width=768&dpr=4&quality=100&sign=25804579&sv=2) --- # levETH - Levered Ethereum | Plaza Finance _Amplify Your Exposure to Ethereum with Liquidation-Free Leverage_ ### [](#what-is-leveth) What is levETH? levETH is a leveraged token issued by a vault containing liquid staked and liquid restake representations of ETH (like wstETH). Designed for investors seeking higher returns, levETH offers leveraged exposure to ETH related assets without the risk of liquidation. Benefit from the growth potential of Ethereum staking with amplified gains, all while being protected from forced liquidations during market volatility. ### [](#how-does-leveth-work) How does levETH work? #### [](#creation-of-leveth) [Creation of levETH](/protocol-mechanics/create-buy) To create levETH, you deposit ETH related tokens into a smart contract vault on Plaza Finance. The creation price is determined by a **conditional Automated Market Maker (cAMM) curve** based on the vault’s collateral level. * Collateral Level Calculation Collateral Level = (Quantity of ETH related tokens in the vault × Oracle Price of ETH related tokens in the vault) ÷ (Quantity of bondETH outstanding × 100) * If Collateral Level > 1.2: Creation Price = (Total Value of ETH related tokens in the vault - 100 × Quantity of bondETH outstanding) ÷ (Quantity of levETH outstanding) * If Collateral Level ≤ 1.2: Adjusts to 20% of the vault’s collateral value per levETH #### [](#leveraged-exposure) Leveraged Exposure As a levETH holder, you are entitled to the **remaining returns** of the vault after bondETH obligations are met. This includes: * **Price Appreciation of ETH**: Your gains are amplified due to leverage financed by bondETH holders and their ETH related tokens deposits. * **Staking Rewards**: Benefit from Ethereum staking rewards after fixed coupons are paid to bondETH holders. #### [](#redemption-of-leveth) [Redemption of levETH](/protocol-mechanics/redeem-sell) The redemption price is determined by a conditional Automated Market Maker (cAMM) curve based on the vault's collateral level. You can redeem your levETH tokens for ETH related tokens at any time. * Redemption Price Calculation Uses the same Collateral Level calculation as creation * If Collateral Level > 1.2: Redemption Price = (Total Value of ETH related tokens in the Vault - (100 × Quantity of bondETH outstanding)) ÷ (Quantity of levETH outstanding) * If Collateral Level ≤ 1.2: Adjusts to 20% of the vault’s collateral value per levETH or the market price, whichever is lower ### [](#liquidation-free) Liquidation Free **levETH** provides levered exposure to ETH price without the risk of liquidation. levETH is liquidation free because the Plaza protocol ensures there is always ETH related tokens in the pool that levETH holders can redeem their levETH for. This is maintained by the following properties of the protocol: * levETH has dynamic market-set leverage: bondETH can be created and redeemed permissionless and provides the leverage to levETH by contributing ETH related tokens to the pool for a fixed return. Redemptions of bondETH in periods of market uncertainty reduce the amount of USDC the pool needs to generate from ETH related tokens sales. * bondETH coupons pause under extreme market conditions: if the price of ETH falls such that a USDC coupon exceeds the value of the ETH related tokens in the pool, the protocol pauses coupons until the price of ETH recovers or amount of bondETH outstanding reduces to the point where the protocol can resume coupons. The liquidation-free nature of levETH makes it the ideal product to express a long-term bullish view on Ethereum. levETH holders may experience a mark-to-market loss if the price of ETH falls, however there will always be ETH related tokens in the pool that levETH holders are exposed to, allowing holders to experience the upside of a recovery without getting stopped out of their position as they would by expressing the bullish view through perpetual futures. ### [](#interplay-between-leveth-and-bondeth) Interplay between levETH and bondETH **levETH** is another token issued by the same vault, offering leveraged exposure to ETH. While bondETH provides stability and fixed income, levETH is designed for investors seeking higher returns through leverage without liquidation risk. * Shared Vault: Both bondETH and levETH are backed by the same pool of ETH related tokens * Allocation of Returns: * bondETH Holders: Receive fixed USDC coupons funded by ETH related token sales * levETH Holders: Benefit from leveraged exposure to ETH price movements * Risk and Reward Balance: * bondETH: Lower risk, stable returns. Protected by the vault's collateral management * levETH: Higher risk, potential for greater returns. Gains amplified due to leverage but exposed to greater price volatility ### [](#why-choose-leveth) Why Choose levETH? * Leverage Without Liquidation: Amplify your exposure to Ethereum’s growth without the fear of forced liquidation. * Asset-Backed: Fully backed by ETH LSTs and LRTs, combining Ethereum staking benefits with bond safety * Flexibility and Control: Create and redeem levETH at any time based on your strategy and risk tolerance * Transparency: All operations are conducted by audited smart contracts on Base, ensuring trust ### [](#getting-started-with-leveth) Getting Started with levETH * Access [Plaza Finance](http://plaza.finance) : Visit the platform to interact with the bondETH and levETH vault * Create bondETH or levETH tokens: Choose bondETH for stable income, levETH for leveraged growth, or mix both * Monitor the Vault: Stay informed about collateral levels and market prices for timely decisions… or set it and forget it <3. _Disclaimer: Products like levETH can result in significant gains or losses. Cryptocurrency investments carry risks. Please perform your own due diligence and consult with a financial advisor if necessary before investing._ [PreviousbondETH - An Ethereum-backed Bond](/plaza-assets/bondeth-an-ethereum-backed-bond) [NextPlaza Points (PP) Overview](/plaza-points-pp/plaza-points-pp-overview) Last updated 2 months ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) --- # Plaza Overview | Plaza Finance [NextWhat are programmable derivatives?](/what-are-programmable-derivatives) Last updated 2 months ago Plaza is a platform for [programmable derivatives](/what-are-programmable-derivatives) built as a set of Solidity smart contracts on [Base](https://base.org) . It offers two core products: [bondETH](/plaza-assets/bondeth-an-ethereum-backed-bond) and [levETH](/plaza-assets/leveth-levered-ethereum) , which are programmable derivatives of a pool of ETH liquid staking derivatives (LSTs) and liquid restaking derivatives (LRTs) such as wstETH. Users can deposit an underlying pool asset like wstETH and receive levETH or bondETH in return, which are represented as ERC20 tokens. These tokens are composable with protocols such as DEXes, lending markets, restaking platforms, etc. bondETH and levETH represent splits of the total return of the underlying pool of ETH LSTs and LRTs, giving users access to a profile of risk and returns that better suits their needs and investment style. Plaza operates in a fully permissionless manner, with each core function of the protocol executable by anyone. Plaza has three core user functionalities in the protocol: creations, redemptions, and coupon claiming. * [Creations](/protocol-mechanics/create-buy) : converting a pool asset like wstETH into bondETH or levETH. * [Redemptions](/protocol-mechanics/redeem-sell) : exchanging a programmable derivative (bondETH or levETH) for an underlying pool asset like wstETH. * [Coupon Claiming](/protocol-mechanics/claiming-coupons) : collecting payment in USDC for holding bondETH at the end of a coupon distribution period. Aside from the above user actions, the protocol has two additional mechanisms that aid its function—merchant auctions and distributions. * [Merchant Auctions](/protocol-mechanics/coupon-auction) : the process of selling a portion of pool assets like wstETH in exchange for USDC to distribute to the bondETH holders at each coupon distribution. * [Distribution](/protocol-mechanics/coupon-distributions) : The process of distributing USDC to bondETH holders who can claim a USDC coupon payment during the distribution period. External dependencies on trusted partners: * [**Chainlink**](https://chain.link) **:** Chainlink Price Feeds (oracle service) are referenced each time a derivative is created or redeemed. Based on the price of underlying pool assets and programmable derivatives, and the quantity being created or redeemed, the conditional AMM determines the amount of returned asset to deliver back to the user. ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) ![](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FYRvQTTbio3aL8Tx2Y9c6%252FScreenshot%25202024-06-16%2520at%252011.27.02%25E2%2580%25AFPM.png%3Falt%3Dmedia%26token%3Dc5859b61-e1b6-4b02-b640-ff0c46e1f9cd&width=768&dpr=4&quality=100&sign=88ec8978&sv=2) --- # Plaza Points (PP) Overview | Plaza Finance The **Plaza Preseason Points Program** is designed to reward users for engaging with the platform and participating in various activities. The program offers a mix of **action-based**, **social media**, and **community participation** incentives to encourage long-term usage and platform engagement. At the end of each season, points are snapshotted and reset, giving everyone a fresh start to earn points and get rewarded. ### [](#disclaimer) Disclaimer To ensure fairness and maintain the integrity of the protocol, each user is strictly limited to the use of one wallet per person. Attempts to exploit the system by using multiple wallets, also known as Sybil attacks, are prohibited and will result in disqualification from receiving rewards and possible suspension from the platform. Plaza reserves the right to detect and remove points from anyone caught abusing the system. ### [](#action-incentives) Action Incentives **Action Incentives** are based on protocol usage on the [webapp](https://testnet.plaza.finance) . These refresh daily at 00:00 UTC, so make sure to come back often to collect your daily points reward! Action Description Points **Create** Create a bond or leverage token using the underlying faucet token. The amount of tokens created does not have an effect on the amount of points rewarded. A point is given for each token type created. The transaction itself is what counts. 4 points / day / token type (levETH and bondETH) Up to 8 points per day **Redeem** Redeem a bond back to the underlying ETH or into USDC via the UI. Again, the amount of tokens created does not have an effect on the amount of points rewarded. A point is given for each token type created. The transaction itself is what counts. 4 points / day / token type (levETH and bondETH) Up to 8 points per day ### [](#social-media-incentives-guild.xyz) Social Media Incentives ([Guild.xyz](https://guild.xyz/plaza-finance) ) **Social Media Incentives** are based on connecting your account to Plaza's socials. To qualify for the rewards, complete the tasks in the [Guild](https://guild.xyz/plaza-finance) . Stay tuned for engagement-based social media incentives. Action Description Points / Multiplier **Connect** [**Discord**](https://discord.gg/plazafinance) Connect Discord and verify via our server’s captcha. \+ 10% of future points accrued **Connect** [**Twitter/X**](https://twitter.com/plaza_finance) Connect to Twitter and follow @plaza\_finance. \+ 10% of future points accrued. **Connect Email** Connect email and agree to marketing terms. \+ 10% of future points accrued. **Connect** [**Farcaster**](https://warpcast.com/plazafinance) Connect to Farcaster and follow @plazafinance. \+ 10% of future points accrued. **Boost** [**Discord**](https://discord.gg/plazafinance) Boost the Discord server. \+ 50 points [**Discord**](https://discord.gg/plazafinance) **Level Up** Increase your Discord level by participating in discussions. +0.1% of future points accrued for each level earned. ### [](#community-participation-incentives) Community Participation Incentives Plaza hosts many community initiatives, all of which are included in the **Community Participation Incentives.** Keep an eye out on [Twitter/X](https://twitter.com/plaza_finance) and [Discord](https://discord.gg/plazafinance) for more information on how to participate. Action Description Points / Multiplier **Content Contest Participation** Participation in content contest (Tweet contest, art contest, meme contest). These happen in the Discord once a week. \+ 0.5% of future points accrued. **Game Win** Win a game or competitive live event, at mod’s discretion. 100 points **Contest Win** Win a content contest for the week, judged by the mods. 250 points **Quests** TBD TBD ### [](#plaza-referral-program) Plaza Referral Program The **Plaza Referral Program** rewards users for growing the Plaza community by inviting their friends. Referring a user entitles the referrer to a percentage of the points earned by the referree in future seasons. The points are additive - they do not subtract from the person you refer. In the Pre-Season, users only earn points through testnet actions and game wins. Referrals do not accrue points in the Pre-Season. This keeps the points system fair in the Pre-Season and ensures early users get rewarded for their contribution to the Plaza. ### [](#plaza-levels-program) Plaza Levels Program The **Plaza Levels Program** rewards users for their engagement and participation on the platform, offering exciting rewards such as exclusive NFTs, Discord roles, and merchandise to those who accrue points. As you accumulate points through daily activities, social engagement, and competition wins, you advance through levels, unlocking new rewards at each stage. At the end of each season, levels are reset, giving everyone a fresh start to compete and climb the levels again. Once levels refresh, new seasons bring fresh opportunities to claim additional rewards, including new NFTs, limited-edition merchandise, and roles. ### [](#rewards-overview) **Rewards Overview:** * **NFTs**: Collect exclusive NFTs as you progress through levels. These digital collectibles increase in rarity and value as you advance. * **Discord Roles**: Unlock special Discord roles at various levels, granting you access to exclusive community channels, events, and perks. * **Merchandise**: At higher levels, earn NFTs that can be redeemed for physical merchandise like T-shirts, hats, hoodies, and more. You can claim the merch immediately or hold the NFT to redeem at any time in the future. Level Points Needed Reward(s) Notes 1 50 Basic NFT (Plaza Collectible) Easy entry-level reward for casual engagement. 2 100 Discord Role: "Points Dabbler (100 Points)" Role to signify new community members. 3 200 NFT Badge: "200" Recognition for early users or contributors. 4 300 Access to Exclusive Discord Channel Private channel for more engaged users. 5 500 NFT: "500" Higher-quality NFT for continued engagement. 6 750 Discord Role: "Preseason Executive (750)" Status upgrade in Discord community. 7 1,000 Special Edition NFT (Preseason Completionist) Exclusive digital asset with potential for upgrades. 8 1,500 Discord Role: "Unattainable (1,500 points preseason)" Elevated role within the community with more privileges. [PreviouslevETH - Levered Ethereum](/plaza-assets/leveth-levered-ethereum) [NextCreate (Buy)](/protocol-mechanics/create-buy) Last updated 1 month ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) --- # Redeem (Sell) | Plaza Finance [PreviousCreate (Buy)](/protocol-mechanics/create-buy) [NextClaiming Coupons](/protocol-mechanics/claiming-coupons) Last updated 2 months ago Redemption, the opposite of [Creation](/protocol-mechanics/create-buy) , is the process of exchanging bondETH or levETH for an underlying pool asset from the Plaza Pool. Redemptions are denoted as a Sell on the Plaza UI. The Plaza Pool calculates the issuance rate for each token based on the following formulas: ### [](#redemption-of-bondeth) Redemption of [bondETH](/plaza-assets/bondeth-an-ethereum-backed-bond) The redemption price is determined by a conditional Automated Market Maker (cAMM) curve based on the vault's collateral level. You can redeem your bondETH tokens for an underlying pool asset at any time. Estimated Pro-Forma Collateral Level = ((Quantity of ETH-related tokens in the vault× Oracle Price of ETH related tokens in the vault) - (Quantity of bondETH redeemed x 100)) ÷ ((Quantity of bondETH outstanding - Quantity of bondETH redeemed) × 100) * If Estimated Pro-Forma Collateral Level > 1.2: Redemption Price is the lesser of 100 USDC or current market price of bondETH * If Estimated Pro-Forma Collateral Level ≤ 1.2: Redemption Price adjusts to 80% of vault's collateral value per bondETH or market price, whichever is lower ### [](#redemption-of-leveth) Redemption of [levETH](/plaza-assets/leveth-levered-ethereum) The redemption price is determined by a conditional Automated Market Maker (cAMM) curve based on the vault's collateral level. You can redeem your levETH tokens for ETH related tokens in the vault at any time. Collateral Level = (Quantity of ETH related tokens in the vault × Oracle Price of ETH related tokens in the vault) ÷ (Quantity of bondETH outstanding × 100) * If Collateral Level > 1.2: Redemption Price} = (Total Value of ETH related tokens in the vault in Vault - (100 × Quantity of bondETH outstanding)) ÷ (Quantity of levETH outstanding) * If Collateral Level ≤ 1.2: Adjusts to 20% of the vault’s collateral value per levETH or the market price, whichever is lower [](#redeem-flow) Redeem Flow --------------------------------- Below is an example of the redemption flow. It is very similar to the create flow, except here it burns the derivative token provided and returns the user an allocation of the desired underlying pool asset. Here, we see the interactions between the pool, the oracle, and the token contracts. ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) ![](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FKy1yxZPKIBpn26oOQPZC%252FEVM%2520Protocol%2520Architecture%2520%2830%29.png%3Falt%3Dmedia%26token%3D8177ac63-0bc8-4faf-a65a-a01accdcd86f&width=768&dpr=4&quality=100&sign=1c345620&sv=2) --- # Coupon Distributions | Plaza Finance [PreviousClaiming Coupons](/protocol-mechanics/claiming-coupons) [NextCoupon Auction](/protocol-mechanics/coupon-auction) Last updated 2 months ago ### [](#periodic-distribution-flow) Periodic Distribution Flow After the total outstanding coupon amount for the period has been [generated](/protocol-mechanics/coupon-auction) and the period time has elapsed, the distribution method is called in the Pool contract, which sends the total coupon amount to the distributor contract. From there, the bondholders are able to claim their owed debt coupon. Plaza may distribute asset coupons to a large number of users at scale proportionately to their holdings of bondETH at a certain point in time. Naive distribution methods like individually sending assets to each of the bondholders upon a new coupon distribution are infeasible due to time and gas constraints at scale. To avoid processing a large number of balances and performing individual sends at every distribution, Plaza employs a checkpointing mechanism to determine how many bonds each holder held at the distribution time, which allows for a maximum time complexity of O(1) at each distribution. Distributing simply allows the pool to send the total amount of USDC at distribution time, and users may claim their shares at any point thereafter. ### [](#checkpointing) Checkpointing Checkpointing is a function that tracks the holdings of each user during specific coupon distribution periods to account for outstanding coupons. It determines which period the asset has been transferred in and tallies up all of the unclaimed coupons for each period. Therefore, there is always a running record of each holder and the distribution period that they have held at. Thus, when a distribution occurs and the period increases, there is still evidence that the user was holding a bond in previous periods and the user will be eligible to claim previous coupons from the Distributor. Furthermore, this allows a user to claim a debt coupon even after they have transferred the bond away from their wallet. This is critical because if a user held a bond at the coupon date, didn't claim the coupon, and sold the asset, the user is still entitled to that coupon, a structure familiar to bond investors in traditional finance. The mechanism for checkpointing is displayed below. Every time a user transfers a bond token, the protocol updates the balances for that period and tallies up the amounts for all the periods since the user has completed the last action, including transfers and claims. Below is an example: 1. Ollie purchases a bond at the start of the year in the first distribution period. Upon purchase and transfer into Ollie’s wallet, the bond contract notes down the distribution period in which the transfer occurred. The period is 1. 2. Ollie has been holding this bond token for the past 4 periods. Each period corresponds to a quarter of a year. For each of these quarterly periods, the pool has distributed 2.5 USDC. The amount of USDC distributed per period is noted down in the bond contract. However, Ollie does not yet claim. 3. While Ollie has still not claimed the asset, he has decided to sell the bond on Uniswap, triggering a Sell event noted by the contract. The bond contract updates the owed coupon amount in Ollie’s account through the following process: 1. The contract checks the amount of coupons outstanding since the last time an action was taken. Since Ollie’s last bond balance change was when he purchased the bond for the first time, this amount is 0. 2. The contract then runs through the list of previous distribution periods and tallies the coupon amount at each. Since each period distributed 2.5USDC, Ollie has held 1 bond throughout this time, and there have been 4 distributions/periods, the total amount owed is now up to 10 USDC. 3. The contract finally updates the last calculation time to the current time and sets 10 USDC as the owed amount. Ollie is able to come back and claim this amount at any point in the future. 4. Ollie can now claim the asset at any point, which would prompt the distributor to reference the owed amount from within the bond contract before sending the required amount to him. Below is some code describing the mechanism at each bond transfer: Copy for (uint256 i = userPool.lastUpdatedPeriod; i < period; i++) { shares += (balance * globalPool.previousPoolAmounts[i].sharesPerToken).toBaseUnit(SHARES_DECIMALS); } userAssets[user].indexedAmountShares = shares; userAssets[user].lastUpdatedPeriod = period; Whoever holds the bond token at the time of distribution is owed the debt coupon until they claim. Transferring the bond coupon to another holder will not change the coupon obligation whatsoever. Coupon obligations are not tradable. ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) ![](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252F48xB3YgmmTRDFqNjkJFC%252FEVM%2520Protocol%2520Architecture%2520%2832%29.png%3Falt%3Dmedia%26token%3Da6dc53b6-ad62-4bb9-8aa2-df0457b2736a&width=768&dpr=4&quality=100&sign=5c9a542c&sv=2) ![](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FiHqQeAJUoAJ0jyBHbRoN%252FEVM%2520Protocol%2520Architecture%2520%2834%29.png%3Falt%3Dmedia%26token%3D6d16e735-ed79-46ca-b58d-57c2c42f50f4&width=768&dpr=4&quality=100&sign=12e73705&sv=2) --- # Claiming Coupons | Plaza Finance [PreviousRedeem (Sell)](/protocol-mechanics/redeem-sell) [NextCoupon Distributions](/protocol-mechanics/coupon-distributions) Last updated 2 months ago At every coupon distribution period, users may claim their owed coupons. In the first released ETH LST/LRT pool, coupons are distributed at a rate of 2.5 USDC per bond per quarter. The holder of bondETH at the time of coupon distribution is entitled to the distribution, even if they subsequently sold the bondETH. Once a distribution occurs, a bondETH holder may claim their coupons at any point, whether they still hold the bond tokens or not. ### [](#coupon-claiming-flow) Coupon Claiming Flow Bondholders may claim their coupons at any time after a distribution period has occurred as long as they have held the bond at the exact time that the distributions happened. If a user has transferred the tokens away after a coupon has been distributed and/or has not claimed previous coupon distributions, they are still eligible to claim them at any time. The calculating mechanism for historical holdings is explained in detail [here](/protocol-mechanics/coupon-distributions) . ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) ![](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FqwWCqQSi8yBasf3fnaj2%252FEVM%2520Protocol%2520Architecture%2520%2833%29.png%3Falt%3Dmedia%26token%3D87c7f015-c3a0-4a39-9fea-e46979be679c&width=768&dpr=4&quality=100&sign=7f5ac399&sv=2) --- # Coupon Auction | Plaza Finance [PreviousCoupon Distributions](/protocol-mechanics/coupon-distributions) [NextAddresses](/contracts/addresses) Last updated 2 months ago The auction is a process where participants bid USDC to acquire underlying pool assets like wstETH from a pool over a specified time frame, typically 10 days. During the auction, bidders submit their offers in USDC, competing for a portion of the pool's ETH. The auction contract tracks each bid, ensuring that all bids are recorded and accounted for. ### [](#auction-flow) Auction Flow To understand how this system works, let’s walk through the process of how users participate in the auction and how the distribution of ETH related pool assets and USDC works, similar to the transfer and tracking of bond tokens: 1. A new auction is created, and the system sets a 10-day period for participants to bid for ETH related assets using USDC. A portion of the underlying assets (like wstETH) in the pool are made available for bidding, not to exceed 95% percent of the value of the pool. 2. During the auction period, bidders place their bids specifying the quantity of USDC they are willing to pay and the quantity of ETH related pool assets they are willing to receive. The bidder deposits the USDC required to fulfill the bid into a contract. Each bid has an explicit size and implicit price of ETH asset for USDC. **Each bid is portioned into** [_**slots**_](/protocol-mechanics/coupon-auction#bid-slots) **, which represent a multiple of the minimum bid amount.** The auction contract records each bid placed and the USDC amount offered. The contract tracks the total amount of bids made by each bidder. If all of the bid slots are filled, newer bids kick the lowest bids out of the queue, and losing bidders may reclaim their original bid amount without loss. 3. Once the 10-day auction ends, the auction contract finalizes the results. At this point, the contract tallies up the bids and calculates the winning bids based on the amount of USDC each user has submitted. The auction contract then proceeds to settle the results. The USDC from the winning bids is transferred into the pool to be readied for distribution. 4. After the auction is completed, the pool allocates the corresponding amount of ETH related assets to the winning bidders. The contract keeps track of how much ETH each user has won based on the amount of USDC they bid. For example, if a user wins 5 ETH in the auction, the pool allocates that amount within the contract for the user to claim. 5. The bidders can now claim the ETH they won from the auction. The claim process triggers the auction contract to release the correct amount of ETH related assets that each user is entitled to. For instance, if a user bid 100 USDC and won 2 ETH, they can claim these tokens at any point after the auction is finalized. 6. Once the auction is fully processed, the USDC collected from the winning bids is transferred to the pool, and then subsequently to a distribution contract. This contract is responsible for distributing the USDC to the bondETH holders. ### [](#bid-slots) Bid Slots In this auction, each bid is divided into slots, with each slot representing a multiple of USDC. The slots are essentially standardized units of bidding, tied to a minimum amount of USDC required to participate. Instead of bidding a random amount of USDC, every bid is structured around these slots, where each slot corresponds to a fixed fraction of USDC known as the "minimum bid amount." For instance, if the minimum bid for a slot is set at 100 USDC, and a user wants to bid 500 USDC, this bid would be broken down into 5 slots. Each slot represents a share of the total USDC needed in the auction, with the slot system ensuring that bids are consistently structured and measured. As the auction proceeds, the system tracks how many slots each participant bids on. For example, if a user submits 1000 USDC and the minimum bid per slot is 100 USDC, that bid equates to 10 slots. Once the auction ends, the system calculates how many slots each participant has successfully won based on the overall demand and other bids. At the end of the auction, each winning bidder is awarded ETH related asset for the slots they won - this quantity is based on their bid scaled for how much they are actually being filled if that amount is smaller than their total bid. If the participant's bid of 10 slots results in winning 6 slots after the auction closes, they would receive a portion of ETH related assets proportional to those 6 slots. This slot-based system provides a clear structure for participants to understand how their bids relate to the minimum bid requirement and how much ETH they might win. It also ensures that the ETH is distributed fairly and proportionately based on the number of slots successfully acquired in the auction, and allows the protocol to overcome block size limitations when tallying bids. Refer to the image below, referenced from [Gnosis’ EasyAuction](https://github.com/gnosis/ido-contracts?tab=readme-ov-file) contracts to better understand how the slotting mechanism works. **The initial version of the auctioning system splits the available USDC the protocol needs to acquire into 1,000 equal slots.** ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) ![](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FDitEOi0X9CPqLfVEqGmc%252FScreenshot%25202024-10-29%2520at%252011.00.36%25E2%2580%25AFPM.png%3Falt%3Dmedia%26token%3D0e027d90-d8c1-4359-9f6c-68bb380d1cb7&width=768&dpr=4&quality=100&sign=bc02dec6&sv=2) ![](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FNvmPnD7bm9NLZ2UWiCxE%252Fimage.png%3Falt%3Dmedia%26token%3D6f93ddf0-0b49-4108-b8e4-a80a967c424e&width=768&dpr=4&quality=100&sign=6901e8c&sv=2) --- # BalancerOracleAdapter | Plaza Finance ### [](#state-variables) State Variables #### [](#pooladdress) poolAddress _Address of the Balancer pool this oracle adapter reads from_ Copy address public poolAddress; #### [](#decimals) decimals _Number of decimals used for price values returned by this oracle_ Copy uint8 public decimals; ### [](#functions) Functions #### [](#constructor) constructor **Note:** oz-upgrades-unsafe-allow: constructor Copy constructor(); #### [](#initialize) initialize _Initializes the BalancerOracleAdapter. This function is called once during deployment or upgrading to initialize state variables._ Copy function initialize(address _poolAddress, uint8 _decimals, address _oracleFeeds, address _owner) external initializer; **Parameters** Name Type Description `_poolAddress` `address` Address of the BALANCER Pool used for the oracle. `_decimals` `uint8` Number of decimals returned by the oracle. `_oracleFeeds` `address` Address of the OracleReader feeds contract, containing the Chainlink price feeds for each asset in the pool. `_owner` `address` #### [](#description) description _Returns the number of decimals used by the oracle._ _Returns the description of the oracle._ Copy function description() external pure returns (string memory); **Returns** Name Type Description `` `string` uint8 The number of decimals. #### [](#version) version _Returns the version of the oracle._ Copy function version() external pure returns (uint256); **Returns** Name Type Description `` `uint256` uint256 The version. #### [](#getrounddata) getRoundData _Not implemented._ Copy function getRoundData(uint80) public pure returns (uint80, int256, uint256, uint256, uint80); #### [](#latestrounddata) latestRoundData _Returns the latest round data. Calls getRoundData with round ID 0._ Copy function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80); **Returns** Name Type Description `` `uint80` roundId The round ID. Always 0 for this oracle. `` `int256` answer The price. `` `uint256` startedAt The timestamp of the round. `` `uint256` updatedAt The timestamp of the round. `` `uint80` answeredInRound The round ID. Always 0 for this oracle. #### [](#calculatefairuintprice) \_calculateFairUintPrice _Calculates the fair price of the pool in USD using the Balancer invariant formula:_ [_https://docs.balancer.fi/concepts/advanced/valuing-bpt/valuing-bpt.html#on-chain-price-evaluation_](https://docs.balancer.fi/concepts/advanced/valuing-bpt/valuing-bpt.html#on-chain-price-evaluation) _._ Copy function _calculateFairUintPrice( uint256[] memory prices, uint256[] memory weights, uint256 invariant, uint256 totalBPTSupply ) internal pure returns (uint256); **Parameters** Name Type Description `prices` `uint256[]` Array of prices of the assets in the pool. `weights` `uint256[]` Array of weights of the assets in the pool. `invariant` `uint256` The invariant of the pool. `totalBPTSupply` `uint256` The total supply of BPT in the pool. **Returns** Name Type Description `` `uint256` uint256 The fair price of the pool in USD. #### [](#authorizeupgrade) \_authorizeUpgrade _Function that should revert when_ `_msg.sender_` _is not authorized to upgrade the contract. Called by {upgradeTo} and {upgradeToAndCall}._ Copy function _authorizeUpgrade(address newImplementation) internal override onlyOwner; **Parameters** Name Type Description `newImplementation` `address` Address of the new implementation contract ### [](#errors) Errors #### [](#notimplemented) NotImplemented _Error thrown when calling an unimplemented function_ Copy error NotImplemented(); #### [](#pricetoolargeforintconversion) PriceTooLargeForIntConversion _Error thrown when a price value is too large to be safely converted to int256_ Copy error PriceTooLargeForIntConversion(); [PreviousLeverageToken](/contracts/leveragetoken) Last updated 2 months ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) --- # LeverageToken | Plaza Finance ### [](#state-variables) **State Variables** #### [](#minter_role) **MINTER\_ROLE** _Role identifier for accounts with minting privileges_ Copy bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); #### [](#gov_role) **GOV\_ROLE** _Role identifier for accounts with governance privileges_ Copy bytes32 public constant GOV_ROLE = keccak256("GOV_ROLE"); ### [](#functions) **Functions** #### [](#constructor) **constructor** **Note:** constructor Copy constructor(); #### [](#initialize) **initialize** _Initializes the contract with a name, symbol, minter, and governance address._ Copy function initialize(string memory name, string memory symbol, address minter, address governance) public initializer; **Parameters** Name Type Description `name` `string` The name of the token `symbol` `string` The symbol of the token `minter` `address` The address that will have minting privileges `governance` `address` The address that will have governance privileges #### [](#mint) **mint** Can only be called by addresses with the MINTER\_ROLE. _Mints new tokens to the specified address._ Copy function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE); **Parameters** Name Type Description `to` `address` The address that will receive the minted tokens `amount` `uint256` The amount of tokens to mint #### [](#burn) **burn** Can only be called by addresses with the MINTER\_ROLE. _Burns tokens from the specified account._ Copy function burn(address account, uint256 amount) public onlyRole(MINTER_ROLE); **Parameters** Name Type Description `account` `address` The account from which tokens will be burned `amount` `uint256` The amount of tokens to burn #### [](#update) **\_update** This function is called during token transfer and is paused when the contract is paused. _Internal function to update user assets after a transfer._ Copy function _update(address from, address to, uint256 amount) internal virtual override whenNotPaused; **Parameters** Name Type Description `from` `address` The address tokens are transferred from `to` `address` The address tokens are transferred to `amount` `uint256` The amount of tokens transferred #### [](#grantrole) **grantRole** Can only be called by addresses with the GOV\_ROLE. _Grants a role to an account._ Copy function grantRole(bytes32 role, address account) public virtual override onlyRole(GOV_ROLE); **Parameters** Name Type Description `role` `bytes32` The role being granted `account` `address` The account receiving the role #### [](#revokerole) **revokeRole** Can only be called by addresses with the GOV\_ROLE. _Revokes a role from an account._ Copy function revokeRole(bytes32 role, address account) public virtual override onlyRole(GOV_ROLE); **Parameters** Name Type Description `role` `bytes32` The role being revoked `account` `address` The account losing the role #### [](#pause) **pause** Can only be called by addresses with the GOV\_ROLE. Does not prevent contract upgrades. _Pauses all token transfers, mints, burns, and indexing updates._ Copy function pause() external onlyRole(GOV_ROLE); #### [](#unpause) **unpause** Can only be called by addresses with the GOV\_ROLE. _Unpauses all token transfers, mints, burns, and indexing updates._ Copy function unpause() external onlyRole(GOV_ROLE); #### [](#authorizeupgrade) **\_authorizeUpgrade** Can only be called by the owner of the contract. _Internal function to authorize an upgrade to a new implementation._ Copy function _authorizeUpgrade(address newImplementation) internal override onlyRole(GOV_ROLE); **Parameters** [PreviousBondToken](/contracts/bondtoken) [NextBalancerOracleAdapter](/contracts/balanceroracleadapter) Last updated 2 months ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) --- # PoolFactory | Plaza Finance ### [](#state-variables) State Variables #### [](#gov_role) GOV\_ROLE _Role identifier for governance accounts that can perform admin actions. Has the power to upgrade the implementation of the factory and its beacons._ Copy bytes32 public constant GOV_ROLE = keccak256("GOV_ROLE"); #### [](#pool_role) POOL\_ROLE _Role identifier for users that can interact with the factory to create new pools._ Copy bytes32 public constant POOL_ROLE = keccak256("POOL_ROLE"); #### [](#minter_role) MINTER\_ROLE _Role identifier for accounts that can mint tokens. Given to the pool contracts for their bond and leverage tokens._ Copy bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); #### [](#pools) pools _Array to store addresses of created pools_ Copy address[] public pools; #### [](#governance) governance _Address of the governance contract_ Copy address public governance; #### [](#oraclefeeds) oracleFeeds _Address of the OracleFeeds contract_ Copy address public oracleFeeds; #### [](#deployer) deployer _Instance of the Deployer contract_ Copy Deployer private deployer; #### [](#poolbeacon) poolBeacon _Address of the UpgradeableBeacon for Pool_ Copy address public poolBeacon; #### [](#bondbeacon) bondBeacon _Address of the UpgradeableBeacon for BondToken_ Copy address public bondBeacon; #### [](#leveragebeacon) leverageBeacon _Address of the UpgradeableBeacon for LeverageToken_ Copy address public leverageBeacon; #### [](#distributorbeacon) distributorBeacon _Address of the UpgradeableBeacon for Distributor_ Copy address public distributorBeacon; #### [](#distributors) distributors _Mapping to store distributor addresses for each pool_ Copy mapping(address => address) public distributors; ### [](#functions) Functions #### [](#constructor) constructor **Note:** oz-upgrades-unsafe-allow: constructor Copy constructor(); #### [](#initialize) initialize _Initializes the contract with the governance address and sets up roles. This function is called once during deployment or upgrading to initialize state variables._ Copy function initialize( address _governance, address _deployer, address _oracleFeeds, address _poolImplementation, address _bondImplementation, address _leverageImplementation, address _distributorImplementation ) public initializer; **Parameters** Name Type Description `_governance` `address` Address of the governance account that will have the GOV\_ROLE. `_deployer` `address` Address of the Deployer contract. `_oracleFeeds` `address` Address of the OracleFeeds contract. `_poolImplementation` `address` Address of the Pool implementation contract. `_bondImplementation` `address` Address of the BondToken implementation contract. `_leverageImplementation` `address` Address of the LeverageToken implementation contract. `_distributorImplementation` `address` Address of the Distributor implementation contract. #### [](#createpool) createPool _Creates a new pool with the given parameters_ Copy function createPool( PoolParams calldata params, uint256 reserveAmount, uint256 bondAmount, uint256 leverageAmount, string memory bondName, string memory bondSymbol, string memory leverageName, string memory leverageSymbol ) external whenNotPaused onlyRole(POOL_ROLE) returns (address); **Parameters** Name Type Description `params` `PoolParams` Struct containing pool parameters `reserveAmount` `uint256` Amount of reserve tokens to seed the pool `bondAmount` `uint256` Amount of bond tokens to mint `leverageAmount` `uint256` Amount of leverage tokens to mint `bondName` `string` `bondSymbol` `string` `leverageName` `string` `leverageSymbol` `string` **Returns** Name Type Description `` `address` Address of the newly created pool #### [](#poolslength) poolsLength _Returns the number of pools created._ Copy function poolsLength() external view returns (uint256); **Returns** Name Type Description `` `uint256` The length of the pools array. #### [](#grantrole) grantRole _Grants_ `_role_` _to_ `_account_`_. If_ `_account_` _had not been already granted_ `_role_`_, emits a {RoleGranted} event._ Copy function grantRole(bytes32 role, address account) public virtual override onlyRole(GOV_ROLE); **Parameters** Name Type Description `role` `bytes32` The role to grant `account` `address` The account to grant the role to #### [](#revokerole) revokeRole _Revokes_ `_role_` _from_ `_account_`_. If_ `_account_` _had been granted_ `_role_`_, emits a {RoleRevoked} event._ Copy function revokeRole(bytes32 role, address account) public virtual override onlyRole(GOV_ROLE); **Parameters** Name Type Description `role` `bytes32` The role to revoke `account` `address` The account to revoke the role from #### [](#pause) pause _Pauses contract. Reverts any interaction except upgrade._ Copy function pause() external onlyRole(GOV_ROLE); #### [](#unpause) unpause _Unpauses contract._ Copy function unpause() external onlyRole(GOV_ROLE); #### [](#authorizeupgrade) \_authorizeUpgrade _Authorizes an upgrade to a new implementation. Can only be called by the owner of the contract._ Copy function _authorizeUpgrade(address newImplementation) internal override onlyRole(GOV_ROLE); **Parameters** Name Type Description `newImplementation` `address` Address of the new implementation ### [](#events) Events #### [](#poolcreated) PoolCreated _Emitted when a new pool is created_ Copy event PoolCreated(address pool, uint256 reserveAmount, uint256 bondAmount, uint256 leverageAmount); **Parameters** Name Type Description `pool` `address` Address of the newly created pool `reserveAmount` `uint256` Amount of reserve tokens `bondAmount` `uint256` Amount of bond tokens `leverageAmount` `uint256` Amount of leverage tokens ### [](#errors) Errors #### [](#zerodebtamount) ZeroDebtAmount _Error thrown when bond amount is zero_ Copy error ZeroDebtAmount(); #### [](#zeroreserveamount) ZeroReserveAmount _Error thrown when reserve amount is zero_ Copy error ZeroReserveAmount(); #### [](#zeroleverageamount) ZeroLeverageAmount _Error thrown when leverage amount is zero_ Copy error ZeroLeverageAmount(); ### [](#structs) Structs #### [](#poolparams) PoolParams Copy struct PoolParams { uint256 fee; address reserveToken; address couponToken; uint256 distributionPeriod; uint256 sharesPerToken; address feeBeneficiary; } [PreviousPool](/contracts/pool) [NextDistributor](/contracts/distributor) Last updated 2 months ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) --- # Distributor | Plaza Finance ### [](#state-variables) State Variables #### [](#gov_role) GOV\_ROLE _Role identifier for accounts with governance privileges_ Copy bytes32 public constant GOV_ROLE = keccak256("GOV_ROLE"); #### [](#pool) pool _Pool address_ Copy Pool public pool; #### [](#couponamounttodistribute) couponAmountToDistribute _Coupon token total amount to be distributed_ Copy uint256 public couponAmountToDistribute; ### [](#functions) Functions #### [](#constructor) constructor **Note:** oz-upgrades-unsafe-allow: constructor Copy constructor(); #### [](#initialize) initialize _Initializes the contract with the governance address and sets up roles. This function is called once during deployment or upgrading to initialize state variables._ Copy function initialize(address _governance, address _pool) public initializer; **Parameters** Name Type Description `_governance` `address` Address of the governance account that will have the GOV\_ROLE. `_pool` `address` #### [](#claim) claim _Allows a user to claim their shares from a specific pool. Calculates the number of shares based on the user's bond token balance and the shares per token. Transfers the calculated shares to the user's address._ Copy function claim() external whenNotPaused nonReentrant; #### [](#allocate) allocate _Allocates shares to a pool._ Copy function allocate(uint256 _amountToDistribute) external whenNotPaused; **Parameters** Name Type Description `_amountToDistribute` `uint256` Amount of shares to allocate. #### [](#grantrole) grantRole \*Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: * the caller must have `role`'s admin role.\* Copy function grantRole(bytes32 role, address account) public virtual override onlyRole(GOV_ROLE); **Parameters** Name Type Description `role` `bytes32` The role to grant `account` `address` The account to grant the role to #### [](#revokerole) revokeRole \*Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: * the caller must have `role`'s admin role.\* Copy function revokeRole(bytes32 role, address account) public virtual override onlyRole(GOV_ROLE); **Parameters** Name Type Description `role` `bytes32` The role to revoke `account` `address` The account to revoke the role from #### [](#pause) pause \*Pauses all contract functions except for upgrades. Requirements: * the caller must have the `GOV_ROLE`.\* Copy function pause() external onlyRole(GOV_ROLE); #### [](#unpause) unpause \*Unpauses all contract functions. Requirements: * the caller must have the `GOV_ROLE`.\* Copy function unpause() external onlyRole(GOV_ROLE); ### [](#events) Events #### [](#claimedshares) ClaimedShares _Event emitted when a user claims their shares_ Copy event ClaimedShares(address user, uint256 period, uint256 shares); #### [](#poolregistered) PoolRegistered _Event emitted when a new pool is registered_ Copy event PoolRegistered(address pool, address couponToken); ### [](#errors) Errors #### [](#notenoughsharesbalance) NotEnoughSharesBalance _Error thrown when there are not enough shares in the contract's balance_ Copy error NotEnoughSharesBalance(); #### [](#unsupportedpool) UnsupportedPool _Error thrown when an unsupported pool is accessed_ Copy error UnsupportedPool(); #### [](#notenoughsharestodistribute) NotEnoughSharesToDistribute _Error thrown when there are not enough shares allocated to distribute_ Copy error NotEnoughSharesToDistribute(); #### [](#notenoughcouponbalance) NotEnoughCouponBalance _Error thrown when there are not enough coupon tokens in the contract's balance_ Copy error NotEnoughCouponBalance(); #### [](#poolalreadyregistered) PoolAlreadyRegistered _Error thrown when attempting to register an already registered pool_ Copy error PoolAlreadyRegistered(); #### [](#invalidpooladdress) InvalidPoolAddress _Error thrown when the pool has an invalid address_ Copy error InvalidPoolAddress(); #### [](#callerisnotpool) CallerIsNotPool _error thrown when the caller is not the pool_ Copy error CallerIsNotPool(); [PreviousPoolFactory](/contracts/poolfactory) [NextAuction](/contracts/auction) Last updated 2 months ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) --- # Auction | Plaza Finance ### [](#state-variables) State Variables #### [](#pool) pool _Pool contract associated with the auction_ Copy address public pool; #### [](#beneficiary) beneficiary _Auction beneficiary, usually the pool contract_ Copy address public beneficiary; #### [](#buycoupontoken) buyCouponToken _Auction buy coupon token_ Copy address public buyCouponToken; #### [](#sellreservetoken) sellReserveToken _Auction sell reserve token_ Copy address public sellReserveToken; #### [](#endtime) endTime _Auction end time_ Copy uint256 public endTime; #### [](#totalbuycouponamount) totalBuyCouponAmount _Total buy coupon amount_ Copy uint256 public totalBuyCouponAmount; #### [](#liquidationthreshold) liquidationThreshold _Liquidation threshold_ Copy uint256 public liquidationThreshold; #### [](#state) state _Auction state, either BIDDING, SUCCEEDED, FAILED\_UNDERSOLD, or FAILED\_LIQUIDATION_ Copy State public state; #### [](#bids) bids Mapping to store all bids by their index Copy mapping(uint256 => Bid) public bids; #### [](#bidcount) bidCount Total number of bids Copy uint256 public bidCount; #### [](#lastbidindex) lastBidIndex Index of the last bid Copy uint256 public lastBidIndex; #### [](#highestbidindex) highestBidIndex The index of the highest bid in the sorted list Copy uint256 public highestBidIndex; #### [](#maxbids) maxBids MaxBids Copy uint256 public maxBids; #### [](#lowestbidindex) lowestBidIndex Index of the lowest bid Copy uint256 public lowestBidIndex; #### [](#currentcouponamount) currentCouponAmount Aggregated buy amount (coupon) for the auction Copy uint256 public currentCouponAmount; #### [](#totalsellreserveamount) totalSellReserveAmount Aggregated sell amount (reserve) for the auction Copy uint256 public totalSellReserveAmount; ### [](#functions) Functions #### [](#constructor) constructor **Note:** oz-upgrades-unsafe-allow: constructor Copy constructor(); #### [](#initialize) initialize _Initializes the Auction contract._ Copy function initialize( address _buyCouponToken, address _sellReserveToken, uint256 _totalBuyCouponAmount, uint256 _endTime, uint256 _maxBids, address _beneficiary, uint256 _liquidationThreshold ) public initializer; **Parameters** Name Type Description `_buyCouponToken` `address` The address of the buy token (coupon). `_sellReserveToken` `address` The address of the sell token (reserve). `_totalBuyCouponAmount` `uint256` The total amount of buy tokens (coupon) for the auction. `_endTime` `uint256` The end time of the auction. `_maxBids` `uint256` The maximum number of bids allowed in the auction. `_beneficiary` `address` The address of the auction beneficiary. `_liquidationThreshold` `uint256` The percentage threshold for liquidation (e.g. 95000 = 95%). #### [](#bid) bid _Places a bid on a portion of the pool._ Copy function bid(uint256 buyReserveAmount, uint256 sellCouponAmount) external auctionActive returns (uint256); **Parameters** Name Type Description `buyReserveAmount` `uint256` The amount of buy tokens (reserve) to bid. `sellCouponAmount` `uint256` The amount of sell tokens (coupon) to bid. **Returns** Name Type Description `` `uint256` The index of the bid. #### [](#insertsortedbid) insertSortedBid _Inserts the bid into the linked list based on the price (buyAmount/sellAmount) in descending order, then by sellAmount._ Copy function insertSortedBid(uint256 newBidIndex) internal; **Parameters** Name Type Description `newBidIndex` `uint256` The index of the bid to insert. #### [](#removeexcessbids) removeExcessBids _Removes excess bids from the auction._ Copy function removeExcessBids() internal; #### [](#removebid) \_removeBid _Removes a bid from the linked list._ Copy function _removeBid(uint256 bidIndex) internal; **Parameters** Name Type Description `bidIndex` `uint256` The index of the bid to remove. #### [](#endauction) endAuction _Ends the auction and transfers the reserve to the auction._ Copy function endAuction() external auctionExpired; #### [](#claimbid) claimBid _Claims the tokens for a winning bid._ Copy function claimBid(uint256 bidIndex) external auctionExpired auctionSucceeded; **Parameters** Name Type Description `bidIndex` `uint256` The index of the bid to claim. #### [](#claimrefund) claimRefund _Claims a refund for a bid in a failed auction._ Copy function claimRefund(uint256 bidIndex) external auctionExpired auctionFailed; **Parameters** Name Type Description `bidIndex` `uint256` The index of the bid to claim a refund for. #### [](#slotsize) slotSize _Returns the size of a bid slot._ Copy function slotSize() internal view returns (uint256); **Returns** Name Type Description `` `uint256` uint256 The size of a bid slot. #### [](#auctionactive) auctionActive _Modifier to check if the auction is still active._ Copy modifier auctionActive(); #### [](#auctionexpired) auctionExpired _Modifier to check if the auction has expired._ Copy modifier auctionExpired(); #### [](#auctionsucceeded) auctionSucceeded _Modifier to check if the auction succeeded._ Copy modifier auctionSucceeded(); #### [](#auctionfailed) auctionFailed _Modifier to check if the auction has failed. This happens if the auction didn't succeed to generate enough coupon tokens or the amount of reserve tokens sold exceeds the allowed threshold._ Copy modifier auctionFailed(); #### [](#onlyrole) onlyRole _Modifier to check if the caller has the specified role._ Copy modifier onlyRole(bytes32 role); **Parameters** Name Type Description `role` `bytes32` The role to check for. #### [](#authorizeupgrade) \_authorizeUpgrade _Authorizes an upgrade to a new implementation. Can only be called by the owner of the contract._ Copy function _authorizeUpgrade(address newImplementation) internal override onlyRole(PoolFactory(Pool(pool).poolFactory()).GOV_ROLE()); **Parameters** Name Type Description `newImplementation` `address` Address of the new implementation ### [](#events) Events #### [](#auctionended) AuctionEnded _Auction ended event_ Copy event AuctionEnded(State state, uint256 totalSellReserveAmount, uint256 totalBuyCouponAmount); **Parameters** Name Type Description `state` `State` Auction state `totalSellReserveAmount` `uint256` Total sell reserve amount. The amount of reserve tokens sold by the protocol during the auction. `totalBuyCouponAmount` `uint256` Total buy coupon amount. The amount of coupon tokens bought by the protocol from the bidders during the auction. #### [](#bidrefundclaimed) BidRefundClaimed _Bid refund claimed event_ Copy event BidRefundClaimed(uint256 bidIndex, address indexed bidder, uint256 sellCouponAmount); **Parameters** Name Type Description `bidIndex` `uint256` Index of the bid `bidder` `address` Address of the bidder `sellCouponAmount` `uint256` Amount of bid coupon tokens refunded to the bidder #### [](#bidclaimed) BidClaimed _Bid claimed event_ Copy event BidClaimed(uint256 indexed bidIndex, address indexed bidder, uint256 sellCouponAmount); **Parameters** Name Type Description `bidIndex` `uint256` Index of the bid `bidder` `address` Address of the bidder `sellCouponAmount` `uint256` Amount of bid coupon tokens claimed by the bidder #### [](#bidplaced) BidPlaced _Bid placed event_ Copy event BidPlaced(uint256 indexed bidIndex, address indexed bidder, uint256 buyReserveAmount, uint256 sellCouponAmount); **Parameters** Name Type Description `bidIndex` `uint256` Index of the bid `bidder` `address` Address of the bidder `buyReserveAmount` `uint256` Amount of bid reserve tokens `sellCouponAmount` `uint256` Amount of bid coupon tokens #### [](#bidremoved) BidRemoved _Bid removed event_ Copy event BidRemoved(uint256 indexed bidIndex, address indexed bidder, uint256 buyReserveAmount, uint256 sellCouponAmount); **Parameters** Name Type Description `bidIndex` `uint256` Index of the bid `bidder` `address` Address of the bidder `buyReserveAmount` `uint256` Amount of bid reserve tokens `sellCouponAmount` `uint256` Amount of bid coupon tokens #### [](#bidreduced) BidReduced _Bid reduced event_ Copy event BidReduced(uint256 indexed bidIndex, address indexed bidder, uint256 buyReserveAmount, uint256 sellCouponAmount); **Parameters** Name Type Description `bidIndex` `uint256` Index of the bid `bidder` `address` Address of the bidder `buyReserveAmount` `uint256` Amount of bid reserve tokens `sellCouponAmount` `uint256` Amount of bid coupon tokens ### [](#errors) Errors #### [](#accessdenied) AccessDenied _Access denied error_ Copy error AccessDenied(); #### [](#auctionfailed-1) AuctionFailed _Auction failed error_ Copy error AuctionFailed(); #### [](#nothingtoclaim) NothingToClaim _Nothing to claim error_ Copy error NothingToClaim(); #### [](#alreadyclaimed) AlreadyClaimed _Already claimed error_ Copy error AlreadyClaimed(); #### [](#auctionhasended) AuctionHasEnded _Auction has ended error_ Copy error AuctionHasEnded(); #### [](#auctionnotended) AuctionNotEnded _Auction not ended error_ Copy error AuctionNotEnded(); #### [](#bidamounttoolow) BidAmountTooLow _Bid amount too low error_ Copy error BidAmountTooLow(); #### [](#invalidsellamount) InvalidSellAmount _Invalid sell amount error_ Copy error InvalidSellAmount(); #### [](#auctionstillongoing) AuctionStillOngoing _Auction still ongoing error_ Copy error AuctionStillOngoing(); #### [](#auctionalreadyended) AuctionAlreadyEnded _Auction already ended error_ Copy error AuctionAlreadyEnded(); ### [](#structs) Structs #### [](#bid-1) Bid _Bid struct_ Copy struct Bid { address bidder; uint256 buyReserveAmount; uint256 sellCouponAmount; uint256 nextBidIndex; uint256 prevBidIndex; bool claimed; } ### [](#enums) Enums #### [](#state-1) State _Auction state_ Copy enum State { BIDDING, SUCCEEDED, FAILED_UNDERSOLD, FAILED_LIQUIDATION } [PreviousDistributor](/contracts/distributor) [NextBondToken](/contracts/bondtoken) Last updated 2 months ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) --- # BondToken | Plaza Finance ### [](#state-variables) **State Variables** #### [](#globalpool) **globalPool** _The global asset pool_ Copy IndexedGlobalAssetPool public globalPool; #### [](#userassets) **userAssets** _Mapping of user addresses to their indexed assets_ Copy mapping(address => IndexedUserAssets) public userAssets; #### [](#minter_role) **MINTER\_ROLE** _Role identifier for accounts with minting privileges_ Copy bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); #### [](#gov_role) **GOV\_ROLE** _Role identifier for accounts with governance privileges_ Copy bytes32 public constant GOV_ROLE = keccak256("GOV_ROLE"); #### [](#distributor_role) **DISTRIBUTOR\_ROLE** _Role identifier for the distributor_ Copy bytes32 public constant DISTRIBUTOR_ROLE = keccak256("DISTRIBUTOR_ROLE"); #### [](#shares_decimals) **SHARES\_DECIMALS** _The number of decimals for shares_ Copy uint8 public constant SHARES_DECIMALS = 6; ### [](#functions) **Functions** #### [](#constructor) **constructor** **Note:** constructor Copy constructor(); #### [](#initialize) **initialize** _Initializes the contract with a name, symbol, minter, governance address, distributor, and initial shares per token._ Copy function initialize( string memory name, string memory symbol, address minter, address governance, uint256 sharesPerToken ) public initializer; **Parameters** Name Type Description `name` `string` The name of the token `symbol` `string` The symbol of the token `minter` `address` The address that will have minting privileges `governance` `address` The address that will have governance privileges `sharesPerToken` `uint256` The initial number of shares per token #### [](#mint) **mint** Can only be called by addresses with the MINTER\_ROLE. _Mints new tokens to the specified address._ Copy function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE); **Parameters** Name Type Description `to` `address` The address that will receive the minted tokens `amount` `uint256` The amount of tokens to mint #### [](#burn) **burn** Can only be called by addresses with the MINTER\_ROLE. _Burns tokens from the specified account._ Copy function burn(address account, uint256 amount) public onlyRole(MINTER_ROLE); **Parameters** Name Type Description `account` `address` The account from which tokens will be burned `amount` `uint256` The amount of tokens to burn #### [](#getpreviouspoolamounts) **getPreviousPoolAmounts** _Returns the previous pool amounts from the global pool._ Copy function getPreviousPoolAmounts() external view returns (PoolAmount[] memory); **Returns** Name Type Description `` `PoolAmount[]` An array of PoolAmount structs representing the previous pool amounts #### [](#update) **\_update** This function is called during token transfer and is paused when the contract is paused. _Internal function to update user assets after a transfer._ Copy function _update(address from, address to, uint256 amount) internal virtual override whenNotPaused; **Parameters** Name Type Description `from` `address` The address tokens are transferred from `to` `address` The address tokens are transferred to `amount` `uint256` The amount of tokens transferred #### [](#updateindexeduserassets) **updateIndexedUserAssets** This function updates the number of shares held by the user based on the current period. _Updates the indexed user assets for a specific user._ Copy function updateIndexedUserAssets(address user, uint256 balance) internal; **Parameters** Name Type Description `user` `address` The address of the user `balance` `uint256` The current balance of the user #### [](#getindexeduseramount) **getIndexedUserAmount** This function calculates the number of shares based on the current period and the previous pool amounts. _Returns the indexed amount of shares for a specific user._ Copy function getIndexedUserAmount(address user, uint256 balance, uint256 period) public view returns (uint256); **Parameters** Name Type Description `user` `address` The address of the user `balance` `uint256` The current balance of the user `period` `uint256` The period to calculate the shares for **Returns** Name Type Description `` `uint256` The indexed amount of shares for the user #### [](#resetindexeduserassets) **resetIndexedUserAssets** This function resets the last updated period and indexed amount of shares to zero. Can only be called by addresses with the DISTRIBUTOR\_ROLE and when the contract is not paused. _Resets the indexed user assets for a specific user._ Copy function resetIndexedUserAssets(address user) external onlyRole(DISTRIBUTOR_ROLE) whenNotPaused; **Parameters** Name Type Description `user` `address` The address of the user #### [](#increaseindexedassetperiod) **increaseIndexedAssetPeriod** Can only be called by addresses with the GOV\_ROLE and when the contract is not paused. _Increases the current period and updates the shares per token._ Copy function increaseIndexedAssetPeriod(uint256 sharesPerToken) public onlyRole(DISTRIBUTOR_ROLE) whenNotPaused; **Parameters** Name Type Description `sharesPerToken` `uint256` The new number of shares per token #### [](#grantrole) **grantRole** Can only be called by addresses with the GOV\_ROLE. _Grants a role to an account._ Copy function grantRole(bytes32 role, address account) public virtual override onlyRole(GOV_ROLE); **Parameters** Name Type Description `role` `bytes32` The role to grant `account` `address` The account to grant the role to #### [](#revokerole) **revokeRole** Can only be called by addresses with the GOV\_ROLE. _Revokes a role from an account._ Copy function revokeRole(bytes32 role, address account) public virtual override onlyRole(GOV_ROLE); **Parameters** Name Type Description `role` `bytes32` The role to revoke `account` `address` The account to revoke the role from #### [](#pause) **pause** Can only be called by addresses with the GOV\_ROLE. _Pauses all contract functions except for upgrades._ Copy function pause() external onlyRole(GOV_ROLE); #### [](#unpause) **unpause** Can only be called by addresses with the GOV\_ROLE. _Unpauses all contract functions._ Copy function unpause() external onlyRole(GOV_ROLE); #### [](#authorizeupgrade) **\_authorizeUpgrade** Can only be called by addresses with the GOV\_ROLE. _Function that should revert when_ `_msg.sender_` _is not authorized to upgrade the contract. Called by {upgradeTo} and {upgradeToAndCall}._ Copy function _authorizeUpgrade(address newImplementation) internal override onlyRole(GOV_ROLE); **Parameters** Name Type Description `newImplementation` `address` Address of the new implementation contract ### [](#events) **Events** #### [](#increasedassetperiod) **IncreasedAssetPeriod** _Emitted when the asset period is increased_ Copy event IncreasedAssetPeriod(uint256 currentPeriod, uint256 sharesPerToken); #### [](#updateduserassets) **UpdatedUserAssets** _Emitted when a user's assets are updated_ Copy event UpdatedUserAssets(address user, uint256 lastUpdatedPeriod, uint256 indexedAmountShares); ### [](#structs) **Structs** #### [](#poolamount) **PoolAmount** _Struct to represent a pool's outstanding shares and shares per bond at a specific period_ Copy struct PoolAmount { uint256 period; uint256 amount; uint256 sharesPerToken; } **Properties** Name Type Description `period` `uint256` The period of the pool amount `amount` `uint256` The total amount in the pool `sharesPerToken` `uint256` The number of shares per token (base 10000) #### [](#indexedglobalassetpool) **IndexedGlobalAssetPool** _Struct to represent the global asset pool, including the current period, shares per token, and previous pool amounts._ Copy struct IndexedGlobalAssetPool { uint256 currentPeriod; uint256 sharesPerToken; PoolAmount[] previousPoolAmounts; } **Properties** Name Type Description `currentPeriod` `uint256` The current period of the global pool `sharesPerToken` `uint256` The current number of shares per token (base 10000) `previousPoolAmounts` `PoolAmount[]` An array of previous pool amounts #### [](#indexeduserassets) **IndexedUserAssets** _Struct to represent a user's indexed assets, which are the user's shares_ Copy struct IndexedUserAssets { uint256 lastUpdatedPeriod; uint256 indexedAmountShares; } **Properties** Name Type Description `lastUpdatedPeriod` `uint256` The last period when the user's assets were updated `indexedAmountShares` `uint256` The user's indexed amount of shares [PreviousAuction](/contracts/auction) [NextLeverageToken](/contracts/leveragetoken) Last updated 2 months ago ![Page cover image](https://docs.plaza.finance/~gitbook/image?url=https%3A%2F%2F26399151-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FhFwp3ECGFzu44LoG4pcB%252Fuploads%252FHFAiWjSnk40cE4QMnKIJ%252FKey%2520Visual%25201-1.jpg%3Falt%3Dmedia%26token%3Dbc2ea8ed-e304-4841-befc-9b70522ac67c&width=1248&dpr=4&quality=100&sign=45167838&sv=2) ---