Architecture
FluidNFT is at its core a hybrid peer-to-peer and peer-to-pool NFT liquidity protocol. On top of this there an exists an objectives-first mechanism design built to align incentives across different actors to optimize for capital efficient borrowing & lending while mitigating the risks of bad debt accrual and contagion.
System Diagram
Mechanism Design
Permissionless Access
FluidNFT is a permissionless NFTxDeFi protocol designed to democratise access to NFT liquidity. Users can instantiate a pool with any approved collateral-asset pair or agree loan terms directly. With any new collaterals and assets to be approved by governance. Note that while pools are by default permissionless, additional token-gated pools can also be created.
Isolation Pools
Isolation pools are used to protect against risk contagion from one collateral or asset effecting lender funds in other pools. These are lending pools that restrict reserves to one single collateral-asset pair and are fundamental to our risk model and protocol design.
Stability Pools
Stability pools are used to tranche risks and offer senior tranche lenders protection against bad debt accrual. Stability pool stakers are rewarded for providing this protection with the downside being a partial slash of their staked funds (up to 30%) to resolve any bad debt should the situation arise.
P2Pool Reserves
A proportion of all P2Pool loan repayments go to the respective pool's reserve. The allocation amount is set by the pool's Reserve Factor which depends on the volatility of the reserve's underlying collateral-asset pair and acts as a "buyer of last resort" to protect lender funds in the case of a Black Swan event.
P2Peer Yield-Earning Loan Offers
FluidNFT allows F-Tokens to be used in making loan offers on behalf of the underlying asset. This enables lenders to optimize for capital efficiency; to earn passive yield across lending pools while making peer-to-peer loan offers as part of an active lending strategy utilizing the same capital.
Tokenized Incentives
FluidNFT's native governance token $FLUID is used to further align incentives, to promote the healthy utilization of the protocol. Rewarded behaviours include capital efficient borrowing, lending, and the staking of funds in stability pools.
Governance-Controlled Incentive Distributions
FluidNFT uses a gauge system to allow $FLUID holders to vote on the proportion of tokens distributed across the pools this epoch. This rewards loyal users with more control over protocol governance.
Modules
Lending
TODO
Lending Pool
This module exposes all P2Pool user interaction endpoints.
deposit
: to deposit assets within a lendng poolwithdraw
: to withdraw assets from a lending poolborrow
: to borrow assets using NFTs as collateralrepay
: to repay assets to retrieve NFT collateralliquidate
: to purchase the underlying collateral of a defaulted borrow
Note that batch functionality is also possible.
batchDeposit
: to batch multiple deposits across poolsbatchWithdraw
: to batch multiple withdraws across poolsbatchBorrow
: to batch multiple borrows across poolsbatchRepay
: to batch multiple repays across poolsbatchLiquidate
: to batch multiple liquidates
Collateral Manager
This module handles the decentralised escrow of collateral for both P2Pool and P2Peer loans.
Libraries
TODO
F-Tokens
F-Tokens are incentivized, interest-bearing derivative tokens that are minted and burned upon the deposit
and withdraw
of asset tokens to / from the Lending Pool in a 1:1 ratio.
F-Token contracts are used to silo funds for a given pool. E.g. DAI supplied to the World of Women DAI pool will be held within the fWOWDAI contract and liquidity will only be available to users borrowing against the World of Women NFT collection.
Debt-Tokens
Debt-Tokens are incentivized, non-transferable derivative tokens that are minted and burned upon the borrow
and repay
of asset token loans from / to the Lending Pool in a 1:1 ratio.
Note that it is the ratio of debtTokens
to fTokens
, updated every user interaction, that is used to calculate the interest generated by the pool.
Staked-Tokens
Staked-Tokens are incentivized, derivate tokens that are minted and burned upon the stake
and redeem
of F-Tokens to / from the Staked Token contract, a.k.a. the Stability Pool, in a 1:1 ratio.
Note that stakedTokens
must undergo a coolDown
period before they can be redeemed, and that while they are staked governance may vote to slash
each user's staked tokens by up to 30% to voer any bad debt held within the associated lending pool.
Promissory Notes
Promissory Notes are smart redeemable NFTs that grant the holder rights to the interest repayment of a P2Peer loan or the underlying collateral in the case of foreclosure. These can be freely held, sold or transferred.
Obligation Receipts
Obligation Receipts are smart redeemable NFTs that grant the holder rights to the underlying collateral of a P2Peer or P2Pool loan once its associated debt balance has been repaid. These can be freely held, sold or transferred.
Trust-Minimized NFT Price Oracle
FluidNFT uses a trust-minimized oracle solution for its NFT prices. This is an extension of the Trust-us project from Zefram Lou that could best be characterized as "Verify-us"; by adding a price update verification window to resolve any potential price manipulation or erroneous anomoly coming from the oracle data feed.
Components of the NFT Price Oracle System:
- Server: to fetch the required off-chain data
- Keeper: to periodically call the server and update the Smart Contract
- Smart Contract: to verify and store off-chain data on-chain
Workflow to update the NFT Price Oracle:
- The keeper makes a request to the server to fetch the desired off-chain data.
- The server returns the data packet as well as a signature signed using the server's public key, which should already registered as trusted by the smart contract.
- The keeper calls the smart contract, providing the data packet & signature as input.
- The smart contract verifies & consumes the data packet, and uses the off-chain data during the call.
Asset Price Feed
FluidNFT currently uses Chainlink PriceConsumerV3
as a dependency for its asset price feed data. This may be updated to use Uniswap TWAPs in a future iteration to remove this relatively centralized dependency.
Configurator
The Configurator module includes all admin and emergency admin interaction endpoints.
batchApproveCollateral
: approves collaterals to be used within the protocolbatchApproveAsset
: approves assets to be used within the protocolbatchApproveExecutionDelegate
: approves execution delegates within the protocolbatchConfigReserve
: configures pool reservesbatchConfigReserveCollateral
: configures collateralbatchConfigReserveAuction
: configures reserve auctionssetActiveFlagOnReserve
: flags pool reserves as active / inactivesetBorrowingFlagOnReserve
: flags pool reserve borrowing as active / inactivesetFreezeFlagOnReserve
: flags a pool reserve freezes as active / inactivesetReserveFactor
: sets the proportion of interest allocated to a given pool's reservesetLendingFactor
: sets the proportion of P2Peer interest allocated to the treasurysetInterestRateStrategy
: sets the interest rate strategy for a given reservesetDiscountBoosters
: sets the liquidation price discounts for payments in F-Tokens and Staked-TokenssetReserveMaxSupply
: sets the collaterals that can be supplied within a given poolsetMaxNumberOfReserves
: sets the maximum number of reserves that can be createdsetPoolPause
: pauses / unpauses a poolsetPoolPauseTime
: sets the pool pause timeupdateFToken
: updates the F-Token implementation contractupdateDebtToken
: updates the Debt-Token implementation contractupdateStakedToken
: updates the Staked-Token implementation contract