contract LiquidityAccessMulti is LiquidityAccess {
    /**
     * @dev Borrow Flashloan and Cast spells.
     * @param tokens Array of token Addresses.
     * @param amts Array of token Amounts.
     * @param route Route to borrow.
     * @param data targets & data for cast.
     */
    function flashMultiBorrowAndCast(address[] calldata tokens, uint[] calldata amts, uint route, bytes calldata data) external payable {
        AccountInterface(address(this)).enable(getInstaFlashV2Addr());

        emit LogFlashBorrow(tokens, amts);

        InstaFlashV2Interface(getInstaFlashV2Addr()).initiateFlashLoan(tokens, amts, route, data);

        AccountInterface(address(this)).disable(getInstaFlashV2Addr());

    }

    /**
     * @dev Return Multiple token liquidity to InstaPool.
     * @param tokens Array of token addresses.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
     * @param amts Array of token amounts.
     * @param getId get token amounts at this IDs from `InstaMemory` Contract.
     * @param setId set token amounts at this IDs in `InstaMemory` Contract.
    */
    function flashMultiPayback(address[] calldata tokens, uint[] calldata amts, uint[] calldata getId, uint[] calldata setId) external payable {
        uint _length = tokens.length;
        InstaFlashV2Interface instapoolContract = InstaFlashV2Interface(getInstaFlashV2Addr());

        uint[] memory totalAmtFees = new uint[](_length);
        for (uint i = 0; i < _length; i++) {
            uint _amt = getUint(getId[i], amts[i]);
            IERC20 tokenContract = IERC20(tokens[i]);

            
            (totalAmtFees[i]) = calculateTotalFeeAmt(instapoolContract, _amt);

            _transfer(payable(address(getInstaFlashV2Addr())), tokenContract, totalAmtFees[i]);

            setUint(setId[i], totalAmtFees[i]);
        }

        emit LogFlashPayback(tokens, amts, totalAmtFees);
    }

}
function flashMultiBorrowAndCast(address[] calldata tokens, uint[] calldata amts, uint route, bytes calldata data) external payable {
    AccountInterface(address(this)).enable(getInstaFlashV2Addr());

    emit LogFlashBorrow(tokens, amts);

    InstaFlashV2Interface(getInstaFlashV2Addr()).initiateFlashLoan(tokens, amts, route, data);

    AccountInterface(address(this)).disable(getInstaFlashV2Addr());

}

/**
 * @dev Borrow Flashloan and Cast spells.
 * @param tokens Array of token Addresses.
 * @param amts Array of token Amounts.
 * @param route Route to borrow.
 * @param data targets & data for cast.
 */