What Is DeFiPie (PIE)?
The DeFiPie protocol is a series of interest rate pools running on a variety of blockchains. When users and applications deposit their assets to the DeFIPIE Protocol, they begin earning a variable interest rate instantly. Interest accrues every block (for Ethereum ~13 seconds, for Binance Smart Chain ~3 seconds), and users can withdraw their principal plus interest anytime. On the other hand, users can borrow tokens from the pool by paying an interest rate to all pool lenders
When users deposit assets, they receive pTokens from DeFiPIE in exchange. pTokens are ERC20 tokens that can be redeemed for their underlying assets at any time. As interest accrues to the assets deposited, pTokens are redeemable at an exchange rate (relative to the underlying asset) that constantly increases over time, based on the rate of interest earned by the underlying asset.
DeFiPie Storage Key Points
Coin Basic | Information |
---|---|
Coin Name | DeFiPie |
Short Name | PIE |
Circulating Supply | N/A |
Total Supply | 220,000,000 |
Source Code | Click Here To View Source Code |
Explorers | Click Here To View Explorers |
Twitter Page | Click Here To Visit Twitter Group |
Whitepaper | Click Here To View |
Support | 24/7 |
Official Project Website | Click Here To Visit Project Website |
Protocol Math
The DeFiPie protocol contracts use a system of exponential math, Exponential.sol, in order to represent fractional quantities with sufficient precision. Most numbers are represented as a mantissa, an unsigned integer scaled in order to perform basic math at a high level of precision.
pToken and Underlying Decimals
Prices and exchange rates are scaled by the decimals unique to each asset; pTokens are ERC-20 tokens with 8 decimals In most cases (there are several pTokens exceptions in Ethereum network with 18 decimals), while their underlying tokens vary, and have a public member named decimals.
Calculating Accrued Interest
Interest rates for each pool update on any block in which the ratio of borrowed assets to deposited assets in the pool has changed. The amount interest rates are changed depends on the interest rate model smart contract implemented for the pool, and the amount of change in the ratio of borrowed assets to deposited assets in the pool. Interest accrues to all lenders and borrowers in a pool when any Ethereum address interacts with the pool’s pToken contract, calling one of these functions mint, redeem, borrow, or repay.
Successful execution of one of these functions triggers the accrue Interest method, which causes interest to be added to the underlying balance of every lender and borrower in the pool. Interest accrues for the current block, as well as each prior block in which the accrue Interest method was not triggered (no user interacted with the pToken contract). Interest compounds only during blocks in which the pToken contract has one of the aforementioned methods invoked.
How do pTokens earn interest?
Each pool has its own Deposit interest rate (APR). Interest isn’t distributed; instead, simply by holding pTokens, you’ll earn interest. DeFiPie accumulates interest through their exchange rate — over time, each pToken becomes convertible into an increasing amount of it’s underlying asset, even while the number of pTokens in your wallet stays the same.
Do I need to calculate the pToken exchange rate?
When a pool is launched, the DeFiPie exchange rate (how much ETH one cETH is worth) begins at 0.020000 — and increases at a rate equal to the compounding pool interest rate. For example, after one year, the exchange rate might equal 0.021591. Each user has the same pToken exchange rate; there’s nothing unique to your wallet that you have to worry about.
How do I view my pTokens?
Each pToken is visible on Etherscan, and you should be able to view them in the list of tokens associated with your address. You can add pToken by its address in any wallet (Metamask, Trust Wallet etc.) as a simple ERC-20 token. Yes, but exercise caution! By transferring pTokens, you’re transferring your balance of the underlying asset inside the DeFiPie protocol. If you send a pToken to your friend, your balance will decline, and your friend will see their balance increase. A pToken transfer will fail if the account has entered that pToken pool and the transfer would have put the account into a state of negative liquidity.
Mint
The mint function transfers an asset into the protocol, which begins accumulating interest based on the current Supply Rate for the asset. The user receives a quantity of pTokens equal to the underlying tokens deposited, divided by the current Exchange Rate.
Redeem
The redeem function converts a specified quantity of DeFiPie into the underlying asset, and returns them to the user. The amount of underlying tokens received is equal to the quantity of pTokens redeemed, multiplied by the current Exchange Rate. The amount redeemed must be less than the user’s Account Liquidity and the pool’s available liquidity.