ETH Price: $3,178.30 (+2.39%)

Contract

0xa8478781D9605E17c3b4c9C79e7127c4597116E4
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Create Bond182597972023-10-02 2:15:23411 days ago1696212923IN
0xa8478781...4597116E4
0 ETH0.013242987.54984718
0x60a03461182597472023-10-02 2:05:23411 days ago1696212323IN
 Create: FXBFactory
0 ETH0.0365003410.74295069

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
182597972023-10-02 2:15:23411 days ago1696212923
0xa8478781...4597116E4
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FXBFactory

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
london EvmVersion
File 1 of 20 : FXBFactory.sol
// SPDX-License-Identifier: ISC
pragma solidity ^0.8.19;

// ====================================================================
// |     ______                   _______                             |
// |    / _____________ __  __   / ____(_____  ____ _____  ________   |
// |   / /_  / ___/ __ `| |/_/  / /_  / / __ \/ __ `/ __ \/ ___/ _ \  |
// |  / __/ / /  / /_/ _>  <   / __/ / / / / / /_/ / / / / /__/  __/  |
// | /_/   /_/   \__,_/_/|_|  /_/   /_/_/ /_/\__,_/_/ /_/\___/\___/   |
// |                                                                  |
// ====================================================================
// ============================ FXBFactory ============================
// ====================================================================
// Frax Finance: https://github.com/FraxFinance

import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { Timelock2Step } from "frax-std/access-control/v2/Timelock2Step.sol";
import { BokkyPooBahsDateTimeLibrary as DateTimeLibrary } from "./utils/BokkyPooBahsDateTimeLibrary.sol";
import { FXB } from "./FXB.sol";

/// @title FXBFactory
/// @notice  Deploys FXB FXB ERC20 contracts
contract FXBFactory is Timelock2Step {
    using Strings for uint256;

    // =============================================================================================
    // Storage
    // =============================================================================================

    // Core
    /// @notice The Frax token contract
    address public immutable FRAX;

    /// @notice Array of bond addresses
    address[] public allBonds;

    /// @notice Whether a given address is an FXB
    mapping(address _fxb => bool _isFXB) public isFXB;

    /// @notice Whether a given timestamp has an FXB deployed
    mapping(uint256 _timestamp => bool _isFXB) public isTimestampFXB;

    // =============================================================================================
    // Constructor
    // =============================================================================================

    /// @notice Constructor
    /// @param _timelockAddress The owner of this contract
    constructor(address _timelockAddress, address _fraxErc20) Timelock2Step(_timelockAddress) {
        FRAX = _fraxErc20;
    }

    //==============================================================================
    // Helper Functions
    //==============================================================================

    /// @notice The ```_monthNames``` function returns the 3 letter names of the months given an index
    /// @param _monthIndex The index of the month
    /// @return _monthName The name of the month
    function _monthNames(uint256 _monthIndex) internal pure returns (string memory _monthName) {
        if (_monthIndex == 1) return "JAN";
        if (_monthIndex == 2) return "FEB";
        if (_monthIndex == 3) return "MAR";
        if (_monthIndex == 4) return "APR";
        if (_monthIndex == 5) return "MAY";
        if (_monthIndex == 6) return "JUN";
        if (_monthIndex == 7) return "JUL";
        if (_monthIndex == 8) return "AUG";
        if (_monthIndex == 9) return "SEP";
        if (_monthIndex == 10) return "OCT";
        if (_monthIndex == 11) return "NOV";
        if (_monthIndex == 12) return "DEC";
        revert InvalidMonthNumber();
    }

    // =============================================================================================
    // View functions
    // =============================================================================================

    /// @notice Returns the total number of bonds created
    /// @return _length uint256 Number of bonds created
    function allBondsLength() public view returns (uint256 _length) {
        return allBonds.length;
    }

    /// @notice Generates the bond symbol in the format FXB_YYYYMMDD
    /// @param _maturityTimestamp Date the bond will mature
    /// @return _bondName The name of the bond
    function _generateBondSymbol(uint256 _maturityTimestamp) internal pure returns (string memory _bondName) {
        // Maturity date
        uint256 _maturityMonth = DateTimeLibrary.getMonth(_maturityTimestamp);
        uint256 _maturityDay = DateTimeLibrary.getDay(_maturityTimestamp);
        uint256 _maturityYear = DateTimeLibrary.getYear(_maturityTimestamp);

        string memory maturityMonthString;
        if (_maturityMonth > 9) {
            maturityMonthString = _maturityMonth.toString();
        } else {
            maturityMonthString = string.concat("0", _maturityMonth.toString());
        }

        string memory maturityDayString;
        if (_maturityDay > 9) {
            maturityDayString = _maturityDay.toString();
        } else {
            maturityDayString = string.concat("0", _maturityDay.toString());
        }

        // Assemble all the strings into one
        _bondName = string(
            abi.encodePacked("FXB", "_", _maturityYear.toString(), maturityMonthString, maturityDayString)
        );
    }

    /// @notice Generates the bond name in the format (e.g. FXB_4_MMMDDYYYY)
    /// @param _bondId The id of the bond
    /// @param _maturityTimestamp Date the bond will mature
    /// @return _bondName The name of the bond
    function _generateBondName(
        uint256 _bondId,
        uint256 _maturityTimestamp
    ) internal pure returns (string memory _bondName) {
        // Maturity date
        uint256 _maturityMonth = DateTimeLibrary.getMonth(_maturityTimestamp);
        uint256 _maturityDay = DateTimeLibrary.getDay(_maturityTimestamp);
        uint256 _maturityYear = DateTimeLibrary.getYear(_maturityTimestamp);

        string memory maturityDayString;
        if (_maturityDay > 9) {
            maturityDayString = _maturityDay.toString();
        } else {
            maturityDayString = string(abi.encodePacked("0", _maturityDay.toString()));
        }

        // Assemble all the strings into one
        _bondName = string(
            abi.encodePacked(
                "FXB",
                "_",
                _bondId.toString(),
                "_",
                _monthNames(_maturityMonth),
                maturityDayString,
                _maturityYear.toString()
            )
        );
    }

    // =============================================================================================
    // Configurations / Privileged functions
    // =============================================================================================

    /// @notice Generates a new bond contract
    /// @param _maturityTimestamp Date the bond will mature and be redeemable
    /// @return _bondAddress The address of the new bond
    /// @return _bondId The id of the new bond
    function createBond(uint256 _maturityTimestamp) public returns (address _bondAddress, uint256 _bondId) {
        _requireSenderIsTimelock();

        // Set the bond id
        _bondId = allBondsLength();

        // Coerce the timestamp to 00:00 UTC
        uint256 _coercedMaturityTimestamp = (_maturityTimestamp / 86_400) * 86_400;

        // Get the new symbol and name
        string memory _bondSymbol = _generateBondSymbol({ _maturityTimestamp: _coercedMaturityTimestamp });
        string memory _bondName = _generateBondName({
            _bondId: _bondId,
            _maturityTimestamp: _coercedMaturityTimestamp
        });

        // Create the new contract
        FXB fxb = new FXB({
            _symbol: _bondSymbol,
            _name: _bondName,
            _maturityTimestamp: _coercedMaturityTimestamp,
            _fraxErc20: FRAX
        });
        _bondAddress = address(fxb);

        // Add the new bond address to the array and update the map
        allBonds.push(_bondAddress);
        isFXB[_bondAddress] = true;

        // Ensure bond maturity is unique
        if (isTimestampFXB[_coercedMaturityTimestamp]) {
            revert BondMaturityAlreadyExists();
        }
        isTimestampFXB[_coercedMaturityTimestamp] = true;

        emit BondCreated({
            newAddress: _bondAddress,
            newId: _bondId,
            newSymbol: _bondSymbol,
            newName: _bondName,
            maturityTimestamp: _coercedMaturityTimestamp
        });
    }

    // ==============================================================================
    // Events
    // ==============================================================================

    /// @notice The ```BondCreated``` event is emitted when a new bond is created
    /// @param newAddress Address of the bond
    /// @param newId The ID of the bond
    /// @param newSymbol The bond's symbol
    /// @param newName Name of the bond
    /// @param maturityTimestamp Date the bond will mature
    event BondCreated(address newAddress, uint256 newId, string newSymbol, string newName, uint256 maturityTimestamp);

    // ==============================================================================
    // Errors
    // ==============================================================================

    /// @notice The ```InvalidMonthNumber``` error is thrown when an invalid month number is passed
    error InvalidMonthNumber();

    /// @notice The ```BondMaturityAlreadyExists``` error is thrown when a bond with the same maturity already exists
    error BondMaturityAlreadyExists();
}

File 2 of 20 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 3 of 20 : Timelock2Step.sol
// SPDX-License-Identifier: ISC
pragma solidity >=0.8.0;

// ====================================================================
// |     ______                   _______                             |
// |    / _____________ __  __   / ____(_____  ____ _____  ________   |
// |   / /_  / ___/ __ `| |/_/  / /_  / / __ \/ __ `/ __ \/ ___/ _ \  |
// |  / __/ / /  / /_/ _>  <   / __/ / / / / / /_/ / / / / /__/  __/  |
// | /_/   /_/   \__,_/_/|_|  /_/   /_/_/ /_/\__,_/_/ /_/\___/\___/   |
// |                                                                  |
// ====================================================================
// ========================== Timelock2Step ===========================
// ====================================================================
// Frax Finance: https://github.com/FraxFinance

// Primary Author
// Drake Evans: https://github.com/DrakeEvans

// Reviewers
// Dennis: https://github.com/denett

// ====================================================================

/// @title Timelock2Step
/// @author Drake Evans (Frax Finance) https://github.com/drakeevans
/// @dev Inspired by OpenZeppelin's Ownable2Step contract
/// @notice  An abstract contract which contains 2-step transfer and renounce logic for a timelock address
abstract contract Timelock2Step {
    /// @notice The pending timelock address
    address public pendingTimelockAddress;

    /// @notice The current timelock address
    address public timelockAddress;

    constructor(address _timelockAddress) {
        timelockAddress = _timelockAddress;
    }

    // ============================================================================================
    // Functions: External Functions
    // ============================================================================================

    /// @notice The ```transferTimelock``` function initiates the timelock transfer
    /// @dev Must be called by the current timelock
    /// @param _newTimelock The address of the nominated (pending) timelock
    function transferTimelock(address _newTimelock) external virtual {
        _requireSenderIsTimelock();
        _transferTimelock(_newTimelock);
    }

    /// @notice The ```acceptTransferTimelock``` function completes the timelock transfer
    /// @dev Must be called by the pending timelock
    function acceptTransferTimelock() external virtual {
        _requireSenderIsPendingTimelock();
        _acceptTransferTimelock();
    }

    /// @notice The ```renounceTimelock``` function renounces the timelock after setting pending timelock to current timelock
    /// @dev Pending timelock must be set to current timelock before renouncing, creating a 2-step renounce process
    function renounceTimelock() external virtual {
        _requireSenderIsTimelock();
        _requireSenderIsPendingTimelock();
        _transferTimelock(address(0));
        _setTimelock(address(0));
    }

    // ============================================================================================
    // Functions: Internal Actions
    // ============================================================================================

    /// @notice The ```_transferTimelock``` function initiates the timelock transfer
    /// @dev This function is to be implemented by a public function
    /// @param _newTimelock The address of the nominated (pending) timelock
    function _transferTimelock(address _newTimelock) internal {
        pendingTimelockAddress = _newTimelock;
        emit TimelockTransferStarted(timelockAddress, _newTimelock);
    }

    /// @notice The ```_acceptTransferTimelock``` function completes the timelock transfer
    /// @dev This function is to be implemented by a public function
    function _acceptTransferTimelock() internal {
        pendingTimelockAddress = address(0);
        _setTimelock(msg.sender);
    }

    /// @notice The ```_setTimelock``` function sets the timelock address
    /// @dev This function is to be implemented by a public function
    /// @param _newTimelock The address of the new timelock
    function _setTimelock(address _newTimelock) internal {
        emit TimelockTransferred(timelockAddress, _newTimelock);
        timelockAddress = _newTimelock;
    }

    // ============================================================================================
    // Functions: Internal Checks
    // ============================================================================================

    /// @notice The ```_isTimelock``` function checks if _address is current timelock address
    /// @param _address The address to check against the timelock
    /// @return Whether or not msg.sender is current timelock address
    function _isTimelock(address _address) internal view returns (bool) {
        return _address == timelockAddress;
    }

    /// @notice The ```_requireIsTimelock``` function reverts if _address is not current timelock address
    /// @param _address The address to check against the timelock
    function _requireIsTimelock(address _address) internal view {
        if (!_isTimelock(_address)) revert AddressIsNotTimelock(timelockAddress, _address);
    }

    /// @notice The ```_requireSenderIsTimelock``` function reverts if msg.sender is not current timelock address
    /// @dev This function is to be implemented by a public function
    function _requireSenderIsTimelock() internal view {
        _requireIsTimelock(msg.sender);
    }

    /// @notice The ```_isPendingTimelock``` function checks if the _address is pending timelock address
    /// @dev This function is to be implemented by a public function
    /// @param _address The address to check against the pending timelock
    /// @return Whether or not _address is pending timelock address
    function _isPendingTimelock(address _address) internal view returns (bool) {
        return _address == pendingTimelockAddress;
    }

    /// @notice The ```_requireIsPendingTimelock``` function reverts if the _address is not pending timelock address
    /// @dev This function is to be implemented by a public function
    /// @param _address The address to check against the pending timelock
    function _requireIsPendingTimelock(address _address) internal view {
        if (!_isPendingTimelock(_address)) revert AddressIsNotPendingTimelock(pendingTimelockAddress, _address);
    }

    /// @notice The ```_requirePendingTimelock``` function reverts if msg.sender is not pending timelock address
    /// @dev This function is to be implemented by a public function
    function _requireSenderIsPendingTimelock() internal view {
        _requireIsPendingTimelock(msg.sender);
    }

    // ============================================================================================
    // Functions: Events
    // ============================================================================================

    /// @notice The ```TimelockTransferStarted``` event is emitted when the timelock transfer is initiated
    /// @param previousTimelock The address of the previous timelock
    /// @param newTimelock The address of the new timelock
    event TimelockTransferStarted(address indexed previousTimelock, address indexed newTimelock);

    /// @notice The ```TimelockTransferred``` event is emitted when the timelock transfer is completed
    /// @param previousTimelock The address of the previous timelock
    /// @param newTimelock The address of the new timelock
    event TimelockTransferred(address indexed previousTimelock, address indexed newTimelock);

    // ============================================================================================
    // Functions: Errors
    // ============================================================================================

    /// @notice Emitted when timelock is transferred
    error AddressIsNotTimelock(address timelockAddress, address actualAddress);

    /// @notice Emitted when pending timelock is transferred
    error AddressIsNotPendingTimelock(address pendingTimelockAddress, address actualAddress);
}

File 4 of 20 : BokkyPooBahsDateTimeLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;

// ----------------------------------------------------------------------------
// BokkyPooBah's DateTime Library v1.01
//
// A gas-efficient Solidity date and time library
//
// https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary
//
// Tested date range 1970/01/01 to 2345/12/31
//
// Conventions:
// Unit      | Range         | Notes
// :-------- |:-------------:|:-----
// timestamp | >= 0          | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC
// year      | 1970 ... 2345 |
// month     | 1 ... 12      |
// day       | 1 ... 31      |
// hour      | 0 ... 23      |
// minute    | 0 ... 59      |
// second    | 0 ... 59      |
// dayOfWeek | 1 ... 7       | 1 = Monday, ..., 7 = Sunday
//
//
// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018-2019. The MIT Licence.
// ----------------------------------------------------------------------------

library BokkyPooBahsDateTimeLibrary {
    uint256 constant SECONDS_PER_DAY = 24 * 60 * 60;
    uint256 constant SECONDS_PER_HOUR = 60 * 60;
    uint256 constant SECONDS_PER_MINUTE = 60;
    int256 constant OFFSET19700101 = 2_440_588;

    uint256 constant DOW_MON = 1;
    uint256 constant DOW_TUE = 2;
    uint256 constant DOW_WED = 3;
    uint256 constant DOW_THU = 4;
    uint256 constant DOW_FRI = 5;
    uint256 constant DOW_SAT = 6;
    uint256 constant DOW_SUN = 7;

    // ------------------------------------------------------------------------
    // Calculate the number of days from 1970/01/01 to year/month/day using
    // the date conversion algorithm from
    //   http://aa.usno.navy.mil/faq/docs/JD_Formula.php
    // and subtracting the offset 2440588 so that 1970/01/01 is day 0
    //
    // days = day
    //      - 32075
    //      + 1461 * (year + 4800 + (month - 14) / 12) / 4
    //      + 367 * (month - 2 - (month - 14) / 12 * 12) / 12
    //      - 3 * ((year + 4900 + (month - 14) / 12) / 100) / 4
    //      - offset
    // ------------------------------------------------------------------------
    function _daysFromDate(uint256 year, uint256 month, uint256 day) internal pure returns (uint256 _days) {
        require(year >= 1970);
        int256 _year = int256(year);
        int256 _month = int256(month);
        int256 _day = int256(day);

        int256 __days = _day -
            32_075 +
            (1461 * (_year + 4800 + (_month - 14) / 12)) /
            4 +
            (367 * (_month - 2 - ((_month - 14) / 12) * 12)) /
            12 -
            (3 * ((_year + 4900 + (_month - 14) / 12) / 100)) /
            4 -
            OFFSET19700101;

        _days = uint256(__days);
    }

    // ------------------------------------------------------------------------
    // Calculate year/month/day from the number of days since 1970/01/01 using
    // the date conversion algorithm from
    //   http://aa.usno.navy.mil/faq/docs/JD_Formula.php
    // and adding the offset 2440588 so that 1970/01/01 is day 0
    //
    // int L = days + 68569 + offset
    // int N = 4 * L / 146097
    // L = L - (146097 * N + 3) / 4
    // year = 4000 * (L + 1) / 1461001
    // L = L - 1461 * year / 4 + 31
    // month = 80 * L / 2447
    // dd = L - 2447 * month / 80
    // L = month / 11
    // month = month + 2 - 12 * L
    // year = 100 * (N - 49) + year + L
    // ------------------------------------------------------------------------
    function _daysToDate(uint256 _days) internal pure returns (uint256 year, uint256 month, uint256 day) {
        int256 __days = int256(_days);

        int256 L = __days + 68_569 + OFFSET19700101;
        int256 N = (4 * L) / 146_097;
        L = L - (146_097 * N + 3) / 4;
        int256 _year = (4000 * (L + 1)) / 1_461_001;
        L = L - (1461 * _year) / 4 + 31;
        int256 _month = (80 * L) / 2447;
        int256 _day = L - (2447 * _month) / 80;
        L = _month / 11;
        _month = _month + 2 - 12 * L;
        _year = 100 * (N - 49) + _year + L;

        year = uint256(_year);
        month = uint256(_month);
        day = uint256(_day);
    }

    function timestampFromDate(uint256 year, uint256 month, uint256 day) internal pure returns (uint256 timestamp) {
        timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY;
    }

    function timestampFromDateTime(
        uint256 year,
        uint256 month,
        uint256 day,
        uint256 hour,
        uint256 minute,
        uint256 second
    ) internal pure returns (uint256 timestamp) {
        timestamp =
            _daysFromDate(year, month, day) *
            SECONDS_PER_DAY +
            hour *
            SECONDS_PER_HOUR +
            minute *
            SECONDS_PER_MINUTE +
            second;
    }

    function timestampToDate(uint256 timestamp) internal pure returns (uint256 year, uint256 month, uint256 day) {
        (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }

    function timestampToDateTime(
        uint256 timestamp
    ) internal pure returns (uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second) {
        (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        uint256 secs = timestamp % SECONDS_PER_DAY;
        hour = secs / SECONDS_PER_HOUR;
        secs = secs % SECONDS_PER_HOUR;
        minute = secs / SECONDS_PER_MINUTE;
        second = secs % SECONDS_PER_MINUTE;
    }

    function isValidDate(uint256 year, uint256 month, uint256 day) internal pure returns (bool valid) {
        if (year >= 1970 && month > 0 && month <= 12) {
            uint256 daysInMonth = _getDaysInMonth(year, month);
            if (day > 0 && day <= daysInMonth) {
                valid = true;
            }
        }
    }

    function isValidDateTime(
        uint256 year,
        uint256 month,
        uint256 day,
        uint256 hour,
        uint256 minute,
        uint256 second
    ) internal pure returns (bool valid) {
        if (isValidDate(year, month, day)) {
            if (hour < 24 && minute < 60 && second < 60) {
                valid = true;
            }
        }
    }

    function isLeapYear(uint256 timestamp) internal pure returns (bool leapYear) {
        (uint256 year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY);
        leapYear = _isLeapYear(year);
    }

    function _isLeapYear(uint256 year) internal pure returns (bool leapYear) {
        leapYear = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
    }

    function isWeekDay(uint256 timestamp) internal pure returns (bool weekDay) {
        weekDay = getDayOfWeek(timestamp) <= DOW_FRI;
    }

    function isWeekEnd(uint256 timestamp) internal pure returns (bool weekEnd) {
        weekEnd = getDayOfWeek(timestamp) >= DOW_SAT;
    }

    function getDaysInMonth(uint256 timestamp) internal pure returns (uint256 daysInMonth) {
        (uint256 year, uint256 month, ) = _daysToDate(timestamp / SECONDS_PER_DAY);
        daysInMonth = _getDaysInMonth(year, month);
    }

    function _getDaysInMonth(uint256 year, uint256 month) internal pure returns (uint256 daysInMonth) {
        if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
            daysInMonth = 31;
        } else if (month != 2) {
            daysInMonth = 30;
        } else {
            daysInMonth = _isLeapYear(year) ? 29 : 28;
        }
    }

    // 1 = Monday, 7 = Sunday

    function getDayOfWeek(uint256 timestamp) internal pure returns (uint256 dayOfWeek) {
        uint256 _days = timestamp / SECONDS_PER_DAY;
        dayOfWeek = ((_days + 3) % 7) + 1;
    }

    function getYear(uint256 timestamp) internal pure returns (uint256 year) {
        (year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }

    function getMonth(uint256 timestamp) internal pure returns (uint256 month) {
        (, month, ) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }

    function getDay(uint256 timestamp) internal pure returns (uint256 day) {
        (, , day) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }

    function getHour(uint256 timestamp) internal pure returns (uint256 hour) {
        uint256 secs = timestamp % SECONDS_PER_DAY;
        hour = secs / SECONDS_PER_HOUR;
    }

    function getMinute(uint256 timestamp) internal pure returns (uint256 minute) {
        uint256 secs = timestamp % SECONDS_PER_HOUR;
        minute = secs / SECONDS_PER_MINUTE;
    }

    function getSecond(uint256 timestamp) internal pure returns (uint256 second) {
        second = timestamp % SECONDS_PER_MINUTE;
    }

    function addYears(uint256 timestamp, uint256 _years) internal pure returns (uint256 newTimestamp) {
        (uint256 year, uint256 month, uint256 day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        year += _years;
        uint256 daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY);
        require(newTimestamp >= timestamp);
    }

    function addMonths(uint256 timestamp, uint256 _months) internal pure returns (uint256 newTimestamp) {
        (uint256 year, uint256 month, uint256 day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        month += _months;
        year += (month - 1) / 12;
        month = ((month - 1) % 12) + 1;
        uint256 daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY);
        require(newTimestamp >= timestamp);
    }

    function addDays(uint256 timestamp, uint256 _days) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp + _days * SECONDS_PER_DAY;
        require(newTimestamp >= timestamp);
    }

    function addHours(uint256 timestamp, uint256 _hours) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp + _hours * SECONDS_PER_HOUR;
        require(newTimestamp >= timestamp);
    }

    function addMinutes(uint256 timestamp, uint256 _minutes) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp + _minutes * SECONDS_PER_MINUTE;
        require(newTimestamp >= timestamp);
    }

    function addSeconds(uint256 timestamp, uint256 _seconds) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp + _seconds;
        require(newTimestamp >= timestamp);
    }

    function subYears(uint256 timestamp, uint256 _years) internal pure returns (uint256 newTimestamp) {
        (uint256 year, uint256 month, uint256 day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        year -= _years;
        uint256 daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY);
        require(newTimestamp <= timestamp);
    }

    function subMonths(uint256 timestamp, uint256 _months) internal pure returns (uint256 newTimestamp) {
        (uint256 year, uint256 month, uint256 day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        uint256 yearMonth = year * 12 + (month - 1) - _months;
        year = yearMonth / 12;
        month = (yearMonth % 12) + 1;
        uint256 daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY);
        require(newTimestamp <= timestamp);
    }

    function subDays(uint256 timestamp, uint256 _days) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp - _days * SECONDS_PER_DAY;
        require(newTimestamp <= timestamp);
    }

    function subHours(uint256 timestamp, uint256 _hours) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp - _hours * SECONDS_PER_HOUR;
        require(newTimestamp <= timestamp);
    }

    function subMinutes(uint256 timestamp, uint256 _minutes) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp - _minutes * SECONDS_PER_MINUTE;
        require(newTimestamp <= timestamp);
    }

    function subSeconds(uint256 timestamp, uint256 _seconds) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp - _seconds;
        require(newTimestamp <= timestamp);
    }

    function diffYears(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _years) {
        require(fromTimestamp <= toTimestamp);
        (uint256 fromYear, , ) = _daysToDate(fromTimestamp / SECONDS_PER_DAY);
        (uint256 toYear, , ) = _daysToDate(toTimestamp / SECONDS_PER_DAY);
        _years = toYear - fromYear;
    }

    function diffMonths(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _months) {
        require(fromTimestamp <= toTimestamp);
        (uint256 fromYear, uint256 fromMonth, ) = _daysToDate(fromTimestamp / SECONDS_PER_DAY);
        (uint256 toYear, uint256 toMonth, ) = _daysToDate(toTimestamp / SECONDS_PER_DAY);
        _months = toYear * 12 + toMonth - fromYear * 12 - fromMonth;
    }

    function diffDays(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _days) {
        require(fromTimestamp <= toTimestamp);
        _days = (toTimestamp - fromTimestamp) / SECONDS_PER_DAY;
    }

    function diffHours(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _hours) {
        require(fromTimestamp <= toTimestamp);
        _hours = (toTimestamp - fromTimestamp) / SECONDS_PER_HOUR;
    }

    function diffMinutes(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _minutes) {
        require(fromTimestamp <= toTimestamp);
        _minutes = (toTimestamp - fromTimestamp) / SECONDS_PER_MINUTE;
    }

    function diffSeconds(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _seconds) {
        require(fromTimestamp <= toTimestamp);
        _seconds = toTimestamp - fromTimestamp;
    }
}

File 5 of 20 : FXB.sol
// SPDX-License-Identifier: ISC
pragma solidity ^0.8.19;

// ====================================================================
// |     ______                   _______                             |
// |    / _____________ __  __   / ____(_____  ____ _____  ________   |
// |   / /_  / ___/ __ `| |/_/  / /_  / / __ \/ __ `/ __ \/ ___/ _ \  |
// |  / __/ / /  / /_/ _>  <   / __/ / / / / / /_/ / / / / /__/  __/  |
// | /_/   /_/   \__,_/_/|_|  /_/   /_/_/ /_/\__,_/_/ /_/\___/\___/   |
// |                                                                  |
// ====================================================================
// =============================== FXB ================================
// ====================================================================
// Frax Finance: https://github.com/FraxFinance

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
import { IFrax } from "./interfaces/IFrax.sol";
import { FXBFactory } from "./FXBFactory.sol";

/// @title FXB
/// @notice  The FXB token can be redeemed for 1 FRAX at a later date. Created via a factory contract.
contract FXB is ERC20, ERC20Permit {
    // =============================================================================================
    // Storage
    // =============================================================================================

    /// @notice Factory contract for generating FXBs
    FXBFactory public immutable FXB_FACTORY;

    /// @notice The Frax token contract
    IFrax public immutable FRAX;

    /// @notice Timestamp of bond maturity
    uint256 public immutable MATURITY_TIMESTAMP;

    /// @notice Total amount of FXB redeemed
    uint256 public totalFXBRedeemed;

    // =============================================================================================
    // Structs
    // =============================================================================================

    /// @notice Bond Information
    /// @param symbol The symbol of the bond
    /// @param name The name of the bond
    /// @param maturityTimestamp Timestamp the bond will mature
    struct BondInfo {
        string symbol;
        string name;
        uint256 maturityTimestamp;
    }

    // =============================================================================================
    // Constructor
    // =============================================================================================

    /// @notice Called by the factory
    /// @param _symbol The symbol of the bond
    /// @param _name The name of the bond
    /// @param _maturityTimestamp Timestamp the bond will mature and be redeemable
    constructor(
        address _fraxErc20,
        string memory _symbol,
        string memory _name,
        uint256 _maturityTimestamp
    ) ERC20(_symbol, _name) ERC20Permit(_symbol) {
        // Set the FRAX address
        FRAX = IFrax(_fraxErc20);

        // Set the factory
        FXB_FACTORY = FXBFactory(msg.sender);

        // Set the maturity timestamp
        MATURITY_TIMESTAMP = _maturityTimestamp;
    }

    // =============================================================================================
    // View functions
    // =============================================================================================

    /// @notice Returns summary information about the bond
    /// @return BondInfo Summary of the bond
    function bondInfo() external view returns (BondInfo memory) {
        return BondInfo({ symbol: symbol(), name: name(), maturityTimestamp: MATURITY_TIMESTAMP });
    }

    /// @notice Returns a boolean representing whether a bond can be redeemed
    /// @return _isRedeemable If the bond is redeemable
    function isRedeemable() public view returns (bool _isRedeemable) {
        _isRedeemable = (block.timestamp >= MATURITY_TIMESTAMP);
    }

    // =============================================================================================
    // Public functions
    // =============================================================================================

    /// @notice Mints a specified amount of tokens to the account, requires caller to approve on the FRAX contract in an amount equal to the minted amount
    /// @param _to The account to receive minted tokens
    /// @param _amount The amount of the token to mint
    function mint(address _to, uint256 _amount) public {
        // NOTE: Allow minting after expiry

        // Effects: Give the FXB to the recipient
        _mint({ account: _to, amount: _amount });

        // Interactions: Take 1-to-1 FRAX from the user
        FRAX.transferFrom({ sender: msg.sender, recipient: address(this), amount: _amount });
    }

    /// @notice Redeems FXB 1-to-1 for FRAX
    /// @param _recipient Recipient of the FRAX
    /// @param _redeemAmount Amount to redeem
    function burn(address _recipient, uint256 _redeemAmount) public {
        // Make sure the bond has matured
        if (!isRedeemable()) revert BondNotRedeemable();

        // Effects: Update redeem tracking
        totalFXBRedeemed += _redeemAmount;

        // Effects: Burn the FXB from the user
        _burn({ account: msg.sender, amount: _redeemAmount });

        // Interactions: Give FRAX to the recipient
        FRAX.transfer({ recipient: _recipient, amount: _redeemAmount });
    }

    // ==============================================================================
    // Errors
    // ==============================================================================

    /// @notice Thrown if the bond hasn't matured yet, or redeeming is paused
    error BondNotRedeemable();
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 7 of 20 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 8 of 20 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}

File 9 of 20 : ERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)

pragma solidity ^0.8.0;

import "./IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/cryptography/EIP712.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation 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.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private constant _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    /**
     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.
     * However, to ensure consistency with the upgradeable transpiler, we will continue
     * to reserve a slot.
     * @custom:oz-renamed-from _PERMIT_TYPEHASH
     */
    // solhint-disable-next-line var-name-mixedcase
    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

File 10 of 20 : IFrax.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.11;

interface IFrax {
    function COLLATERAL_RATIO_PAUSER() external view returns (bytes32);

    function DEFAULT_ADMIN_ADDRESS() external view returns (address);

    function DEFAULT_ADMIN_ROLE() external view returns (bytes32);

    function addPool(address pool_address) external;

    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function balanceOf(address account) external view returns (uint256);

    function burn(uint256 amount) external;

    function burnFrom(address account, uint256 amount) external;

    function collateral_ratio_paused() external view returns (bool);

    function controller_address() external view returns (address);

    function creator_address() external view returns (address);

    function decimals() external view returns (uint8);

    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);

    function eth_usd_consumer_address() external view returns (address);

    function eth_usd_price() external view returns (uint256);

    function frax_eth_oracle_address() external view returns (address);

    function frax_info() external view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256);

    function frax_pools(address) external view returns (bool);

    function frax_pools_array(uint256) external view returns (address);

    function frax_price() external view returns (uint256);

    function frax_step() external view returns (uint256);

    function fxs_address() external view returns (address);

    function fxs_eth_oracle_address() external view returns (address);

    function fxs_price() external view returns (uint256);

    function genesis_supply() external view returns (uint256);

    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    function getRoleMemberCount(bytes32 role) external view returns (uint256);

    function globalCollateralValue() external view returns (uint256);

    function global_collateral_ratio() external view returns (uint256);

    function grantRole(bytes32 role, address account) external;

    function hasRole(bytes32 role, address account) external view returns (bool);

    function increaseAllowance(address spender, uint256 addedValue) external returns (bool);

    function last_call_time() external view returns (uint256);

    function minting_fee() external view returns (uint256);

    function name() external view returns (string memory);

    function owner_address() external view returns (address);

    function pool_burn_from(address b_address, uint256 b_amount) external;

    function pool_mint(address m_address, uint256 m_amount) external;

    function price_band() external view returns (uint256);

    function price_target() external view returns (uint256);

    function redemption_fee() external view returns (uint256);

    function refreshCollateralRatio() external;

    function refresh_cooldown() external view returns (uint256);

    function removePool(address pool_address) external;

    function renounceRole(bytes32 role, address account) external;

    function revokeRole(bytes32 role, address account) external;

    function setController(address _controller_address) external;

    function setETHUSDOracle(address _eth_usd_consumer_address) external;

    function setFRAXEthOracle(address _frax_oracle_addr, address _weth_address) external;

    function setFXSAddress(address _fxs_address) external;

    function setFXSEthOracle(address _fxs_oracle_addr, address _weth_address) external;

    function setFraxStep(uint256 _new_step) external;

    function setMintingFee(uint256 min_fee) external;

    function setOwner(address _owner_address) external;

    function setPriceBand(uint256 _price_band) external;

    function setPriceTarget(uint256 _new_price_target) external;

    function setRedemptionFee(uint256 red_fee) external;

    function setRefreshCooldown(uint256 _new_cooldown) external;

    function setTimelock(address new_timelock) external;

    function symbol() external view returns (string memory);

    function timelock_address() external view returns (address);

    function toggleCollateralRatio() external;

    function totalSupply() external view returns (uint256);

    function transfer(address recipient, uint256 amount) external returns (bool);

    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

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

File 11 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 12 of 20 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

File 13 of 20 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

File 14 of 20 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 15 of 20 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

File 16 of 20 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}

File 17 of 20 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 18 of 20 : ShortStrings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

File 20 of 20 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

Settings
{
  "remappings": [
    "frax-std/=lib/frax-standard-solidity/src/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@uniswap/=node_modules/@uniswap/",
    "base64-sol/=node_modules/base64-sol/",
    "ds-test/=lib/frax-standard-solidity/lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/frax-standard-solidity/lib/forge-std/src/",
    "frax-standard-solidity/=lib/frax-standard-solidity/src/",
    "solidity-bytes-utils/=lib/frax-standard-solidity/lib/solidity-bytes-utils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "none",
    "appendCBOR": false
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_timelockAddress","type":"address"},{"internalType":"address","name":"_fraxErc20","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"pendingTimelockAddress","type":"address"},{"internalType":"address","name":"actualAddress","type":"address"}],"name":"AddressIsNotPendingTimelock","type":"error"},{"inputs":[{"internalType":"address","name":"timelockAddress","type":"address"},{"internalType":"address","name":"actualAddress","type":"address"}],"name":"AddressIsNotTimelock","type":"error"},{"inputs":[],"name":"BondMaturityAlreadyExists","type":"error"},{"inputs":[],"name":"InvalidMonthNumber","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"newId","type":"uint256"},{"indexed":false,"internalType":"string","name":"newSymbol","type":"string"},{"indexed":false,"internalType":"string","name":"newName","type":"string"},{"indexed":false,"internalType":"uint256","name":"maturityTimestamp","type":"uint256"}],"name":"BondCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousTimelock","type":"address"},{"indexed":true,"internalType":"address","name":"newTimelock","type":"address"}],"name":"TimelockTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousTimelock","type":"address"},{"indexed":true,"internalType":"address","name":"newTimelock","type":"address"}],"name":"TimelockTransferred","type":"event"},{"inputs":[],"name":"FRAX","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptTransferTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allBonds","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allBondsLength","outputs":[{"internalType":"uint256","name":"_length","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maturityTimestamp","type":"uint256"}],"name":"createBond","outputs":[{"internalType":"address","name":"_bondAddress","type":"address"},{"internalType":"uint256","name":"_bondId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fxb","type":"address"}],"name":"isFXB","outputs":[{"internalType":"bool","name":"_isFXB","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"isTimestampFXB","outputs":[{"internalType":"bool","name":"_isFXB","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingTimelockAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelockAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newTimelock","type":"address"}],"name":"transferTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a03461009657601f62003d6638819003918201601f19168301916001600160401b0383118484101761009b57808492604094855283398101031261009657610053602061004c836100b1565b92016100b1565b600180546001600160a01b0319166001600160a01b0390931692909217909155608052604051613ca09081620000c6823960805181818161031301526106430152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100965756fe60808060405260043610156200001457600080fd5b60003560e01c908163090f3f501462000ac557508063450140951462000a125780634bc66f3214620009be5780634f8b4ae714620008e45780636350e4b21462000337578063b0e4556f14620002c6578063b4efcf4a1462000255578063c8bf84a71462000217578063dfea196214620001a7578063f6ccaad414620000fa5763fb5e1f5b14620000a457600080fd5b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576004356000526004602052602060ff604060002054166040519015158152f35b600080fd5b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576200013562000bf0565b7fffffffffffffffffffffffff00000000000000000000000000000000000000008060005416600055600154903373ffffffffffffffffffffffffffffffffffffffff83167f31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc6600080a3163317600155005b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f55760043573ffffffffffffffffffffffffffffffffffffffff8116809103620000f5576000526003602052602060ff604060002054166040519015158152f35b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576020600254604051908152f35b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f557600435600254811015620000f55773ffffffffffffffffffffffffffffffffffffffff620002b660209262000b16565b9190546040519260031b1c168152f35b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f557602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576200037262000b7d565b60025462015180908160043504908183810204831482151715620008b5576200039f83808402046200131c565b50929050620004ac6024620003b886808502046200131c565b9691505062000407620003cf88808702046200131c565b505091600981116000146200089f57620003e99062000dc1565b965b60098111156200088a57620004009062000dc1565b9162000dc1565b906040519687927f465842000000000000000000000000000000000000000000000000000000000060208501527f5f0000000000000000000000000000000000000000000000000000000000000060238501526200046f815180926020888801910162000c63565b830162000486825180936020888501910162000c63565b016200049c825180936020878501910162000c63565b0103600481018652018462000cea565b620004bb84808302046200131c565b509050620006036025620004d387808602046200131c565b94915050620004e688808702046200131c565b505093600981116000146200082257620005009062000dc1565b620005216200051a620005138962000dc1565b9362000f89565b9562000dc1565b906040519586937f465842000000000000000000000000000000000000000000000000000000000060208601527f5f0000000000000000000000000000000000000000000000000000000000000060238601526200058a81518092602060248901910162000c63565b84017f5f000000000000000000000000000000000000000000000000000000000000006024820152620005c7825180936020898501910162000c63565b01620005dd825180936020888501910162000c63565b01620005f3825180936020878501910162000c63565b0103600581018452018262000cea565b60405193612633948581019581871067ffffffffffffffff881117620007e7576200166d82398073ffffffffffffffffffffffffffffffffffffffff96877f0000000000000000000000000000000000000000000000000000000000000000168152608060208201526200068e6200067f608083018662000c88565b82810360408401528662000c88565b9060608a880291015203906000f08015620008165785169460025468010000000000000000811015620007e757806001620006cd920160025562000b16565b819291549060031b9188831b921b19161790558460005260036020526040600020927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0093600185825416179055868102600052600460205260ff60406000205416620007bd5786620007a762000798947f70447ad46f3971bf936af78a90dbb9f714c328506d57cf6034d96dd6c13787189660409a8502600052600460205260018b6000209182541617905589519586958a875289602088015260a08c88015260a087019062000c88565b90858203606087015262000c88565b910260808301520390a182519182526020820152f35b60046040517fe388d64f000000000000000000000000000000000000000000000000000000008152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040513d6000823e3d90fd5b6200082d9062000dc1565b62000884602160405180937f3000000000000000000000000000000000000000000000000000000000000000602083015262000873815180926020868601910162000c63565b810103600181018452018262000cea565b62000500565b62000899620004009162000dc1565b62000d2c565b62000899620008ae9162000dc1565b96620003eb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576200091f62000b7d565b6200092962000bf0565b7fffffffffffffffffffffffff00000000000000000000000000000000000000008060005416600055600154600073ffffffffffffffffffffffffffffffffffffffff821681817f162998b90abc2507f3953aa797827b03a14c42dbd9a35f09feaf02e0d592773a8280a37f31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc68280a316600155005b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f557602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f55760043573ffffffffffffffffffffffffffffffffffffffff808216809203620000f55762000a7062000b7d565b817fffffffffffffffffffffffff00000000000000000000000000000000000000006000541617600055600154167f162998b90abc2507f3953aa797827b03a14c42dbd9a35f09feaf02e0d592773a600080a3005b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f55760209073ffffffffffffffffffffffffffffffffffffffff600054168152f35b60025481101562000b4e5760026000527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0190600090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff6001541680330362000ba15750565b6040517f443dc2b400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152336024820152604490fd5b73ffffffffffffffffffffffffffffffffffffffff6000541680330362000c145750565b6040517fbe5a953700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152336024820152604490fd5b60005b83811062000c775750506000910152565b818101518382015260200162000c66565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60209362000cc68151809281875287808801910162000c63565b0116010190565b6040810190811067ffffffffffffffff821117620007e757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117620007e757604052565b9062000d84602160405180947f3000000000000000000000000000000000000000000000000000000000000000602083015262000d73815180926020868601910162000c63565b810103600181018552018362000cea565b565b67ffffffffffffffff8111620007e757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008082101562000f7a575b506d04ee2d6d415b85acef81000000008083101562000f6a575b50662386f26fc100008083101562000f5a575b506305f5e1008083101562000f4a575b506127108083101562000f3a575b50606482101562000f29575b600a8092101562000f1e575b600190816021818601957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe062000ea162000e888962000d86565b9862000e986040519a8b62000cea565b808a5262000d86565b01366020890137860101905b62000eba575b5050505090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019083907f30313233343536373839616263646566000000000000000000000000000000008282061a83530491821562000f185791908262000ead565b62000eb3565b916001019162000e4e565b919060646002910491019162000e42565b6004919392049101913862000e36565b6008919392049101913862000e28565b6010919392049101913862000e18565b6020919392049101913862000e05565b60409350810491503862000deb565b60018114620012a957600281146200126d57600390818114620012325760048114620011f75760058114620011bc57600681146200118157600781146200114657600881146200110b5760098114620010d057600a81146200109557600b81146200105a57600c14620010205760046040517fc8d7e9c5000000000000000000000000000000000000000000000000000000008152fd5b604051906200102f8262000ccd565b81527f4445430000000000000000000000000000000000000000000000000000000000602082015290565b50604051906200106a8262000ccd565b81527f4e4f560000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620010a58262000ccd565b81527f4f43540000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620010e08262000ccd565b81527f5345500000000000000000000000000000000000000000000000000000000000602082015290565b50604051906200111b8262000ccd565b81527f4155470000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620011568262000ccd565b81527f4a554c0000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620011918262000ccd565b81527f4a554e0000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620011cc8262000ccd565b81527f4d41590000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620012078262000ccd565b81527f4150520000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620012428262000ccd565b81527f4d41520000000000000000000000000000000000000000000000000000000000602082015290565b506040516200127c8162000ccd565b600381527f4645420000000000000000000000000000000000000000000000000000000000602082015290565b50604051620012b88162000ccd565b600381527f4a414e0000000000000000000000000000000000000000000000000000000000602082015290565b91909160008382019384129112908015821691151617620008b557565b81810392916000138015828513169184121617620008b557565b62010bd991828201928312916000928382129080158216911516176200163f576226496501928262253d8c8512911290801582169115161762001612578260021b6004938482058103620015e65762023ab1809205918281029081058303620015ba57600381019085600383129112908015821691151617620015ba579085620013a892059062001302565b6001810160018112858312908015821691151617620015ba57610fa09080820291820503620015ba5762164b099005906105b582810290810583036200158e579086620013f792059062001302565b91601f83019285601f85129112908015821691151617620015ba5782605002926050840581036200158e5761098f80940593848102908105850362001562579060506200144692059062001302565b94600b840593600281019082600283129112908015821691151617620015365784600c0290600c820586036200150a5790620014829162001302565b967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcf8301928313600116620014de5782606402926064840503620014de575050620014d99291620014d391620012e5565b620012e5565b929190565b9060116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60248360118b7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60248260118a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60248760118a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024866011897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024856011887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024846011877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fdfe6101c06040818152346200048b5762002633803803809162000022828662000490565b84398201906080838303126200048b5782516001600160a01b038116908190036200048b576020848101516001600160401b0394919391908581116200048b578162000070918801620004d9565b90828701518681116200048b576060916200008d918901620004d9565b96015193825190838201828110888211176200039757845260019384835281830194603160f81b86528451898111620003975760038054918383811c9316801562000480575b868410146200046a57601f928381116200041f575b508086848211600114620003b957600091620003ad575b5060001982841b1c191690841b1781555b8b51918b8311620003975760049c8d548581811c911680156200038c575b8882101462000377578e8382116200032c575b50508d87928511600114620002c15750938394918492600095620002b5575b50501b92600019911b1c19161789555b6200017b8462000534565b946101209586526200018d84620006d9565b94610140958652838151910120938460e0525190209861010099808b524660a0528251938401947f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f86528385015260608401524660808401523060a084015260a0835260c0830198838a10908a1117620002a057508790525190206080523060c052610180928352610160913383526101a0948552611e02968762000831883960805187611b0c015260a05187611bd8015260c05187611add015260e05187611b5b01525186611b8101525185610ab501525184610adf015251836111bf01525182818161053f015281816108340152610dd60152518181816101b801528181610599015281816107530152610a5c0152f35b604190634e487b7160e01b6000525260246000fd5b01519350388062000160565b929190601f1985169360005284886000209460005b8a89838310620003145750505010620002f9575b50505050811b01895562000170565b01519060f884600019921b161c1916905538808080620002ea565b868601518955909701969485019488935001620002d6565b600052876000208380870160051c8201928a88106200036d575b0160051c019086905b828110620003605750508e62000141565b600081550186906200034f565b9250819262000346565b60228f634e487b7160e01b6000525260246000fd5b90607f16906200012e565b634e487b7160e01b600052604160045260246000fd5b905088015138620000ff565b859250601f1982169084600052886000209160005b8a8d83831062000409575050508311620003f0575b5050811b01815562000110565b8a015160001983861b60f8161c191690553880620003e3565b84015185558996909401939283019201620003ce565b82600052866000208480840160051c82019289851062000460575b0160051c019085905b82811062000453575050620000e8565b6000815501859062000443565b925081926200043a565b634e487b7160e01b600052602260045260246000fd5b92607f1692620000d3565b600080fd5b601f909101601f19168101906001600160401b038211908210176200039757604052565b60005b838110620004c85750506000910152565b8181015183820152602001620004b7565b81601f820112156200048b5780516001600160401b03811162000397576040519262000510601f8301601f19166020018562000490565b818452602082840101116200048b57620005319160208085019101620004b4565b90565b80516020919082811015620005b4575090601f8251116200057257808251920151908083106200056357501790565b82600019910360031b1b161790565b604490620005a69260405193849263305a27a960e01b845280600485015282519283918260248701528686019101620004b4565b601f01601f19168101030190fd5b6001600160401b03811162000397576005928354926001938481811c91168015620006ce575b838210146200046a57601f811162000697575b5081601f84116001146200062d575092829391839260009462000621575b50501b916000199060031b1c191617905560ff90565b0151925038806200060b565b919083601f1981168760005284600020946000905b888383106200067c575050501062000662575b505050811b01905560ff90565b015160001960f88460031b161c1916905538808062000655565b85870151885590960195948501948793509081019062000642565b8560005284601f846000209201871c820191601f8601881c015b828110620006c1575050620005ed565b60008155018590620006b1565b90607f1690620005da565b805160209081811015620007065750601f8251116200057257808251920151908083106200056357501790565b906001600160401b0382116200039757600654926001938481811c9116801562000825575b838210146200046a57601f8111620007eb575b5081601f84116001146200077f575092829391839260009462000773575b50501b916000199060031b1c19161760065560ff90565b0151925038806200075c565b919083601f198116600660005284600020946000905b88838310620007d05750505010620007b6575b505050811b0160065560ff90565b015160001960f88460031b161c19169055388080620007a8565b85870151885590960195948501948793509081019062000795565b600660005284601f84600020920160051c820191601f860160051c015b828110620008185750506200073e565b6000815501859062000808565b90607f16906200072b56fe608060408181526004918236101561001657600080fd5b600092833560e01c91826306aa6375146111755750816306fdde0314611132578163095ea7b3146110ea57816318160ddd146110ad57816323b872dd14610f7f578163313ce56714610f455781633644e51514610f035781633950935114610e8957816340c10f1914610cf057816370a0823114610c8f57816372c381b314610c525781637ecebe0014610bf057816384b0196e14610a7f5781638e3bc0ac14610a2657816395d89b41146109cd5781639dc29fac14610714578163a457c2d71461060e578163a9059cbb146105bf578163af92058214610563578163b0e4556f146104f4578163d505accf146102a757508063dd62ed3e146102345763f3b39b5b1461012257600080fd5b3461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576101f49181805161016081611429565b606081526060602082015201528051906101848261017d816113a2565b0383611490565b610225815161019d81610196816112df565b0382611490565b8251936101a985611429565b845260208401908152828401927f00000000000000000000000000000000000000000000000000000000000000008452805195869560208752516060602088015260808701906111e3565b9151907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe086840301908601526111e3565b905160608301520390f35b5080fd5b503461023057807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578060209261026f611241565b610277611269565b73ffffffffffffffffffffffffffffffffffffffff91821683526001865283832091168252845220549051908152f35b839150346102305760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576102e1611241565b6102e9611269565b906044359260643560843560ff811681036104f0578142116104935773ffffffffffffffffffffffffffffffffffffffff90818516928389526007602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff821117610467578b525190206103f5916103ed916103ac611ac6565b908c51917f190100000000000000000000000000000000000000000000000000000000000083526002830152602282015260c43591604260a4359220611a2a565b919091611891565b160361040a575061040793945061171c565b80f35b60649060208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b60248b6041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60648360208a51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8680fd5b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057602090517f00000000000000000000000000000000000000000000000000000000000000004210158152f35b50503461023057807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020906106076105fd611241565b602435903361150d565b5160018152f35b9050823461071157827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261071157610647611241565b918360243592338152600160205281812073ffffffffffffffffffffffffffffffffffffffff8616825260205220549082821061068e57602085610607858503873361171c565b60849060208651917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152fd5b80fd5b919050346109c957807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109c95761074d611241565b906024357f000000000000000000000000000000000000000000000000000000000000000042106109a157610784816009546114d1565b600955331561091e573385526020938585528286205482811061089c5782918693604492338a52898652038589205582600254036002558785518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef863392a387855196879485937fa9059cbb00000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff8093169085015260248401527f0000000000000000000000000000000000000000000000000000000000000000165af19081156108935750610866578280f35b8161088592903d1061088c575b61087d8183611490565b810190611dea565b5038808280f35b503d610873565b513d85823e3d90fd5b608482878651917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b60848460208451917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b8382517f1440798b000000000000000000000000000000000000000000000000000000008152fd5b8280fd5b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578051610a2291610a108261017d816113a2565b519182916020835260208301906111e3565b0390f35b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b919050346109c957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109c957610ad97f0000000000000000000000000000000000000000000000000000000000000000611bfe565b92610b037f0000000000000000000000000000000000000000000000000000000000000000611d30565b908251926020928385019585871067ffffffffffffffff881117610bc457509280610b7a838896610b6d998b9996528686528151998a997f0f000000000000000000000000000000000000000000000000000000000000008b5260e0868c015260e08b01906111e3565b91898303908a01526111e3565b924660608801523060808801528460a088015286840360c088015251928381520193925b828110610bad57505050500390f35b835185528695509381019392810192600101610b9e565b8360416024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b5050346102305760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578060209273ffffffffffffffffffffffffffffffffffffffff610c42611241565b1681526007845220549051908152f35b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020906009549051908152f35b5050346102305760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578060209273ffffffffffffffffffffffffffffffffffffffff610ce1611241565b16815280845220549051908152f35b919050346109c957807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109c957610d29611241565b73ffffffffffffffffffffffffffffffffffffffff926024359184168015610e2c578291606491610d5e6020956002546114d1565b600255808852878552858820848154019055877fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef868851878152a386855196879485937f23b872dd000000000000000000000000000000000000000000000000000000008552339085015230602485015260448401527f0000000000000000000000000000000000000000000000000000000000000000165af1908115610e235750610e08575080f35b610e1f9060203d811161088c5761087d8183611490565b5080f35b513d84823e3d90fd5b60648260208651917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b50503461023057807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057610607602092610efc610eca611241565b913381526001865284812073ffffffffffffffffffffffffffffffffffffffff841682528652846024359120546114d1565b903361171c565b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057602090610f3e611ac6565b9051908152f35b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020905160128152f35b839150346102305760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057610fb9611241565b610fc1611269565b91846044359473ffffffffffffffffffffffffffffffffffffffff8416815260016020528181203382526020522054907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611027575b60208661060787878761150d565b8482106110505750918391611045602096956106079503338361171c565b919394819350611019565b60649060208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020906002549051908152f35b50503461023057807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057602090610607611128611241565b602435903361171c565b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578051610a2291610a108261017d816112df565b84903461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102305760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b919082519283825260005b84811061122d5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b6020818301810151848301820152016111ee565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361126457565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361126457565b90600182811c921680156112d5575b60208310146112a657565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f169161129b565b600354600092916112ef8261128c565b80825291600190818116908115611366575060011461130d57505050565b9192935060036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b916000925b84841061134e57505060209250010190565b8054602085850181019190915290930192810161133c565b905060209495507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091509291921683830152151560051b010190565b600454600092916113b28261128c565b8082529160019081811690811561136657506001146113d057505050565b9192935060046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b916000925b84841061141157505060209250010190565b805460208585018101919091529093019281016113ff565b6060810190811067ffffffffffffffff82111761144557604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761144557604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761144557604052565b919082018092116114de57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561169857169182156116145760008281528060205260408120549180831061159057604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220818154019055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561180e571691821561178a5760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b60058110156119fb57806118a25750565b600181036119085760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b6002810361196e5760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b60031461197757565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311611aba5791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa15611aad57815173ffffffffffffffffffffffffffffffffffffffff811615611aa7579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480611bd5575b15611b2e577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176114455760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000004614611b05565b60ff8114611c545760ff811690601f8211611c2a5760405191611c2083611474565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600554816000611c678361128c565b80835292600190818116908115611cf05750600114611c91575b50611c8e92500382611490565b90565b6005600090815291507f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db05b848310611cd55750611c8e935050810160200138611c81565b81935090816020925483858901015201910190918492611cbc565b60209350611c8e9592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b82010138611c81565b60ff8114611d525760ff811690601f8211611c2a5760405191611c2083611474565b50604051600654816000611d658361128c565b80835292600190818116908115611cf05750600114611d8b5750611c8e92500382611490565b6006600090815291507ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f5b848310611dcf5750611c8e935050810160200138611c81565b81935090816020925483858901015201910190918492611db6565b9081602091031261126457518015158103611264579056000000000000000000000000db3388e770f49a604e11f1a2084b39279492a61f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e

Deployed Bytecode

0x60808060405260043610156200001457600080fd5b60003560e01c908163090f3f501462000ac557508063450140951462000a125780634bc66f3214620009be5780634f8b4ae714620008e45780636350e4b21462000337578063b0e4556f14620002c6578063b4efcf4a1462000255578063c8bf84a71462000217578063dfea196214620001a7578063f6ccaad414620000fa5763fb5e1f5b14620000a457600080fd5b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576004356000526004602052602060ff604060002054166040519015158152f35b600080fd5b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576200013562000bf0565b7fffffffffffffffffffffffff00000000000000000000000000000000000000008060005416600055600154903373ffffffffffffffffffffffffffffffffffffffff83167f31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc6600080a3163317600155005b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f55760043573ffffffffffffffffffffffffffffffffffffffff8116809103620000f5576000526003602052602060ff604060002054166040519015158152f35b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576020600254604051908152f35b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f557600435600254811015620000f55773ffffffffffffffffffffffffffffffffffffffff620002b660209262000b16565b9190546040519260031b1c168152f35b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f557602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e168152f35b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576200037262000b7d565b60025462015180908160043504908183810204831482151715620008b5576200039f83808402046200131c565b50929050620004ac6024620003b886808502046200131c565b9691505062000407620003cf88808702046200131c565b505091600981116000146200089f57620003e99062000dc1565b965b60098111156200088a57620004009062000dc1565b9162000dc1565b906040519687927f465842000000000000000000000000000000000000000000000000000000000060208501527f5f0000000000000000000000000000000000000000000000000000000000000060238501526200046f815180926020888801910162000c63565b830162000486825180936020888501910162000c63565b016200049c825180936020878501910162000c63565b0103600481018652018462000cea565b620004bb84808302046200131c565b509050620006036025620004d387808602046200131c565b94915050620004e688808702046200131c565b505093600981116000146200082257620005009062000dc1565b620005216200051a620005138962000dc1565b9362000f89565b9562000dc1565b906040519586937f465842000000000000000000000000000000000000000000000000000000000060208601527f5f0000000000000000000000000000000000000000000000000000000000000060238601526200058a81518092602060248901910162000c63565b84017f5f000000000000000000000000000000000000000000000000000000000000006024820152620005c7825180936020898501910162000c63565b01620005dd825180936020888501910162000c63565b01620005f3825180936020878501910162000c63565b0103600581018452018262000cea565b60405193612633948581019581871067ffffffffffffffff881117620007e7576200166d82398073ffffffffffffffffffffffffffffffffffffffff96877f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e168152608060208201526200068e6200067f608083018662000c88565b82810360408401528662000c88565b9060608a880291015203906000f08015620008165785169460025468010000000000000000811015620007e757806001620006cd920160025562000b16565b819291549060031b9188831b921b19161790558460005260036020526040600020927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0093600185825416179055868102600052600460205260ff60406000205416620007bd5786620007a762000798947f70447ad46f3971bf936af78a90dbb9f714c328506d57cf6034d96dd6c13787189660409a8502600052600460205260018b6000209182541617905589519586958a875289602088015260a08c88015260a087019062000c88565b90858203606087015262000c88565b910260808301520390a182519182526020820152f35b60046040517fe388d64f000000000000000000000000000000000000000000000000000000008152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040513d6000823e3d90fd5b6200082d9062000dc1565b62000884602160405180937f3000000000000000000000000000000000000000000000000000000000000000602083015262000873815180926020868601910162000c63565b810103600181018452018262000cea565b62000500565b62000899620004009162000dc1565b62000d2c565b62000899620008ae9162000dc1565b96620003eb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f5576200091f62000b7d565b6200092962000bf0565b7fffffffffffffffffffffffff00000000000000000000000000000000000000008060005416600055600154600073ffffffffffffffffffffffffffffffffffffffff821681817f162998b90abc2507f3953aa797827b03a14c42dbd9a35f09feaf02e0d592773a8280a37f31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc68280a316600155005b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f557602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b34620000f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f55760043573ffffffffffffffffffffffffffffffffffffffff808216809203620000f55762000a7062000b7d565b817fffffffffffffffffffffffff00000000000000000000000000000000000000006000541617600055600154167f162998b90abc2507f3953aa797827b03a14c42dbd9a35f09feaf02e0d592773a600080a3005b34620000f55760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620000f55760209073ffffffffffffffffffffffffffffffffffffffff600054168152f35b60025481101562000b4e5760026000527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0190600090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff6001541680330362000ba15750565b6040517f443dc2b400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152336024820152604490fd5b73ffffffffffffffffffffffffffffffffffffffff6000541680330362000c145750565b6040517fbe5a953700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152336024820152604490fd5b60005b83811062000c775750506000910152565b818101518382015260200162000c66565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60209362000cc68151809281875287808801910162000c63565b0116010190565b6040810190811067ffffffffffffffff821117620007e757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117620007e757604052565b9062000d84602160405180947f3000000000000000000000000000000000000000000000000000000000000000602083015262000d73815180926020868601910162000c63565b810103600181018552018362000cea565b565b67ffffffffffffffff8111620007e757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008082101562000f7a575b506d04ee2d6d415b85acef81000000008083101562000f6a575b50662386f26fc100008083101562000f5a575b506305f5e1008083101562000f4a575b506127108083101562000f3a575b50606482101562000f29575b600a8092101562000f1e575b600190816021818601957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe062000ea162000e888962000d86565b9862000e986040519a8b62000cea565b808a5262000d86565b01366020890137860101905b62000eba575b5050505090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019083907f30313233343536373839616263646566000000000000000000000000000000008282061a83530491821562000f185791908262000ead565b62000eb3565b916001019162000e4e565b919060646002910491019162000e42565b6004919392049101913862000e36565b6008919392049101913862000e28565b6010919392049101913862000e18565b6020919392049101913862000e05565b60409350810491503862000deb565b60018114620012a957600281146200126d57600390818114620012325760048114620011f75760058114620011bc57600681146200118157600781146200114657600881146200110b5760098114620010d057600a81146200109557600b81146200105a57600c14620010205760046040517fc8d7e9c5000000000000000000000000000000000000000000000000000000008152fd5b604051906200102f8262000ccd565b81527f4445430000000000000000000000000000000000000000000000000000000000602082015290565b50604051906200106a8262000ccd565b81527f4e4f560000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620010a58262000ccd565b81527f4f43540000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620010e08262000ccd565b81527f5345500000000000000000000000000000000000000000000000000000000000602082015290565b50604051906200111b8262000ccd565b81527f4155470000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620011568262000ccd565b81527f4a554c0000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620011918262000ccd565b81527f4a554e0000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620011cc8262000ccd565b81527f4d41590000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620012078262000ccd565b81527f4150520000000000000000000000000000000000000000000000000000000000602082015290565b5060405190620012428262000ccd565b81527f4d41520000000000000000000000000000000000000000000000000000000000602082015290565b506040516200127c8162000ccd565b600381527f4645420000000000000000000000000000000000000000000000000000000000602082015290565b50604051620012b88162000ccd565b600381527f4a414e0000000000000000000000000000000000000000000000000000000000602082015290565b91909160008382019384129112908015821691151617620008b557565b81810392916000138015828513169184121617620008b557565b62010bd991828201928312916000928382129080158216911516176200163f576226496501928262253d8c8512911290801582169115161762001612578260021b6004938482058103620015e65762023ab1809205918281029081058303620015ba57600381019085600383129112908015821691151617620015ba579085620013a892059062001302565b6001810160018112858312908015821691151617620015ba57610fa09080820291820503620015ba5762164b099005906105b582810290810583036200158e579086620013f792059062001302565b91601f83019285601f85129112908015821691151617620015ba5782605002926050840581036200158e5761098f80940593848102908105850362001562579060506200144692059062001302565b94600b840593600281019082600283129112908015821691151617620015365784600c0290600c820586036200150a5790620014829162001302565b967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcf8301928313600116620014de5782606402926064840503620014de575050620014d99291620014d391620012e5565b620012e5565b929190565b9060116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60248360118b7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60248260118a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60248760118a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024866011897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024856011887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024846011877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fdfe6101c06040818152346200048b5762002633803803809162000022828662000490565b84398201906080838303126200048b5782516001600160a01b038116908190036200048b576020848101516001600160401b0394919391908581116200048b578162000070918801620004d9565b90828701518681116200048b576060916200008d918901620004d9565b96015193825190838201828110888211176200039757845260019384835281830194603160f81b86528451898111620003975760038054918383811c9316801562000480575b868410146200046a57601f928381116200041f575b508086848211600114620003b957600091620003ad575b5060001982841b1c191690841b1781555b8b51918b8311620003975760049c8d548581811c911680156200038c575b8882101462000377578e8382116200032c575b50508d87928511600114620002c15750938394918492600095620002b5575b50501b92600019911b1c19161789555b6200017b8462000534565b946101209586526200018d84620006d9565b94610140958652838151910120938460e0525190209861010099808b524660a0528251938401947f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f86528385015260608401524660808401523060a084015260a0835260c0830198838a10908a1117620002a057508790525190206080523060c052610180928352610160913383526101a0948552611e02968762000831883960805187611b0c015260a05187611bd8015260c05187611add015260e05187611b5b01525186611b8101525185610ab501525184610adf015251836111bf01525182818161053f015281816108340152610dd60152518181816101b801528181610599015281816107530152610a5c0152f35b604190634e487b7160e01b6000525260246000fd5b01519350388062000160565b929190601f1985169360005284886000209460005b8a89838310620003145750505010620002f9575b50505050811b01895562000170565b01519060f884600019921b161c1916905538808080620002ea565b868601518955909701969485019488935001620002d6565b600052876000208380870160051c8201928a88106200036d575b0160051c019086905b828110620003605750508e62000141565b600081550186906200034f565b9250819262000346565b60228f634e487b7160e01b6000525260246000fd5b90607f16906200012e565b634e487b7160e01b600052604160045260246000fd5b905088015138620000ff565b859250601f1982169084600052886000209160005b8a8d83831062000409575050508311620003f0575b5050811b01815562000110565b8a015160001983861b60f8161c191690553880620003e3565b84015185558996909401939283019201620003ce565b82600052866000208480840160051c82019289851062000460575b0160051c019085905b82811062000453575050620000e8565b6000815501859062000443565b925081926200043a565b634e487b7160e01b600052602260045260246000fd5b92607f1692620000d3565b600080fd5b601f909101601f19168101906001600160401b038211908210176200039757604052565b60005b838110620004c85750506000910152565b8181015183820152602001620004b7565b81601f820112156200048b5780516001600160401b03811162000397576040519262000510601f8301601f19166020018562000490565b818452602082840101116200048b57620005319160208085019101620004b4565b90565b80516020919082811015620005b4575090601f8251116200057257808251920151908083106200056357501790565b82600019910360031b1b161790565b604490620005a69260405193849263305a27a960e01b845280600485015282519283918260248701528686019101620004b4565b601f01601f19168101030190fd5b6001600160401b03811162000397576005928354926001938481811c91168015620006ce575b838210146200046a57601f811162000697575b5081601f84116001146200062d575092829391839260009462000621575b50501b916000199060031b1c191617905560ff90565b0151925038806200060b565b919083601f1981168760005284600020946000905b888383106200067c575050501062000662575b505050811b01905560ff90565b015160001960f88460031b161c1916905538808062000655565b85870151885590960195948501948793509081019062000642565b8560005284601f846000209201871c820191601f8601881c015b828110620006c1575050620005ed565b60008155018590620006b1565b90607f1690620005da565b805160209081811015620007065750601f8251116200057257808251920151908083106200056357501790565b906001600160401b0382116200039757600654926001938481811c9116801562000825575b838210146200046a57601f8111620007eb575b5081601f84116001146200077f575092829391839260009462000773575b50501b916000199060031b1c19161760065560ff90565b0151925038806200075c565b919083601f198116600660005284600020946000905b88838310620007d05750505010620007b6575b505050811b0160065560ff90565b015160001960f88460031b161c19169055388080620007a8565b85870151885590960195948501948793509081019062000795565b600660005284601f84600020920160051c820191601f860160051c015b828110620008185750506200073e565b6000815501859062000808565b90607f16906200072b56fe608060408181526004918236101561001657600080fd5b600092833560e01c91826306aa6375146111755750816306fdde0314611132578163095ea7b3146110ea57816318160ddd146110ad57816323b872dd14610f7f578163313ce56714610f455781633644e51514610f035781633950935114610e8957816340c10f1914610cf057816370a0823114610c8f57816372c381b314610c525781637ecebe0014610bf057816384b0196e14610a7f5781638e3bc0ac14610a2657816395d89b41146109cd5781639dc29fac14610714578163a457c2d71461060e578163a9059cbb146105bf578163af92058214610563578163b0e4556f146104f4578163d505accf146102a757508063dd62ed3e146102345763f3b39b5b1461012257600080fd5b3461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576101f49181805161016081611429565b606081526060602082015201528051906101848261017d816113a2565b0383611490565b610225815161019d81610196816112df565b0382611490565b8251936101a985611429565b845260208401908152828401927f00000000000000000000000000000000000000000000000000000000000000008452805195869560208752516060602088015260808701906111e3565b9151907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe086840301908601526111e3565b905160608301520390f35b5080fd5b503461023057807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578060209261026f611241565b610277611269565b73ffffffffffffffffffffffffffffffffffffffff91821683526001865283832091168252845220549051908152f35b839150346102305760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576102e1611241565b6102e9611269565b906044359260643560843560ff811681036104f0578142116104935773ffffffffffffffffffffffffffffffffffffffff90818516928389526007602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff821117610467578b525190206103f5916103ed916103ac611ac6565b908c51917f190100000000000000000000000000000000000000000000000000000000000083526002830152602282015260c43591604260a4359220611a2a565b919091611891565b160361040a575061040793945061171c565b80f35b60649060208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b60248b6041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60648360208a51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8680fd5b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057602090517f00000000000000000000000000000000000000000000000000000000000000004210158152f35b50503461023057807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020906106076105fd611241565b602435903361150d565b5160018152f35b9050823461071157827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261071157610647611241565b918360243592338152600160205281812073ffffffffffffffffffffffffffffffffffffffff8616825260205220549082821061068e57602085610607858503873361171c565b60849060208651917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152fd5b80fd5b919050346109c957807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109c95761074d611241565b906024357f000000000000000000000000000000000000000000000000000000000000000042106109a157610784816009546114d1565b600955331561091e573385526020938585528286205482811061089c5782918693604492338a52898652038589205582600254036002558785518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef863392a387855196879485937fa9059cbb00000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff8093169085015260248401527f0000000000000000000000000000000000000000000000000000000000000000165af19081156108935750610866578280f35b8161088592903d1061088c575b61087d8183611490565b810190611dea565b5038808280f35b503d610873565b513d85823e3d90fd5b608482878651917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b60848460208451917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b8382517f1440798b000000000000000000000000000000000000000000000000000000008152fd5b8280fd5b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578051610a2291610a108261017d816113a2565b519182916020835260208301906111e3565b0390f35b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b919050346109c957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109c957610ad97f0000000000000000000000000000000000000000000000000000000000000000611bfe565b92610b037f0000000000000000000000000000000000000000000000000000000000000000611d30565b908251926020928385019585871067ffffffffffffffff881117610bc457509280610b7a838896610b6d998b9996528686528151998a997f0f000000000000000000000000000000000000000000000000000000000000008b5260e0868c015260e08b01906111e3565b91898303908a01526111e3565b924660608801523060808801528460a088015286840360c088015251928381520193925b828110610bad57505050500390f35b835185528695509381019392810192600101610b9e565b8360416024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b5050346102305760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578060209273ffffffffffffffffffffffffffffffffffffffff610c42611241565b1681526007845220549051908152f35b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020906009549051908152f35b5050346102305760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578060209273ffffffffffffffffffffffffffffffffffffffff610ce1611241565b16815280845220549051908152f35b919050346109c957807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109c957610d29611241565b73ffffffffffffffffffffffffffffffffffffffff926024359184168015610e2c578291606491610d5e6020956002546114d1565b600255808852878552858820848154019055877fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef868851878152a386855196879485937f23b872dd000000000000000000000000000000000000000000000000000000008552339085015230602485015260448401527f0000000000000000000000000000000000000000000000000000000000000000165af1908115610e235750610e08575080f35b610e1f9060203d811161088c5761087d8183611490565b5080f35b513d84823e3d90fd5b60648260208651917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b50503461023057807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057610607602092610efc610eca611241565b913381526001865284812073ffffffffffffffffffffffffffffffffffffffff841682528652846024359120546114d1565b903361171c565b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057602090610f3e611ac6565b9051908152f35b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020905160128152f35b839150346102305760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057610fb9611241565b610fc1611269565b91846044359473ffffffffffffffffffffffffffffffffffffffff8416815260016020528181203382526020522054907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611027575b60208661060787878761150d565b8482106110505750918391611045602096956106079503338361171c565b919394819350611019565b60649060208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230576020906002549051908152f35b50503461023057807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261023057602090610607611128611241565b602435903361171c565b50503461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610230578051610a2291610a108261017d816112df565b84903461023057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102305760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b919082519283825260005b84811061122d5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b6020818301810151848301820152016111ee565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361126457565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361126457565b90600182811c921680156112d5575b60208310146112a657565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f169161129b565b600354600092916112ef8261128c565b80825291600190818116908115611366575060011461130d57505050565b9192935060036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b916000925b84841061134e57505060209250010190565b8054602085850181019190915290930192810161133c565b905060209495507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091509291921683830152151560051b010190565b600454600092916113b28261128c565b8082529160019081811690811561136657506001146113d057505050565b9192935060046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b916000925b84841061141157505060209250010190565b805460208585018101919091529093019281016113ff565b6060810190811067ffffffffffffffff82111761144557604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761144557604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761144557604052565b919082018092116114de57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561169857169182156116145760008281528060205260408120549180831061159057604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220818154019055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561180e571691821561178a5760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b60058110156119fb57806118a25750565b600181036119085760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b6002810361196e5760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b60031461197757565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311611aba5791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa15611aad57815173ffffffffffffffffffffffffffffffffffffffff811615611aa7579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480611bd5575b15611b2e577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176114455760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000004614611b05565b60ff8114611c545760ff811690601f8211611c2a5760405191611c2083611474565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600554816000611c678361128c565b80835292600190818116908115611cf05750600114611c91575b50611c8e92500382611490565b90565b6005600090815291507f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db05b848310611cd55750611c8e935050810160200138611c81565b81935090816020925483858901015201910190918492611cbc565b60209350611c8e9592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b82010138611c81565b60ff8114611d525760ff811690601f8211611c2a5760405191611c2083611474565b50604051600654816000611d658361128c565b80835292600190818116908115611cf05750600114611d8b5750611c8e92500382611490565b6006600090815291507ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f5b848310611dcf5750611c8e935050810160200138611c81565b81935090816020925483858901015201910190918492611db6565b9081602091031261126457518015158103611264579056

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

000000000000000000000000db3388e770f49a604e11f1a2084b39279492a61f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e

-----Decoded View---------------
Arg [0] : _timelockAddress (address): 0xdB3388e770F49A604E11f1a2084B39279492a61f
Arg [1] : _fraxErc20 (address): 0x853d955aCEf822Db058eb8505911ED77F175b99e

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000db3388e770f49a604e11f1a2084b39279492a61f
Arg [1] : 000000000000000000000000853d955acef822db058eb8505911ed77f175b99e


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.