In this series of posts, I will walk you through the Notional V2 smart contracts. The goal of these posts is to help technically minded users and developers better understand a large and complex codebase (~12,000+ lines of Solidity!). In this post we will discuss how Notional V2 was designed with market makers in mind. We distinguish market makers from liquidity providers in that market makers are more active participants in the Notional V2 ecosystem. Market makers actively trade fCash in addition to providing liquidity to fCash markets.
This post is not aimed at explaining how to make markets in Notional V2 but will give an overview of the tools available to market makers.
fCash that is not actively tradable in fCash markets is called idiosyncratic fCash (ifCash for short). fCash assets lent or borrowed at the 1 year tenor become ifCash for 3 months between the 1 year fCash market settlement (at 9 months to maturity) and the 6 month fCash market.
As Notional V2 launches longer term fCash markets, trading ifCash between those markets will be an important role for market makers to allow users to get liquidity on ifCash assets that are not tradable in fCash markets. Market makers who trade in ifCash will need to handle more fCash assets than a normal user and therefore require a more gas efficient portfolio type.
Bitmap Portfolios are described in detail in Appendix B of the whitepaper. Rather than rehash all the math there, this section will just give some references to the implementation.
- Bitmap Portfolios must first be enabled as an account action. Bitmap currencies can only be changed if the account has no debt and no assets.
- The date math described in Appendix B of the whitepaper is implemented in DateTime.sol.
- Adding and removing fCash is handled by the BitmapAssetsHandler.sol
- TransferAssets.sol is used as an abstraction layer when fCash assets are transferred between accounts. It will call the correct methods depending on each account's portfolio type.
- Settlement of bitmap portfolios is implemented in SettleBitmapAssets.sol.
- Cash balances and nToken balances work the same way regardless of portfolio type.
For the most part, users do not need to change any method calls before and after enabling a bitmap portfolio. The only restriction is that once a bitmap portfolio is enabled, that account can only hold fCash assets in the bitmap currency. The limit on fCash assets a bitmap portfolio can hold is
MAX_BITMAP_ASSETS. This limit is applied simply to limit the gas costs of doing a free collateral check on the portfolio and may be increased in the future via a protocol upgrade.
ERC1155 Transfers and OTC Trading
Over the counter (OTC) trading refers to trading of ifCash assets outside of on chain fCash markets. OTC trading is enabled via the ERC1155Action.sol contract using
Since Notional V2 guarantees that every positive fCash asset has an equal offsetting negative fCash asset, an fCash pair can be created via transfer. A transfer of 100 fCash from Alice to Bob will result in -100 fCash in Alice's account and +100 fCash in Bob's account. If Alice has no fCash in her account, she will incur a debt of -100 fCash and require a free collateral check. Bob's account does not require a free collateral check regardless of his debt status because we know it will necessarily increase. The net effect of this transfer is one leg of the OTC trade. The other leg of the trade would be to transfer cash tokens (i.e. DAI or cDAI) from Bob (the lender) to Alice (the borrower). This transfer will be handled outside of Notional V2 by an off chain orderbook protocol like 0x RFQ. Notional governors can whitelist trusted protocols as a
globalTransferOperator to automatically approve them for all users.
Market makers can also engage with Notional V2 to service end user ifCash demand. For example, if a user wants to borrow with a specific maturity in mind that there is no fCash market for, a market maker can step in and quote that user a rate. The market maker would borrow from an active Notional V2 fCash market and lend to the idiosyncratic date that the user wants to borrow from. The market maker will be left with a negative fCash asset and a positive ifCash asset. Since the Notional V2 valuation curve allows all fCash and ifCash assets to act as collateral, this can be quite capital efficient and profitable for the market maker.
In order to allow market makers to complete this in a single transaction, the ERC1155Action contract allows market makers to specify a trading action using the
data field in the
Although the first wave of Notional V2 adoption will likely come via on chain trading in fCash markets, we believe that ifCash will enable Notional V2 to serve a much broader market. Many users have specific needs to lend or borrow to specific dates and Notional V2's ability to enable market makers to serve that demand in a capital efficient manner gives the protocol room for future growth. I believe that the most exciting Notional V2 integrations will come from building on top of these advanced trading features to serve demand for ifCash.
Notional Finance Newsletter
Join the newsletter to receive the latest updates in your inbox.