FlashLoan

Write Methods

flashLoanERC20

function flashLoanERC20(
    uint32 poolId,
    address[] calldata assets,
    uint256[] calldata amounts,
    address receiverAddress,
    bytes calldata params
  ) public

Allows smart contracts to access the ERC20 tokens within one transaction, as long as the tokens taken are returned.

Parameter NameTypeDescription

poolId

uint32

The id of the pool

assets

address[]

The address of the underlying asset to be borrowed

amounts

uint256[]

The underlying amount to be borrowed, expressed in underlying asset decimals units

receiverAddress

address

The address whom will receive the balance and MUST be a deployed smart contract

params

bytes

Variadic packed params to pass to the receiver as extra data

flashLoanERC721

function flashLoanERC721(
    uint32 poolId,
    address[] calldata nftAssets,
    uint256[] calldata nftTokenIds,
    address receiverAddress,
    bytes calldata params
  ) public

Allows smart contracts to access the ERC721 tokens within one transaction, as long as the tokens taken are returned.

Only the NFT owner can do the flash loan for his owned NFTs.

Parameter NameTypeDescription

poolId

uint32

The id of the pool

nftAssets

address[]

The address of the underlying asset to be borrowed

nftTokenIds

uint256[]

The token id list of the underlying asset to borrowed

receiverAddress

address

The address whom will receive the balance and MUST be a deployed smart contract

params

bytes

Variadic packed params to pass to the receiver as extra data

Last updated