PoolCore
Main point of interaction with an ParaSpace protocol's market
Users can:
Supply
Withdraw
Borrow
Repay
Liquidate positions
To be covered by a proxy contract, owned by the PoolAddressesProvider of the specific market All admin functions are callable by the PoolConfigurator contract defined also in the PoolAddressesProvider
POOL_REVISION
ADDRESSES_PROVIDER
Returns the PoolAddressesProvider connected to this contract
Return Values
getRevision
Returns the revision number of the contract
Needs to be defined in the inherited class as a constant.
Return Values
constructor
Constructor.
Parameters
initialize
Initializes the Pool.
Function is invoked by the proxy contract when the Pool contract is added to the PoolAddressesProvider of the market. Caching the address of the PoolAddressesProvider in order to reduce gas consumption on subsequent operations
Parameters
supply
Supplies an amount
of underlying asset into the reserve, receiving in return overlying xTokens.
E.g. User supplies 100 USDC and gets in return 100 pUSDC
Parameters
supplyERC721
Supplies multiple tokenIds
of underlying ERC721 asset into the reserve, receiving in return overlying nTokens.
E.g. User supplies 2 BAYC and gets in return 2 nBAYC
Parameters
supplyERC721FromNToken
Same as supplyERC721
but this can only be called by NToken contract and doesn't require sending the underlying asset.
Parameters
supplyWithPermit
Supply with transfer approval of asset to be supplied done via permit function see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
Parameters
withdraw
Withdraws an amount
of underlying asset from the reserve, burning the equivalent xTokens owned E.g. User has 100 pUSDC, calls withdraw() and receives 100 USDC, burning the 100 pUSDC
Parameters
Return Values
withdrawERC721
Withdraws multiple tokenIds
of underlying ERC721 asset from the reserve, burning the equivalent nTokens owned E.g. User has 2 nBAYC, calls withdraw() and receives 2 BAYC, burning the 2 nBAYC
Parameters
Return Values
decreaseUniswapV3Liquidity
Decreases liquidity for underlying Uniswap V3 NFT LP and validates that the user respects liquidation checks.
Parameters
borrow
Allows users to borrow a specific amount
of the reserve underlying asset, provided that the borrower already supplied enough collateral, or he was given enough allowance by a credit delegator on the corresponding debt token (VariableDebtToken)
E.g. User borrows 100 USDC passing as
onBehalfOf
his own address, receiving the 100 USDC in his wallet and 100 stable/variable debt tokens
Parameters
repay
Repays a borrowed amount
on a specific reserve, burning the equivalent debt tokens owned
E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the
onBehalfOf
address
Parameters
Return Values
repayWithPTokens
Repays a borrowed amount
on a specific reserve using the reserve xTokens, burning the equivalent debt tokens
E.g. User repays 100 USDC using 100 pUSDC, burning 100 variable/stable debt tokens
Passing uint256.max as amount will clean up any residual xToken dust balance, if the user xToken balance is not enough to cover the whole debt
Parameters
Return Values
repayWithPermit
Repay with transfer approval of asset to be repaid done via permit function see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
Parameters
Return Values
setUserUseERC20AsCollateral
Allows suppliers to enable/disable a specific supplied asset as collateral
Parameters
setUserUseERC721AsCollateral
Allows suppliers to enable/disable a specific supplied ERC721 asset with a tokenID as collateral
Parameters
liquidateERC20
Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1
The caller (liquidator) covers
liquidationAmount
amount of debt of the user getting liquidated, and receives a proportionally amount of thecollateralAsset
plus a bonus to cover market risk
Parameters
liquidateERC721
startAuction
Start the auction on user's specific NFT collateral
Parameters
endAuction
End specific user's auction
Parameters
flashClaim
_Allows smart contracts to access the tokens within one transaction, as long as the tokens taken is returned.
Requirements:
nftTokenIds
must exist._
Parameters
getReserveData
Returns the state and configuration of the reserve
Parameters
Return Values
getConfiguration
Returns the configuration of the reserve
Parameters
Return Values
getUserConfiguration
Returns the configuration of the user across all the reserves
Parameters
Return Values
getReserveNormalizedIncome
Returns the normalized income normalized income of the reserve
Parameters
Return Values
getReserveNormalizedVariableDebt
Returns the normalized variable debt per unit of asset
Parameters
Return Values
getReservesList
Returns the list of the underlying assets of all the initialized reserves
It does not include dropped reserves
Return Values
getReserveAddressById
Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct
Parameters
Return Values
MAX_NUMBER_RESERVES
Returns the maximum number of reserves supported to be listed in this Pool
Return Values
AUCTION_RECOVERY_HEALTH_FACTOR
Returns the auction recovery health factor
Return Values
finalizeTransfer
Validates and finalizes an PToken transfer
Only callable by the overlying xToken of the asset
Parameters
finalizeTransferERC721
Validates and finalizes an NToken transfer
Only callable by the overlying xToken of the asset
Parameters
getAuctionData
Returns the auction related data of specific asset collection and token id.