ETH Price: $2,414.57 (-0.28%)

Contract

0xDcCada4894941593f4C842D7c6bFD486E8344116

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0xb8644844160112572024-09-15 2:05:157 hrs ago1726365915IN
0xDcCada48...6E8344116
0.00164699 ETH0.000006430.0161
0xb8644844160067052024-09-14 22:15:4911 hrs ago1726352149IN
0xDcCada48...6E8344116
0.00374205 ETH0.000009840.02345787
0xb8644844160008402024-09-14 17:20:2316 hrs ago1726334423IN
0xDcCada48...6E8344116
0.000028 ETH0.000015440.03843331
0xb8644844159951312024-09-14 12:32:5221 hrs ago1726317172IN
0xDcCada48...6E8344116
0.00028175 ETH0.000011370.0291701
0xb8644844159823842024-09-14 1:50:4331 hrs ago1726278643IN
0xDcCada48...6E8344116
0.00125456 ETH0.000008420.0236
0xb8644844159802392024-09-14 0:03:0133 hrs ago1726272181IN
0xDcCada48...6E8344116
0.00134233 ETH0.00001480.03824791
0xb8644844159675772024-09-13 13:26:4444 hrs ago1726234004IN
0xDcCada48...6E8344116
0.00200966 ETH0.000017540.04071611
0xb8644844159639972024-09-13 10:27:1947 hrs ago1726223239IN
0xDcCada48...6E8344116
0 ETH0.000015260.03797497
0xb8644844159563252024-09-13 4:01:312 days ago1726200091IN
0xDcCada48...6E8344116
0.000334 ETH0.00001990.024
0xb8644844159557562024-09-13 3:32:522 days ago1726198372IN
0xDcCada48...6E8344116
0.00170688 ETH0.000009410.0217
0xb8644844159555002024-09-13 3:19:582 days ago1726197598IN
0xDcCada48...6E8344116
0 ETH0.00005350.1251
0xb8644844159397192024-09-12 14:06:092 days ago1726149969IN
0xDcCada48...6E8344116
0.00053401 ETH0.000040960.09440539
0xb8644844159375622024-09-12 12:17:522 days ago1726143472IN
0xDcCada48...6E8344116
0 ETH0.000024950.0402
0xb8644844159374182024-09-12 12:10:372 days ago1726143037IN
0xDcCada48...6E8344116
0 ETH0.00001840.0462
0xb8644844159326132024-09-12 8:09:163 days ago1726128556IN
0xDcCada48...6E8344116
0 ETH0.000021350.0335
0xb8644844159324162024-09-12 7:59:263 days ago1726127966IN
0xDcCada48...6E8344116
0 ETH0.00005170.08075081
0xb8644844159322232024-09-12 7:49:443 days ago1726127384IN
0xDcCada48...6E8344116
0 ETH0.000019410.0293
0xb8644844159320742024-09-12 7:42:183 days ago1726126938IN
0xDcCada48...6E8344116
0 ETH0.000026120.0413
0xb8644844159318402024-09-12 7:30:323 days ago1726126232IN
0xDcCada48...6E8344116
0 ETH0.000022460.0349
0xb8644844159315952024-09-12 7:18:103 days ago1726125490IN
0xDcCada48...6E8344116
0 ETH0.000024380.0379
0xb8644844159315412024-09-12 7:15:263 days ago1726125326IN
0xDcCada48...6E8344116
0.001 ETH0.000017570.0405
0xb8644844159313122024-09-12 7:03:503 days ago1726124630IN
0xDcCada48...6E8344116
0 ETH0.000022090.0343
0xb8644844159268962024-09-12 3:21:273 days ago1726111287IN
0xDcCada48...6E8344116
0 ETH0.000039280.0639
0xb8644844159267782024-09-12 3:15:293 days ago1726110929IN
0xDcCada48...6E8344116
0 ETH0.000024610.0363
0xb8644844159265982024-09-12 3:06:293 days ago1726110389IN
0xDcCada48...6E8344116
0 ETH0.000019180.0276
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
160112572024-09-15 2:05:157 hrs ago1726365915
0xDcCada48...6E8344116
0.00164699 ETH
160067052024-09-14 22:15:4911 hrs ago1726352149
0xDcCada48...6E8344116
0.00374205 ETH
160008402024-09-14 17:20:2316 hrs ago1726334423
0xDcCada48...6E8344116
0.000028 ETH
159951312024-09-14 12:32:5221 hrs ago1726317172
0xDcCada48...6E8344116
0.00028175 ETH
159823842024-09-14 1:50:4331 hrs ago1726278643
0xDcCada48...6E8344116
0.00125456 ETH
159802392024-09-14 0:03:0133 hrs ago1726272181
0xDcCada48...6E8344116
0.00134233 ETH
159675772024-09-13 13:26:4444 hrs ago1726234004
0xDcCada48...6E8344116
0.00200966 ETH
159639972024-09-13 10:27:1947 hrs ago1726223239
0xDcCada48...6E8344116
0.00180518 ETH
159639972024-09-13 10:27:1947 hrs ago1726223239
0xDcCada48...6E8344116
0.00180518 ETH
159563252024-09-13 4:01:312 days ago1726200091
0xDcCada48...6E8344116
0.000334 ETH
159557562024-09-13 3:32:522 days ago1726198372
0xDcCada48...6E8344116
0.00170688 ETH
159397192024-09-12 14:06:092 days ago1726149969
0xDcCada48...6E8344116
0.00053401 ETH
159375622024-09-12 12:17:522 days ago1726143472
0xDcCada48...6E8344116
0.0005867 ETH
159375622024-09-12 12:17:522 days ago1726143472
0xDcCada48...6E8344116
0.0005867 ETH
159374182024-09-12 12:10:372 days ago1726143037
0xDcCada48...6E8344116
0.00044178 ETH
159374182024-09-12 12:10:372 days ago1726143037
0xDcCada48...6E8344116
0.00044178 ETH
159326132024-09-12 8:09:163 days ago1726128556
0xDcCada48...6E8344116
0.00951696 ETH
159326132024-09-12 8:09:163 days ago1726128556
0xDcCada48...6E8344116
0.00951696 ETH
159324162024-09-12 7:59:263 days ago1726127966
0xDcCada48...6E8344116
0.00950578 ETH
159324162024-09-12 7:59:263 days ago1726127966
0xDcCada48...6E8344116
0.00950578 ETH
159322232024-09-12 7:49:443 days ago1726127384
0xDcCada48...6E8344116
0.00926668 ETH
159322232024-09-12 7:49:443 days ago1726127384
0xDcCada48...6E8344116
0.00926668 ETH
159320742024-09-12 7:42:183 days ago1726126938
0xDcCada48...6E8344116
0.00962454 ETH
159320742024-09-12 7:42:183 days ago1726126938
0xDcCada48...6E8344116
0.00962454 ETH
159318402024-09-12 7:30:323 days ago1726126232
0xDcCada48...6E8344116
0.00957188 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Router

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 16 : Router.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "./interfaces/IRouter.sol";
import "./interfaces/IWETH.sol";
import "./interfaces/ICryptoSwap2Pool.sol";
import "./interfaces/IMetaPool.sol";
import "./library/ReentrancyGuard.sol";
import "./utils/ZKokonutAccess.sol";

contract Router is ReentrancyGuard, IRouter {
    using SafeERC20 for IERC20;

    address private immutable WETH_ADDRESS;

    mapping(address => mapping(address => bool)) public isApproved;

    constructor(address wethAddress) {
        WETH_ADDRESS = wethAddress;
    }

    function getPrice(address[] calldata path, uint256[3][] calldata swapParams) external view returns (uint256 price) {
        address inputToken = path[0];
        if (inputToken == address(0)) inputToken = WETH_ADDRESS;
        price = 10 ** 18;

        for (uint256 i = 1; i < path.length / 2 + 1; ++i) {
            // 4 rounds of iteration to perform up to 4 swaps
            address swap = path[i * 2 - 1];
            if (swap == address(0)) {
                break;
            }
            address outputToken = path[i * 2];
            if (outputToken == address(0)) outputToken = WETH_ADDRESS;
            uint256[3] calldata params = swapParams[i - 1]; // i, j, swap type
            _checkSwapParams(inputToken, outputToken, swap, params);

            if (params[2] == 1) {
                price = (price * IStableSwap(swap).getPrice(params[0], params[1])) / 10 ** 18;
            } else if (params[2] == 2) {
                price = (price * IMetaPool(swap).getPrice(params[0], params[1])) / 10 ** 18;
            } else if (params[2] == 3) {
                price = (price * ICryptoSwap2Pool(swap).getPrice(params[0], params[1])) / 10 ** 18;
            } else {
                revert("Bad swap type");
            }

            inputToken = outputToken;
        }
    }

    function getDy(
        address[] calldata path,
        uint256[3][] calldata swapParams,
        uint256 amount
    ) external view returns (uint256[] memory) {
        return _getDy(path, swapParams, amount, false);
    }

    function getDyWithoutFee(
        address[] calldata path,
        uint256[3][] calldata swapParams,
        uint256 amount
    ) external view returns (uint256[] memory) {
        return _getDy(path, swapParams, amount, true);
    }

    /// @notice Perform up to multiple swaps in a single transaction
    /// @dev Routing and swap params must be determined off-chain. This
    ///      functionality is designed for gas efficiency over ease-of-use.
    /// @param path Array of [initial token, pool, token, pool, token, ...]
    ///               The array is iterated until a pool address of 0x00, then the last
    ///               given token is transferred to `_receiver`
    /// @param swapParams Multidimensional array of [i, j, swap type] where i and j are the correct
    ///                     values for the n'th pool in `_route`. The swap type should be 1 for
    ///                     a stableswap `exchange`, 2 for stableswap `exchange_underlying` and 3
    ///                     for a cryptoswap `exchange`.
    /// @param amount The amount of input token.
    /// @return outputs The array of the amount of all output tokens through the path
    function _getDy(
        address[] calldata path,
        uint256[3][] calldata swapParams,
        uint256 amount,
        bool withoutFee
    ) internal view returns (uint256[] memory outputs) {
        address inputToken = path[0];
        if (inputToken == address(0)) inputToken = WETH_ADDRESS;
        address outputToken;
        outputs = new uint256[](path.length / 2);

        for (uint256 i = 1; i < path.length / 2 + 1; ++i) {
            // 4 rounds of iteration to perform up to 4 swaps
            address swap = path[i * 2 - 1];
            if (swap == address(0)) {
                break;
            }
            outputToken = path[i * 2];
            if (outputToken == address(0)) outputToken = WETH_ADDRESS;
            uint256[3] calldata params = swapParams[i - 1]; // i, j, swap type
            _checkSwapParams(inputToken, outputToken, swap, params);

            uint256 dy;
            uint256 dyFee;
            if (params[2] == 1) {
                (dy, dyFee) = IStableSwap(swap).getDy(params[0], params[1], amount);
            } else if (params[2] == 2) {
                (dy, dyFee) = IMetaPool(swap).getDyUnderlying(params[0], params[1], amount);
            } else if (params[2] == 3) {
                (dy, dyFee) = ICryptoSwap2Pool(swap).getDy(params[0], params[1], amount);
            } else {
                revert("Bad swap type");
            }
            outputs[i - 1] = withoutFee ? dy + dyFee : dy;

            // sanity check, if the routing data is incorrect we will have a 0 balance and that is bad
            require(amount != 0, "Received nothing");

            // if there is another swap, the output token becomes the input for the next round
            amount = outputs[i - 1];
            inputToken = outputToken;
        }
    }

    /// @notice Perform up to multiple swaps in a single transaction
    /// @dev Routing and swap params must be determined off-chain. This
    ///      functionality is designed for gas efficiency over ease-of-use.
    /// @param path Array of [initial token, pool, token, pool, token, ...]
    ///               The array is iterated until a pool address of 0x00, then the last
    ///               given token is transferred to `msg.sender`
    /// @param swapParams Multidimensional array of [i, j, swap type] where i and j are the correct
    ///                     values for the n'th pool in `_route`. The swap type should be 1 for
    ///                     a stableswap `exchange`, 2 for stableswap `exchange_underlying` and 3
    ///                     for a cryptoswap `exchange`.
    /// @param amount The amount of input token.
    /// @param minAmount The minimum amount received after the final swap.
    /// @return outputs The array of the amount of all output tokens through the path
    function swapWithPath(
        address[] calldata path,
        uint256[3][] calldata swapParams,
        uint256 amount,
        uint256 minAmount
    ) external payable nonReentrant returns (uint256[] memory outputs) {
        address curInputToken = path[0];
        address curOutputToken = address(0);
        uint256 inputAmount = amount;
        outputs = new uint256[](path.length / 2);

        if (curInputToken == address(0)) {
            if (msg.value > amount) {
                IWETH(WETH_ADDRESS).deposit{value: amount}();
                (bool success, ) = msg.sender.call{value: msg.value - amount}("");
                require(success);
            } else {
                IWETH(WETH_ADDRESS).deposit{value: msg.value}();
                if (msg.value < amount) {
                    IERC20(WETH_ADDRESS).safeTransferFrom(msg.sender, address(this), amount - msg.value);
                }
            }
        } else {
            require(msg.value == 0);
            IERC20(curInputToken).safeTransferFrom(msg.sender, address(this), amount);
        }

        for (uint256 i = 1; i < path.length / 2 + 1; ++i) {
            // 4 rounds of iteration to perform up to 4 swaps
            address swap = path[i * 2 - 1];
            if (swap == address(0)) {
                break;
            }
            if (curInputToken == address(0)) {
                curInputToken = WETH_ADDRESS;
            }
            curOutputToken = path[i * 2];
            uint256[3] calldata params = swapParams[i - 1]; // i, j, swap type
            _checkSwapParams(curInputToken, curOutputToken == address(0) ? WETH_ADDRESS : curOutputToken, swap, params);
            _ensureApproved(swap, curInputToken);

            uint256 dy;
            if (params[2] == 1) {
                (dy, ) = IStableSwap(swap).exchange(params[0], params[1], amount, 0, new bytes(0));
            } else if (params[2] == 2) {
                (dy, ) = IMetaPool(swap).exchangeUnderlying(params[0], params[1], amount, 0);
            } else if (params[2] == 3) {
                (dy, ) = ICryptoSwap2Pool(swap).exchange(params[0], params[1], amount, 0, new bytes(0));
            } else {
                revert("Bad swap type");
            }
            outputs[i - 1] = dy;

            // update the amount received
            if (curOutputToken == address(0)) {
                amount = IERC20(WETH_ADDRESS).balanceOf(address(this));
            } else {
                amount = IERC20(curOutputToken).balanceOf(address(this));
            }

            // sanity check, if the routing data is incorrect we will have a 0 balance and that is bad
            require(amount != 0, "Received nothing");

            // if there is another swap, the output token becomes the input for the next round
            curInputToken = curOutputToken;
        }

        // validate the final amount received
        require(amount >= minAmount);
        require(curOutputToken == path[path.length - 1], "wrong output");

        // transfer the final token to the msg.sender
        if (curOutputToken == address(0)) {
            IWETH(WETH_ADDRESS).withdraw(amount);
            (bool success, ) = msg.sender.call{value: amount}("");
            require(success);
        } else {
            IERC20(curOutputToken).safeTransfer(msg.sender, amount);
        }

        emit SwapWithPath(msg.sender, path[0], inputAmount, curOutputToken, amount);
    }

    function addLiquidity(
        address pool,
        uint256 poolType,
        uint256[] memory amounts,
        uint256 minMintAmount
    ) external payable nonReentrant returns (uint256 mintAmount) {
        uint256 nCoins = IKokonutSwapPool(pool).N_COINS();
        require(amounts.length == nCoins, "wrong length");
        for (uint256 i = 0; i < nCoins; ++i) {
            address coin = IKokonutSwapPool(pool).coins(i);
            if (amounts[i] > 0) {
                IERC20(coin).safeTransferFrom(msg.sender, address(this), amounts[i]);
            }
            if (coin == WETH_ADDRESS && msg.value > 0) {
                amounts[i] += msg.value;
                IWETH(WETH_ADDRESS).deposit{value: msg.value}();
            }
            if (amounts[i] > 0) {
                _ensureApproved(pool, coin);
            }
        }
        address lpToken = IKokonutSwapPool(pool).token();

        if (poolType == 1) {
            (mintAmount, ) = IStableSwap(pool).addLiquidity(amounts, minMintAmount);
        } else if (poolType == 2) {
            (mintAmount, ) = IMetaPool(pool).addLiquidity(amounts, minMintAmount);
        } else if (poolType == 3) {
            (mintAmount, ) = ICryptoSwap2Pool(pool).addLiquidity(amounts, minMintAmount);
        } else {
            revert("Bad swap type");
        }
        IERC20(lpToken).safeTransfer(msg.sender, mintAmount);
    }

    function _ensureApproved(address pool, address coin) internal {
        if (!isApproved[coin][pool]) {
            // approve the pool to transfer the input token
            IERC20(coin).safeApprove(pool, type(uint256).max);
            isApproved[coin][pool] = true;
        }
    }

    function _checkSwapParams(
        address inputToken,
        address outputToken,
        address swap,
        uint256[3] calldata swapParam
    ) internal view {
        require(IKokonutSwapPool(swap).coins(swapParam[0]) == inputToken, "swap param");
        require(IKokonutSwapPool(swap).coins(swapParam[1]) == outputToken, "swap param");
    }

    receive() external payable {}
}

File 2 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 3 of 16 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 4 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 5 of 16 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 6 of 16 : ICryptoSwap2Pool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

import "./IKokonutSwapPool.sol";

interface ICryptoSwap2Pool is IKokonutSwapPool {
    event AddLiquidity(
        address indexed provider,
        uint256[] tokenAmounts,
        uint256 fee,
        uint256 invariant,
        uint256 tokenSupply
    );
    event RemoveLiquidityOne(
        address indexed provider,
        uint256 i,
        uint256 tokenAmount,
        uint256 lpFee,
        uint256 tokenSupply
    );
    event CommitNewParameters(
        uint256 indexed deadline,
        uint256 adminFee,
        uint256 flashLoanFee,
        uint256 midFee,
        uint256 outFee,
        uint256 feeGamma,
        uint256 allowedExtraProfit,
        uint256 minRemainingPostRebalanceRatio,
        uint256 adjustmentStep,
        uint256 maHalfTime
    );
    event NewParameters(
        uint256 adminFee,
        uint256 flashLoanFee,
        uint256 midFee,
        uint256 outFee,
        uint256 feeGamma,
        uint256 allowedExtraProfit,
        uint256 minRemainingPostRebalanceRatio,
        uint256 adjustmentStep,
        uint256 maHalfTime
    );
    event RampAGamma(
        uint256 initialA,
        uint256 futureA,
        uint256 initialGamma,
        uint256 futureGamma,
        uint256 initialTime,
        uint256 futureTime
    );
    event StopRampA(uint256 currentA, uint256 currentGamma, uint256 time);
    event ClaimAdminFee(address indexed admin, uint256 tokens);
    event TweakPrice(uint256 priceScale, uint256 newD, uint256 virtualPrice, uint256 xcpProfit);

    function lpPrice() external view returns (uint256);

    function gamma() external view returns (uint256);

    function midFee() external view returns (uint256);

    function outFee() external view returns (uint256);

    function priceOracle() external view returns (uint256);

    function addLiquidity(uint256[] calldata amounts, uint256 minMintAmount) external returns (uint256, uint256);

    function calcDeposit(uint256[] calldata amounts) external view returns (uint256, uint256);

    function removeLiquidityOneCoin(
        uint256 tokenAmount,
        uint256 i,
        uint256 minAmount
    ) external returns (uint256, uint256);

    function calcWithdrawOneCoin(uint256 tokenAmount, uint256 i) external view returns (uint256, uint256);

    function claimableAdminFee() external view returns (uint256);

    function claimAdminFee() external;

    function rampAGamma(uint32 futureA, uint64 futureGamma, uint32 futureTime) external;

    function stopRampAGamma() external;

    function commitNewParameters(
        uint256 _newMidFee,
        uint256 _newOutFee,
        uint256 _newAdminFee,
        uint256 _newFlashLoanFee,
        uint256 _newFeeGamma,
        uint256 _newAllowedExtraProfit,
        uint256 _newRebalancingThreshold,
        uint256 _newAdjustmentStep,
        uint256 _newMaHalfTime
    ) external;

    function applyNewParameters() external;

    function revertNewParameters() external;

    struct InitializeArgs {
        uint32 A;
        uint64 gamma;
        uint256 midFee;
        uint256 outFee;
        uint256 allowedExtraProfit;
        uint256 minRemainingPostRebalanceRatio;
        uint256 feeGamma;
        uint256 adjustmentStep;
        uint256 adminFee;
        uint256 flashLoanFee;
        uint256 maHalfTime;
        uint256 initialPrice;
        address[] coins;
    }

    function priceScale() external view returns (uint256);

    function lastPrices() external view returns (uint256);

    function lastPricesTimestamp() external view returns (uint256);

    function initialA() external view returns (uint32);

    function futureA() external view returns (uint32);

    function initialGamma() external view returns (uint64);

    function futureGamma() external view returns (uint64);

    function initialAGammaTime() external view returns (uint32);

    function futureAGammaTime() external view returns (uint32);

    function allowedExtraProfit() external view returns (uint256);

    function futureAllowedExtraProfit() external view returns (uint256);

    function minRemainingPostRebalanceRatio() external view returns (uint256);

    function futureRebalancingThreshold() external view returns (uint256);

    function feeGamma() external view returns (uint256);

    function futureFeeGamma() external view returns (uint256);

    function adjustmentStep() external view returns (uint256);

    function futureAdjustmentStep() external view returns (uint256);

    function maHalfTime() external view returns (uint256);

    function futureMaHalfTime() external view returns (uint256);

    function futureMidFee() external view returns (uint256);

    function futureOutFee() external view returns (uint256);

    function futureAdminFee() external view returns (uint256);

    function futureFlashLoanFee() external view returns (uint256);

    function D() external view returns (uint256);

    function xcpProfit() external view returns (uint256);

    function xcpProfitA() external view returns (uint256);

    function virtualPrice() external view returns (uint256);

    function adminActionsDeadline() external view returns (uint256);
}

File 7 of 16 : IKokonutSwapFlashCallback.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IKokonutSwapFlashCallback {
    function onFlashLoan(
        address initiator,
        uint256[] calldata amounts,
        uint256[] calldata fees,
        bytes calldata data
    ) external;
}

File 8 of 16 : IKokonutSwapPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

import "./IKokonutSwapFlashCallback.sol";

interface IKokonutSwapPool {
    event TokenExchange(
        address indexed buyer,
        uint256 soldId,
        uint256 tokensSold,
        uint256 boughtId,
        uint256 tokensBought,
        uint256 fee
    );
    event RemoveLiquidity(address indexed provider, uint256[] tokenAmounts, uint256 tokenSupply);
    event FlashLoan(address indexed borrower, uint256[] amounts, uint256[] fees);

    function N_COINS() external view returns (uint256);

    function balances(uint256 i) external view returns (uint256);

    function token() external view returns (address);

    function coins(uint256 i) external view returns (address);

    function getPrice(uint256 i, uint256 j) external view returns (uint256);

    function getVirtualPrice() external view returns (uint256);

    function A() external view returns (uint256);

    function fee() external view returns (uint256);

    function adminFee() external view returns (uint256);

    function exchange(
        uint256 i,
        uint256 j,
        uint256 dx,
        uint256 minDy,
        bytes calldata data
    ) external returns (uint256, uint256);

    function flashLoanFee() external view returns (uint256);

    function removeLiquidity(uint256 amount, uint256[] calldata minAmounts) external returns (uint256[] memory);

    function getDy(uint256 i, uint256 j, uint256 dx) external view returns (uint256, uint256);

    function calcWithdraw(uint256 amount) external view returns (uint256[] memory);

    function flashLoan(IKokonutSwapFlashCallback borrower, uint256[] calldata amounts, bytes calldata data) external;

    function withdrawLostToken(address token, uint256 amount, address to) external;
}

File 9 of 16 : IMetaPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

import "./IStableSwap.sol";

interface IMetaPool is IStableSwap {
    function basePool() external view returns (address);

    function exchangeUnderlying(uint256 i, uint256 j, uint256 dx, uint256 minDy) external returns (uint256, uint256);

    event TokenExchangeUnderlying(
        address indexed buyer,
        uint256 soldId,
        uint256 tokensSold,
        uint256 boughtId,
        uint256 tokensBought,
        uint256 fee
    );
}

File 10 of 16 : IRouter.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

import "./IKokonutSwapPool.sol";

interface IRouter {
    event SwapWithPath(
        address user,
        address inputToken,
        uint256 inputAmount,
        address outputToken,
        uint256 outputAmount
    );

    function getPrice(address[] calldata path, uint256[3][] calldata swapParams) external view returns (uint256);

    function getDy(
        address[] calldata path,
        uint256[3][] calldata swapParams,
        uint256 amount
    ) external view returns (uint256[] memory);

    function getDyWithoutFee(
        address[] calldata path,
        uint256[3][] calldata swapParams,
        uint256 amount
    ) external view returns (uint256[] memory);

    function swapWithPath(
        address[] calldata path,
        uint256[3][] calldata swapParams,
        uint256 amount,
        uint256 minAmount
    ) external payable returns (uint256[] memory);

    function addLiquidity(
        address pool,
        uint256 poolType,
        uint256[] calldata amounts,
        uint256 minMintAmount
    ) external payable returns (uint256);
}

File 11 of 16 : IStableSwap.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

import "./IKokonutSwapPool.sol";

interface IStableSwap is IKokonutSwapPool {
    event AddLiquidity(
        address indexed provider,
        uint256[] tokenAmounts,
        uint256[] feeAmounts,
        uint256 invariant,
        uint256 tokenSupply
    );
    event RemoveLiquidityOne(
        address indexed provider,
        uint256 i,
        uint256 tokenAmount,
        uint256 feeAmount,
        uint256 tokenSupply
    );
    event RemoveLiquidityImbalance(
        address indexed provider,
        uint256[] tokenAmounts,
        uint256[] fees,
        uint256 invariant,
        uint256 tokenSupply
    );
    event CommitNewOwner(uint256 indexed deadline, address indexed owner);
    event CommitNewFee(uint256 indexed deadine, uint256 fee, uint256 adminFee);
    event NewFee(uint256 fee, uint256 adminFee);
    event RampA(uint256 oldA, uint256 newA, uint256 initialTime, uint256 futureTime);
    event StopRampA(uint256 A, uint256 t);

    function APrecise() external view returns (uint256);

    function getLpPrice(uint256 i) external view returns (uint256);

    function getDx(uint256 i, uint256 j, uint256 dy) external view returns (uint256);

    function getDyUnderlying(uint256 i, uint256 j, uint256 dx) external view returns (uint256, uint256);

    function addLiquidity(
        uint256[] calldata amounts,
        uint256 minMintAmount
    ) external returns (uint256, uint256[] memory);

    function removeLiquidityImbalance(uint256[] calldata amounts, uint256 maxBurnAmount) external returns (uint256);

    function removeLiquidityOneCoin(
        uint256 tokenAmount,
        uint256 i,
        uint256 minAmount
    ) external returns (uint256, uint256);

    function calcDeposit(uint256[] calldata amounts) external view returns (uint256, uint256[] memory);

    function calcWithdraw(uint256[] calldata amounts) external view returns (uint256, uint256);

    function calcWithdrawOneCoin(uint256 tokenAmount, uint256 i) external view returns (uint256, uint256);

    function rampA(uint256 _futureA, uint256 _futureTime) external;

    function stopRampA() external;

    function commitNewFee(uint256 newFee, uint256 newAdminFee) external;

    function applyNewFee() external;

    function revertNewParameters() external;

    function transferOwnership(address newOwner) external;

    function applyTransferOwnership() external;

    function revertTransferOwnership() external;

    function adminBalances(uint256 i) external view returns (uint256);

    function adminBalanceList() external view returns (uint256[] memory balances_);

    function withdrawAdminFees(address recipient) external;

    function donateAdminFees() external;

    function initialA() external view returns (uint256);

    function futureA() external view returns (uint256);

    function initialATime() external view returns (uint256);

    function futureATime() external view returns (uint256);

    function adminActionsDeadline() external view returns (uint256);

    function transferOwnershipDeadline() external view returns (uint256);

    function futureFee() external view returns (uint256);

    function futureAdminFee() external view returns (uint256);

    function futureOwner() external view returns (address);
}

File 12 of 16 : IWETH.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IWETH is IERC20 {
    function deposit() external payable;

    function withdraw(uint256 wad) external;
}

File 13 of 16 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

abstract contract Ownable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    constructor() {
        _transferOwnership(msg.sender);
    }

    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    function owner() public view virtual returns (address) {
        return _owner;
    }

    function _checkOwner() internal view virtual {
        require(owner() == msg.sender, "Ownable");
    }

    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable");
        _transferOwnership(newOwner);
    }

    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 14 of 16 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

abstract contract Pausable {
    event Paused(address account);
    event Unpaused(address account);

    bool private _paused;

    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    modifier whenPaused() {
        _requirePaused();
        _;
    }

    function paused() public view virtual returns (bool) {
        return _paused;
    }

    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable");
    }

    function _requirePaused() internal view virtual {
        require(paused(), "Pausable");
    }

    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(msg.sender);
    }

    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(msg.sender);
    }
}

File 15 of 16 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)
// Modified by KokonutSwap

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "Reentrant");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function reentrancyGuardEntered() public view returns (bool) {
        return _status == _ENTERED;
    }
}

File 16 of 16 : ZKokonutAccess.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

import "../library/Pausable.sol";
import "../library/Ownable.sol";

abstract contract ZKokonutAccess is Ownable, Pausable {
    function _initializeZKokonutAccess(address owner_) internal {
        _transferOwnership(owner_);
    }

    function pause() public onlyOwner {
        _pause();
    }

    function unpause() public onlyOwner {
        _unpause();
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"wethAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"inputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"outputAmount","type":"uint256"}],"name":"SwapWithPath","type":"event"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"poolType","type":"uint256"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"minMintAmount","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256[3][]","name":"swapParams","type":"uint256[3][]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getDy","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256[3][]","name":"swapParams","type":"uint256[3][]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getDyWithoutFee","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256[3][]","name":"swapParams","type":"uint256[3][]"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApproved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reentrancyGuardEntered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256[3][]","name":"swapParams","type":"uint256[3][]"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"}],"name":"swapWithPath","outputs":[{"internalType":"uint256[]","name":"outputs","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a060405234801561001057600080fd5b50604051620023a5380380620023a583398101604081905261003191610047565b60016000556001600160a01b0316608052610077565b60006020828403121561005957600080fd5b81516001600160a01b038116811461007057600080fd5b9392505050565b6080516122be620000e760003960008181610343015281816103b7015281816106c0015281816107a6015281816109d801528181610ab901528181610b4c01528181610c1e01528181610cbe01528181610e730152818161109b0152818161123c015261136501526122be6000f3fe6080604052600436106100745760003560e01c806349e52a5b1161004e57806349e52a5b146100f7578063a389783e14610117578063b864484414610162578063d2c725e01461017557600080fd5b80630318b8121461008057806304fa1648146100b657806329cccf7e146100d757600080fd5b3661007b57005b600080fd5b34801561008c57600080fd5b506100a061009b366004611cb3565b61018d565b6040516100ad9190611d62565b60405180910390f35b6100c96100c4366004611dff565b6101a8565b6040519081526020016100ad565b3480156100e357600080fd5b506100a06100f2366004611cb3565b610671565b34801561010357600080fd5b506100c9610112366004611eb9565b610682565b34801561012357600080fd5b50610152610132366004611f25565b600160209081526000928352604080842090915290825290205460ff1681565b60405190151581526020016100ad565b6100a0610170366004611f5e565b610938565b34801561018157600080fd5b50600054600214610152565b606061019e868686868660016111fd565b9695505050505050565b60006101b261158f565b6000856001600160a01b031663293577506040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102169190611fdc565b90508084511461026d5760405162461bcd60e51b815260206004820152600c60248201527f77726f6e67206c656e677468000000000000000000000000000000000000000060448201526064015b60405180910390fd5b60005b818110156104675760405163c661065760e01b8152600481018290526000906001600160a01b0389169063c661065790602401602060405180830381865afa1580156102c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e49190611ff5565b905060008683815181106102fa576102fa612012565b6020026020010151111561034157610341333088858151811061031f5761031f612012565b6020026020010151846001600160a01b03166115e8909392919063ffffffff16565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03161480156103825750600034115b1561042a573486838151811061039a5761039a612012565b602002602001018181516103ae919061203e565b915081815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561041057600080fd5b505af1158015610424573d6000803e3d6000fd5b50505050505b600086838151811061043e5761043e612012565b6020026020010151111561045657610456888261169f565b5061046081612057565b9050610270565b506000866001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cc9190611ff5565b905085600103610553576040516318b7662d60e31b81526001600160a01b0388169063c5bb3168906105049088908890600401612070565b6000604051808303816000875af1158015610523573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261054b9190810190612092565b509250610649565b85600203610589576040516318b7662d60e31b81526001600160a01b0388169063c5bb3168906105049088908890600401612070565b85600303610601576040516318b7662d60e31b81526001600160a01b0388169063c5bb3168906105bf9088908890600401612070565b60408051808303816000875af11580156105dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054b919061212f565b60405162461bcd60e51b815260206004820152600d60248201527f42616420737761702074797065000000000000000000000000000000000000006044820152606401610264565b61065d6001600160a01b0382163385611719565b50506106696001600055565b949350505050565b606061019e868686868660006111fd565b6000808585600081811061069857610698612012565b90506020020160208101906106ad9190612153565b90506001600160a01b0381166106e057507f00000000000000000000000000000000000000000000000000000000000000005b670de0b6b3a7640000915060015b6106f9600287612170565b61070490600161203e565b81101561092e5760008787600161071c856002612192565b61072691906121a9565b81811061073557610735612012565b905060200201602081019061074a9190612153565b90506001600160a01b038116610760575061092e565b6000888861076f856002612192565b81811061077e5761077e612012565b90506020020160208101906107939190612153565b90506001600160a01b0381166107c657507f00000000000000000000000000000000000000000000000000000000000000005b3687876107d46001876121a9565b8181106107e3576107e3612012565b90506060020190506107f785838584611767565b60408101356001036108c157670de0b6b3a76400006001600160a01b038416635cf4ee918360005b60405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526020918202929092013560048301528501356024820152604401602060405180830381865afa158015610882573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a69190611fdc565b6108b09088612192565b6108ba9190612170565b9550610919565b60408101356002036108ed57670de0b6b3a76400006001600160a01b038416635cf4ee9183600061081f565b604081013560030361060157670de0b6b3a76400006001600160a01b038416635cf4ee9183600061081f565b509250610927905081612057565b90506106ee565b5050949350505050565b606061094261158f565b60008787600081811061095757610957612012565b905060200201602081019061096c9190612153565b905060008461097c60028a612170565b67ffffffffffffffff81111561099457610994611d94565b6040519080825280602002602001820160405280156109bd578160200160208202803683370190505b5093506001600160a01b038316610b795785341115610ab7577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a3157600080fd5b505af1158015610a45573d6000803e3d6000fd5b50505050506000336001600160a01b03168734610a6291906121a9565b604051600081818185875af1925050503d8060008114610a9e576040519150601f19603f3d011682016040523d82523d6000602084013e610aa3565b606091505b5050905080610ab157600080fd5b50610b99565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610b1257600080fd5b505af1158015610b26573d6000803e3d6000fd5b505050505085341015610b7457610b743330610b42348a6121a9565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169291906115e8565b610b99565b3415610b8457600080fd5b610b996001600160a01b0384163330896115e8565b60015b610ba760028b612170565b610bb290600161203e565b811015610fbf5760008b8b6001610bca856002612192565b610bd491906121a9565b818110610be357610be3612012565b9050602002016020810190610bf89190612153565b90506001600160a01b038116610c0e5750610fbf565b6001600160a01b038516610c40577f000000000000000000000000000000000000000000000000000000000000000094505b8b8b610c4d846002612192565b818110610c5c57610c5c612012565b9050602002016020810190610c719190612153565b9350368a8a610c816001866121a9565b818110610c9057610c90612012565b9050606002019050610ce58660006001600160a01b0316876001600160a01b031614610cbc5786610cde565b7f00000000000000000000000000000000000000000000000000000000000000005b8484611767565b610cef828761169f565b60006040820135600103610d9b576001600160a01b0383166377adb3f08360005b604080516000808252602082810190935292820293909301359290870135918f916040518663ffffffff1660e01b8152600401610d5195949392919061220c565b60408051808303816000875af1158015610d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d93919061212f565b509050610e28565b6040820135600203610e05576040517f464327540000000000000000000000000000000000000000000000000000000081528235600482015260208301356024820152604481018b9052600060648201526001600160a01b03841690634643275490608401610d51565b6040820135600303610601576001600160a01b0383166377adb3f0836000610d10565b8088610e356001876121a9565b81518110610e4557610e45612012565b60209081029190910101526001600160a01b038616610eed576040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee69190611fdc565b9950610f58565b6040516370a0823160e01b81523060048201526001600160a01b038716906370a0823190602401602060405180830381865afa158015610f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f559190611fdc565b99505b89600003610fa85760405162461bcd60e51b815260206004820152601060248201527f5265636569766564206e6f7468696e67000000000000000000000000000000006044820152606401610264565b85965050505080610fb890612057565b9050610b9c565b5084861015610fcd57600080fd5b8989610fda6001826121a9565b818110610fe957610fe9612012565b9050602002016020810190610ffe9190612153565b6001600160a01b0316826001600160a01b03161461105e5760405162461bcd60e51b815260206004820152600c60248201527f77726f6e67206f757470757400000000000000000000000000000000000000006044820152606401610264565b6001600160a01b03821661115a576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156110e757600080fd5b505af11580156110fb573d6000803e3d6000fd5b50506040516000925033915088908381818185875af1925050503d8060008114611141576040519150601f19603f3d011682016040523d82523d6000602084013e611146565b606091505b505090508061115457600080fd5b5061116e565b61116e6001600160a01b0383163388611719565b7fc962647aaa07feb4e0f812d101efd0874b4fe5160b7799bfd61cf192a6752d2a338b8b60008181106111a3576111a3612012565b90506020020160208101906111b89190612153565b604080516001600160a01b0393841681529183166020830152810184905290841660608201526080810188905260a00160405180910390a150505061019e6001600055565b606060008787600081811061121457611214612012565b90506020020160208101906112299190612153565b90506001600160a01b03811661125c57507f00000000000000000000000000000000000000000000000000000000000000005b6000611269600289612170565b67ffffffffffffffff81111561128157611281611d94565b6040519080825280602002602001820160405280156112aa578160200160208202803683370190505b50925060015b6112bb60028a612170565b6112c690600161203e565b8110156115825760008a8a60016112de856002612192565b6112e891906121a9565b8181106112f7576112f7612012565b905060200201602081019061130c9190612153565b90506001600160a01b0381166113225750611582565b8a8a61132f846002612192565b81811061133e5761133e612012565b90506020020160208101906113539190612153565b92506001600160a01b038316611387577f000000000000000000000000000000000000000000000000000000000000000092505b3689896113956001866121a9565b8181106113a4576113a4612012565b90506060020190506113b885858484611767565b6000806040830135600103611471576001600160a01b03841663580680d88460005b60405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526020918202929092013560048301528601356024820152604481018d90526064016040805180830381865afa158015611443573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611467919061212f565b90925090506114b7565b6040830135600203611494576001600160a01b03841663c5a152868460006113da565b6040830135600303610601576001600160a01b03841663580680d88460006113da565b886114c257816114cc565b6114cc818361203e565b886114d86001886121a9565b815181106114e8576114e8612012565b602002602001018181525050896000036115445760405162461bcd60e51b815260206004820152601060248201527f5265636569766564206e6f7468696e67000000000000000000000000000000006044820152606401610264565b876115506001876121a9565b8151811061156057611560612012565b60200260200101519950859650505050508061157b90612057565b90506112b0565b5050509695505050505050565b6002600054036115e15760405162461bcd60e51b815260206004820152600960248201527f5265656e7472616e7400000000000000000000000000000000000000000000006044820152606401610264565b6002600055565b6040516001600160a01b03808516602483015283166044820152606481018290526116999085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526118cc565b50505050565b6001600160a01b0380821660009081526001602090815260408083209386168352929052205460ff16611715576116e26001600160a01b038216836000196119b1565b6001600160a01b0380821660009081526001602081815260408084209487168452939052919020805460ff191690911790555b5050565b6040516001600160a01b0383166024820152604481018290526117629084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611635565b505050565b60405163c661065760e01b8152813560048201526001600160a01b03858116919084169063c661065790602401602060405180830381865afa1580156117b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d59190611ff5565b6001600160a01b0316146118185760405162461bcd60e51b815260206004820152600a6024820152697377617020706172616d60b01b6044820152606401610264565b60405163c661065760e01b8152602082013560048201526001600160a01b03848116919084169063c661065790602401602060405180830381865afa158015611865573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118899190611ff5565b6001600160a01b0316146116995760405162461bcd60e51b815260206004820152600a6024820152697377617020706172616d60b01b6044820152606401610264565b6000611921826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611aff9092919063ffffffff16565b805190915015611762578080602001905181019061193f9190612237565b6117625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610264565b801580611a4457506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a429190611fdc565b155b611ab65760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610264565b6040516001600160a01b0383166024820152604481018290526117629084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611635565b6060610669848460008585600080866001600160a01b03168587604051611b269190612259565b60006040518083038185875af1925050503d8060008114611b63576040519150601f19603f3d011682016040523d82523d6000602084013e611b68565b606091505b5091509150611b7987838387611b84565b979650505050505050565b60608315611bf3578251600003611bec576001600160a01b0385163b611bec5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610264565b5081610669565b6106698383815115611c085781518083602001fd5b8060405162461bcd60e51b81526004016102649190612275565b60008083601f840112611c3457600080fd5b50813567ffffffffffffffff811115611c4c57600080fd5b6020830191508360208260051b8501011115611c6757600080fd5b9250929050565b60008083601f840112611c8057600080fd5b50813567ffffffffffffffff811115611c9857600080fd5b602083019150836020606083028501011115611c6757600080fd5b600080600080600060608688031215611ccb57600080fd5b853567ffffffffffffffff80821115611ce357600080fd5b611cef89838a01611c22565b90975095506020880135915080821115611d0857600080fd5b50611d1588828901611c6e565b96999598509660400135949350505050565b600081518084526020808501945080840160005b83811015611d5757815187529582019590820190600101611d3b565b509495945050505050565b602081526000611d756020830184611d27565b9392505050565b6001600160a01b0381168114611d9157600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611dd357611dd3611d94565b604052919050565b600067ffffffffffffffff821115611df557611df5611d94565b5060051b60200190565b60008060008060808587031215611e1557600080fd5b8435611e2081611d7c565b93506020858101359350604086013567ffffffffffffffff811115611e4457600080fd5b8601601f81018813611e5557600080fd5b8035611e68611e6382611ddb565b611daa565b81815260059190911b8201830190838101908a831115611e8757600080fd5b928401925b82841015611ea557833582529284019290840190611e8c565b979a96995096976060013596505050505050565b60008060008060408587031215611ecf57600080fd5b843567ffffffffffffffff80821115611ee757600080fd5b611ef388838901611c22565b90965094506020870135915080821115611f0c57600080fd5b50611f1987828801611c6e565b95989497509550505050565b60008060408385031215611f3857600080fd5b8235611f4381611d7c565b91506020830135611f5381611d7c565b809150509250929050565b60008060008060008060808789031215611f7757600080fd5b863567ffffffffffffffff80821115611f8f57600080fd5b611f9b8a838b01611c22565b90985096506020890135915080821115611fb457600080fd5b50611fc189828a01611c6e565b979a9699509760408101359660609091013595509350505050565b600060208284031215611fee57600080fd5b5051919050565b60006020828403121561200757600080fd5b8151611d7581611d7c565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561205157612051612028565b92915050565b60006001820161206957612069612028565b5060010190565b6040815260006120836040830185611d27565b90508260208301529392505050565b600080604083850312156120a557600080fd5b8251915060208084015167ffffffffffffffff8111156120c457600080fd5b8401601f810186136120d557600080fd5b80516120e3611e6382611ddb565b81815260059190911b8201830190838101908883111561210257600080fd5b928401925b8284101561212057835182529284019290840190612107565b80955050505050509250929050565b6000806040838503121561214257600080fd5b505080516020909101519092909150565b60006020828403121561216557600080fd5b8135611d7581611d7c565b60008261218d57634e487b7160e01b600052601260045260246000fd5b500490565b808202811582820484141761205157612051612028565b8181038181111561205157612051612028565b60005b838110156121d75781810151838201526020016121bf565b50506000910152565b600081518084526121f88160208601602086016121bc565b601f01601f19169290920160200192915050565b85815284602082015283604082015282606082015260a060808201526000611b7960a08301846121e0565b60006020828403121561224957600080fd5b81518015158114611d7557600080fd5b6000825161226b8184602087016121bc565b9190910192915050565b602081526000611d7560208301846121e056fea264697066735822122095e4c0e7cf4323fefddb3d46f8329752e7f966460a492d3e7c27ac1dc717d10f64736f6c634300081100330000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9

Deployed Bytecode

0x6080604052600436106100745760003560e01c806349e52a5b1161004e57806349e52a5b146100f7578063a389783e14610117578063b864484414610162578063d2c725e01461017557600080fd5b80630318b8121461008057806304fa1648146100b657806329cccf7e146100d757600080fd5b3661007b57005b600080fd5b34801561008c57600080fd5b506100a061009b366004611cb3565b61018d565b6040516100ad9190611d62565b60405180910390f35b6100c96100c4366004611dff565b6101a8565b6040519081526020016100ad565b3480156100e357600080fd5b506100a06100f2366004611cb3565b610671565b34801561010357600080fd5b506100c9610112366004611eb9565b610682565b34801561012357600080fd5b50610152610132366004611f25565b600160209081526000928352604080842090915290825290205460ff1681565b60405190151581526020016100ad565b6100a0610170366004611f5e565b610938565b34801561018157600080fd5b50600054600214610152565b606061019e868686868660016111fd565b9695505050505050565b60006101b261158f565b6000856001600160a01b031663293577506040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102169190611fdc565b90508084511461026d5760405162461bcd60e51b815260206004820152600c60248201527f77726f6e67206c656e677468000000000000000000000000000000000000000060448201526064015b60405180910390fd5b60005b818110156104675760405163c661065760e01b8152600481018290526000906001600160a01b0389169063c661065790602401602060405180830381865afa1580156102c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e49190611ff5565b905060008683815181106102fa576102fa612012565b6020026020010151111561034157610341333088858151811061031f5761031f612012565b6020026020010151846001600160a01b03166115e8909392919063ffffffff16565b7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96001600160a01b0316816001600160a01b03161480156103825750600034115b1561042a573486838151811061039a5761039a612012565b602002602001018181516103ae919061203e565b915081815250507f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561041057600080fd5b505af1158015610424573d6000803e3d6000fd5b50505050505b600086838151811061043e5761043e612012565b6020026020010151111561045657610456888261169f565b5061046081612057565b9050610270565b506000866001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cc9190611ff5565b905085600103610553576040516318b7662d60e31b81526001600160a01b0388169063c5bb3168906105049088908890600401612070565b6000604051808303816000875af1158015610523573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261054b9190810190612092565b509250610649565b85600203610589576040516318b7662d60e31b81526001600160a01b0388169063c5bb3168906105049088908890600401612070565b85600303610601576040516318b7662d60e31b81526001600160a01b0388169063c5bb3168906105bf9088908890600401612070565b60408051808303816000875af11580156105dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054b919061212f565b60405162461bcd60e51b815260206004820152600d60248201527f42616420737761702074797065000000000000000000000000000000000000006044820152606401610264565b61065d6001600160a01b0382163385611719565b50506106696001600055565b949350505050565b606061019e868686868660006111fd565b6000808585600081811061069857610698612012565b90506020020160208101906106ad9190612153565b90506001600160a01b0381166106e057507f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e95b670de0b6b3a7640000915060015b6106f9600287612170565b61070490600161203e565b81101561092e5760008787600161071c856002612192565b61072691906121a9565b81811061073557610735612012565b905060200201602081019061074a9190612153565b90506001600160a01b038116610760575061092e565b6000888861076f856002612192565b81811061077e5761077e612012565b90506020020160208101906107939190612153565b90506001600160a01b0381166107c657507f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e95b3687876107d46001876121a9565b8181106107e3576107e3612012565b90506060020190506107f785838584611767565b60408101356001036108c157670de0b6b3a76400006001600160a01b038416635cf4ee918360005b60405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526020918202929092013560048301528501356024820152604401602060405180830381865afa158015610882573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a69190611fdc565b6108b09088612192565b6108ba9190612170565b9550610919565b60408101356002036108ed57670de0b6b3a76400006001600160a01b038416635cf4ee9183600061081f565b604081013560030361060157670de0b6b3a76400006001600160a01b038416635cf4ee9183600061081f565b509250610927905081612057565b90506106ee565b5050949350505050565b606061094261158f565b60008787600081811061095757610957612012565b905060200201602081019061096c9190612153565b905060008461097c60028a612170565b67ffffffffffffffff81111561099457610994611d94565b6040519080825280602002602001820160405280156109bd578160200160208202803683370190505b5093506001600160a01b038316610b795785341115610ab7577f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a3157600080fd5b505af1158015610a45573d6000803e3d6000fd5b50505050506000336001600160a01b03168734610a6291906121a9565b604051600081818185875af1925050503d8060008114610a9e576040519150601f19603f3d011682016040523d82523d6000602084013e610aa3565b606091505b5050905080610ab157600080fd5b50610b99565b7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610b1257600080fd5b505af1158015610b26573d6000803e3d6000fd5b505050505085341015610b7457610b743330610b42348a6121a9565b6001600160a01b037f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9169291906115e8565b610b99565b3415610b8457600080fd5b610b996001600160a01b0384163330896115e8565b60015b610ba760028b612170565b610bb290600161203e565b811015610fbf5760008b8b6001610bca856002612192565b610bd491906121a9565b818110610be357610be3612012565b9050602002016020810190610bf89190612153565b90506001600160a01b038116610c0e5750610fbf565b6001600160a01b038516610c40577f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e994505b8b8b610c4d846002612192565b818110610c5c57610c5c612012565b9050602002016020810190610c719190612153565b9350368a8a610c816001866121a9565b818110610c9057610c90612012565b9050606002019050610ce58660006001600160a01b0316876001600160a01b031614610cbc5786610cde565b7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e95b8484611767565b610cef828761169f565b60006040820135600103610d9b576001600160a01b0383166377adb3f08360005b604080516000808252602082810190935292820293909301359290870135918f916040518663ffffffff1660e01b8152600401610d5195949392919061220c565b60408051808303816000875af1158015610d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d93919061212f565b509050610e28565b6040820135600203610e05576040517f464327540000000000000000000000000000000000000000000000000000000081528235600482015260208301356024820152604481018b9052600060648201526001600160a01b03841690634643275490608401610d51565b6040820135600303610601576001600160a01b0383166377adb3f0836000610d10565b8088610e356001876121a9565b81518110610e4557610e45612012565b60209081029190910101526001600160a01b038616610eed576040516370a0823160e01b81523060048201527f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96001600160a01b0316906370a0823190602401602060405180830381865afa158015610ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee69190611fdc565b9950610f58565b6040516370a0823160e01b81523060048201526001600160a01b038716906370a0823190602401602060405180830381865afa158015610f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f559190611fdc565b99505b89600003610fa85760405162461bcd60e51b815260206004820152601060248201527f5265636569766564206e6f7468696e67000000000000000000000000000000006044820152606401610264565b85965050505080610fb890612057565b9050610b9c565b5084861015610fcd57600080fd5b8989610fda6001826121a9565b818110610fe957610fe9612012565b9050602002016020810190610ffe9190612153565b6001600160a01b0316826001600160a01b03161461105e5760405162461bcd60e51b815260206004820152600c60248201527f77726f6e67206f757470757400000000000000000000000000000000000000006044820152606401610264565b6001600160a01b03821661115a576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018790527f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156110e757600080fd5b505af11580156110fb573d6000803e3d6000fd5b50506040516000925033915088908381818185875af1925050503d8060008114611141576040519150601f19603f3d011682016040523d82523d6000602084013e611146565b606091505b505090508061115457600080fd5b5061116e565b61116e6001600160a01b0383163388611719565b7fc962647aaa07feb4e0f812d101efd0874b4fe5160b7799bfd61cf192a6752d2a338b8b60008181106111a3576111a3612012565b90506020020160208101906111b89190612153565b604080516001600160a01b0393841681529183166020830152810184905290841660608201526080810188905260a00160405180910390a150505061019e6001600055565b606060008787600081811061121457611214612012565b90506020020160208101906112299190612153565b90506001600160a01b03811661125c57507f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e95b6000611269600289612170565b67ffffffffffffffff81111561128157611281611d94565b6040519080825280602002602001820160405280156112aa578160200160208202803683370190505b50925060015b6112bb60028a612170565b6112c690600161203e565b8110156115825760008a8a60016112de856002612192565b6112e891906121a9565b8181106112f7576112f7612012565b905060200201602081019061130c9190612153565b90506001600160a01b0381166113225750611582565b8a8a61132f846002612192565b81811061133e5761133e612012565b90506020020160208101906113539190612153565b92506001600160a01b038316611387577f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e992505b3689896113956001866121a9565b8181106113a4576113a4612012565b90506060020190506113b885858484611767565b6000806040830135600103611471576001600160a01b03841663580680d88460005b60405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526020918202929092013560048301528601356024820152604481018d90526064016040805180830381865afa158015611443573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611467919061212f565b90925090506114b7565b6040830135600203611494576001600160a01b03841663c5a152868460006113da565b6040830135600303610601576001600160a01b03841663580680d88460006113da565b886114c257816114cc565b6114cc818361203e565b886114d86001886121a9565b815181106114e8576114e8612012565b602002602001018181525050896000036115445760405162461bcd60e51b815260206004820152601060248201527f5265636569766564206e6f7468696e67000000000000000000000000000000006044820152606401610264565b876115506001876121a9565b8151811061156057611560612012565b60200260200101519950859650505050508061157b90612057565b90506112b0565b5050509695505050505050565b6002600054036115e15760405162461bcd60e51b815260206004820152600960248201527f5265656e7472616e7400000000000000000000000000000000000000000000006044820152606401610264565b6002600055565b6040516001600160a01b03808516602483015283166044820152606481018290526116999085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526118cc565b50505050565b6001600160a01b0380821660009081526001602090815260408083209386168352929052205460ff16611715576116e26001600160a01b038216836000196119b1565b6001600160a01b0380821660009081526001602081815260408084209487168452939052919020805460ff191690911790555b5050565b6040516001600160a01b0383166024820152604481018290526117629084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611635565b505050565b60405163c661065760e01b8152813560048201526001600160a01b03858116919084169063c661065790602401602060405180830381865afa1580156117b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d59190611ff5565b6001600160a01b0316146118185760405162461bcd60e51b815260206004820152600a6024820152697377617020706172616d60b01b6044820152606401610264565b60405163c661065760e01b8152602082013560048201526001600160a01b03848116919084169063c661065790602401602060405180830381865afa158015611865573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118899190611ff5565b6001600160a01b0316146116995760405162461bcd60e51b815260206004820152600a6024820152697377617020706172616d60b01b6044820152606401610264565b6000611921826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611aff9092919063ffffffff16565b805190915015611762578080602001905181019061193f9190612237565b6117625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610264565b801580611a4457506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a429190611fdc565b155b611ab65760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610264565b6040516001600160a01b0383166024820152604481018290526117629084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611635565b6060610669848460008585600080866001600160a01b03168587604051611b269190612259565b60006040518083038185875af1925050503d8060008114611b63576040519150601f19603f3d011682016040523d82523d6000602084013e611b68565b606091505b5091509150611b7987838387611b84565b979650505050505050565b60608315611bf3578251600003611bec576001600160a01b0385163b611bec5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610264565b5081610669565b6106698383815115611c085781518083602001fd5b8060405162461bcd60e51b81526004016102649190612275565b60008083601f840112611c3457600080fd5b50813567ffffffffffffffff811115611c4c57600080fd5b6020830191508360208260051b8501011115611c6757600080fd5b9250929050565b60008083601f840112611c8057600080fd5b50813567ffffffffffffffff811115611c9857600080fd5b602083019150836020606083028501011115611c6757600080fd5b600080600080600060608688031215611ccb57600080fd5b853567ffffffffffffffff80821115611ce357600080fd5b611cef89838a01611c22565b90975095506020880135915080821115611d0857600080fd5b50611d1588828901611c6e565b96999598509660400135949350505050565b600081518084526020808501945080840160005b83811015611d5757815187529582019590820190600101611d3b565b509495945050505050565b602081526000611d756020830184611d27565b9392505050565b6001600160a01b0381168114611d9157600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611dd357611dd3611d94565b604052919050565b600067ffffffffffffffff821115611df557611df5611d94565b5060051b60200190565b60008060008060808587031215611e1557600080fd5b8435611e2081611d7c565b93506020858101359350604086013567ffffffffffffffff811115611e4457600080fd5b8601601f81018813611e5557600080fd5b8035611e68611e6382611ddb565b611daa565b81815260059190911b8201830190838101908a831115611e8757600080fd5b928401925b82841015611ea557833582529284019290840190611e8c565b979a96995096976060013596505050505050565b60008060008060408587031215611ecf57600080fd5b843567ffffffffffffffff80821115611ee757600080fd5b611ef388838901611c22565b90965094506020870135915080821115611f0c57600080fd5b50611f1987828801611c6e565b95989497509550505050565b60008060408385031215611f3857600080fd5b8235611f4381611d7c565b91506020830135611f5381611d7c565b809150509250929050565b60008060008060008060808789031215611f7757600080fd5b863567ffffffffffffffff80821115611f8f57600080fd5b611f9b8a838b01611c22565b90985096506020890135915080821115611fb457600080fd5b50611fc189828a01611c6e565b979a9699509760408101359660609091013595509350505050565b600060208284031215611fee57600080fd5b5051919050565b60006020828403121561200757600080fd5b8151611d7581611d7c565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561205157612051612028565b92915050565b60006001820161206957612069612028565b5060010190565b6040815260006120836040830185611d27565b90508260208301529392505050565b600080604083850312156120a557600080fd5b8251915060208084015167ffffffffffffffff8111156120c457600080fd5b8401601f810186136120d557600080fd5b80516120e3611e6382611ddb565b81815260059190911b8201830190838101908883111561210257600080fd5b928401925b8284101561212057835182529284019290840190612107565b80955050505050509250929050565b6000806040838503121561214257600080fd5b505080516020909101519092909150565b60006020828403121561216557600080fd5b8135611d7581611d7c565b60008261218d57634e487b7160e01b600052601260045260246000fd5b500490565b808202811582820484141761205157612051612028565b8181038181111561205157612051612028565b60005b838110156121d75781810151838201526020016121bf565b50506000910152565b600081518084526121f88160208601602086016121bc565b601f01601f19169290920160200192915050565b85815284602082015283604082015282606082015260a060808201526000611b7960a08301846121e0565b60006020828403121561224957600080fd5b81518015158114611d7557600080fd5b6000825161226b8184602087016121bc565b9190910192915050565b602081526000611d7560208301846121e056fea264697066735822122095e4c0e7cf4323fefddb3d46f8329752e7f966460a492d3e7c27ac1dc717d10f64736f6c63430008110033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9

-----Decoded View---------------
Arg [0] : wethAddress (address): 0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9


Block Transaction Gas Used Reward
view all blocks sequenced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.