🎊Contract Integration

Find out how to start working with FluidNFT smart contracts.

Modules​

The FluidNFT protocol is a collection of smart contracts connected via a modular system. Each module handles a specific aspect of the protocol. Depending on your use case you may need to interact with several different contract addresses.

Some modules are global, for example:

  • ExecutionDelegate: Grant ERC20, ERC721 & ERC1155 token access across the protocol

  • ExecutionManager: Batch requests to save on gas

  • LendingPool: Execute peer-to-pool transactions

  • Lending: Execute peer-to-peer transactions

Some modules are asset-specific, for example:

  • fTokens: Incentivised ERC-20 tokens that represent assets

  • stableDebtTokens: Incentivised ERC-20 tokens that represent stable interest rate liabilities

  • variablDebtTokens: Incentivised ERC-20 tokens representing variable interest rate liabilities

Execution​

As it may be beneficial to batch requests to save on gas all modules can be called using the optional ExecutionManager.

Example of depositing into a lending pool with the execution manager:

// Use the lending pool module:
ILendingPool lendingPool = ILendingPool(LENDING_POOL);

// Deposit asset tokens into a pool
lendingPool.deposit(amount, reserveId, onBehalfOf, referralCode);

Without the execution manager:

Note the ExecutionManager supports both .call() and .multiCall() functionality, for batch execution.

The remainder of this document details how to integrate without the execution module, for the sake of brevity.

P2Pool​

Core peer-to-pool operations.

Deposit and withdraw​

In order to earn passive yield, you need to deposit into a lending pool.

Use the fToken reserve to check balances.

You can withdraw at anytime to retrieve your funds.

Borrow and repay​

To borrow an asset, you must supply collateral to be held in escrow for the duration of the loan.

Use the debtToken reserve to check debt balances.

You can repay at anytime to retrieve your collateral.

Liquidate​

If a loan is no longer sufficiently overcollateralised, i.e. when the amount of outstanding debt exceeds the maximum loan-to-value, it can be liquidated.

The price is determined via a proprietary dynamic-Dutch auction mechanic that results in a high liquidation price when the loan is a little undercollateralised, that decays exponentially as the loan becomes more and more undercollateralised.

The liquidation price is further dependent on the asset being used to purchase the underlying collateral, with smaller and larger discounts available for their reserve's fTokens and stakedToken, respectively.

Last updated