316 lines
8.6 KiB
Solidity
316 lines
8.6 KiB
Solidity
|
// SPDX-License-Identifier: Unlicensed
|
||
|
|
||
|
pragma solidity ^0.8.14;
|
||
|
|
||
|
interface IPancakeSwapPair {
|
||
|
event Approval(address indexed owner, address indexed spender, uint256 value);
|
||
|
event Transfer(address indexed from, address indexed to, uint256 value);
|
||
|
|
||
|
function name() external pure returns (string memory);
|
||
|
|
||
|
function symbol() external pure returns (string memory);
|
||
|
|
||
|
function decimals() external pure returns (uint8);
|
||
|
|
||
|
function totalSupply() external view returns (uint256);
|
||
|
|
||
|
function balanceOf(address owner) external view returns (uint256);
|
||
|
|
||
|
function allowance(address owner, address spender) external view returns (uint256);
|
||
|
|
||
|
function approve(address spender, uint256 value) external returns (bool);
|
||
|
|
||
|
function transfer(address to, uint256 value) external returns (bool);
|
||
|
|
||
|
function transferFrom(
|
||
|
address from,
|
||
|
address to,
|
||
|
uint256 value
|
||
|
) external returns (bool);
|
||
|
|
||
|
function DOMAIN_SEPARATOR() external view returns (bytes32);
|
||
|
|
||
|
function PERMIT_TYPEHASH() external pure returns (bytes32);
|
||
|
|
||
|
function nonces(address owner) external view returns (uint256);
|
||
|
|
||
|
function permit(
|
||
|
address owner,
|
||
|
address spender,
|
||
|
uint256 value,
|
||
|
uint256 deadline,
|
||
|
uint8 v,
|
||
|
bytes32 r,
|
||
|
bytes32 s
|
||
|
) external;
|
||
|
|
||
|
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
|
||
|
event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);
|
||
|
event Swap(
|
||
|
address indexed sender,
|
||
|
uint256 amount0In,
|
||
|
uint256 amount1In,
|
||
|
uint256 amount0Out,
|
||
|
uint256 amount1Out,
|
||
|
address indexed to
|
||
|
);
|
||
|
event Sync(uint112 reserve0, uint112 reserve1);
|
||
|
|
||
|
function MINIMUM_LIQUIDITY() external pure returns (uint256);
|
||
|
|
||
|
function factory() external view returns (address);
|
||
|
|
||
|
function token0() external view returns (address);
|
||
|
|
||
|
function token1() external view returns (address);
|
||
|
|
||
|
function getReserves()
|
||
|
external
|
||
|
view
|
||
|
returns (
|
||
|
uint112 reserve0,
|
||
|
uint112 reserve1,
|
||
|
uint32 blockTimestampLast
|
||
|
);
|
||
|
|
||
|
function price0CumulativeLast() external view returns (uint256);
|
||
|
|
||
|
function price1CumulativeLast() external view returns (uint256);
|
||
|
|
||
|
function kLast() external view returns (uint256);
|
||
|
|
||
|
function mint(address to) external returns (uint256 liquidity);
|
||
|
|
||
|
function burn(address to) external returns (uint256 amount0, uint256 amount1);
|
||
|
|
||
|
function swap(
|
||
|
uint256 amount0Out,
|
||
|
uint256 amount1Out,
|
||
|
address to,
|
||
|
bytes calldata data
|
||
|
) external;
|
||
|
|
||
|
function skim(address to) external;
|
||
|
|
||
|
function sync() external;
|
||
|
|
||
|
function initialize(address, address) external;
|
||
|
}
|
||
|
|
||
|
interface IPancakeSwapRouter {
|
||
|
function factory() external pure returns (address);
|
||
|
|
||
|
function WETH() external pure returns (address);
|
||
|
|
||
|
function addLiquidity(
|
||
|
address tokenA,
|
||
|
address tokenB,
|
||
|
uint256 amountADesired,
|
||
|
uint256 amountBDesired,
|
||
|
uint256 amountAMin,
|
||
|
uint256 amountBMin,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
)
|
||
|
external
|
||
|
returns (
|
||
|
uint256 amountA,
|
||
|
uint256 amountB,
|
||
|
uint256 liquidity
|
||
|
);
|
||
|
|
||
|
function addLiquidityETH(
|
||
|
address token,
|
||
|
uint256 amountTokenDesired,
|
||
|
uint256 amountTokenMin,
|
||
|
uint256 amountETHMin,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
)
|
||
|
external
|
||
|
payable
|
||
|
returns (
|
||
|
uint256 amountToken,
|
||
|
uint256 amountETH,
|
||
|
uint256 liquidity
|
||
|
);
|
||
|
|
||
|
function removeLiquidity(
|
||
|
address tokenA,
|
||
|
address tokenB,
|
||
|
uint256 liquidity,
|
||
|
uint256 amountAMin,
|
||
|
uint256 amountBMin,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external returns (uint256 amountA, uint256 amountB);
|
||
|
|
||
|
function removeLiquidityETH(
|
||
|
address token,
|
||
|
uint256 liquidity,
|
||
|
uint256 amountTokenMin,
|
||
|
uint256 amountETHMin,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external returns (uint256 amountToken, uint256 amountETH);
|
||
|
|
||
|
function removeLiquidityWithPermit(
|
||
|
address tokenA,
|
||
|
address tokenB,
|
||
|
uint256 liquidity,
|
||
|
uint256 amountAMin,
|
||
|
uint256 amountBMin,
|
||
|
address to,
|
||
|
uint256 deadline,
|
||
|
bool approveMax,
|
||
|
uint8 v,
|
||
|
bytes32 r,
|
||
|
bytes32 s
|
||
|
) external returns (uint256 amountA, uint256 amountB);
|
||
|
|
||
|
function removeLiquidityETHWithPermit(
|
||
|
address token,
|
||
|
uint256 liquidity,
|
||
|
uint256 amountTokenMin,
|
||
|
uint256 amountETHMin,
|
||
|
address to,
|
||
|
uint256 deadline,
|
||
|
bool approveMax,
|
||
|
uint8 v,
|
||
|
bytes32 r,
|
||
|
bytes32 s
|
||
|
) external returns (uint256 amountToken, uint256 amountETH);
|
||
|
|
||
|
function swapExactTokensForTokens(
|
||
|
uint256 amountIn,
|
||
|
uint256 amountOutMin,
|
||
|
address[] calldata path,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external returns (uint256[] memory amounts);
|
||
|
|
||
|
function swapTokensForExactTokens(
|
||
|
uint256 amountOut,
|
||
|
uint256 amountInMax,
|
||
|
address[] calldata path,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external returns (uint256[] memory amounts);
|
||
|
|
||
|
function swapExactETHForTokens(
|
||
|
uint256 amountOutMin,
|
||
|
address[] calldata path,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external payable returns (uint256[] memory amounts);
|
||
|
|
||
|
function swapTokensForExactETH(
|
||
|
uint256 amountOut,
|
||
|
uint256 amountInMax,
|
||
|
address[] calldata path,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external returns (uint256[] memory amounts);
|
||
|
|
||
|
function swapExactTokensForETH(
|
||
|
uint256 amountIn,
|
||
|
uint256 amountOutMin,
|
||
|
address[] calldata path,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external returns (uint256[] memory amounts);
|
||
|
|
||
|
function swapETHForExactTokens(
|
||
|
uint256 amountOut,
|
||
|
address[] calldata path,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external payable returns (uint256[] memory amounts);
|
||
|
|
||
|
function quote(
|
||
|
uint256 amountA,
|
||
|
uint256 reserveA,
|
||
|
uint256 reserveB
|
||
|
) external pure returns (uint256 amountB);
|
||
|
|
||
|
function getAmountOut(
|
||
|
uint256 amountIn,
|
||
|
uint256 reserveIn,
|
||
|
uint256 reserveOut
|
||
|
) external pure returns (uint256 amountOut);
|
||
|
|
||
|
function getAmountIn(
|
||
|
uint256 amountOut,
|
||
|
uint256 reserveIn,
|
||
|
uint256 reserveOut
|
||
|
) external pure returns (uint256 amountIn);
|
||
|
|
||
|
function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);
|
||
|
|
||
|
function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);
|
||
|
|
||
|
function removeLiquidityETHSupportingFeeOnTransferTokens(
|
||
|
address token,
|
||
|
uint256 liquidity,
|
||
|
uint256 amountTokenMin,
|
||
|
uint256 amountETHMin,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external returns (uint256 amountETH);
|
||
|
|
||
|
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
|
||
|
address token,
|
||
|
uint256 liquidity,
|
||
|
uint256 amountTokenMin,
|
||
|
uint256 amountETHMin,
|
||
|
address to,
|
||
|
uint256 deadline,
|
||
|
bool approveMax,
|
||
|
uint8 v,
|
||
|
bytes32 r,
|
||
|
bytes32 s
|
||
|
) external returns (uint256 amountETH);
|
||
|
|
||
|
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
|
||
|
uint256 amountIn,
|
||
|
uint256 amountOutMin,
|
||
|
address[] calldata path,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external;
|
||
|
|
||
|
function swapExactETHForTokensSupportingFeeOnTransferTokens(
|
||
|
uint256 amountOutMin,
|
||
|
address[] calldata path,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external payable;
|
||
|
|
||
|
function swapExactTokensForETHSupportingFeeOnTransferTokens(
|
||
|
uint256 amountIn,
|
||
|
uint256 amountOutMin,
|
||
|
address[] calldata path,
|
||
|
address to,
|
||
|
uint256 deadline
|
||
|
) external;
|
||
|
}
|
||
|
|
||
|
interface IPancakeSwapFactory {
|
||
|
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
|
||
|
|
||
|
function feeTo() external view returns (address);
|
||
|
|
||
|
function feeToSetter() external view returns (address);
|
||
|
|
||
|
function getPair(address tokenA, address tokenB) external view returns (address pair);
|
||
|
|
||
|
function allPairs(uint256) external view returns (address pair);
|
||
|
|
||
|
function allPairsLength() external view returns (uint256);
|
||
|
|
||
|
function createPair(address tokenA, address tokenB) external returns (address pair);
|
||
|
|
||
|
function setFeeTo(address) external;
|
||
|
|
||
|
function setFeeToSetter(address) external;
|
||
|
}
|