Deposit and Withdraw

Deposits to & Withdraws from the specified lending pool. When you deposit to the lending pool, the corresponding "infToken" will be minted as a receipt token that represents your shares of the pool.

Deposit

To deposit to a lending pool, users must perform 2 steps:

  1. transfer underlying token to the pool

  2. call mintTo on InfinitCore

The action returns shares of the lending pool.

circle-info

infToken decimals may be different from the underlying token's decimals. Currently, it is set to 8 + underlyingToken.decimals() to conform to the ERC-4626 standard.

circle-exclamation
// Example deposit function
function deposit(address lendingPool, uint256 amount, address receiver) external returns (uint256 shares) {
    // .. transfer in the tokens to this address ..
    
    // 1. transfer tokens to the lending pool
    IERC20(underlyingToken).safeTransfer(lendingPool, amount);

    // 2. call mintTo
    shares = IInfinitCore(INFINIT_CORE).mintTo(lendingPool, receiver);
}

Withdraw

To withdraw from a lending pool, users must perform 2 steps:

  1. transfer infToken to the pool

  2. call burnTo on InfinitCore

The action returns amount of underlying token to be received.

circle-exclamation

Last updated