Sepolia Testnet

Contract

0xc1849F54e225495B9638dfCc5379B278377D20A9

Overview

ETH Balance

0 ETH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

> 10 Token Transfers found.

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
HybridCurveUniV3Exchange

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 14 : HybridCurveUniV3Exchange.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import "openzeppelin-contracts/contracts/utils/math/Math.sol";

import "../../../Interfaces/IWETH.sol";
import "../../LeftoversSweep.sol";
// Curve
import "./Curve/ICurveStableswapNGPool.sol";
// UniV3
import "./UniswapV3/ISwapRouter.sol";

import "../../Interfaces/IExchange.sol";

// import "forge-std/console2.sol";

contract HybridCurveUniV3Exchange is LeftoversSweep, IExchange {
    using SafeERC20 for IERC20;

    // TODO: pass it as param in functions, so we can reuse the same exchange for different branches
    IERC20 public immutable collToken;
    IBoldToken public immutable boldToken;
    IERC20 public immutable USDC;
    IWETH public immutable WETH;

    // Curve
    ICurveStableswapNGPool public immutable curvePool;
    uint128 public immutable USDC_INDEX;
    uint128 public immutable BOLD_TOKEN_INDEX;

    // Uniswap
    uint24 public immutable feeUsdcWeth;
    uint24 public immutable feeWethColl;
    ISwapRouter public immutable uniV3Router;

    constructor(
        IERC20 _collToken,
        IBoldToken _boldToken,
        IERC20 _usdc,
        IWETH _weth,
        // Curve
        ICurveStableswapNGPool _curvePool,
        uint128 _usdcIndex,
        uint128 _boldIndex,
        // UniV3
        uint24 _feeUsdcWeth,
        uint24 _feeWethColl,
        ISwapRouter _uniV3Router
    ) {
        collToken = _collToken;
        boldToken = _boldToken;
        USDC = _usdc;
        WETH = _weth;

        // Curve
        curvePool = _curvePool;
        USDC_INDEX = _usdcIndex;
        BOLD_TOKEN_INDEX = _boldIndex;

        // Uniswap
        feeUsdcWeth = _feeUsdcWeth;
        feeWethColl = _feeWethColl;
        uniV3Router = _uniV3Router;
    }

    // Bold -> USDC on Curve; then USDC -> WETH, and optionally WETH -> Coll, on UniV3
    function swapFromBold(uint256 _boldAmount, uint256 _minCollAmount) external {
        InitialBalances memory initialBalances;
        _setHybridExchangeInitialBalances(initialBalances);

        // Curve
        boldToken.transferFrom(msg.sender, address(this), _boldAmount);
        boldToken.approve(address(curvePool), _boldAmount);

        uint256 curveUsdcAmount = curvePool.exchange(int128(BOLD_TOKEN_INDEX), int128(USDC_INDEX), _boldAmount, 0);

        // Uniswap
        USDC.approve(address(uniV3Router), curveUsdcAmount);

        // See: https://docs.uniswap.org/contracts/v3/guides/swaps/multihop-swaps
        bytes memory path;
        if (address(WETH) == address(collToken)) {
            path = abi.encodePacked(USDC, feeUsdcWeth, WETH);
        } else {
            path = abi.encodePacked(USDC, feeUsdcWeth, WETH, feeWethColl, collToken);
        }

        ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({
            path: path,
            recipient: msg.sender,
            deadline: block.timestamp,
            amountIn: curveUsdcAmount,
            amountOutMinimum: _minCollAmount
        });

        // Executes the swap.
        uniV3Router.exactInput(params);

        // return leftovers to user
        _returnLeftovers(initialBalances);
    }

    // Optionally Coll -> WETH, and WETH -> USDC on UniV3; then USDC -> Bold on Curve
    function swapToBold(uint256 _collAmount, uint256 _minBoldAmount) external returns (uint256) {
        InitialBalances memory initialBalances;
        _setHybridExchangeInitialBalances(initialBalances);

        // Uniswap
        collToken.safeTransferFrom(msg.sender, address(this), _collAmount);
        collToken.approve(address(uniV3Router), _collAmount);

        // See: https://docs.uniswap.org/contracts/v3/guides/swaps/multihop-swaps
        bytes memory path;
        if (address(WETH) == address(collToken)) {
            path = abi.encodePacked(WETH, feeUsdcWeth, USDC);
        } else {
            path = abi.encodePacked(collToken, feeWethColl, WETH, feeUsdcWeth, USDC);
        }

        ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({
            path: path,
            recipient: address(this),
            deadline: block.timestamp,
            amountIn: _collAmount,
            amountOutMinimum: 0
        });

        // Executes the swap.
        uint256 uniV3UsdcAmount = uniV3Router.exactInput(params);

        // Curve
        USDC.approve(address(curvePool), uniV3UsdcAmount);

        uint256 boldAmount =
            curvePool.exchange(int128(USDC_INDEX), int128(BOLD_TOKEN_INDEX), uniV3UsdcAmount, _minBoldAmount);
        boldToken.transfer(msg.sender, boldAmount);

        // return leftovers to user
        _returnLeftovers(initialBalances);

        return boldAmount;
    }

    function _setHybridExchangeInitialBalances(InitialBalances memory initialBalances) internal view {
        initialBalances.tokens[0] = boldToken;
        initialBalances.tokens[1] = USDC;
        initialBalances.tokens[2] = WETH;
        if (address(WETH) != address(collToken)) {
            initialBalances.tokens[3] = collToken;
        }
        _setInitialBalances(initialBalances);
    }
}

File 2 of 14 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/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;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 3 of 14 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 4 of 14 : IWETH.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";

interface IWETH is IERC20Metadata {
    function deposit() external payable;
    function withdraw(uint256 wad) external;
}

File 5 of 14 : LeftoversSweep.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.24;

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

import "../Interfaces/IBoldToken.sol";

contract LeftoversSweep {
    struct InitialBalances {
        IERC20[4] tokens; // paving the way for completely dynamic routes
        uint256[4] balances;
        address receiver;
    }

    function _setInitialTokensAndBalances(
        IERC20 _collToken,
        IBoldToken _boldToken,
        InitialBalances memory _initialBalances
    ) internal view {
        _setInitialTokensBalancesAndReceiver(_collToken, _boldToken, _initialBalances, msg.sender);
    }

    function _setInitialTokensBalancesAndReceiver(
        IERC20 _collToken,
        IBoldToken _boldToken,
        InitialBalances memory _initialBalances,
        address _receiver
    ) internal view {
        _initialBalances.tokens[0] = _collToken;
        _initialBalances.tokens[1] = _boldToken;
        _setInitialBalancesAndReceiver(_initialBalances, _receiver);
    }

    function _setInitialBalances(InitialBalances memory _initialBalances) internal view {
        _setInitialBalancesAndReceiver(_initialBalances, msg.sender);
    }

    function _setInitialBalancesAndReceiver(InitialBalances memory _initialBalances, address _receiver) internal view {
        for (uint256 i = 0; i < _initialBalances.tokens.length; i++) {
            if (address(_initialBalances.tokens[i]) == address(0)) break;

            _initialBalances.balances[i] = _initialBalances.tokens[i].balanceOf(address(this));
        }
        _initialBalances.receiver = _receiver;
    }

    function _returnLeftovers(InitialBalances memory _initialBalances) internal {
        for (uint256 i = 0; i < _initialBalances.tokens.length; i++) {
            if (address(_initialBalances.tokens[i]) == address(0)) break;

            uint256 currentBalance = _initialBalances.tokens[i].balanceOf(address(this));
            if (currentBalance > _initialBalances.balances[i]) {
                _initialBalances.tokens[i].transfer(
                    _initialBalances.receiver, currentBalance - _initialBalances.balances[i]
                );
            }
        }
    }
}

File 6 of 14 : ICurveStableswapNGPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface ICurveStableswapNGPool {
    function add_liquidity(uint256[] memory amounts, uint256 min_mint_amount) external returns (uint256);
    function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external returns (uint256 output);
    function get_dx(int128 i, int128 j, uint256 dy) external view returns (uint256 dx);
    function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);
}

File 7 of 14 : ISwapRouter.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

File 8 of 14 : IExchange.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IExchange {
    function swapFromBold(uint256 _boldAmount, uint256 _minCollAmount) external;

    function swapToBold(uint256 _collAmount, uint256 _minBoldAmount) external returns (uint256);
}

File 9 of 14 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 10 of 14 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    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 11 of 14 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/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 12 of 14 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 13 of 14 : IBoldToken.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol";
import "openzeppelin-contracts/contracts/interfaces/IERC5267.sol";

interface IBoldToken is IERC20Metadata, IERC20Permit, IERC5267 {
    function setBranchAddresses(
        address _troveManagerAddress,
        address _stabilityPoolAddress,
        address _borrowerOperationsAddress,
        address _activePoolAddress
    ) external;

    function setCollateralRegistry(address _collateralRegistryAddress) external;

    function mint(address _account, uint256 _amount) external;

    function burn(address _account, uint256 _amount) external;

    function sendToPool(address _sender, address poolAddress, uint256 _amount) external;

    function returnFromPool(address poolAddress, address user, uint256 _amount) external;
}

File 14 of 14 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

Settings
{
  "remappings": [
    "openzeppelin/=lib/V2-gov/lib/openzeppelin-contracts/",
    "@chimera/=lib/V2-gov/lib/chimera/src/",
    "@ensdomains/=lib/V2-gov/lib/v4-core/node_modules/@ensdomains/",
    "@openzeppelin/=lib/V2-gov/lib/v4-core/lib/openzeppelin-contracts/",
    "@openzeppelin/contracts/=lib/V2-gov/lib/openzeppelin-contracts/contracts/",
    "Solady/=lib/Solady/src/",
    "V2-gov/=lib/V2-gov/",
    "chimera/=lib/V2-gov/lib/chimera/src/",
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-gas-snapshot/=lib/V2-gov/lib/v4-core/lib/forge-gas-snapshot/src/",
    "forge-std/=lib/forge-std/src/",
    "hardhat/=lib/V2-gov/lib/v4-core/node_modules/hardhat/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solmate/=lib/V2-gov/lib/v4-core/lib/solmate/src/",
    "v4-core/=lib/V2-gov/lib/v4-core/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false,
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_collToken","type":"address"},{"internalType":"contract IBoldToken","name":"_boldToken","type":"address"},{"internalType":"contract IERC20","name":"_usdc","type":"address"},{"internalType":"contract IWETH","name":"_weth","type":"address"},{"internalType":"contract ICurveStableswapNGPool","name":"_curvePool","type":"address"},{"internalType":"uint128","name":"_usdcIndex","type":"uint128"},{"internalType":"uint128","name":"_boldIndex","type":"uint128"},{"internalType":"uint24","name":"_feeUsdcWeth","type":"uint24"},{"internalType":"uint24","name":"_feeWethColl","type":"uint24"},{"internalType":"contract ISwapRouter","name":"_uniV3Router","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BOLD_TOKEN_INDEX","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC_INDEX","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boldToken","outputs":[{"internalType":"contract IBoldToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"curvePool","outputs":[{"internalType":"contract ICurveStableswapNGPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeUsdcWeth","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeWethColl","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_boldAmount","type":"uint256"},{"internalType":"uint256","name":"_minCollAmount","type":"uint256"}],"name":"swapFromBold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collAmount","type":"uint256"},{"internalType":"uint256","name":"_minBoldAmount","type":"uint256"}],"name":"swapToBold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniV3Router","outputs":[{"internalType":"contract ISwapRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101c060405234801562000011575f80fd5b50604051620019d0380380620019d08339810160408190526200003491620000d1565b6001600160a01b03998a1660805297891660a05295881660c05293871660e052918616610100526001600160801b0390811661012052166101405262ffffff908116610160521661018052166101a052620001ac565b6001600160a01b03811681146200009f575f80fd5b50565b80516001600160801b0381168114620000b9575f80fd5b919050565b805162ffffff81168114620000b9575f80fd5b5f805f805f805f805f806101408b8d031215620000ec575f80fd5b8a51620000f9816200008a565b60208c0151909a506200010c816200008a565b60408c01519099506200011f816200008a565b60608c015190985062000132816200008a565b60808c015190975062000145816200008a565b95506200015560a08c01620000a2565b94506200016560c08c01620000a2565b93506200017560e08c01620000be565b9250620001866101008c01620000be565b91506101208b015162000199816200008a565b809150509295989b9194979a5092959850565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516116826200034e5f395f818161016001528181610321015281816105a401528181610ab50152610d3901525f81816101d5015281816104c40152610c9f01525f8181610125015281816104390152818161050601528181610bd20152610c5d01525f818161028c0152818161071101526109c901525f8181610223015281816106e601526109f401525f818160ba0152818161063801528181610749015281816109200152610a2c01525f81816101fc015281816103e901528181610418015281816104e501528181610b8201528181610bf301528181610c7e0152610e2801525f81816101ae0152818161045a015281816105270152818161066a01528181610ae701528181610bb101528181610c3c0152610dfc01525f8181610187015281816107da015281816108960152818161094f0152610dd401525f818160fe015281816102e201528181610350015281816103bf015281816104a301528181610b5801528181610cc001528181610e530152610e8601526116825ff3fe608060405234801561000f575f80fd5b50600436106100b1575f3560e01c806390a7e01f1161006e57806390a7e01f146101d0578063ad5c4648146101f7578063c38cff9a1461021e578063d9b0f56e14610266578063e8f2751114610287578063fa52ed82146102ae575f80fd5b8063218751b2146100b557806331b8c946146100f957806347398d4b146101205780635fafa5891461015b578063630afce51461018257806389a30271146101a9575b5f80fd5b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6101477f000000000000000000000000000000000000000000000000000000000000000081565b60405162ffffff90911681526020016100f0565b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6101477f000000000000000000000000000000000000000000000000000000000000000081565b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6102457f000000000000000000000000000000000000000000000000000000000000000081565b6040516fffffffffffffffffffffffffffffffff90911681526020016100f0565b61027961027436600461145e565b6102c3565b6040519081526020016100f0565b6102457f000000000000000000000000000000000000000000000000000000000000000081565b6102c16102bc36600461145e565b610863565b005b5f6102cc611414565b6102d581610dc8565b61030a6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333087610eb9565b60405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018690527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303815f875af1158015610396573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ba919061147e565b5060607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316036104a1577f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060405160200161048b939291906114a4565b604051602081830303815290604052905061056c565b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060405160200161055a9594939291906114df565b60405160208183030381529060405290505b6040805160a0810182528281523060208201524281830152606081018790525f60808201819052915163c04b8d5960e01b81529091907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c04b8d59906105e190859060040161157e565b6020604051808303815f875af11580156105fd573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061062191906115d5565b60405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390529192507f00000000000000000000000000000000000000000000000000000000000000009091169063095ea7b3906044016020604051808303815f875af11580156106b2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106d6919061147e565b50604051630f7c084960e21b81527f0000000000000000000000000000000000000000000000000000000000000000600f90810b60048301527f0000000000000000000000000000000000000000000000000000000000000000900b602482015260448101829052606481018790525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633df02124906084016020604051808303815f875af1158015610797573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107bb91906115d5565b60405163a9059cbb60e01b8152336004820152602481018290529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb906044016020604051808303815f875af1158015610828573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061084c919061147e565b5061085685610f19565b9450505050505b92915050565b61086b611414565b61087481610dc8565b6040516323b872dd60e01b8152336004820152306024820152604481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303815f875af11580156108e4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610908919061147e565b5060405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018590527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303815f875af1158015610995573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109b9919061147e565b50604051630f7c084960e21b81527f0000000000000000000000000000000000000000000000000000000000000000600f90810b60048301527f0000000000000000000000000000000000000000000000000000000000000000900b6024820152604481018490525f60648201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633df02124906084016020604051808303815f875af1158015610a7a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a9e91906115d5565b60405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390529192507f00000000000000000000000000000000000000000000000000000000000000009091169063095ea7b3906044016020604051808303815f875af1158015610b2f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b53919061147e565b5060607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603610c3a577f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000604051602001610c24939291906114a4565b6040516020818303038152906040529050610d05565b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000604051602001610cf39594939291906114df565b60405160208183030381529060405290505b6040805160a08101825282815233602082015242818301526060810184905260808101869052905163c04b8d5960e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c04b8d5990610d7690849060040161157e565b6020604051808303815f875af1158015610d92573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610db691906115d5565b50610dc084610f19565b505050505050565b80516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811690915281517f000000000000000000000000000000000000000000000000000000000000000082166020919091015281517f0000000000000000000000000000000000000000000000000000000000000000821660409091018190527f000000000000000000000000000000000000000000000000000000000000000090911614610ead5780516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166060909101525b610eb6816110bc565b50565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610f139085906110c6565b50505050565b5f5b60048110156110b85781515f908260048110610f3957610f396115ec565b60200201516001600160a01b0316146110b85781515f908260048110610f6157610f616115ec565b60200201516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610fa9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fcd91906115d5565b905082602001518260048110610fe557610fe56115ec565b60200201518111156110af5782518260048110611004576110046115ec565b60200201516001600160a01b031663a9059cbb846040015185602001518560048110611032576110326115ec565b60200201516110419085611600565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303815f875af1158015611089573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110ad919061147e565b505b50600101610f1b565b5050565b610eb681336111a3565b5f61111a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661128a9092919063ffffffff16565b905080515f148061113a57508080602001905181019061113a919061147e565b61119e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b505050565b5f5b60048110156112785782515f9082600481106111c3576111c36115ec565b60200201516001600160a01b03161461127857825181600481106111e9576111e96115ec565b60200201516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611231573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061125591906115d5565b8360200151826004811061126b5761126b6115ec565b60200201526001016111a5565b506001600160a01b0316604090910152565b606061129884845f856112a0565b949350505050565b6060824710156113015760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611195565b5f80866001600160a01b0316858760405161131c919061161f565b5f6040518083038185875af1925050503d805f8114611356576040519150601f19603f3d011682016040523d82523d5f602084013e61135b565b606091505b509150915061136c87838387611377565b979650505050505050565b606083156113e55782515f036113de576001600160a01b0385163b6113de5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611195565b5081611298565b61129883838151156113fa5781518083602001fd5b8060405162461bcd60e51b8152600401611195919061163a565b6040518060600160405280611427611440565b8152602001611434611440565b81525f60209091015290565b60405180608001604052806004906020820280368337509192915050565b5f806040838503121561146f575f80fd5b50508035926020909101359150565b5f6020828403121561148e575f80fd5b8151801515811461149d575f80fd5b9392505050565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b6bffffffffffffffffffffffff19606096871b811682526001600160e81b031960e896871b8116601484015294871b811660178301529290941b909216602b840152921b909116602e82015260420190565b5f5b8381101561154b578181015183820152602001611533565b50505f910152565b5f815180845261156a816020860160208601611531565b601f01601f19169290920160200192915050565b602081525f825160a0602084015261159960c0840182611553565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b5f602082840312156115e5575f80fd5b5051919050565b634e487b7160e01b5f52603260045260245ffd5b8181038181111561085d57634e487b7160e01b5f52601160045260245ffd5b5f8251611630818460208701611531565b9190910192915050565b602081525f61149d602083018461155356fea2646970667358221220a825ec2e17724e6826f10f940443d79b361eda07152deb305fa6a94faa6fa03c64736f6c6343000818003300000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c000000000000000000000000620ce1130f7c63457784cdfa31cfccbfb6be5029000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f380000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea89000000000000000000000000df80694a2f2befd0a0b30b77afb47a960c677b090000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000006400000000000000000000000065669fe35312947050c450bd5d36e6361f85ec12

Deployed Bytecode

0x608060405234801561000f575f80fd5b50600436106100b1575f3560e01c806390a7e01f1161006e57806390a7e01f146101d0578063ad5c4648146101f7578063c38cff9a1461021e578063d9b0f56e14610266578063e8f2751114610287578063fa52ed82146102ae575f80fd5b8063218751b2146100b557806331b8c946146100f957806347398d4b146101205780635fafa5891461015b578063630afce51461018257806389a30271146101a9575b5f80fd5b6100dc7f000000000000000000000000df80694a2f2befd0a0b30b77afb47a960c677b0981565b6040516001600160a01b0390911681526020015b60405180910390f35b6100dc7f00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c81565b6101477f00000000000000000000000000000000000000000000000000000000000001f481565b60405162ffffff90911681526020016100f0565b6100dc7f00000000000000000000000065669fe35312947050c450bd5d36e6361f85ec1281565b6100dc7f000000000000000000000000620ce1130f7c63457784cdfa31cfccbfb6be502981565b6100dc7f000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f3881565b6101477f000000000000000000000000000000000000000000000000000000000000006481565b6100dc7f0000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea8981565b6102457f000000000000000000000000000000000000000000000000000000000000000181565b6040516fffffffffffffffffffffffffffffffff90911681526020016100f0565b61027961027436600461145e565b6102c3565b6040519081526020016100f0565b6102457f000000000000000000000000000000000000000000000000000000000000000081565b6102c16102bc36600461145e565b610863565b005b5f6102cc611414565b6102d581610dc8565b61030a6001600160a01b037f00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c16333087610eb9565b60405163095ea7b360e01b81526001600160a01b037f00000000000000000000000065669fe35312947050c450bd5d36e6361f85ec1281166004830152602482018690527f00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c169063095ea7b3906044016020604051808303815f875af1158015610396573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ba919061147e565b5060607f00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c6001600160a01b03167f0000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea896001600160a01b0316036104a1577f0000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea897f00000000000000000000000000000000000000000000000000000000000001f47f000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f3860405160200161048b939291906114a4565b604051602081830303815290604052905061056c565b7f00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c7f00000000000000000000000000000000000000000000000000000000000000647f0000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea897f00000000000000000000000000000000000000000000000000000000000001f47f000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f3860405160200161055a9594939291906114df565b60405160208183030381529060405290505b6040805160a0810182528281523060208201524281830152606081018790525f60808201819052915163c04b8d5960e01b81529091907f00000000000000000000000065669fe35312947050c450bd5d36e6361f85ec126001600160a01b03169063c04b8d59906105e190859060040161157e565b6020604051808303815f875af11580156105fd573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061062191906115d5565b60405163095ea7b360e01b81526001600160a01b037f000000000000000000000000df80694a2f2befd0a0b30b77afb47a960c677b0981166004830152602482018390529192507f000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f389091169063095ea7b3906044016020604051808303815f875af11580156106b2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106d6919061147e565b50604051630f7c084960e21b81527f0000000000000000000000000000000000000000000000000000000000000001600f90810b60048301527f0000000000000000000000000000000000000000000000000000000000000000900b602482015260448101829052606481018790525f907f000000000000000000000000df80694a2f2befd0a0b30b77afb47a960c677b096001600160a01b031690633df02124906084016020604051808303815f875af1158015610797573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107bb91906115d5565b60405163a9059cbb60e01b8152336004820152602481018290529091507f000000000000000000000000620ce1130f7c63457784cdfa31cfccbfb6be50296001600160a01b03169063a9059cbb906044016020604051808303815f875af1158015610828573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061084c919061147e565b5061085685610f19565b9450505050505b92915050565b61086b611414565b61087481610dc8565b6040516323b872dd60e01b8152336004820152306024820152604481018490527f000000000000000000000000620ce1130f7c63457784cdfa31cfccbfb6be50296001600160a01b0316906323b872dd906064016020604051808303815f875af11580156108e4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610908919061147e565b5060405163095ea7b360e01b81526001600160a01b037f000000000000000000000000df80694a2f2befd0a0b30b77afb47a960c677b0981166004830152602482018590527f000000000000000000000000620ce1130f7c63457784cdfa31cfccbfb6be5029169063095ea7b3906044016020604051808303815f875af1158015610995573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109b9919061147e565b50604051630f7c084960e21b81527f0000000000000000000000000000000000000000000000000000000000000000600f90810b60048301527f0000000000000000000000000000000000000000000000000000000000000001900b6024820152604481018490525f60648201819052907f000000000000000000000000df80694a2f2befd0a0b30b77afb47a960c677b096001600160a01b031690633df02124906084016020604051808303815f875af1158015610a7a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a9e91906115d5565b60405163095ea7b360e01b81526001600160a01b037f00000000000000000000000065669fe35312947050c450bd5d36e6361f85ec1281166004830152602482018390529192507f000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f389091169063095ea7b3906044016020604051808303815f875af1158015610b2f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b53919061147e565b5060607f00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c6001600160a01b03167f0000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea896001600160a01b031603610c3a577f000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f387f00000000000000000000000000000000000000000000000000000000000001f47f0000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea89604051602001610c24939291906114a4565b6040516020818303038152906040529050610d05565b7f000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f387f00000000000000000000000000000000000000000000000000000000000001f47f0000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea897f00000000000000000000000000000000000000000000000000000000000000647f00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c604051602001610cf39594939291906114df565b60405160208183030381529060405290505b6040805160a08101825282815233602082015242818301526060810184905260808101869052905163c04b8d5960e01b81527f00000000000000000000000065669fe35312947050c450bd5d36e6361f85ec126001600160a01b03169063c04b8d5990610d7690849060040161157e565b6020604051808303815f875af1158015610d92573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610db691906115d5565b50610dc084610f19565b505050505050565b80516001600160a01b037f000000000000000000000000620ce1130f7c63457784cdfa31cfccbfb6be5029811690915281517f000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f3882166020919091015281517f0000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea89821660409091018190527f00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c90911614610ead5780516001600160a01b037f00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c166060909101525b610eb6816110bc565b50565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610f139085906110c6565b50505050565b5f5b60048110156110b85781515f908260048110610f3957610f396115ec565b60200201516001600160a01b0316146110b85781515f908260048110610f6157610f616115ec565b60200201516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610fa9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fcd91906115d5565b905082602001518260048110610fe557610fe56115ec565b60200201518111156110af5782518260048110611004576110046115ec565b60200201516001600160a01b031663a9059cbb846040015185602001518560048110611032576110326115ec565b60200201516110419085611600565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303815f875af1158015611089573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110ad919061147e565b505b50600101610f1b565b5050565b610eb681336111a3565b5f61111a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661128a9092919063ffffffff16565b905080515f148061113a57508080602001905181019061113a919061147e565b61119e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b505050565b5f5b60048110156112785782515f9082600481106111c3576111c36115ec565b60200201516001600160a01b03161461127857825181600481106111e9576111e96115ec565b60200201516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611231573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061125591906115d5565b8360200151826004811061126b5761126b6115ec565b60200201526001016111a5565b506001600160a01b0316604090910152565b606061129884845f856112a0565b949350505050565b6060824710156113015760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611195565b5f80866001600160a01b0316858760405161131c919061161f565b5f6040518083038185875af1925050503d805f8114611356576040519150601f19603f3d011682016040523d82523d5f602084013e61135b565b606091505b509150915061136c87838387611377565b979650505050505050565b606083156113e55782515f036113de576001600160a01b0385163b6113de5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611195565b5081611298565b61129883838151156113fa5781518083602001fd5b8060405162461bcd60e51b8152600401611195919061163a565b6040518060600160405280611427611440565b8152602001611434611440565b81525f60209091015290565b60405180608001604052806004906020820280368337509192915050565b5f806040838503121561146f575f80fd5b50508035926020909101359150565b5f6020828403121561148e575f80fd5b8151801515811461149d575f80fd5b9392505050565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b6bffffffffffffffffffffffff19606096871b811682526001600160e81b031960e896871b8116601484015294871b811660178301529290941b909216602b840152921b909116602e82015260420190565b5f5b8381101561154b578181015183820152602001611533565b50505f910152565b5f815180845261156a816020860160208601611531565b601f01601f19169290920160200192915050565b602081525f825160a0602084015261159960c0840182611553565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b5f602082840312156115e5575f80fd5b5051919050565b634e487b7160e01b5f52603260045260245ffd5b8181038181111561085d57634e487b7160e01b5f52601160045260245ffd5b5f8251611630818460208701611531565b9190910192915050565b602081525f61149d602083018461155356fea2646970667358221220a825ec2e17724e6826f10f940443d79b361eda07152deb305fa6a94faa6fa03c64736f6c63430008180033

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

00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c000000000000000000000000620ce1130f7c63457784cdfa31cfccbfb6be5029000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f380000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea89000000000000000000000000df80694a2f2befd0a0b30b77afb47a960c677b090000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000006400000000000000000000000065669fe35312947050c450bd5d36e6361f85ec12

-----Decoded View---------------
Arg [0] : _collToken (address): 0x10f8d8422A36BA75Ae3381815eA72638dDa0088C
Arg [1] : _boldToken (address): 0x620cE1130f7c63457784cdFA31cfcCBFb6bE5029
Arg [2] : _usdc (address): 0x375a88c7BA42507b597579A99170C854b7ef1F38
Arg [3] : _weth (address): 0x2442cA14d1217b4dD503e47DFdF79b774b56Ea89
Arg [4] : _curvePool (address): 0xDf80694A2f2BeFd0a0B30B77aFB47a960C677b09
Arg [5] : _usdcIndex (uint128): 1
Arg [6] : _boldIndex (uint128): 0
Arg [7] : _feeUsdcWeth (uint24): 500
Arg [8] : _feeWethColl (uint24): 100
Arg [9] : _uniV3Router (address): 0x65669fE35312947050C450Bd5d36e6361F85eC12

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 00000000000000000000000010f8d8422a36ba75ae3381815ea72638dda0088c
Arg [1] : 000000000000000000000000620ce1130f7c63457784cdfa31cfccbfb6be5029
Arg [2] : 000000000000000000000000375a88c7ba42507b597579a99170c854b7ef1f38
Arg [3] : 0000000000000000000000002442ca14d1217b4dd503e47dfdf79b774b56ea89
Arg [4] : 000000000000000000000000df80694a2f2befd0a0b30b77afb47a960c677b09
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [7] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [9] : 00000000000000000000000065669fe35312947050c450bd5d36e6361f85ec12


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.