Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notional Finance #6

Open
Richa-iitr opened this issue Jun 6, 2022 · 7 comments
Open

Notional Finance #6

Richa-iitr opened this issue Jun 6, 2022 · 7 comments

Comments

@Richa-iitr
Copy link
Owner

Richa-iitr commented Jun 6, 2022

nTokens

  • nTokens are ERC-20 tokens that enable users to provide liquidity across all active maturities without interacting with specific liquidity pools tied to a particular maturity. This means that the LP can make a single deposit into one liquidity pool using cTokens which distributes liquidity across underlying pools and the LP with nTokens.
  • holders of nTokens earn interests in 3ways:
    • blended rate of interest earned from cTokens and fCash held by nToken account. This rate will sit somewhere between the fCash interest rate and cToken supply rate. borrowing drives up interest rates, the nToken accounts receive fCash while cToken are deposited. The opposite holds true for falling interest rates and greater demand to lend.
    • nToken owners can earn a return through traditional liquidity fees which may be offset by impermanent loss. Potential for nTokens to achieve impermanent loss is low given stable exchange rates of fCash.
    • Third, is the accrual of NOTE tokens, Notional’s governance token, which are awarded proportional to the total share of nTokens in a specific currency.
  • Lending and borrowing on Notional is facilitated by liquidity providers who hold nTokens.
  • When redeeming nTokens, fCash will be sold on the market to convert it back to cash. There are slippage costs associated with this that may make it impossible to redeem nTokens as cash.
  • method called nTokenRedeem that allows accounts to manually redeem nTokens without selling fCash. nTokens will always be redeemable via this second method.
  • nTokens are automatically listed as collateral inside Notional.
  • an account can borrow ETH against nETH and then use that ETH to mint additional nETH. This is called providing liquidity on leverage, and the maximum amount of leverage allowed is determined by the nToken PV Haircut percentage.
  • NOTE incentives for a particular currency are automatically claimed and transferred whenever an nToken balance is changed (minted or redeemed), manually - nTokenClaimIncentives.
@Richa-iitr
Copy link
Owner Author

Account Assets

  • currency: an asset cash token (interest bearing yield token, like a cToken or aToken) and an underlying token (such as DAI, USDC, etc).
    • wrapping to nToken (non-maturing)--> even higher yield(from trading fees on fCash, NOTE incentives).
  • fCash --> fixed amount of underlying after maturity. after maturity fCash deleted from portfolio. settled to asset cash which continues to earn variable yield. settlement automatically after every transaction.
  • array portfolios are limited to a maximum of 7 fCash assets in multiple currencies --> due to gas costs.
  • bitmap portfolios limit of 20 fcash assets.
  • if account ahs negative cash or cash, debts require a free collateral check.

@Richa-iitr
Copy link
Owner Author

Richa-iitr commented Jun 7, 2022

  • fCash is denominated in any of the base tokens, but settled in a separate base cToken.
  • Positive fCash tokens are for lenders who can redeem currency at a future point, while negative tokens represent future obligations to the lender.
  • Redemption of fCash at loan maturity is made with an equivalent token value of the cToken, not the underlying token.
  • Liquidity providers deposit cTokens into pools to enhance their returns as they receive both the cToken lending rate and LP fees
  • cToken balances also accrue interest in the underlying cryptoasset which circumvents the need to roll loans forward.

@Richa-iitr
Copy link
Owner Author

Richa-iitr commented Jun 7, 2022

Liquidity Provider Perspective

  • capitalize liquidity pools with cTokens to act as the counterparty to all other lenders and borrowers.
  • earn rewards and liquidity fees.
  • If an LP wants to provide 100 DAI worth of tokens into a pool in V2, they will do so through their nToken account.
  • The LP will first mint a pair of fDAI tokens ( the positive and negative cash flows) into their nToken account.
  • Through the nToken account, they then deposit their cDAI (worth exactly 100 DAI) and positive fDAI into the pool.
  • In exchange, the LP receives liquidity tokens representing their proportional contribution to the pool.
  • The LP now holds these liquidity tokens, as well as the negative fDAI minted in the original pair.
  • At any time, the LP can exchange their liquidity tokens for the offsetting positive fDAI and 100 DAI worth of cDAI.

@Richa-iitr
Copy link
Owner Author

Richa-iitr commented Jun 7, 2022

Lender Perspective:

  • a lender looking to lend out 100 DAI
  • will convert the100 DAI into cDAI and then deposit it into a select pool.
  • they will receive fDAI to be redeemed at a future maturity date.
  • The fDAI exchanged will be greater than the original cDAI deposited. This represents the fixed exchange rate received by the lender.
  • The lender is only eligible to cash in their fDAI once the maturity date is reached.

lender ------------ -100 DAI (cDai) ----------------------------> liquidity pool
lender <---------- +105 date dai ----------------------lp

// maturity date
lender ------------ -105 date dai ----------------------> notional
lender <---------- 105 DAI ------------------------------------- notional

@Richa-iitr
Copy link
Owner Author

Borrower's perspective

  • The borrower first mints collateral into their portfolio (say 1 ETH).
  • then once again mints fDAI tokens at their selected maturity.
  • This time, however, the borrower sells the positive fDAI in exchange for 100 DAI worth of cDAI.
  • the borrower must repay their future obligation by the maturity date which has a fixed rate represented by the difference between the fDAI to be repaid and cDAI received.
  • If the borrower fails to maintain adequate collateral due to market fluctuations, Notional may take some or all of the collateral.
  • Should the borrower not want to repay the loan, they may elect to roll it forward to a future maturity.
  • A third-party can also roll it forward on their behalf with an additional penalty interest rate.

@Richa-iitr
Copy link
Owner Author

fCash

  • fCash in one maturity (i.e. due to mature at timestamp 100) is fungible with other fCash tokens with the same maturity.
  • Also note that the entitlement to receive fCash (CASH_RECEIVER) is freely transferrable but the obligation to pay (CASH_PAYER) is not.
  • fCash tokens are not strictly ERC20 tokens because fCash tokens at different maturities are not fungible with each other. fCash tokens can be represented under the ERC1155 token standard which allows for interoperability.

Current cash

  • Notional uses an internal accounting concept called current cash to represent deposits and matured cash flows.
  • Since cash flows may be positive (CASH_RECEIVER) or negative (CASH_PAYER), current cash is represented as a signed integer (i.e. positive or negative).
  • When a fCash token matures, its positive or negative value is added to the account's total current cash balance.

Maturities

  • G_MATURITY_LENGTH defines how long each periodic maturity will last in seconds.
  • G_NUM_MATURITIES defines how many of these maturities will be traded in the future.
  • if G_MATURITY_LENGTH = 1000 and G_NUM_MATURITIES = 4 and we are starting at time 0, there will be maturities at timestamps 1000, 2000, 3000, 4000
  • Each one of these maturities will have a pool of fCash tokens that can be bought and sold.

@Richa-iitr
Copy link
Owner Author

  • Liquidity providers can provide liquidity to a market at a specfied maturity by calling the addLiquidity and removeLiquidity functions. When a liquidity provider adds liquidity, they deposit Dai and fCash at the prevailing exchange rate to both sides of the market. The provider submits the amount of fCash to add and the corresponding amount of Dai is calculated using the current exchange rate.

Repository owner deleted a comment from MohaiminulEraj Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@Richa-iitr and others