Indexed Finance
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.0; pragma experimental ABIEncoderV2;
interface IIndexPool { /**
  • @dev Token record data structure
  • @param bound is token bound to pool
  • @param ready has token been initialized
  • @param lastDenormUpdate timestamp of last denorm change
  • @param denorm denormalized weight
  • @param desiredDenorm desired denormalized weight (used for incremental changes)
  • @param index index of address in tokens array
  • @param balance token balance */ struct Record { bool bound; bool ready; uint40 lastDenormUpdate; uint96 denorm; uint96 desiredDenorm; uint8 index; uint256 balance; }
    event LOG_SWAP( address indexed caller, address indexed tokenIn, address indexed tokenOut, uint256 tokenAmountIn, uint256 tokenAmountOut );
    event LOG_JOIN( address indexed caller, address indexed tokenIn, uint256 tokenAmountIn );
    event LOG_EXIT( address indexed caller, address indexed tokenOut, uint256 tokenAmountOut );
    event LOG_DENORM_UPDATED(address indexed token, uint256 newDenorm);
    event LOG_DESIRED_DENORM_SET(address indexed token, uint256 desiredDenorm);
    event LOG_TOKEN_REMOVED(address token);
    event LOG_TOKEN_ADDED( address indexed token, uint256 desiredDenorm, uint256 minimumBalance );
    event LOG_MINIMUM_BALANCE_UPDATED(address token, uint256 minimumBalance);
    event LOG_TOKEN_READY(address indexed token);
    event LOG_MAX_TOKENS_UPDATED(uint256 maxPoolTokens);
    event LOG_SWAP_FEE_UPDATED(uint256 swapFee);
    function configure( address controller, string calldata name, string calldata symbol ) external;
    function initialize( address[] calldata tokens, uint256[] calldata balances, uint96[] calldata denorms, address tokenProvider, address unbindHandler ) external;
    function setMaxPoolTokens(uint256 maxPoolTokens) external;
    function setSwapFee(uint256 swapFee) external;
    function reweighTokens( address[] calldata tokens, uint96[] calldata desiredDenorms ) external;
    function reindexTokens( address[] calldata tokens, uint96[] calldata desiredDenorms, uint256[] calldata minimumBalances ) external;
    function setMinimumBalance(address token, uint256 minimumBalance) external;
    function joinPool(uint256 poolAmountOut, uint256[] calldata maxAmountsIn) external;
    function joinswapExternAmountIn( address tokenIn, uint256 tokenAmountIn, uint256 minPoolAmountOut ) external returns (uint256/ poolAmountOut /);
    function joinswapPoolAmountOut( address tokenIn, uint256 poolAmountOut, uint256 maxAmountIn ) external returns (uint256/ tokenAmountIn /);
    function exitPool(uint256 poolAmountIn, uint256[] calldata minAmountsOut) external;
    function exitswapPoolAmountIn( address tokenOut, uint256 poolAmountIn, uint256 minAmountOut ) external returns (uint256/ tokenAmountOut /);
    function exitswapExternAmountOut( address tokenOut, uint256 tokenAmountOut, uint256 maxPoolAmountIn ) external returns (uint256/ poolAmountIn /);
    function gulp(address token) external;
    function flashBorrow( address recipient, address token, uint256 amount, bytes calldata data ) external;
    function swapExactAmountIn( address tokenIn, uint256 tokenAmountIn, address tokenOut, uint256 minAmountOut, uint256 maxPrice ) external returns (uint256/ tokenAmountOut /, uint256/ spotPriceAfter /);
    function swapExactAmountOut( address tokenIn, uint256 maxAmountIn, address tokenOut, uint256 tokenAmountOut, uint256 maxPrice ) external returns (uint256 / tokenAmountIn /, uint256 / spotPriceAfter /);
    function isPublicSwap() external view returns (bool);
    function getSwapFee() external view returns (uint256/ swapFee /);
    function getController() external view returns (address);
    function getMaxPoolTokens() external view returns (uint256);
    function isBound(address t) external view returns (bool);
    function getNumTokens() external view returns (uint256);
    function getCurrentTokens() external view returns (address[] memory tokens);
    function getCurrentDesiredTokens() external view returns (address[] memory tokens);
    function getDenormalizedWeight(address token) external view returns (uint256/ denorm /);
    function getTokenRecord(address token) external view returns (Record memory record);
    function extrapolatePoolValueFromToken() external view returns (address/ token /, uint256/ extrapolatedValue /);
    function getTotalDenormalizedWeight() external view returns (uint256);
    function getBalance(address token) external view returns (uint256);
    function getMinimumBalance(address token) external view returns (uint256);
    function getUsedBalance(address token) external view returns (uint256);
    function getSpotPrice(address tokenIn, address tokenOut) external view returns (uint256); }
Last modified 1yr ago
Copy link