LendPool

The LendPool contract is the main contract of the protocol. It exposes all the user-oriented actions that can be invoked using either Solidity or web3 libraries.

If you need development support, join the #developers channel on the Bend community Discord server.

LendPool methods deposit, borrow, withdraw and repay are only for ERC20 and ERC721, if you want to deposit, withdraw, borrow or repay using native ETH use WETHGateway instead, and if you want to borrow or repay using CryptoPunks as collaterals use PunkGateway.

Methods

deposit

function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode)

Deposits an amount of underlying asset into the reserve, receiving in return overlying bTokens. E.g. User deposits 100 USDC and gets in return 100 bUSDC.

withdraw

function withdraw( address asset, uint256 amount, address to )

Withdraws an amount of underlying asset from the reserve, burning the equivalent bTokens owned.

borrow

function borrow( address asset, uint256 amount, address nftAsset, uint256 nftTokenId, address onBehalfOf, uint16 referralCode )

Allows users to borrow a specific amount of the reserve underlying asset. E.g. User borrows 100 USDC, receiving the 100 USDC in his wallet and lock collateral asset in contract.

repay

function repay( address nftAsset, uint256 nftTokenId, uint256 amount )

Repays a borrowed amount on a specific reserve, burning the equivalent loan owned. E.g. User repays 100 USDC, burning loan and receives collateral asset.

Return Values

auction

function auction( address nftAsset, uint256 nftTokenId, uint256 bidPrice, address onBehalfOf )

Function to auction a non-healthy position collateral-wise. The caller (liquidator) want to buy collateral asset of the user getting liquidated. Auction mechanism in Bend is English Auction, the highest bidder will be the winner.

redeem

function redeem(address nftAsset, uint256 nftTokenId, uint256 bidFine)

Function to redeem a non-healthy NFT loan which state is in Auction. The caller must be borrower of loan. The borrower can redeem his own things before the redemption time expires.

Return Values

liquidate

function liquidate( address nftAsset, uint256 nftTokenId, address onBehalfOf )

Function to liquidate a non-healthy NFT loan which state is in Auction. The caller (liquidator) buy collateral asset of the user getting liquidated, and receives the collateral asset.

Return Values

View Methods

getReservesList

function getReservesList()

Returns the underlying address list of the initialized reserves.

getReserveData

function getReserveData(address asset)

Returns the state and configuration of the reserve.

Return Values

getReserveConfiguration

function getReserveConfiguration(address asset)

Returns the configuration of the reserve.

getReserveNormalizedIncome

function getReserveNormalizedIncome(address asset)

Returns the normalized income normalized income of the reserve.

getReserveNormalizedVariableDebt

function getReserveNormalizedVariableDebt(address asset)

Returns the normalized variable debt per unit of asset.

getNftsList

function getNftsList()

Returns the underlying address list of the initialized NFTs.

getNftData

function getNftData(address asset)

Returns the state and configuration of the nft.

getNftConfiguration

function getNftConfiguration(address asset)

Returns the configuration of the NFT.

getNftCollateralData

function getNftCollateralData(address nftAsset, uint256 nftTokenId)

Returns the collateral data of the NFT.

Return Values

getNftDebtData

function getNftDebtData(address nftAsset, uint256 nftTokenId)

Returns the debt data of the NFT.

Return Values

getNftAuctionData

function getNftAuctionData(address nftAsset, uint256 nftTokenId)

Returns the auction data of the NFT.

Return Values

getNftAuctionEndTime

function getNftAuctionEndTime(address nftAsset, uint256 nftTokenId)

Returns the auction end time of the NFT.

Return Values

getNftLiquidatePrice

Returns the liquidate price of the NFT which health factor is below 1.

getNftCollateralData

function getNftCollateralData(address nftAsset, address reserveAsset)

Returns the collateral data of the NFT.

Return Values

paused

Returns true if the LendPool is paused

Last updated