ETH Price: $3,416.21 (+3.14%)

Contract

0x47612eabFbE65329AeD1ab1BF3FCbAE493aEf460
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Create Auction197091012024-04-22 6:18:47215 days ago1713766727IN
0x47612eab...493aEf460
0 ETH0.011650956.86502071
Create Auction197066832024-04-21 22:11:59215 days ago1713737519IN
0x47612eab...493aEf460
0 ETH0.0096815.72050056
0x60a06040197020692024-04-21 6:43:47216 days ago1713681827IN
 Create: BatchAuctionUncappedFactory
0 ETH0.024329489.2437202

Latest 3 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
197091012024-04-22 6:18:47215 days ago1713766727
0x47612eab...493aEf460
 Contract Creation0 ETH
197088382024-04-22 5:25:23215 days ago1713763523
0x47612eab...493aEf460
 Contract Creation0 ETH
197066832024-04-21 22:11:59215 days ago1713737519
0x47612eab...493aEf460
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BatchAuctionUncappedFactory

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 9999 runs

Other Settings:
paris EvmVersion
File 1 of 15 : BatchAuctionUncappedFactory.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

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

import {BazaarManager} from "./BazaarManager.sol";

import "./interfaces/IBatchAuctionUncapped.sol";
import "./BatchAuctionUncapped.sol";

struct BatchAuctionUncappedConfig {
    IERC20 projectToken;
    IERC20 quoteToken;
    uint256 projectTokenAmount;
    uint256 floorQuoteAmount;
    uint256 startTime;
    uint256 endTime;
}

contract BatchAuctionUncappedFactory {
    // Manager
    BazaarManager public manager;

    uint256 private constant MAX_FEE_PERCENTAGE = 1e18 / 2; // 50%

    address public immutable wethAddress;

    mapping(address => bool) public auctionFromFactory;

    // Events
    event AuctionFeesSet(
        address auction,
        uint256 swapPercentage,
        uint256 exitQuotePercentage
    );
    event AuctionUncappedCreated(
        address auction,
        address auctionCreator,
        IERC20 quoteToken,
        IERC20 projectToken,
        uint256 projectTokenAmount,
        uint256 floorQuoteAmount,
        uint256 startTime,
        uint256 endTime,
        uint256 swapFeePercentage,
        uint256 exitQuoteFeePercentage
    );

    // Modifiers
    modifier onlyManager() {
        require(manager.owner() == msg.sender, "Only BazaarManager owner");
        _;
    }
    modifier fromFactory(address auction) {
        require(
            auctionFromFactory[auction],
            "IBatchAuctionUncapped not created from factory"
        );
        _;
    }

    constructor(BazaarManager _manager, address _wethAddress) {
        manager = _manager;
        wethAddress = _wethAddress;
    }

    // Fees

    function setAuctionFeePercentages(
        address auctionAddress,
        uint256 swapPercentage,
        uint256 exitQuotePercentage
    ) external fromFactory(auctionAddress) onlyManager {
        require(
            swapPercentage <= MAX_FEE_PERCENTAGE &&
                exitQuotePercentage <= MAX_FEE_PERCENTAGE,
            "Invalid Fee Percentage"
        );

        IBatchAuctionUncapped auction = IBatchAuctionUncapped(auctionAddress);
        auction.setFees(swapPercentage, exitQuotePercentage);

        emit AuctionFeesSet(
            auctionAddress,
            swapPercentage,
            exitQuotePercentage
        );
    }

    // Create Auction

    function createAuction(
        BatchAuctionUncappedConfig memory cfg
    ) external virtual returns (BatchAuctionUncapped) {
        require(
            manager.isQuoteToken(address(cfg.quoteToken)) !=
                manager.isQuoteToken(address(cfg.projectToken)),
            "Auction must have a quote & project token"
        );
        require(
            cfg.startTime > block.timestamp,
            "Auction start time must be in the future"
        );

        (uint256 swapFee, uint256 exitFee) = manager.defaultFeePercentages();
        BatchAuctionUncapped auction = new BatchAuctionUncapped(
            msg.sender,
            cfg.quoteToken,
            cfg.projectToken,
            cfg.projectTokenAmount,
            cfg.floorQuoteAmount,
            cfg.startTime,
            cfg.endTime,
            swapFee,
            exitFee,
            address(cfg.quoteToken) == wethAddress
        );

        SafeERC20.safeTransferFrom(
            cfg.projectToken,
            msg.sender,
            address(auction),
            cfg.projectTokenAmount
        );

        auctionFromFactory[address(auction)] = true;

        emit AuctionUncappedCreated(
            address(auction),
            msg.sender,
            cfg.quoteToken,
            cfg.projectToken,
            cfg.projectTokenAmount,
            cfg.floorQuoteAmount,
            cfg.startTime,
            cfg.endTime,
            swapFee,
            exitFee
        );

        return auction;
    }

    function claimBazaarFees(
        address auctionAddress
    ) external onlyManager fromFactory(auctionAddress) {
        IBatchAuctionUncapped auction = IBatchAuctionUncapped(auctionAddress);
        auction.claimBazaarFees(manager.feeCollector());
    }
}

File 2 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

File 3 of 15 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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 An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @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.encodeCall(token.approve, (spender, value));

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

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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(token).code.length > 0;
    }
}

File 4 of 15 : BazaarManager.sol
pragma solidity >=0.7.0 <0.9.0;

// We're using a patched version of openzeppelin's `Ownable` contract based on solidity 0.7.0 but
// updated in our fork with a >=0.7.0 <0.9.0 pragma statement allowing it to be used in this repo
// for both solidity versions
import {Ownable} from "balancer-lbp-patch/v2-solidity-utils/contracts/openzeppelin/Ownable.sol";

contract BazaarManager is Ownable {
    address public feeCollector;

    // Default Swap Fee Percentages
    uint256 private constant MAX_FEE_PERCENTAGE = 1e18 / 2; // 50%

    uint256 public defaultSwapFeePercentage = 1e18 / 100; // 1%
    uint256 public defaultExitQuoteFeePercentage = 2e18 / 100 ; // 2%

    // Quote Tokens
    mapping(address => bool) public quoteTokens;

    // Events
    event QuoteTokenChange(address token, bool enabled);

    constructor(address _admin, address _feeCollector) Ownable() {
        feeCollector = _feeCollector;

        if (_admin != msg.sender) {
            transferOwnership(_admin);
        }
    }

    /** Fees **/

    function setFeeCollector(address _feeCollector) external onlyOwner {
        require(_feeCollector != address(0), "fee collector cannot be zero address");
        feeCollector = _feeCollector;
    }

    function setDefaultFeePercentages(uint256 swapPercentage, uint256 exitQuotePercentage) external onlyOwner {
        require(swapPercentage <= MAX_FEE_PERCENTAGE && exitQuotePercentage <= MAX_FEE_PERCENTAGE, "Invalid Fee Percentage");

        defaultSwapFeePercentage = swapPercentage;
        defaultExitQuoteFeePercentage = exitQuotePercentage;
    }

    function defaultFeePercentages() external view returns (uint256, uint256) {
        return (defaultSwapFeePercentage, defaultExitQuoteFeePercentage);
    }

    /** Quote Tokens **/

    function setQuoteToken(address token, bool enabled) external onlyOwner {
        quoteTokens[token] = enabled;
        emit QuoteTokenChange(token, enabled);
    }

    function isQuoteToken(address token) external view returns (bool) {
        return quoteTokens[token];
    }
}

File 5 of 15 : IBatchAuctionUncapped.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

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

interface IBatchAuctionUncapped {
    // Event declarations
    event Subscribed(address indexed user, uint256 amount, uint256 fees);
    event ProjectTokenClaimed(
        address indexed user,
        IERC20 indexed token,
        uint256 amount
    );
    event AuctionQuoteTokensClaimed(
        address indexed user,
        IERC20 indexed token,
        uint256 amount,
        bool isFees
    );
    event AuctionFeesSet(uint256 swapPercentage, uint256 exitQuotePercentage);

    // Function declarations
    function setFees(
        uint256 _swapFeePercentage,
        uint256 _exitQuoteFeePercentage
    ) external;
    function setPaused(bool _paused) external;
    function subscribe(address subscriber, uint256 amount) external payable;
    function claimProjectToken() external;
    function claimAuctionQuoteTokens() external;
    function claimBazaarFees(address feeRecipient) external;

    // Getters for public variables
    function isQuoteWETH() external view returns (bool);
    function auctionOwner() external view returns (address);
    function swapFeePercentage() external view returns (uint256);
    function exitQuoteFeePercentage() external view returns (uint256);
    function startTime() external view returns (uint256);
    function endTime() external view returns (uint256);
    function totalProjectTokenAmount() external view returns (uint256);
    function subscriptions(address user) external view returns (uint256);
    function totalSubscriptions() external view returns (uint256);
    function totalSwapFees() external view returns (uint256);
}

File 6 of 15 : BatchAuctionUncapped.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {IWETH9} from "./interfaces/IWETH9.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

contract BatchAuctionUncapped is Ownable, ReentrancyGuard {
    using SafeCast for uint256;

    IERC20 public quoteToken;
    IERC20 public projectToken;

    bool public paused = false;
    bool public isQuoteWETH;
    bool public bazaarFeesClaimed = false;
    bool public auctionQuoteFeesClaimed = false;

    address public auctionOwner;

    uint256 public swapFeePercentage;
    uint256 public exitQuoteFeePercentage;

    uint256 public startTime;
    uint256 public endTime;

    uint256 public floorQuoteAmount;
    uint256 public totalProjectTokenAmount;

    // Subscriptions Accounting
    mapping(address => uint256) public subscriptions;

    uint256 public totalSubscriptions;
    uint256 public totalSwapFees;

    event Subscribed(address indexed subscriber, uint256 amount, uint256 fees);

    event ProjectTokenClaimed(
        address indexed user,
        IERC20 indexed token,
        uint256 amount
    );

    // isFees defines whether this is the auctionOwner claiming proceeds (isFees = false) or Bazaar team collecting auction fees (isFees = true)
    event AuctionQuoteTokensClaimed(
        address indexed user,
        IERC20 indexed token,
        uint256 amount,
        bool isFees
    );

    event AuctioneerProjectTokensRefunded(
        address indexed user,
        IERC20 indexed token,
        uint256 amountRefunded
    );

    event AuctionFeesSet(uint256 swapPercentage, uint256 exitQuotePercentage);

    modifier onlyAuctionOwner() {
        require(auctionOwner == msg.sender, "Only auction Owner");
        _;
    }

    constructor(
        address _auctionOwner,
        IERC20 _quoteToken,
        IERC20 _projectToken,
        uint256 _projectTokenAmount,
        uint256 _floorQuoteAmount,
        uint256 _startTime,
        uint256 _endTime,
        uint256 _swapFeePercentage,
        uint256 _exitQuoteFeePercentage,
        bool _isQuoteWETH
    ) Ownable(msg.sender) {
        require(
            _startTime < _endTime,
            "Auction start time must be less than end time"
        );
        require(
            _projectTokenAmount > 0,
            "Project token amount must be greater than 0"
        );

        auctionOwner = _auctionOwner;
        startTime = _startTime;
        endTime = _endTime;
        totalProjectTokenAmount = _projectTokenAmount;
        floorQuoteAmount = _floorQuoteAmount;
        quoteToken = _quoteToken;
        projectToken = _projectToken;
        swapFeePercentage = _swapFeePercentage;
        exitQuoteFeePercentage = _exitQuoteFeePercentage;
        isQuoteWETH = _isQuoteWETH;
    }

    // Admin Functions

    function setFees(
        uint256 _swapFeePercentage,
        uint256 _exitQuoteFeePercentage
    ) external onlyOwner nonReentrant {
        swapFeePercentage = _swapFeePercentage;
        exitQuoteFeePercentage = _exitQuoteFeePercentage;

        emit AuctionFeesSet(_swapFeePercentage, _exitQuoteFeePercentage);
    }

    function setPaused(bool _paused) external onlyAuctionOwner nonReentrant {
        paused = _paused;
    }

    // Auction Functions

    // subscriber parameter is only ever different from msg.sender for across swap handler,
    // or if a user wants to pay for someone else's subscription
    function subscribe(
        address subscriber,
        uint256 amount
    ) external payable nonReentrant {
        require(!paused, "Contract is paused");
        require(
            startTime < block.timestamp && block.timestamp < endTime,
            "Subscription period is not active"
        );

        // For ETH auctions, a user can choose between WETH and ETH by use of the msg.value field
        // if this field is the corect amount, we use msg.value and ETH. If not, we ensure a user
        // isn't sending ETH, and instead we'll withdraw WETH
        if (isQuoteWETH && msg.value == amount) {
            require(
                msg.value == amount,
                "Amount specified must be the same as msg.value for ETH"
            );
            // Convert ETH to WETH
            IWETH9(address(quoteToken)).deposit{value: msg.value}();
        } else {
            require(
                msg.value == 0,
                "No msg.value should be sent as user is paying with an ERC20"
            );
            SafeERC20.safeTransferFrom(
                quoteToken,
                msg.sender,
                address(this),
                amount
            );
        }

        uint256 fees = (amount * swapFeePercentage) / 1e18;
        uint256 subscriptionAmount = amount - fees;

        subscriptions[subscriber] += subscriptionAmount;
        totalSubscriptions += subscriptionAmount;
        totalSwapFees += fees;

        emit Subscribed(subscriber, amount, fees);
    }

    function claimProjectToken() external nonReentrant {
        require(block.timestamp > endTime, "Auction has not ended");
        uint256 subscriptionAmount = subscriptions[msg.sender];
        require(subscriptionAmount > 0, "No subscriptions");

        subscriptions[msg.sender] = 0;

        // If the floorQuoteAmount amount is not cleared, we use the floorQuoteAmount as our ratio
        // and not all of the tokens will be sold off
        uint256 divisor = totalSubscriptions < floorQuoteAmount ? floorQuoteAmount : totalSubscriptions;

        uint256 claimableAmount = (subscriptionAmount *
            totalProjectTokenAmount) / divisor;

        SafeERC20.safeTransfer(projectToken, msg.sender, claimableAmount);

        emit ProjectTokenClaimed(msg.sender, projectToken, claimableAmount);
    }

    // Auctioneer claims quoteTokens, and if the auction floor price is not cleared, they
    // claim their extra projectTokens as well
    function claimAuctioneerTokens() external onlyAuctionOwner nonReentrant {
        require(block.timestamp > endTime, "Auction has not ended");
        require(!auctionQuoteFeesClaimed, "Auction quote fees already claimed");

        uint256 auctionProceeds = totalSubscriptions -
            ((totalSubscriptions * exitQuoteFeePercentage) / 1e18);
        
        bool projectTokensToRefund = totalSubscriptions < floorQuoteAmount;

        if (isQuoteWETH) {
            IWETH9(address(quoteToken)).withdraw(auctionProceeds);

            // Transfer auction proceeds in ETH to the auction owner
            (bool success, ) = msg.sender.call{value: auctionProceeds}("");
            require(success, "Failed to send Ether to auction owner");
        } else {
            SafeERC20.safeTransfer(quoteToken, msg.sender, auctionProceeds);
        }

        if (projectTokensToRefund) {
            uint256 amountSold = totalProjectTokenAmount * totalSubscriptions / floorQuoteAmount;
            SafeERC20.safeTransfer(projectToken, msg.sender, totalProjectTokenAmount - amountSold);

            emit AuctioneerProjectTokensRefunded(
                msg.sender,
                projectToken,
                totalProjectTokenAmount - amountSold
            );
        }

        auctionQuoteFeesClaimed = true;

        emit AuctionQuoteTokensClaimed(
            msg.sender,
            quoteToken,
            auctionProceeds,
            false
        );
    }

    // Owner is the Factory contract which has the ability to claim the fees
    function claimBazaarFees(
        address feeRecipient
    ) external onlyOwner nonReentrant {
        require(block.timestamp > endTime, "Auction has not ended");
        require(!bazaarFeesClaimed, "Bazaar fees already claimed");

        // We don't care about under/overflow tag as it is not possible in this case
        uint256 totalFees = totalSwapFees +
            ((totalSubscriptions * exitQuoteFeePercentage) / 1e18);

        if (isQuoteWETH) {
            IWETH9(address(quoteToken)).withdraw(totalFees);

            // Transfer auction proceeds in ETH to the fee recipient
            (bool success, ) = feeRecipient.call{value: totalFees}("");
            require(success, "Failed to send Ether to auction owner");
        } else {
            SafeERC20.safeTransfer(quoteToken, feeRecipient, totalFees);
        }

        bazaarFeesClaimed = true;

        emit AuctionQuoteTokensClaimed(
            feeRecipient,
            quoteToken,
            totalFees,
            true
        );
    }

    fallback() external payable {}
}

File 7 of 15 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @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 8 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

File 9 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT

// Based on the Ownable library from OpenZeppelin Contracts, altered to reduce runtime gas by dropping
// support for the GSN.

pragma solidity >=0.7.0 <0.9.0;

import "../helpers/BalancerErrors.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(msg.sender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _require(owner() == msg.sender, Errors.CALLER_IS_NOT_OWNER);
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        _require(newOwner != address(0), Errors.NEW_OWNER_IS_ZERO);
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 10 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 11 of 15 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.20;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeCast {
    /**
     * @dev Value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);

    /**
     * @dev An int value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedIntToUint(int256 value);

    /**
     * @dev Value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);

    /**
     * @dev An uint value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedUintToInt(uint256 value);

    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        if (value > type(uint248).max) {
            revert SafeCastOverflowedUintDowncast(248, value);
        }
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        if (value > type(uint240).max) {
            revert SafeCastOverflowedUintDowncast(240, value);
        }
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        if (value > type(uint232).max) {
            revert SafeCastOverflowedUintDowncast(232, value);
        }
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        if (value > type(uint224).max) {
            revert SafeCastOverflowedUintDowncast(224, value);
        }
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        if (value > type(uint216).max) {
            revert SafeCastOverflowedUintDowncast(216, value);
        }
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        if (value > type(uint208).max) {
            revert SafeCastOverflowedUintDowncast(208, value);
        }
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        if (value > type(uint200).max) {
            revert SafeCastOverflowedUintDowncast(200, value);
        }
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        if (value > type(uint192).max) {
            revert SafeCastOverflowedUintDowncast(192, value);
        }
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        if (value > type(uint184).max) {
            revert SafeCastOverflowedUintDowncast(184, value);
        }
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        if (value > type(uint176).max) {
            revert SafeCastOverflowedUintDowncast(176, value);
        }
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        if (value > type(uint168).max) {
            revert SafeCastOverflowedUintDowncast(168, value);
        }
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) {
            revert SafeCastOverflowedUintDowncast(160, value);
        }
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        if (value > type(uint152).max) {
            revert SafeCastOverflowedUintDowncast(152, value);
        }
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        if (value > type(uint144).max) {
            revert SafeCastOverflowedUintDowncast(144, value);
        }
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        if (value > type(uint136).max) {
            revert SafeCastOverflowedUintDowncast(136, value);
        }
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        if (value > type(uint128).max) {
            revert SafeCastOverflowedUintDowncast(128, value);
        }
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        if (value > type(uint120).max) {
            revert SafeCastOverflowedUintDowncast(120, value);
        }
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        if (value > type(uint112).max) {
            revert SafeCastOverflowedUintDowncast(112, value);
        }
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        if (value > type(uint104).max) {
            revert SafeCastOverflowedUintDowncast(104, value);
        }
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        if (value > type(uint96).max) {
            revert SafeCastOverflowedUintDowncast(96, value);
        }
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        if (value > type(uint88).max) {
            revert SafeCastOverflowedUintDowncast(88, value);
        }
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        if (value > type(uint80).max) {
            revert SafeCastOverflowedUintDowncast(80, value);
        }
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        if (value > type(uint72).max) {
            revert SafeCastOverflowedUintDowncast(72, value);
        }
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        if (value > type(uint64).max) {
            revert SafeCastOverflowedUintDowncast(64, value);
        }
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        if (value > type(uint56).max) {
            revert SafeCastOverflowedUintDowncast(56, value);
        }
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        if (value > type(uint48).max) {
            revert SafeCastOverflowedUintDowncast(48, value);
        }
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        if (value > type(uint40).max) {
            revert SafeCastOverflowedUintDowncast(40, value);
        }
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        if (value > type(uint32).max) {
            revert SafeCastOverflowedUintDowncast(32, value);
        }
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        if (value > type(uint24).max) {
            revert SafeCastOverflowedUintDowncast(24, value);
        }
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        if (value > type(uint16).max) {
            revert SafeCastOverflowedUintDowncast(16, value);
        }
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        if (value > type(uint8).max) {
            revert SafeCastOverflowedUintDowncast(8, value);
        }
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        if (value < 0) {
            revert SafeCastOverflowedIntToUint(value);
        }
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(248, value);
        }
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(240, value);
        }
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(232, value);
        }
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(224, value);
        }
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(216, value);
        }
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(208, value);
        }
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(200, value);
        }
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(192, value);
        }
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(184, value);
        }
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(176, value);
        }
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(168, value);
        }
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(160, value);
        }
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(152, value);
        }
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(144, value);
        }
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(136, value);
        }
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(128, value);
        }
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(120, value);
        }
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(112, value);
        }
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(104, value);
        }
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(96, value);
        }
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(88, value);
        }
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(80, value);
        }
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(72, value);
        }
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(64, value);
        }
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(56, value);
        }
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(48, value);
        }
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(40, value);
        }
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(32, value);
        }
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(24, value);
        }
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(16, value);
        }
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(8, value);
        }
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        if (value > uint256(type(int256).max)) {
            revert SafeCastOverflowedUintToInt(value);
        }
        return int256(value);
    }
}

File 12 of 15 : IWETH9.sol
pragma solidity >=0.7.0 < 0.9.0;

interface IWETH9 {
    // Events
    event Approval(address indexed src, address indexed guy, uint wad);
    event Transfer(address indexed src, address indexed dst, uint wad);
    event Deposit(address indexed dst, uint wad);
    event Withdrawal(address indexed src, uint wad);

    // Functions
    function balanceOf(address wad) external returns (uint);
    function deposit() external payable;
    function withdraw(uint wad) external;
    function totalSupply() external view returns (uint);
    function approve(address guy, uint wad) external returns (bool);
    function transfer(address dst, uint wad) external returns (bool);
    function transferFrom(
        address src,
        address dst,
        uint wad
    ) external returns (bool);
}

File 13 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @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;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // 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() internal view returns (bool) {
        return _status == ENTERED;
    }
}

File 14 of 15 : BalancerErrors.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity >=0.7.0 <0.9.0;

// solhint-disable

/**
 * @dev Reverts if `condition` is false, with a revert reason containing `errorCode`. Only codes up to 999 are
 * supported.
 */
function _require(bool condition, uint256 errorCode) pure {
    if (!condition) _revert(errorCode);
}

/**
 * @dev Reverts with a revert reason containing `errorCode`. Only codes up to 999 are supported.
 */
function _revert(uint256 errorCode) pure {
    // We're going to dynamically create a revert string based on the error code, with the following format:
    // 'BAL#{errorCode}'
    // where the code is left-padded with zeroes to three digits (so they range from 000 to 999).
    //
    // We don't have revert strings embedded in the contract to save bytecode size: it takes much less space to store a
    // number (8 to 16 bits) than the individual string characters.
    //
    // The dynamic string creation algorithm that follows could be implemented in Solidity, but assembly allows for a
    // much denser implementation, again saving bytecode size. Given this function unconditionally reverts, this is a
    // safe place to rely on it without worrying about how its usage might affect e.g. memory contents.
    assembly {
        // First, we need to compute the ASCII representation of the error code. We assume that it is in the 0-999
        // range, so we only need to convert three digits. To convert the digits to ASCII, we add 0x30, the value for
        // the '0' character.

        let units := add(mod(errorCode, 10), 0x30)

        errorCode := div(errorCode, 10)
        let tenths := add(mod(errorCode, 10), 0x30)

        errorCode := div(errorCode, 10)
        let hundreds := add(mod(errorCode, 10), 0x30)

        // With the individual characters, we can now construct the full string. The "BAL#" part is a known constant
        // (0x42414c23): we simply shift this by 24 (to provide space for the 3 bytes of the error code), and add the
        // characters to it, each shifted by a multiple of 8.
        // The revert reason is then shifted left by 200 bits (256 minus the length of the string, 7 characters * 8 bits
        // per character = 56) to locate it in the most significant part of the 256 slot (the beginning of a byte
        // array).

        let revertReason := shl(200, add(0x42414c23000000, add(add(units, shl(8, tenths)), shl(16, hundreds))))

        // We can now encode the reason in memory, which can be safely overwritten as we're about to revert. The encoded
        // message will have the following layout:
        // [ revert reason identifier ] [ string location offset ] [ string length ] [ string contents ]

        // The Solidity revert reason identifier is 0x08c739a0, the function selector of the Error(string) function. We
        // also write zeroes to the next 28 bytes of memory, but those are about to be overwritten.
        mstore(0x0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
        // Next is the offset to the location of the string, which will be placed immediately after (20 bytes away).
        mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020)
        // The string length is fixed: 7 characters.
        mstore(0x24, 7)
        // Finally, the string itself is stored.
        mstore(0x44, revertReason)

        // Even if the string is only 7 bytes long, we need to return a full 32 byte slot containing it. The length of
        // the encoded message is therefore 4 + 32 + 32 + 32 = 100.
        revert(0, 100)
    }
}

library Errors {
    // Math
    uint256 internal constant ADD_OVERFLOW = 0;
    uint256 internal constant SUB_OVERFLOW = 1;
    uint256 internal constant SUB_UNDERFLOW = 2;
    uint256 internal constant MUL_OVERFLOW = 3;
    uint256 internal constant ZERO_DIVISION = 4;
    uint256 internal constant DIV_INTERNAL = 5;
    uint256 internal constant X_OUT_OF_BOUNDS = 6;
    uint256 internal constant Y_OUT_OF_BOUNDS = 7;
    uint256 internal constant PRODUCT_OUT_OF_BOUNDS = 8;
    uint256 internal constant INVALID_EXPONENT = 9;

    // Input
    uint256 internal constant OUT_OF_BOUNDS = 100;
    uint256 internal constant UNSORTED_ARRAY = 101;
    uint256 internal constant UNSORTED_TOKENS = 102;
    uint256 internal constant INPUT_LENGTH_MISMATCH = 103;
    uint256 internal constant ZERO_TOKEN = 104;

    // Shared pools
    uint256 internal constant MIN_TOKENS = 200;
    uint256 internal constant MAX_TOKENS = 201;
    uint256 internal constant MAX_SWAP_FEE_PERCENTAGE = 202;
    uint256 internal constant MIN_SWAP_FEE_PERCENTAGE = 203;
    uint256 internal constant MINIMUM_BPT = 204;
    uint256 internal constant CALLER_NOT_VAULT = 205;
    uint256 internal constant UNINITIALIZED = 206;
    uint256 internal constant BPT_IN_MAX_AMOUNT = 207;
    uint256 internal constant BPT_OUT_MIN_AMOUNT = 208;
    uint256 internal constant EXPIRED_PERMIT = 209;
    uint256 internal constant NOT_TWO_TOKENS = 210;
    uint256 internal constant DISABLED = 211;

    // Pools
    uint256 internal constant MIN_AMP = 300;
    uint256 internal constant MAX_AMP = 301;
    uint256 internal constant MIN_WEIGHT = 302;
    uint256 internal constant MAX_STABLE_TOKENS = 303;
    uint256 internal constant MAX_IN_RATIO = 304;
    uint256 internal constant MAX_OUT_RATIO = 305;
    uint256 internal constant MIN_BPT_IN_FOR_TOKEN_OUT = 306;
    uint256 internal constant MAX_OUT_BPT_FOR_TOKEN_IN = 307;
    uint256 internal constant NORMALIZED_WEIGHT_INVARIANT = 308;
    uint256 internal constant INVALID_TOKEN = 309;
    uint256 internal constant UNHANDLED_JOIN_KIND = 310;
    uint256 internal constant ZERO_INVARIANT = 311;
    uint256 internal constant ORACLE_INVALID_SECONDS_QUERY = 312;
    uint256 internal constant ORACLE_NOT_INITIALIZED = 313;
    uint256 internal constant ORACLE_QUERY_TOO_OLD = 314;
    uint256 internal constant ORACLE_INVALID_INDEX = 315;
    uint256 internal constant ORACLE_BAD_SECS = 316;
    uint256 internal constant AMP_END_TIME_TOO_CLOSE = 317;
    uint256 internal constant AMP_ONGOING_UPDATE = 318;
    uint256 internal constant AMP_RATE_TOO_HIGH = 319;
    uint256 internal constant AMP_NO_ONGOING_UPDATE = 320;
    uint256 internal constant STABLE_INVARIANT_DIDNT_CONVERGE = 321;
    uint256 internal constant STABLE_GET_BALANCE_DIDNT_CONVERGE = 322;
    uint256 internal constant RELAYER_NOT_CONTRACT = 323;
    uint256 internal constant BASE_POOL_RELAYER_NOT_CALLED = 324;
    uint256 internal constant REBALANCING_RELAYER_REENTERED = 325;
    uint256 internal constant GRADUAL_UPDATE_TIME_TRAVEL = 326;
    uint256 internal constant SWAPS_DISABLED = 327;
    uint256 internal constant CALLER_IS_NOT_LBP_OWNER = 328;
    uint256 internal constant PRICE_RATE_OVERFLOW = 329;
    uint256 internal constant INVALID_JOIN_EXIT_KIND_WHILE_SWAPS_DISABLED = 330;
    uint256 internal constant WEIGHT_CHANGE_TOO_FAST = 331;
    uint256 internal constant LOWER_GREATER_THAN_UPPER_TARGET = 332;
    uint256 internal constant UPPER_TARGET_TOO_HIGH = 333;
    uint256 internal constant UNHANDLED_BY_LINEAR_POOL = 334;
    uint256 internal constant OUT_OF_TARGET_RANGE = 335;
    uint256 internal constant UNHANDLED_EXIT_KIND = 336;
    uint256 internal constant UNAUTHORIZED_EXIT = 337;
    uint256 internal constant MAX_MANAGEMENT_SWAP_FEE_PERCENTAGE = 338;
    uint256 internal constant UNHANDLED_BY_MANAGED_POOL = 339;
    uint256 internal constant UNHANDLED_BY_PHANTOM_POOL = 340;
    uint256 internal constant TOKEN_DOES_NOT_HAVE_RATE_PROVIDER = 341;
    uint256 internal constant INVALID_INITIALIZATION = 342;
    uint256 internal constant OUT_OF_NEW_TARGET_RANGE = 343;
    uint256 internal constant UNAUTHORIZED_OPERATION = 344;
    uint256 internal constant UNINITIALIZED_POOL_CONTROLLER = 345;

    // Lib
    uint256 internal constant REENTRANCY = 400;
    uint256 internal constant SENDER_NOT_ALLOWED = 401;
    uint256 internal constant PAUSED = 402;
    uint256 internal constant PAUSE_WINDOW_EXPIRED = 403;
    uint256 internal constant MAX_PAUSE_WINDOW_DURATION = 404;
    uint256 internal constant MAX_BUFFER_PERIOD_DURATION = 405;
    uint256 internal constant INSUFFICIENT_BALANCE = 406;
    uint256 internal constant INSUFFICIENT_ALLOWANCE = 407;
    uint256 internal constant ERC20_TRANSFER_FROM_ZERO_ADDRESS = 408;
    uint256 internal constant ERC20_TRANSFER_TO_ZERO_ADDRESS = 409;
    uint256 internal constant ERC20_MINT_TO_ZERO_ADDRESS = 410;
    uint256 internal constant ERC20_BURN_FROM_ZERO_ADDRESS = 411;
    uint256 internal constant ERC20_APPROVE_FROM_ZERO_ADDRESS = 412;
    uint256 internal constant ERC20_APPROVE_TO_ZERO_ADDRESS = 413;
    uint256 internal constant ERC20_TRANSFER_EXCEEDS_ALLOWANCE = 414;
    uint256 internal constant ERC20_DECREASED_ALLOWANCE_BELOW_ZERO = 415;
    uint256 internal constant ERC20_TRANSFER_EXCEEDS_BALANCE = 416;
    uint256 internal constant ERC20_BURN_EXCEEDS_ALLOWANCE = 417;
    uint256 internal constant SAFE_ERC20_CALL_FAILED = 418;
    uint256 internal constant ADDRESS_INSUFFICIENT_BALANCE = 419;
    uint256 internal constant ADDRESS_CANNOT_SEND_VALUE = 420;
    uint256 internal constant SAFE_CAST_VALUE_CANT_FIT_INT256 = 421;
    uint256 internal constant GRANT_SENDER_NOT_ADMIN = 422;
    uint256 internal constant REVOKE_SENDER_NOT_ADMIN = 423;
    uint256 internal constant RENOUNCE_SENDER_NOT_ALLOWED = 424;
    uint256 internal constant BUFFER_PERIOD_EXPIRED = 425;
    uint256 internal constant CALLER_IS_NOT_OWNER = 426;
    uint256 internal constant NEW_OWNER_IS_ZERO = 427;
    uint256 internal constant CODE_DEPLOYMENT_FAILED = 428;
    uint256 internal constant CALL_TO_NON_CONTRACT = 429;
    uint256 internal constant LOW_LEVEL_CALL_FAILED = 430;
    uint256 internal constant NOT_PAUSED = 431;
    uint256 internal constant ADDRESS_ALREADY_ALLOWLISTED = 432;
    uint256 internal constant ADDRESS_NOT_ALLOWLISTED = 433;

    // Vault
    uint256 internal constant INVALID_POOL_ID = 500;
    uint256 internal constant CALLER_NOT_POOL = 501;
    uint256 internal constant SENDER_NOT_ASSET_MANAGER = 502;
    uint256 internal constant USER_DOESNT_ALLOW_RELAYER = 503;
    uint256 internal constant INVALID_SIGNATURE = 504;
    uint256 internal constant EXIT_BELOW_MIN = 505;
    uint256 internal constant JOIN_ABOVE_MAX = 506;
    uint256 internal constant SWAP_LIMIT = 507;
    uint256 internal constant SWAP_DEADLINE = 508;
    uint256 internal constant CANNOT_SWAP_SAME_TOKEN = 509;
    uint256 internal constant UNKNOWN_AMOUNT_IN_FIRST_SWAP = 510;
    uint256 internal constant MALCONSTRUCTED_MULTIHOP_SWAP = 511;
    uint256 internal constant INTERNAL_BALANCE_OVERFLOW = 512;
    uint256 internal constant INSUFFICIENT_INTERNAL_BALANCE = 513;
    uint256 internal constant INVALID_ETH_INTERNAL_BALANCE = 514;
    uint256 internal constant INVALID_POST_LOAN_BALANCE = 515;
    uint256 internal constant INSUFFICIENT_ETH = 516;
    uint256 internal constant UNALLOCATED_ETH = 517;
    uint256 internal constant ETH_TRANSFER = 518;
    uint256 internal constant CANNOT_USE_ETH_SENTINEL = 519;
    uint256 internal constant TOKENS_MISMATCH = 520;
    uint256 internal constant TOKEN_NOT_REGISTERED = 521;
    uint256 internal constant TOKEN_ALREADY_REGISTERED = 522;
    uint256 internal constant TOKENS_ALREADY_SET = 523;
    uint256 internal constant TOKENS_LENGTH_MUST_BE_2 = 524;
    uint256 internal constant NONZERO_TOKEN_BALANCE = 525;
    uint256 internal constant BALANCE_TOTAL_OVERFLOW = 526;
    uint256 internal constant POOL_NO_TOKENS = 527;
    uint256 internal constant INSUFFICIENT_FLASH_LOAN_BALANCE = 528;

    // Fees
    uint256 internal constant SWAP_FEE_PERCENTAGE_TOO_HIGH = 600;
    uint256 internal constant FLASH_LOAN_FEE_PERCENTAGE_TOO_HIGH = 601;
    uint256 internal constant INSUFFICIENT_FLASH_LOAN_FEE_AMOUNT = 602;
}

File 15 of 15 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "balancer-lbp-patch/=lib/balancer-lbp-patch/node_modules/@balancer-labs/",
    "@balancer-labs/=lib/balancer-lbp-patch/node_modules/@balancer-labs/",
    "@ensdomains/=lib/balancer-v2-monorepo/node_modules/@ensdomains/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@solidity-parser/=lib/balancer-v2-monorepo/node_modules/",
    "balancer-v2-monorepo/=lib/balancer-v2-monorepo/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "hardhat/=lib/balancer-v2-monorepo/node_modules/hardhat/",
    "openzeppelin-0.7/=lib/openzeppelin-0.7/contracts/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "prettier-plugin-solidity/=lib/balancer-v2-monorepo/node_modules/prettier-plugin-solidity/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 9999
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract BazaarManager","name":"_manager","type":"address"},{"internalType":"address","name":"_wethAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"auction","type":"address"},{"indexed":false,"internalType":"uint256","name":"swapPercentage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"exitQuotePercentage","type":"uint256"}],"name":"AuctionFeesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"auction","type":"address"},{"indexed":false,"internalType":"address","name":"auctionCreator","type":"address"},{"indexed":false,"internalType":"contract IERC20","name":"quoteToken","type":"address"},{"indexed":false,"internalType":"contract IERC20","name":"projectToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"projectTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"floorQuoteAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"swapFeePercentage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"exitQuoteFeePercentage","type":"uint256"}],"name":"AuctionUncappedCreated","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"auctionFromFactory","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"auctionAddress","type":"address"}],"name":"claimBazaarFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"projectToken","type":"address"},{"internalType":"contract IERC20","name":"quoteToken","type":"address"},{"internalType":"uint256","name":"projectTokenAmount","type":"uint256"},{"internalType":"uint256","name":"floorQuoteAmount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"internalType":"struct BatchAuctionUncappedConfig","name":"cfg","type":"tuple"}],"name":"createAuction","outputs":[{"internalType":"contract BatchAuctionUncapped","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manager","outputs":[{"internalType":"contract BazaarManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"auctionAddress","type":"address"},{"internalType":"uint256","name":"swapPercentage","type":"uint256"},{"internalType":"uint256","name":"exitQuotePercentage","type":"uint256"}],"name":"setAuctionFeePercentages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wethAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a060405234801561001057600080fd5b50604051612f4e380380612f4e83398101604081905261002f9161006c565b600080546001600160a01b0319166001600160a01b03938416179055166080526100a6565b6001600160a01b038116811461006957600080fd5b50565b6000806040838503121561007f57600080fd5b825161008a81610054565b602084015190925061009b81610054565b809150509250929050565b608051612e876100c76000396000818160d1015261048f0152612e876000f3fe60806040523480156200001157600080fd5b50600436106200007b5760003560e01c8063d3a998d41162000056578063d3a998d4146200010a578063db47e5851462000123578063f86e39ef146200015a57600080fd5b8063481c6a7514620000805780634f0e0ef314620000cb578063ad5b572b14620000f3575b600080fd5b600054620000a19073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b620000a17f000000000000000000000000000000000000000000000000000000000000000081565b620000a16200010436600462001024565b62000171565b620001216200011b366004620010d7565b6200069c565b005b62000149620001343660046200110f565b60016020526000908152604090205460ff1681565b6040519015158152602001620000c2565b620001216200016b3660046200110f565b620009dd565b6000805482516040517fc8c2c29a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015291169063c8c2c29a90602401602060405180830381865afa158015620001e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020a91906200112f565b60005460208401516040517fc8c2c29a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201529215159291169063c8c2c29a90602401602060405180830381865afa15801562000283573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002a991906200112f565b1515036200033e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f41756374696f6e206d757374206861766520612071756f746520262070726f6a60448201527f65637420746f6b656e000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b42826080015111620003d3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f41756374696f6e2073746172742074696d65206d75737420626520696e20746860448201527f6520667574757265000000000000000000000000000000000000000000000000606482015260840162000335565b60008054604080517f43c852cb0000000000000000000000000000000000000000000000000000000081528151849373ffffffffffffffffffffffffffffffffffffffff16926343c852cb92600480820193918290030181865afa15801562000440573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000466919062001153565b91509150600033856020015186600001518760400151886060015189608001518a60a0015189897f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168e6020015173ffffffffffffffffffffffffffffffffffffffff1614604051620004ee9062000fe1565b73ffffffffffffffffffffffffffffffffffffffff9a8b168152988a1660208a01529890961660408801526060870194909452608086019290925260a085015260c084015260e083015261010082015290151561012082015261014001604051809103906000f08015801562000568573d6000803e3d6000fd5b5090506200058185600001513383886040015162000ce3565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602081815260409283902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909217909155860151865187830151606089015160808a015160a08b015195517f97ae7ea52349273ddf301a9447fc959aec12ecab57c76246893a1d326577728f966200068c96899633969195909491939092908d908d9073ffffffffffffffffffffffffffffffffffffffff9a8b168152988a1660208a01529689166040890152949097166060870152608086019290925260a085015260c084015260e08301939093526101008201929092526101208101919091526101400190565b60405180910390a1949350505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054839060ff1662000755576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f49426174636841756374696f6e556e636170706564206e6f742063726561746560448201527f642066726f6d20666163746f7279000000000000000000000000000000000000606482015260840162000335565b600054604080517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529051339273ffffffffffffffffffffffffffffffffffffffff1691638da5cb5b9160048083019260209291908290030181865afa158015620007c5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007eb919062001178565b73ffffffffffffffffffffffffffffffffffffffff16146200086a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f6e6c792042617a6161724d616e61676572206f776e65720000000000000000604482015260640162000335565b6706f05b59d3b2000083111580156200088b57506706f05b59d3b200008211155b620008f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f496e76616c6964204665652050657263656e7461676500000000000000000000604482015260640162000335565b6040517f0b78f9c00000000000000000000000000000000000000000000000000000000081526004810184905260248101839052849073ffffffffffffffffffffffffffffffffffffffff821690630b78f9c090604401600060405180830381600087803b1580156200096557600080fd5b505af11580156200097a573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff89168152602081018890529081018690527fcd19f2489d3c81f669680f3798aa5c666e0410d4d67b55f9fdf2d5c9ea41a7cd9250606001905060405180910390a15050505050565b600054604080517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529051339273ffffffffffffffffffffffffffffffffffffffff1691638da5cb5b9160048083019260209291908290030181865afa15801562000a4d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a73919062001178565b73ffffffffffffffffffffffffffffffffffffffff161462000af2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f6e6c792042617a6161724d616e61676572206f776e65720000000000000000604482015260640162000335565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040902054819060ff1662000bab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f49426174636841756374696f6e556e636170706564206e6f742063726561746560448201527f642066726f6d20666163746f7279000000000000000000000000000000000000606482015260840162000335565b60008290508073ffffffffffffffffffffffffffffffffffffffff1663f86e39ef60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c415b95c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000c38573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c5e919062001178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401600060405180830381600087803b15801562000cc557600080fd5b505af115801562000cda573d6000803e3d6000fd5b50505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905262000d7a90859062000d80565b50505050565b600062000da473ffffffffffffffffffffffffffffffffffffffff84168362000e22565b9050805160001415801562000dcc57508080602001905181019062000dca91906200112f565b155b1562000e1d576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240162000335565b505050565b606062000e328383600062000e39565b9392505050565b60608147101562000e79576040517fcd78605900000000000000000000000000000000000000000000000000000000815230600482015260240162000335565b6000808573ffffffffffffffffffffffffffffffffffffffff16848660405162000ea4919062001198565b60006040518083038185875af1925050503d806000811462000ee3576040519150601f19603f3d011682016040523d82523d6000602084013e62000ee8565b606091505b509150915062000efa86838362000f04565b9695505050505050565b60608262000f1d5762000f178262000f9b565b62000e32565b815115801562000f42575073ffffffffffffffffffffffffffffffffffffffff84163b155b1562000f93576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240162000335565b508062000e32565b80511562000fac5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b611c8880620011ca83390190565b73ffffffffffffffffffffffffffffffffffffffff8116811462000fde57600080fd5b80356200101f8162000fef565b919050565b600060c082840312156200103757600080fd5b60405160c0810181811067ffffffffffffffff8211171562001082577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604052620010908362001012565b8152620010a06020840162001012565b602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201528091505092915050565b600080600060608486031215620010ed57600080fd5b8335620010fa8162000fef565b95602085013595506040909401359392505050565b6000602082840312156200112257600080fd5b813562000e328162000fef565b6000602082840312156200114257600080fd5b8151801515811462000e3257600080fd5b600080604083850312156200116757600080fd5b505080516020909101519092909150565b6000602082840312156200118b57600080fd5b815162000e328162000fef565b6000825160005b81811015620011bb57602081860181015185830152016200119f565b50600092019182525091905056fe60806040526003805463ffff00ff60a01b191690553480156200002157600080fd5b5060405162001c8838038062001c8883398101604081905262000044916200022e565b33806200006c57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200007781620001c5565b5060018055838510620000e35760405162461bcd60e51b815260206004820152602d60248201527f41756374696f6e2073746172742074696d65206d757374206265206c6573732060448201526c7468616e20656e642074696d6560981b606482015260840162000063565b60008711620001495760405162461bcd60e51b815260206004820152602b60248201527f50726f6a65637420746f6b656e20616d6f756e74206d7573742062652067726560448201526a061746572207468616e20360ac1b606482015260840162000063565b600480546001600160a01b039b8c166001600160a01b031991821617909155600795909555600893909355600a95909555600993909355600280549688169690921695909517905560038054600592909255600692909255921515600160a81b02600161ff0160a01b03199093169190931617179055620002d9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200022b57600080fd5b50565b6000806000806000806000806000806101408b8d0312156200024f57600080fd5b8a516200025c8162000215565b60208c0151909a506200026f8162000215565b60408c0151909950620002828162000215565b8098505060608b0151965060808b0151955060a08b0151945060c08b0151935060e08b015192506101008b015191506101208b01518015158114620002c657600080fd5b809150509295989b9194979a5092959850565b61199f80620002e96000396000f3fe6080604052600436106101815760003560e01c806378e97925116100d5578063bed3f89e11610084578063f046395a11610061578063f046395a14610459578063f2fde38b14610486578063f86e39ef146104a6578063f90ad592146104c657005b8063bed3f89e14610400578063c61a77f214610416578063d3924aaf1461042c57005b80638de69284116100b25780638de69284146103c157806395e00a22146103d4578063a4ac0d49146103ea57005b806378e979251461034d5780637d7b8a6b146103635780638da5cb5b1461039657005b8063243fe924116101315780635c975abb1161010e5780635c975abb146102c1578063715018a614610303578063723463091461031857005b8063243fe924146102695780633197cbb61461027e5780634b60ce771461029457005b806316c38b3c1161015f57806316c38b3c146101e15780631e75f23514610201578063217a4b701461021757005b80630b78f9c01461018357806313239b8a146101a35780631328b870146101b8575b005b34801561018f57600080fd5b5061018161019e3660046117bb565b6104fa565b3480156101af57600080fd5b5061018161055a565b3480156101c457600080fd5b506101ce600c5481565b6040519081526020015b60405180910390f35b3480156101ed57600080fd5b506101816101fc3660046117eb565b6106e1565b34801561020d57600080fd5b506101ce60095481565b34801561022357600080fd5b506002546102449073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d8565b34801561027557600080fd5b5061018161079d565b34801561028a57600080fd5b506101ce60085481565b3480156102a057600080fd5b506003546102449073ffffffffffffffffffffffffffffffffffffffff1681565b3480156102cd57600080fd5b506003546102f39074010000000000000000000000000000000000000000900460ff1681565b60405190151581526020016101d8565b34801561030f57600080fd5b50610181610c20565b34801561032457600080fd5b506003546102f39077010000000000000000000000000000000000000000000000900460ff1681565b34801561035957600080fd5b506101ce60075481565b34801561036f57600080fd5b506003546102f3907501000000000000000000000000000000000000000000900460ff1681565b3480156103a257600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610244565b6101816103cf366004611831565b610c32565b3480156103e057600080fd5b506101ce60065481565b3480156103f657600080fd5b506101ce60055481565b34801561040c57600080fd5b506101ce600d5481565b34801561042257600080fd5b506101ce600a5481565b34801561043857600080fd5b506004546102449073ffffffffffffffffffffffffffffffffffffffff1681565b34801561046557600080fd5b506101ce61047436600461185b565b600b6020526000908152604090205481565b34801561049257600080fd5b506101816104a136600461185b565b610fec565b3480156104b257600080fd5b506101816104c136600461185b565b61104d565b3480156104d257600080fd5b506003546102f390760100000000000000000000000000000000000000000000900460ff1681565b61050261139b565b61050a6113ee565b6005829055600681905560408051838152602081018390527fe7e2a095726aa7e61c651d0bea81dc8918f53351816feedbe765b4436e4bc463910160405180910390a161055660018055565b5050565b6105626113ee565b60085442116105b85760405162461bcd60e51b815260206004820152601560248201527f41756374696f6e20686173206e6f7420656e646564000000000000000000000060448201526064015b60405180910390fd5b336000908152600b6020526040902054806106155760405162461bcd60e51b815260206004820152601060248201527f4e6f20737562736372697074696f6e730000000000000000000000000000000060448201526064016105af565b336000908152600b60205260408120819055600954600c541061063a57600c5461063e565b6009545b9050600081600a548461065191906118a5565b61065b91906118bc565b6003549091506106829073ffffffffffffffffffffffffffffffffffffffff163383611431565b60035460405182815273ffffffffffffffffffffffffffffffffffffffff9091169033907fbe73a18309fe904ddf9986e4f1f4c65a7d33988a6ad96f82b1c4ed87e19bb99c9060200160405180910390a35050506106df60018055565b565b60045473ffffffffffffffffffffffffffffffffffffffff1633146107485760405162461bcd60e51b815260206004820152601260248201527f4f6e6c792061756374696f6e204f776e6572000000000000000000000000000060448201526064016105af565b6107506113ee565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000831515021790556001805550565b50565b60045473ffffffffffffffffffffffffffffffffffffffff1633146108045760405162461bcd60e51b815260206004820152601260248201527f4f6e6c792061756374696f6e204f776e6572000000000000000000000000000060448201526064016105af565b61080c6113ee565b600854421161085d5760405162461bcd60e51b815260206004820152601560248201527f41756374696f6e20686173206e6f7420656e646564000000000000000000000060448201526064016105af565b60035477010000000000000000000000000000000000000000000000900460ff16156108f15760405162461bcd60e51b815260206004820152602260248201527f41756374696f6e2071756f7465206665657320616c726561647920636c61696d60448201527f656400000000000000000000000000000000000000000000000000000000000060648201526084016105af565b6000670de0b6b3a7640000600654600c5461090c91906118a5565b61091691906118bc565b600c5461092391906118f7565b600954600c5460035492935010907501000000000000000000000000000000000000000000900460ff1615610a9a576002546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b1580156109be57600080fd5b505af11580156109d2573d6000803e3d6000fd5b50506040516000925033915084908381818185875af1925050503d8060008114610a18576040519150601f19603f3d011682016040523d82523d6000602084013e610a1d565b606091505b5050905080610a945760405162461bcd60e51b815260206004820152602560248201527f4661696c656420746f2073656e6420457468657220746f2061756374696f6e2060448201527f6f776e657200000000000000000000000000000000000000000000000000000060648201526084016105af565b50610abe565b600254610abe9073ffffffffffffffffffffffffffffffffffffffff163384611431565b8015610b7c576000600954600c54600a54610ad991906118a5565b610ae391906118bc565b600354600a54919250610b1b9173ffffffffffffffffffffffffffffffffffffffff909116903390610b169085906118f7565b611431565b600354600a5473ffffffffffffffffffffffffffffffffffffffff9091169033907fda2be1a9e45b257b4871e346718e2baecb61ac0f6eb99017f52965723ea8ac3690610b699085906118f7565b60405190815260200160405180910390a3505b600380547fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff1677010000000000000000000000000000000000000000000000179055600254604080518481526000602082015273ffffffffffffffffffffffffffffffffffffffff9092169133917f4a603ce815dea65b6c1f72f879380d681a068027dc8b99055a03c15559c7a29b910160405180910390a350506106df60018055565b610c2861139b565b6106df60006114b7565b610c3a6113ee565b60035474010000000000000000000000000000000000000000900460ff1615610ca55760405162461bcd60e51b815260206004820152601260248201527f436f6e747261637420697320706175736564000000000000000000000000000060448201526064016105af565b42600754108015610cb7575060085442105b610d295760405162461bcd60e51b815260206004820152602160248201527f537562736372697074696f6e20706572696f64206973206e6f7420616374697660448201527f650000000000000000000000000000000000000000000000000000000000000060648201526084016105af565b6003547501000000000000000000000000000000000000000000900460ff168015610d5357508034145b15610e5557803414610dcd5760405162461bcd60e51b815260206004820152603660248201527f416d6f756e7420737065636966696564206d757374206265207468652073616d60448201527f65206173206d73672e76616c756520666f72204554480000000000000000000060648201526084016105af565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e3757600080fd5b505af1158015610e4b573d6000803e3d6000fd5b5050505050610eee565b3415610ec95760405162461bcd60e51b815260206004820152603b60248201527f4e6f206d73672e76616c75652073686f756c642062652073656e74206173207560448201527f73657220697320706179696e67207769746820616e204552433230000000000060648201526084016105af565b600254610eee9073ffffffffffffffffffffffffffffffffffffffff1633308461152c565b6000670de0b6b3a764000060055483610f0791906118a5565b610f1191906118bc565b90506000610f1f82846118f7565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600b6020526040812080549293508392909190610f5990849061190a565b9250508190555080600c6000828254610f72919061190a565b9250508190555081600d6000828254610f8b919061190a565b9091555050604080518481526020810184905273ffffffffffffffffffffffffffffffffffffffff8616917ff94991dcbea6e8ac439cbc93bd9c62a4d39f04e0ad656df9a703f13552c2787f910160405180910390a2505061055660018055565b610ff461139b565b73ffffffffffffffffffffffffffffffffffffffff8116611044576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016105af565b61079a816114b7565b61105561139b565b61105d6113ee565b60085442116110ae5760405162461bcd60e51b815260206004820152601560248201527f41756374696f6e20686173206e6f7420656e646564000000000000000000000060448201526064016105af565b600354760100000000000000000000000000000000000000000000900460ff161561111b5760405162461bcd60e51b815260206004820152601b60248201527f42617a616172206665657320616c726561647920636c61696d6564000000000060448201526064016105af565b6000670de0b6b3a7640000600654600c5461113691906118a5565b61114091906118bc565b600d5461114d919061190a565b6003549091507501000000000000000000000000000000000000000000900460ff16156112d4576002546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b1580156111e057600080fd5b505af11580156111f4573d6000803e3d6000fd5b5050505060008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114611252576040519150601f19603f3d011682016040523d82523d6000602084013e611257565b606091505b50509050806112ce5760405162461bcd60e51b815260206004820152602560248201527f4661696c656420746f2073656e6420457468657220746f2061756374696f6e2060448201527f6f776e657200000000000000000000000000000000000000000000000000000060648201526084016105af565b506112f8565b6002546112f89073ffffffffffffffffffffffffffffffffffffffff168383611431565b600380547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16760100000000000000000000000000000000000000000000179055600254604080518381526001602082015273ffffffffffffffffffffffffffffffffffffffff928316928516917f4a603ce815dea65b6c1f72f879380d681a068027dc8b99055a03c15559c7a29b910160405180910390a35061079a60018055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106df576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016105af565b60026001540361142a576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b60405173ffffffffffffffffffffffffffffffffffffffff8381166024830152604482018390526114b291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611578565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60405173ffffffffffffffffffffffffffffffffffffffff84811660248301528381166044830152606482018390526115729186918216906323b872dd9060840161146b565b50505050565b600061159a73ffffffffffffffffffffffffffffffffffffffff84168361160e565b905080516000141580156115bf5750808060200190518101906115bd919061191d565b155b156114b2576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024016105af565b606061161c83836000611625565b90505b92915050565b606081471015611663576040517fcd7860590000000000000000000000000000000000000000000000000000000081523060048201526024016105af565b6000808573ffffffffffffffffffffffffffffffffffffffff16848660405161168c919061193a565b60006040518083038185875af1925050503d80600081146116c9576040519150601f19603f3d011682016040523d82523d6000602084013e6116ce565b606091505b50915091506116de8683836116ea565b925050505b9392505050565b6060826116ff576116fa82611779565b6116e3565b8151158015611723575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611772576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105af565b50806116e3565b8051156117895780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080604083850312156117ce57600080fd5b50508035926020909101359150565b801515811461079a57600080fd5b6000602082840312156117fd57600080fd5b81356116e3816117dd565b803573ffffffffffffffffffffffffffffffffffffffff8116811461182c57600080fd5b919050565b6000806040838503121561184457600080fd5b61184d83611808565b946020939093013593505050565b60006020828403121561186d57600080fd5b61161c82611808565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761161f5761161f611876565b6000826118f2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561161f5761161f611876565b8082018082111561161f5761161f611876565b60006020828403121561192f57600080fd5b81516116e3816117dd565b6000825160005b8181101561195b5760208186018101518583015201611941565b50600092019182525091905056fea264697066735822122053aa300564fa7ed88ef3671687f7acb888428e2f317f54d20d55a710579f274764736f6c63430008140033a26469706673582212204a4d957fdba258f2ce5ae108fb26b1407d32fa39c9ca0cfb43a1327f8f450e1a64736f6c63430008140033000000000000000000000000b12509b87908928ff40fb12e04e84384ff51bd9b000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x60806040523480156200001157600080fd5b50600436106200007b5760003560e01c8063d3a998d41162000056578063d3a998d4146200010a578063db47e5851462000123578063f86e39ef146200015a57600080fd5b8063481c6a7514620000805780634f0e0ef314620000cb578063ad5b572b14620000f3575b600080fd5b600054620000a19073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b620000a17f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b620000a16200010436600462001024565b62000171565b620001216200011b366004620010d7565b6200069c565b005b62000149620001343660046200110f565b60016020526000908152604090205460ff1681565b6040519015158152602001620000c2565b620001216200016b3660046200110f565b620009dd565b6000805482516040517fc8c2c29a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015291169063c8c2c29a90602401602060405180830381865afa158015620001e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020a91906200112f565b60005460208401516040517fc8c2c29a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201529215159291169063c8c2c29a90602401602060405180830381865afa15801562000283573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002a991906200112f565b1515036200033e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f41756374696f6e206d757374206861766520612071756f746520262070726f6a60448201527f65637420746f6b656e000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b42826080015111620003d3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f41756374696f6e2073746172742074696d65206d75737420626520696e20746860448201527f6520667574757265000000000000000000000000000000000000000000000000606482015260840162000335565b60008054604080517f43c852cb0000000000000000000000000000000000000000000000000000000081528151849373ffffffffffffffffffffffffffffffffffffffff16926343c852cb92600480820193918290030181865afa15801562000440573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000466919062001153565b91509150600033856020015186600001518760400151886060015189608001518a60a0015189897f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff168e6020015173ffffffffffffffffffffffffffffffffffffffff1614604051620004ee9062000fe1565b73ffffffffffffffffffffffffffffffffffffffff9a8b168152988a1660208a01529890961660408801526060870194909452608086019290925260a085015260c084015260e083015261010082015290151561012082015261014001604051809103906000f08015801562000568573d6000803e3d6000fd5b5090506200058185600001513383886040015162000ce3565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602081815260409283902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909217909155860151865187830151606089015160808a015160a08b015195517f97ae7ea52349273ddf301a9447fc959aec12ecab57c76246893a1d326577728f966200068c96899633969195909491939092908d908d9073ffffffffffffffffffffffffffffffffffffffff9a8b168152988a1660208a01529689166040890152949097166060870152608086019290925260a085015260c084015260e08301939093526101008201929092526101208101919091526101400190565b60405180910390a1949350505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054839060ff1662000755576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f49426174636841756374696f6e556e636170706564206e6f742063726561746560448201527f642066726f6d20666163746f7279000000000000000000000000000000000000606482015260840162000335565b600054604080517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529051339273ffffffffffffffffffffffffffffffffffffffff1691638da5cb5b9160048083019260209291908290030181865afa158015620007c5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007eb919062001178565b73ffffffffffffffffffffffffffffffffffffffff16146200086a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f6e6c792042617a6161724d616e61676572206f776e65720000000000000000604482015260640162000335565b6706f05b59d3b2000083111580156200088b57506706f05b59d3b200008211155b620008f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f496e76616c6964204665652050657263656e7461676500000000000000000000604482015260640162000335565b6040517f0b78f9c00000000000000000000000000000000000000000000000000000000081526004810184905260248101839052849073ffffffffffffffffffffffffffffffffffffffff821690630b78f9c090604401600060405180830381600087803b1580156200096557600080fd5b505af11580156200097a573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff89168152602081018890529081018690527fcd19f2489d3c81f669680f3798aa5c666e0410d4d67b55f9fdf2d5c9ea41a7cd9250606001905060405180910390a15050505050565b600054604080517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529051339273ffffffffffffffffffffffffffffffffffffffff1691638da5cb5b9160048083019260209291908290030181865afa15801562000a4d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a73919062001178565b73ffffffffffffffffffffffffffffffffffffffff161462000af2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f6e6c792042617a6161724d616e61676572206f776e65720000000000000000604482015260640162000335565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040902054819060ff1662000bab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f49426174636841756374696f6e556e636170706564206e6f742063726561746560448201527f642066726f6d20666163746f7279000000000000000000000000000000000000606482015260840162000335565b60008290508073ffffffffffffffffffffffffffffffffffffffff1663f86e39ef60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c415b95c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000c38573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c5e919062001178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401600060405180830381600087803b15801562000cc557600080fd5b505af115801562000cda573d6000803e3d6000fd5b50505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905262000d7a90859062000d80565b50505050565b600062000da473ffffffffffffffffffffffffffffffffffffffff84168362000e22565b9050805160001415801562000dcc57508080602001905181019062000dca91906200112f565b155b1562000e1d576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240162000335565b505050565b606062000e328383600062000e39565b9392505050565b60608147101562000e79576040517fcd78605900000000000000000000000000000000000000000000000000000000815230600482015260240162000335565b6000808573ffffffffffffffffffffffffffffffffffffffff16848660405162000ea4919062001198565b60006040518083038185875af1925050503d806000811462000ee3576040519150601f19603f3d011682016040523d82523d6000602084013e62000ee8565b606091505b509150915062000efa86838362000f04565b9695505050505050565b60608262000f1d5762000f178262000f9b565b62000e32565b815115801562000f42575073ffffffffffffffffffffffffffffffffffffffff84163b155b1562000f93576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240162000335565b508062000e32565b80511562000fac5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b611c8880620011ca83390190565b73ffffffffffffffffffffffffffffffffffffffff8116811462000fde57600080fd5b80356200101f8162000fef565b919050565b600060c082840312156200103757600080fd5b60405160c0810181811067ffffffffffffffff8211171562001082577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604052620010908362001012565b8152620010a06020840162001012565b602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201528091505092915050565b600080600060608486031215620010ed57600080fd5b8335620010fa8162000fef565b95602085013595506040909401359392505050565b6000602082840312156200112257600080fd5b813562000e328162000fef565b6000602082840312156200114257600080fd5b8151801515811462000e3257600080fd5b600080604083850312156200116757600080fd5b505080516020909101519092909150565b6000602082840312156200118b57600080fd5b815162000e328162000fef565b6000825160005b81811015620011bb57602081860181015185830152016200119f565b50600092019182525091905056fe60806040526003805463ffff00ff60a01b191690553480156200002157600080fd5b5060405162001c8838038062001c8883398101604081905262000044916200022e565b33806200006c57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200007781620001c5565b5060018055838510620000e35760405162461bcd60e51b815260206004820152602d60248201527f41756374696f6e2073746172742074696d65206d757374206265206c6573732060448201526c7468616e20656e642074696d6560981b606482015260840162000063565b60008711620001495760405162461bcd60e51b815260206004820152602b60248201527f50726f6a65637420746f6b656e20616d6f756e74206d7573742062652067726560448201526a061746572207468616e20360ac1b606482015260840162000063565b600480546001600160a01b039b8c166001600160a01b031991821617909155600795909555600893909355600a95909555600993909355600280549688169690921695909517905560038054600592909255600692909255921515600160a81b02600161ff0160a01b03199093169190931617179055620002d9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200022b57600080fd5b50565b6000806000806000806000806000806101408b8d0312156200024f57600080fd5b8a516200025c8162000215565b60208c0151909a506200026f8162000215565b60408c0151909950620002828162000215565b8098505060608b0151965060808b0151955060a08b0151945060c08b0151935060e08b015192506101008b015191506101208b01518015158114620002c657600080fd5b809150509295989b9194979a5092959850565b61199f80620002e96000396000f3fe6080604052600436106101815760003560e01c806378e97925116100d5578063bed3f89e11610084578063f046395a11610061578063f046395a14610459578063f2fde38b14610486578063f86e39ef146104a6578063f90ad592146104c657005b8063bed3f89e14610400578063c61a77f214610416578063d3924aaf1461042c57005b80638de69284116100b25780638de69284146103c157806395e00a22146103d4578063a4ac0d49146103ea57005b806378e979251461034d5780637d7b8a6b146103635780638da5cb5b1461039657005b8063243fe924116101315780635c975abb1161010e5780635c975abb146102c1578063715018a614610303578063723463091461031857005b8063243fe924146102695780633197cbb61461027e5780634b60ce771461029457005b806316c38b3c1161015f57806316c38b3c146101e15780631e75f23514610201578063217a4b701461021757005b80630b78f9c01461018357806313239b8a146101a35780631328b870146101b8575b005b34801561018f57600080fd5b5061018161019e3660046117bb565b6104fa565b3480156101af57600080fd5b5061018161055a565b3480156101c457600080fd5b506101ce600c5481565b6040519081526020015b60405180910390f35b3480156101ed57600080fd5b506101816101fc3660046117eb565b6106e1565b34801561020d57600080fd5b506101ce60095481565b34801561022357600080fd5b506002546102449073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d8565b34801561027557600080fd5b5061018161079d565b34801561028a57600080fd5b506101ce60085481565b3480156102a057600080fd5b506003546102449073ffffffffffffffffffffffffffffffffffffffff1681565b3480156102cd57600080fd5b506003546102f39074010000000000000000000000000000000000000000900460ff1681565b60405190151581526020016101d8565b34801561030f57600080fd5b50610181610c20565b34801561032457600080fd5b506003546102f39077010000000000000000000000000000000000000000000000900460ff1681565b34801561035957600080fd5b506101ce60075481565b34801561036f57600080fd5b506003546102f3907501000000000000000000000000000000000000000000900460ff1681565b3480156103a257600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610244565b6101816103cf366004611831565b610c32565b3480156103e057600080fd5b506101ce60065481565b3480156103f657600080fd5b506101ce60055481565b34801561040c57600080fd5b506101ce600d5481565b34801561042257600080fd5b506101ce600a5481565b34801561043857600080fd5b506004546102449073ffffffffffffffffffffffffffffffffffffffff1681565b34801561046557600080fd5b506101ce61047436600461185b565b600b6020526000908152604090205481565b34801561049257600080fd5b506101816104a136600461185b565b610fec565b3480156104b257600080fd5b506101816104c136600461185b565b61104d565b3480156104d257600080fd5b506003546102f390760100000000000000000000000000000000000000000000900460ff1681565b61050261139b565b61050a6113ee565b6005829055600681905560408051838152602081018390527fe7e2a095726aa7e61c651d0bea81dc8918f53351816feedbe765b4436e4bc463910160405180910390a161055660018055565b5050565b6105626113ee565b60085442116105b85760405162461bcd60e51b815260206004820152601560248201527f41756374696f6e20686173206e6f7420656e646564000000000000000000000060448201526064015b60405180910390fd5b336000908152600b6020526040902054806106155760405162461bcd60e51b815260206004820152601060248201527f4e6f20737562736372697074696f6e730000000000000000000000000000000060448201526064016105af565b336000908152600b60205260408120819055600954600c541061063a57600c5461063e565b6009545b9050600081600a548461065191906118a5565b61065b91906118bc565b6003549091506106829073ffffffffffffffffffffffffffffffffffffffff163383611431565b60035460405182815273ffffffffffffffffffffffffffffffffffffffff9091169033907fbe73a18309fe904ddf9986e4f1f4c65a7d33988a6ad96f82b1c4ed87e19bb99c9060200160405180910390a35050506106df60018055565b565b60045473ffffffffffffffffffffffffffffffffffffffff1633146107485760405162461bcd60e51b815260206004820152601260248201527f4f6e6c792061756374696f6e204f776e6572000000000000000000000000000060448201526064016105af565b6107506113ee565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000831515021790556001805550565b50565b60045473ffffffffffffffffffffffffffffffffffffffff1633146108045760405162461bcd60e51b815260206004820152601260248201527f4f6e6c792061756374696f6e204f776e6572000000000000000000000000000060448201526064016105af565b61080c6113ee565b600854421161085d5760405162461bcd60e51b815260206004820152601560248201527f41756374696f6e20686173206e6f7420656e646564000000000000000000000060448201526064016105af565b60035477010000000000000000000000000000000000000000000000900460ff16156108f15760405162461bcd60e51b815260206004820152602260248201527f41756374696f6e2071756f7465206665657320616c726561647920636c61696d60448201527f656400000000000000000000000000000000000000000000000000000000000060648201526084016105af565b6000670de0b6b3a7640000600654600c5461090c91906118a5565b61091691906118bc565b600c5461092391906118f7565b600954600c5460035492935010907501000000000000000000000000000000000000000000900460ff1615610a9a576002546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b1580156109be57600080fd5b505af11580156109d2573d6000803e3d6000fd5b50506040516000925033915084908381818185875af1925050503d8060008114610a18576040519150601f19603f3d011682016040523d82523d6000602084013e610a1d565b606091505b5050905080610a945760405162461bcd60e51b815260206004820152602560248201527f4661696c656420746f2073656e6420457468657220746f2061756374696f6e2060448201527f6f776e657200000000000000000000000000000000000000000000000000000060648201526084016105af565b50610abe565b600254610abe9073ffffffffffffffffffffffffffffffffffffffff163384611431565b8015610b7c576000600954600c54600a54610ad991906118a5565b610ae391906118bc565b600354600a54919250610b1b9173ffffffffffffffffffffffffffffffffffffffff909116903390610b169085906118f7565b611431565b600354600a5473ffffffffffffffffffffffffffffffffffffffff9091169033907fda2be1a9e45b257b4871e346718e2baecb61ac0f6eb99017f52965723ea8ac3690610b699085906118f7565b60405190815260200160405180910390a3505b600380547fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff1677010000000000000000000000000000000000000000000000179055600254604080518481526000602082015273ffffffffffffffffffffffffffffffffffffffff9092169133917f4a603ce815dea65b6c1f72f879380d681a068027dc8b99055a03c15559c7a29b910160405180910390a350506106df60018055565b610c2861139b565b6106df60006114b7565b610c3a6113ee565b60035474010000000000000000000000000000000000000000900460ff1615610ca55760405162461bcd60e51b815260206004820152601260248201527f436f6e747261637420697320706175736564000000000000000000000000000060448201526064016105af565b42600754108015610cb7575060085442105b610d295760405162461bcd60e51b815260206004820152602160248201527f537562736372697074696f6e20706572696f64206973206e6f7420616374697660448201527f650000000000000000000000000000000000000000000000000000000000000060648201526084016105af565b6003547501000000000000000000000000000000000000000000900460ff168015610d5357508034145b15610e5557803414610dcd5760405162461bcd60e51b815260206004820152603660248201527f416d6f756e7420737065636966696564206d757374206265207468652073616d60448201527f65206173206d73672e76616c756520666f72204554480000000000000000000060648201526084016105af565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e3757600080fd5b505af1158015610e4b573d6000803e3d6000fd5b5050505050610eee565b3415610ec95760405162461bcd60e51b815260206004820152603b60248201527f4e6f206d73672e76616c75652073686f756c642062652073656e74206173207560448201527f73657220697320706179696e67207769746820616e204552433230000000000060648201526084016105af565b600254610eee9073ffffffffffffffffffffffffffffffffffffffff1633308461152c565b6000670de0b6b3a764000060055483610f0791906118a5565b610f1191906118bc565b90506000610f1f82846118f7565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600b6020526040812080549293508392909190610f5990849061190a565b9250508190555080600c6000828254610f72919061190a565b9250508190555081600d6000828254610f8b919061190a565b9091555050604080518481526020810184905273ffffffffffffffffffffffffffffffffffffffff8616917ff94991dcbea6e8ac439cbc93bd9c62a4d39f04e0ad656df9a703f13552c2787f910160405180910390a2505061055660018055565b610ff461139b565b73ffffffffffffffffffffffffffffffffffffffff8116611044576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016105af565b61079a816114b7565b61105561139b565b61105d6113ee565b60085442116110ae5760405162461bcd60e51b815260206004820152601560248201527f41756374696f6e20686173206e6f7420656e646564000000000000000000000060448201526064016105af565b600354760100000000000000000000000000000000000000000000900460ff161561111b5760405162461bcd60e51b815260206004820152601b60248201527f42617a616172206665657320616c726561647920636c61696d6564000000000060448201526064016105af565b6000670de0b6b3a7640000600654600c5461113691906118a5565b61114091906118bc565b600d5461114d919061190a565b6003549091507501000000000000000000000000000000000000000000900460ff16156112d4576002546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b1580156111e057600080fd5b505af11580156111f4573d6000803e3d6000fd5b5050505060008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114611252576040519150601f19603f3d011682016040523d82523d6000602084013e611257565b606091505b50509050806112ce5760405162461bcd60e51b815260206004820152602560248201527f4661696c656420746f2073656e6420457468657220746f2061756374696f6e2060448201527f6f776e657200000000000000000000000000000000000000000000000000000060648201526084016105af565b506112f8565b6002546112f89073ffffffffffffffffffffffffffffffffffffffff168383611431565b600380547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16760100000000000000000000000000000000000000000000179055600254604080518381526001602082015273ffffffffffffffffffffffffffffffffffffffff928316928516917f4a603ce815dea65b6c1f72f879380d681a068027dc8b99055a03c15559c7a29b910160405180910390a35061079a60018055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106df576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016105af565b60026001540361142a576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b60405173ffffffffffffffffffffffffffffffffffffffff8381166024830152604482018390526114b291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611578565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60405173ffffffffffffffffffffffffffffffffffffffff84811660248301528381166044830152606482018390526115729186918216906323b872dd9060840161146b565b50505050565b600061159a73ffffffffffffffffffffffffffffffffffffffff84168361160e565b905080516000141580156115bf5750808060200190518101906115bd919061191d565b155b156114b2576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024016105af565b606061161c83836000611625565b90505b92915050565b606081471015611663576040517fcd7860590000000000000000000000000000000000000000000000000000000081523060048201526024016105af565b6000808573ffffffffffffffffffffffffffffffffffffffff16848660405161168c919061193a565b60006040518083038185875af1925050503d80600081146116c9576040519150601f19603f3d011682016040523d82523d6000602084013e6116ce565b606091505b50915091506116de8683836116ea565b925050505b9392505050565b6060826116ff576116fa82611779565b6116e3565b8151158015611723575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611772576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105af565b50806116e3565b8051156117895780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080604083850312156117ce57600080fd5b50508035926020909101359150565b801515811461079a57600080fd5b6000602082840312156117fd57600080fd5b81356116e3816117dd565b803573ffffffffffffffffffffffffffffffffffffffff8116811461182c57600080fd5b919050565b6000806040838503121561184457600080fd5b61184d83611808565b946020939093013593505050565b60006020828403121561186d57600080fd5b61161c82611808565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761161f5761161f611876565b6000826118f2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561161f5761161f611876565b8082018082111561161f5761161f611876565b60006020828403121561192f57600080fd5b81516116e3816117dd565b6000825160005b8181101561195b5760208186018101518583015201611941565b50600092019182525091905056fea264697066735822122053aa300564fa7ed88ef3671687f7acb888428e2f317f54d20d55a710579f274764736f6c63430008140033a26469706673582212204a4d957fdba258f2ce5ae108fb26b1407d32fa39c9ca0cfb43a1327f8f450e1a64736f6c63430008140033

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

000000000000000000000000b12509b87908928ff40fb12e04e84384ff51bd9b000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : _manager (address): 0xB12509B87908928Ff40Fb12E04e84384FF51Bd9B
Arg [1] : _wethAddress (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000b12509b87908928ff40fb12e04e84384ff51bd9b
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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
Loading...
Loading
[ 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.