SwapperV2

可以在 uniswap 上将一种 `token` 兑换成另一种 `token`.

ISwapperV2.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

interface ISwapperV2 {
    event NewSwap(
        address indexed _user,
        address _tokenIn,
        address _tokenOut,
        uint256 _amountIn,
        uint256 _amountOut,
        uint24 _poolFee
    );

    event NewSwapLock(
        uint256 indexed _sid,
        address indexed _user,
        address indexed _recipient,
        address _tokenIn,
        address _tokenOut,
        uint256 _amountIn,
        uint256 _amountOut,
        uint24 _poolFee,
        uint256 _endTime
    );

    event WithdrawToken(
        uint256 indexed _sid,
        address indexed _user,
        address indexed _token,
        uint256 _amount,
        uint256 _endTime,
        uint256 _timestamp
    );

    event AdminClaim(
        uint256 indexed _sid,
        address indexed _user,
        address indexed _token,
        address _to,
        uint256 _amount,
        uint256 _endTime,
        uint256 _timestamp
    );

    function swapExactInputSingle(
        address _sender,
        address _recipient,
        address _tokenIn,
        address _tokenOut,
        uint24 _poolFee,
        uint256 _amountIn,
        uint256 _amountOutMin
    ) external returns (uint256 _amountOut);

    //----------------------------------------------------------------------
    function swapTokenToUsdt(
        address _sender,
        address _tokenIn,
        uint256 _amountIn,
        uint256 _amountOutMin,
        uint24 _poolFee,
        uint256 _lockTime
    ) external returns (uint256 _amountOut);
    //2023.05.30
    function swapUsdtToToken(
        address _tokenOut,
        uint256 _amountIn,
        uint256 _amountOutMin,
        uint24 _poolFee
    ) external returns (uint256 _amountOut);
    sol
    //----------------------------------------------------------------------
    function swapSnakeToUsdt(
        address _sender,
        uint256 _amountIn,
        uint256 _amountOutMin,
        uint24 _poolFee,
        uint256 _lockTime
    ) external returns (uint256 _amountOut);

    function swapUsdtToSnake(
        uint256 _amountIn,
        uint256 _amountOutMin,
        uint24 _poolFee
    ) external returns (uint256 _amountOut);

    //2023.03.21
    function amountOf(
        address _user,
        uint256 _sid
    ) external view returns (uint256);

    function withdrawToken(uint256 _sid) external;

    //----------------------------------------------------------------------

    function setRouterAddress(address _router) external;

    function setSnakeAddress(address _snake) external;

    function setCrazyAddress(address _crazy) external;

    function hash256(string memory name) external pure returns (bytes32);

    function setRefundAddress(address _refundAddress) external;

    function adminClaim(address user, uint256 sid) external;
}

swapTokenToUsdt

swapTokenToUsdt

swapUsdtToToken

swapUsdtToToken

最后更新于