{
"chainId": 1029,
"address": "cfx:acg158kvr8zanb1bs048ryb6rtrhr283ma70vz70tx",
"name": "Wrapped Conflux",
"symbol": "WCFX",
"decimals": 18,
"logoURI": "https://raw.githubusercontent.com/Koichi-Swap/koichi-swap-tokenlists/main/logos/cfx-acg158kvr8zanb1bs048ryb6rtrhr283ma70vz70tx/logo.png"
}
interface IKoichiSwap {
enum PoolSpecialization {
CONSTANT_PRODUCT,
STABLE_SWAP,
META_STABLE_SWAP,
EXTERNAL_CONSTANT_PRODUCT,
EXTERNAL_STABLE_SWAP,
EXTERNAL_META_STABLE_SWAP
}
function createPool(
address factory,
address[] memory tokens,
bytes memory userData
) external returns (bytes32 poolId);
function addLiquidity(
bytes32 poolId,
address recipient,
address[] memory tokens,
uint256[] memory amounts,
bytes memory userData,
uint256 deadline
) external payable returns (uint256);
function removeLiquidity(
bytes32 poolId,
address recipient,
address[] memory tokens,
bytes memory userData,
uint256 deadline
) external returns (uint256[] memory);
function querySwap(
uint256 amountIn,
bytes32[] memory pools,
address[] memory paths
) external view returns (uint256);
function swap(
uint256 amountIn,
uint256 limit,
bytes32[] memory pools,
address[] memory paths,
address recipient,
uint256 deadline
) external payable returns (uint256);
struct BatchSwapStep {
bytes32 poolId;
bytes32 nextPoolId;
uint112 amount;
uint112 limit;
uint8 indexIn;
uint8 indexOut;
}
function batchSwap(
BatchSwapStep[] memory swaps,
address[] memory tokens,
address recipient,
uint256 deadline
) external payable returns (uint256[] memory);
}
interface IPool {
function totalTokens() external view returns (uint256);
function tokens(uint256 index) external view returns (address);
function reserves(uint256 index) external view returns (uint256);
function querysSwap(
address tokenIn,
address tokenOut,
uint256 amountIn
) external view returns (uint256 amountOut);
function onAddLiquidity(address recipient, bytes memory userData) external returns (uint256 liquidity);
function onRemoveLiquidity(
address sender,
address recipient,
bytes memory userData
) external returns (uint256[] memory amounts);
function onSwap(
address tokenIn,
address tokenOut,
address recipient
) external returns (uint256 amountOut);
}
interface IConstantProductPoolFactory {
function getPool(address tokenA, address tokenB) external view returns (bytes32);
function allPools(uint256 index) external view returns (bytes32);
function poolLength() external view returns (uint256);
}
interface IConstantProductPool is IPool {
function getTradeInfo() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _swapFeePercentage);
}
(uint256 reserve0, uint256 reserve1, ) = IConstantProductPool(pool).getTradeInfo();
uint256 price0 = reserve1.mul(1e18).div(reserve0);
uint256 price1 = reserve0.mul(1e18).div(reserve1);
interface IStablePoolFactory {
// bytes32 poolHash = keccak256(abi.encode(tokens));
function getPool(bytes32 poolHash) external view returns (bytes32);
function allPools(uint256 index) external view returns (bytes32);
function poolLength() external view returns (uint256);
}
interface IStablePool is IPool {
function scales(uint256 index) external view returns (uint256);
function swapFeePercentage() external view returns (uint256);
function getA() external view returns (uint256);
function getAPrecise() external view returns (uint256);
function getVirtualPrice() external view returns (uint256);
}