ETH Price: $3,118.21 (-1.62%)

Contract

0x0000000446b28e4c90DbF08Ead10F3904EB27606
 
Transaction Hash
Method
Block
From
To
Increase Bounty ...208480032024-09-28 8:41:3552 days ago1727512895IN
0x00000004...04EB27606
0 ETH0.001483139.75156291
Create Bounty207581502024-09-15 19:36:3564 days ago1726428995IN
0x00000004...04EB27606
0 ETH0.000768762.7958066
Create Bounty205113472024-08-12 8:29:2399 days ago1723451363IN
0x00000004...04EB27606
0 ETH0.001368144.97558089
Create Bounty205113252024-08-12 8:24:5999 days ago1723451099IN
0x00000004...04EB27606
0 ETH0.001513865.50527896
Claim All203644682024-07-22 20:30:59119 days ago1721680259IN
0x00000004...04EB27606
0 ETH0.000603195.55026049
Claim203449712024-07-20 3:11:23122 days ago1721445083IN
0x00000004...04EB27606
0 ETH0.000324343
Claim203440762024-07-20 0:10:47122 days ago1721434247IN
0x00000004...04EB27606
0 ETH0.000378123.49741129
Claim203294922024-07-17 23:20:11124 days ago1721258411IN
0x00000004...04EB27606
0 ETH0.000713145
Claim All202925102024-07-12 19:26:59129 days ago1720812419IN
0x00000004...04EB27606
0 ETH0.00035322.80119753
Claim202851502024-07-11 18:46:47130 days ago1720723607IN
0x00000004...04EB27606
0 ETH0.000670745.3433976
Create Bounty202542252024-07-07 11:06:11135 days ago1720350371IN
0x00000004...04EB27606
0 ETH0.000418891.52342602
Create Bounty202542082024-07-07 11:02:47135 days ago1720350167IN
0x00000004...04EB27606
0 ETH0.000506521.84201953
Create Bounty202541982024-07-07 11:00:47135 days ago1720350047IN
0x00000004...04EB27606
0 ETH0.000430151.56435425
Increase Bounty ...200600012024-06-10 7:40:35162 days ago1718005235IN
0x00000004...04EB27606
0 ETH0.000855985.29355179
Increase Bounty ...200599932024-06-10 7:38:59162 days ago1718005139IN
0x00000004...04EB27606
0 ETH0.000833275.15307257
Increase Bounty ...199602772024-05-27 9:20:59176 days ago1716801659IN
0x00000004...04EB27606
0 ETH0.0016611510.27204584
Increase Bounty ...199602712024-05-27 9:19:47176 days ago1716801587IN
0x00000004...04EB27606
0 ETH0.0019320911.94831409
Claim199317792024-05-23 9:46:47180 days ago1716457607IN
0x00000004...04EB27606
0 ETH0.0011580211
Claim All198806762024-05-16 6:13:35187 days ago1715840015IN
0x00000004...04EB27606
0 ETH0.001168824.08144243
Increase Bounty ...198626062024-05-13 17:31:47189 days ago1715621507IN
0x00000004...04EB27606
0 ETH0.0036375122.49492223
Increase Bounty ...198625912024-05-13 17:28:47189 days ago1715621327IN
0x00000004...04EB27606
0 ETH0.0031974419.77199468
Claim All197804812024-05-02 5:53:59201 days ago1714629239IN
0x00000004...04EB27606
0 ETH0.001521534.79047823
Increase Bounty ...197596102024-04-29 7:54:23204 days ago1714377263IN
0x00000004...04EB27606
0 ETH0.00126797.84087523
Increase Bounty ...197596032024-04-29 7:52:59204 days ago1714377179IN
0x00000004...04EB27606
0 ETH0.001270517.85702608
Claim All197448362024-04-27 6:18:11206 days ago1714198691IN
0x00000004...04EB27606
0 ETH0.000667355.03562034
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
179919772023-08-25 13:22:35452 days ago1692969755  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Platform

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 99999999 runs

Other Settings:
paris EvmVersion
File 1 of 7 : Platform.sol
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.20;
/*
▄▄▄█████▓ ██░ ██ ▓█████     ██░ ██ ▓█████  ██▀███  ▓█████▄ 
▓  ██▒ ▓▒▓██░ ██▒▓█   ▀    ▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒▒██▀ ██▌
▒ ▓██░ ▒░▒██▀▀██░▒███      ▒██▀▀██░▒███   ▓██ ░▄█ ▒░██   █▌
░ ▓██▓ ░ ░▓█ ░██ ▒▓█  ▄    ░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄  ░▓█▄   ▌
  ▒██▒ ░ ░▓█▒░██▓░▒████▒   ░▓█▒░██▓░▒████▒░██▓ ▒██▒░▒████▓ 
  ▒ ░░    ▒ ░░▒░▒░░ ▒░ ░    ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░ ▒▒▓  ▒ 
    ░     ▒ ░▒░ ░ ░ ░  ░    ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░ ░ ▒  ▒ 
  ░       ░  ░░ ░   ░       ░  ░░ ░   ░     ░░   ░  ░ ░  ░ 
          ░  ░  ░   ░  ░    ░  ░  ░   ░  ░   ░        ░    
                                                    ░      
              .,;>>%%%%%>>;,.
           .>%%%%%%%%%%%%%%%%%%%%>,.
         .>%%%%%%%%%%%%%%%%%%>>,%%%%%%;,.
       .>>>>%%%%%%%%%%%%%>>,%%%%%%%%%%%%,>>%%,.
     .>>%>>>>%%%%%%%%%>>,%%%%%%%%%%%%%%%%%,>>%%%%%,.
   .>>%%%%%>>%%%%>>,%%>>%%%%%%%%%%%%%%%%%%%%,>>%%%%%%%,
  .>>%%%%%%%%%%>>,%%%%%%>>%%%%%%%%%%%%%%%%%%,>>%%%%%%%%%%.
  .>>%%%%%%%%%%>>,>>>>%%%%%%%%%%'..`%%%%%%%%,;>>%%%%%%%%%>%%.
.>>%%%>>>%%%%%>,%%%%%%%%%%%%%%.%%%,`%%%%%%,;>>%%%%%%%%>>>%%%%.
>>%%>%>>>%>%%%>,%%%%%>>%%%%%%%%%%%%%`%%%%%%,>%%%%%%%>>>>%%%%%%%.
>>%>>>%%>>>%%%%>,%>>>%%%%%%%%%%%%%%%%`%%%%%%%%%%%%%%%%%%%%%%%%%%.
>>%%%%%%%%%%%%%%,>%%%%%%%%%%%%%%%%%%%'%%%,>>%%%%%%%%%%%%%%%%%%%%%.
>>%%%%%%%%%%%%%%%,>%%%>>>%%%%%%%%%%%%%%%,>>%%%%%%%%>>>>%%%%%%%%%%%.
>>%%%%%%%%;%;%;%%;,%>>>>%%%%%%%%%%%%%%%,>>>%%%%%%>>;";>>%%%%%%%%%%%%.
`>%%%%%%%%%;%;;;%;%,>%%%%%%%%%>>%%%%%%%%,>>>%%%%%%%%%%%%%%%%%%%%%%%%%%.
 >>%%%%%%%%%,;;;;;%%>,%%%%%%%%>>>>%%%%%%%%,>>%%%%%%%%%%%%%%%%%%%%%%%%%%%.
 `>>%%%%%%%%%,%;;;;%%%>,%%%%%%%%>>>>%%%%%%%%,>%%%%%%'%%%%%%%%%%%%%%%%%%%>>.
  `>>%%%%%%%%%%>,;;%%%%%>>,%%%%%%%%>>%%%%%%';;;>%%%%%,`%%%%%%%%%%%%%%%>>%%>.
   >>>%%%%%%%%%%>> %%%%%%%%>>,%%%%>>>%%%%%';;;;;;>>,%%%,`%     `;>%%%%%%>>%%
   `>>%%%%%%%%%%>> %%%%%%%%%>>>>>>>>;;;;'.;;;;;>>%%'  `%%'          ;>%%%%%>
    >>%%%%%%%%%>>; %%%%%%%%>>;;;;;;''    ;;;;;>>%%%                   ;>%%%%
    `>>%%%%%%%>>>, %%%%%%%%%>>;;'        ;;;;>>%%%'                    ;>%%%
     >>%%%%%%>>>':.%%%%%%%%%%>>;        .;;;>>%%%%                    ;>%%%'
     `>>%%%%%>>> ::`%%%%%%%%%%>>;.      ;;;>>%%%%'                   ;>%%%'
      `>>%%%%>>> `:::`%%%%%%%%%%>;.     ;;>>%%%%%                   ;>%%'
       `>>%%%%>>, `::::`%%%%%%%%%%>,   .;>>%%%%%'                   ;>%'
        `>>%%%%>>, `:::::`%%%%%%%%%>>. ;;>%%%%%%                    ;>%,
         `>>%%%%>>, :::::::`>>>%%%%>>> ;;>%%%%%'                     ;>%,
          `>>%%%%>>,::::::,>>>>>>>>>>' ;;>%%%%%                       ;%%,
            >>%%%%>>,:::,%%>>>>>>>>'   ;>%%%%%.                        ;%%
             >>%%%%>>``%%%%%>>>>>'     `>%%%%%%.
             >>%%%%>> `@@a%%%%%%'     .%%%%%%%%%.
             `a@@a%@'    `%a@@'       `a@@a%a@@a
 */

import {Owned} from "solmate/auth/Owned.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {SafeTransferLib} from "solady/utils/SafeTransferLib.sol";
import {ReentrancyGuard} from "solmate/utils/ReentrancyGuard.sol";
import {GaugeController} from "src/interfaces/GaugeController.sol";
import {FixedPointMathLib} from "solady/utils/FixedPointMathLib.sol";

/// @title  Platform
/// @author Stake DAO
contract Platform is Owned, ReentrancyGuard {
    using SafeTransferLib for ERC20;
    using FixedPointMathLib for uint256;

    ////////////////////////////////////////////////////////////////
    /// --- EMERGENCY SHUTDOWN
    ///////////////////////////////////////////////////////////////

    /// @notice Emergency shutdown flag
    bool public isKilled;

    ////////////////////////////////////////////////////////////////
    /// --- STRUCTS
    ///////////////////////////////////////////////////////////////

    /// @notice Bounty struct requirements.
    struct Bounty {
        // Address of the target gauge.
        address gauge;
        // Manager.
        address manager;
        // Address of the ERC20 used for rewards.
        address rewardToken;
        // Number of periods.
        uint8 numberOfPeriods;
        // Timestamp where the bounty become unclaimable.
        uint256 endTimestamp;
        // Max Price per vote.
        uint256 maxRewardPerVote;
        // Total Reward Added.
        uint256 totalRewardAmount;
        // Blacklisted addresses.
        address[] blacklist;
    }

    struct Upgrade {
        // Number of periods after increase.
        uint8 numberOfPeriods;
        // Total reward amount after increase.
        uint256 totalRewardAmount;
        // New max reward per vote after increase.
        uint256 maxRewardPerVote;
        // New end timestamp after increase.
        uint256 endTimestamp;
    }

    /// @notice Period struct.
    struct Period {
        // Period id.
        // Eg: 0 is the first period, 1 is the second period, etc.
        uint8 id;
        // Timestamp of the period start.
        uint256 timestamp;
        // Reward amount distributed during the period.
        uint256 rewardPerPeriod;
    }

    ////////////////////////////////////////////////////////////////
    /// --- CONSTANTS & IMMUTABLES
    ///////////////////////////////////////////////////////////////

    /// @notice Minimum duration a Bounty.
    uint8 public constant MINIMUM_PERIOD = 2;

    /// @notice Week in seconds.
    uint256 private constant _WEEK = 1 weeks;

    /// @notice Base unit for fixed point compute.
    uint256 private constant _BASE_UNIT = 1e18;

    /// @notice Default fee.
    uint256 internal constant _DEFAULT_FEE = 2e16; // 2%

    /// @notice Gauge Controller.
    GaugeController public immutable gaugeController;

    ////////////////////////////////////////////////////////////////
    /// --- STORAGE VARS
    ///////////////////////////////////////////////////////////////

    /// @notice Fee.
    uint256 public fee;

    /// @notice Bounty ID Counter.
    uint256 public nextID;

    /// @notice Fee collector.
    address public feeCollector;

    /// @notice ID => Bounty.
    mapping(uint256 => Bounty) public bounties;

    /// @notice Whitelisted address for some functions
    mapping(address => bool) public whitelisted;

    /// @notice Recipient per address.
    mapping(address => address) public recipient;

    /// @notice Fee accrued per rewardToken.
    mapping(address => uint256) public feeAccrued;

    /// @notice BountyId => isUpgradeable. If true, the bounty can be upgraded.
    mapping(uint256 => bool) public isUpgradeable;

    /// @notice ID => Period running.
    mapping(uint256 => Period) public activePeriod;

    /// @notice ID => Amount Claimed per Bounty.
    mapping(uint256 => uint256) public amountClaimed;

    /// @notice ID => Amount of reward per vote distributed.
    mapping(uint256 => uint256) public rewardPerVote;

    /// @notice ID => Bounty In Queue to be upgraded.
    mapping(uint256 => Upgrade) public upgradeBountyQueue;

    /// @notice Blacklisted addresses per bounty that aren't counted for rewards arithmetics.
    mapping(uint256 => mapping(address => bool)) public isBlacklisted;

    /// @notice Last time a user claimed
    mapping(address => mapping(uint256 => uint256)) public lastUserClaim;

    ////////////////////////////////////////////////////////////////
    /// --- MODIFIERS
    ///////////////////////////////////////////////////////////////

    modifier notKilled() {
        if (isKilled) revert KILLED();
        _;
    }

    modifier onlyManager(uint256 _id) {
        if (msg.sender != bounties[_id].manager) revert AUTH_MANAGER_ONLY();
        _;
    }

    modifier onlyWhitelisted(address _caller) {
        if (!whitelisted[_caller]) revert WHITELISTED_ONLY();
        _;
    }

    ////////////////////////////////////////////////////////////////
    /// --- EVENTS
    ///////////////////////////////////////////////////////////////

    /// @notice Emitted when a new bounty is created.
    /// @param id Bounty ID.
    /// @param gauge Gauge address.
    /// @param manager Manager address.
    /// @param rewardToken Reward token address.
    /// @param numberOfPeriods Number of periods.
    /// @param maxRewardPerVote Max reward per vote.
    /// @param rewardPerPeriod Reward per period.
    /// @param totalRewardAmount Total reward amount.
    /// @param isUpgradeable If true, the bounty can be upgraded.
    event BountyCreated(
        uint256 indexed id,
        address indexed gauge,
        address manager,
        address rewardToken,
        uint8 numberOfPeriods,
        uint256 maxRewardPerVote,
        uint256 rewardPerPeriod,
        uint256 totalRewardAmount,
        bool isUpgradeable
    );

    /// @notice Emitted when a bounty is closed.
    /// @param id Bounty ID.
    /// @param remainingReward Remaining reward.
    event BountyClosed(uint256 id, uint256 remainingReward);

    /// @notice Emitted when a bounty period is rolled over.
    /// @param id Bounty ID.
    /// @param periodId Period ID.
    /// @param timestamp Period timestamp.
    /// @param rewardPerPeriod Reward per period.
    event PeriodRolledOver(uint256 id, uint256 periodId, uint256 timestamp, uint256 rewardPerPeriod);

    /// @notice Emitted on claim.
    /// @param user User address.
    /// @param rewardToken Reward token address.
    /// @param bountyId Bounty ID.
    /// @param amount Amount claimed.
    /// @param protocolFees Protocol fees.
    /// @param period Period timestamp.
    event Claimed(
        address indexed user,
        address rewardToken,
        uint256 indexed bountyId,
        uint256 amount,
        uint256 protocolFees,
        uint256 period
    );

    /// @notice Emitted when a bounty is queued to upgrade.
    /// @param id Bounty ID.
    /// @param numberOfPeriods Number of periods.
    /// @param totalRewardAmount Total reward amount.
    /// @param maxRewardPerVote Max reward per vote.
    event BountyDurationIncreaseQueued(
        uint256 id, uint8 numberOfPeriods, uint256 totalRewardAmount, uint256 maxRewardPerVote
    );

    /// @notice Emitted when a bounty is upgraded.
    /// @param id Bounty ID.
    /// @param numberOfPeriods Number of periods.
    /// @param totalRewardAmount Total reward amount.
    /// @param maxRewardPerVote Max reward per vote.
    event BountyDurationIncrease(
        uint256 id, uint8 numberOfPeriods, uint256 totalRewardAmount, uint256 maxRewardPerVote
    );

    /// @notice Emitted when a bounty manager is updated.
    /// @param id Bounty ID.
    /// @param manager Manager address.
    event ManagerUpdated(uint256 id, address indexed manager);

    /// @notice Emitted when a recipient is set for an address.
    /// @param sender Sender address.
    /// @param recipient Recipient address.
    event RecipientSet(address indexed sender, address indexed recipient);

    /// @notice Emitted when fee is updated.
    /// @param fee Fee.
    event FeeUpdated(uint256 fee);

    /// @notice Emitted when fee collector is updated.
    /// @param feeCollector Fee collector.
    event FeeCollectorUpdated(address feeCollector);

    /// @notice Emitted when fees are collected.
    /// @param rewardToken Reward token address.
    /// @param amount Amount collected.
    event FeesCollected(address indexed rewardToken, uint256 amount);

    /// @notice Emitted when owner changed the whitelist status of an address
    /// @param user Address of the user
    /// @param status New whitelist status
    event WhitelistUpdated(address indexed user, bool indexed status);

    ////////////////////////////////////////////////////////////////
    /// --- ERRORS
    ///////////////////////////////////////////////////////////////

    error KILLED();
    error WRONG_INPUT();
    error NO_RECIPIENT();
    error ZERO_ADDRESS();
    error INVALID_TOKEN();
    error ALREADY_CLOSED();
    error NO_PERIODS_LEFT();
    error NOT_UPGRADEABLE();
    error WHITELISTED_ONLY();
    error AUTH_MANAGER_ONLY();
    error INVALID_NUMBER_OF_PERIODS();

    ////////////////////////////////////////////////////////////////
    /// --- CONSTRUCTOR
    ///////////////////////////////////////////////////////////////

    /// @notice Create Bounty platform.
    /// @param _gaugeController Address of the gauge controller.
    constructor(address _gaugeController, address _feeCollector, address _owner) Owned(_owner) {
        fee = _DEFAULT_FEE;
        feeCollector = _feeCollector;
        gaugeController = GaugeController(_gaugeController);
    }

    ////////////////////////////////////////////////////////////////
    /// --- BOUNTY CREATION LOGIC
    ///////////////////////////////////////////////////////////////

    /// @notice Create a new bounty.
    /// @param gauge Address of the target gauge.
    /// @param rewardToken Address of the ERC20 used or rewards.
    /// @param numberOfPeriods Number of periods.
    /// @param maxRewardPerVote Target Bias for the Gauge.
    /// @param totalRewardAmount Total Reward Added.
    /// @param blacklist Array of addresses to blacklist.
    /// @return newBountyId of the bounty created.
    function createBounty(
        address gauge,
        address manager,
        address rewardToken,
        uint8 numberOfPeriods,
        uint256 maxRewardPerVote,
        uint256 totalRewardAmount,
        address[] calldata blacklist,
        bool upgradeable
    ) external nonReentrant notKilled returns (uint256 newBountyId) {
        // Revert if the gauge is not registered.
        gaugeController.gauge_types(gauge);

        if (numberOfPeriods < MINIMUM_PERIOD) revert INVALID_NUMBER_OF_PERIODS();
        if (totalRewardAmount == 0 || maxRewardPerVote == 0) revert WRONG_INPUT();
        if (rewardToken == address(0) || manager == address(0)) revert ZERO_ADDRESS();

        uint256 size;
        assembly {
            size := extcodesize(rewardToken)
        }
        if (size == 0) revert INVALID_TOKEN();

        // Transfer the rewards to the contracts.
        SafeTransferLib.safeTransferFrom(rewardToken, msg.sender, address(this), totalRewardAmount);

        unchecked {
            // Get the ID for that new Bounty and increment the nextID counter.
            newBountyId = nextID;

            ++nextID;
        }

        uint256 rewardPerPeriod = totalRewardAmount.mulDiv(1, numberOfPeriods);
        uint256 currentPeriod = getCurrentPeriod();

        bounties[newBountyId] = Bounty({
            gauge: gauge,
            manager: manager,
            rewardToken: rewardToken,
            numberOfPeriods: numberOfPeriods,
            endTimestamp: currentPeriod + ((numberOfPeriods + 1) * _WEEK),
            maxRewardPerVote: maxRewardPerVote,
            totalRewardAmount: totalRewardAmount,
            blacklist: blacklist
        });

        emit BountyCreated(
            newBountyId,
            gauge,
            manager,
            rewardToken,
            numberOfPeriods,
            maxRewardPerVote,
            rewardPerPeriod,
            totalRewardAmount,
            upgradeable
        );

        // Set Upgradeable status.
        isUpgradeable[newBountyId] = upgradeable;
        // Starting from next period.
        activePeriod[newBountyId] = Period(0, currentPeriod + _WEEK, rewardPerPeriod);

        // Add the addresses to the blacklist.
        uint256 length = blacklist.length;
        for (uint256 i = 0; i < length;) {
            isBlacklisted[newBountyId][blacklist[i]] = true;
            unchecked {
                ++i;
            }
        }
    }

    /// @notice Claim rewards for a given bounty.
    /// @param bountyId ID of the bounty.
    /// @return Amount of rewards claimed.
    function claim(uint256 bountyId) external returns (uint256) {
        return _claim(msg.sender, msg.sender, bountyId);
    }

    /// @notice Claim rewards for a given bounty.
    /// @param bountyId ID of the bounty.
    /// @return Amount of rewards claimed.
    function claim(uint256 bountyId, address _recipient) external returns (uint256) {
        return _claim(msg.sender, _recipient, bountyId);
    }

    /// @notice Claim rewards for a given bounty.
    /// @param user User to claim for.
    /// @param bountyId ID of the bounty.
    /// @return Amount of rewards claimed.
    function claimFor(address user, uint256 bountyId) external returns (uint256) {
        address _recipient = recipient[user];
        return _claim(user, _recipient != address(0) ? _recipient : user, bountyId);
    }

    /// @notice Claim rewards for a given bounty, for a set of users.
    /// @param bountyId ID of the bounty.
    /// @return Amount of rewards claimed.
    /// @dev All users should have delegated to the msg.sender
    function batchClaimFor(address[] calldata users, uint256 bountyId)
        external
        onlyWhitelisted(msg.sender)
        returns (uint256)
    {
        for (uint256 i = 0; i < users.length; i++) {
            if (recipient[users[i]] != msg.sender) revert NO_RECIPIENT();
        }

        return _batchClaim(users, msg.sender, bountyId);
    }

    /// @notice Claim all rewards for multiple bounties.
    /// @param ids Array of bounty IDs to claim.
    function claimAll(uint256[] calldata ids) external {
        uint256 length = ids.length;

        for (uint256 i = 0; i < length;) {
            uint256 id = ids[i];

            _claim(msg.sender, msg.sender, id);

            unchecked {
                ++i;
            }
        }
    }

    /// @notice Claim all rewards for multiple bounties to a given recipient.
    /// @param ids Array of bounty IDs to claim.
    /// @param _recipient Address to send the rewards to.
    function claimAll(uint256[] calldata ids, address _recipient) external {
        uint256 length = ids.length;

        for (uint256 i = 0; i < length;) {
            uint256 id = ids[i];
            _claim(msg.sender, _recipient, id);

            unchecked {
                ++i;
            }
        }
    }

    /// @notice Claim all rewards for multiple bounties on behalf of a user.
    /// @param ids Array of bounty IDs to claim.
    /// @param _user Address to claim the rewards for.
    function claimAllFor(address _user, uint256[] calldata ids) external {
        address _recipient = recipient[_user];
        if (_recipient == address(0)) _recipient = _user;

        uint256 length = ids.length;
        for (uint256 i = 0; i < length;) {
            uint256 id = ids[i];
            _claim(_user, _recipient, id);
            unchecked {
                ++i;
            }
        }
    }

    /// @notice Update Bounty for a given id.
    /// @param bountyId ID of the bounty.
    function updateBountyPeriod(uint256 bountyId) external {
        _updateBountyPeriod(bountyId);
    }

    /// @notice Update multiple bounties for given ids.
    /// @param ids Array of Bounty IDs.
    function updateBountyPeriods(uint256[] calldata ids) external {
        uint256 length = ids.length;
        for (uint256 i = 0; i < length;) {
            _updateBountyPeriod(ids[i]);
            unchecked {
                ++i;
            }
        }
    }

    /// @notice Set a recipient address for calling user.
    /// @param _recipient Address of the recipient.
    /// @dev Recipient are used when calling claimFor functions. Regular claim functions will use msg.sender as recipient,
    ///  or recipient parameter provided if called by msg.sender.
    function setRecipient(address _recipient) external {
        recipient[msg.sender] = _recipient;

        emit RecipientSet(msg.sender, _recipient);
    }

    ////////////////////////////////////////////////////////////////
    /// --- INTERNAL LOGIC
    ///////////////////////////////////////////////////////////////

    /// @notice Claim rewards for a given bounty.
    /// @param _user Address of the user.
    /// @param _recipient Address of the recipient.
    /// @param _bountyId ID of the bounty.
    /// @return amount of rewards claimed.
    function _claim(address _user, address _recipient, uint256 _bountyId)
        internal
        nonReentrant
        notKilled
        returns (uint256 amount)
    {
        if (isBlacklisted[_bountyId][_user]) return 0;
        // Update if needed the current period.
        uint256 currentPeriod = _updateBountyPeriod(_bountyId);

        Bounty storage bounty = bounties[_bountyId];

        // Get the last_vote timestamp.
        uint256 lastVote = gaugeController.last_user_vote(_user, bounty.gauge);

        GaugeController.VotedSlope memory userSlope = gaugeController.vote_user_slopes(_user, bounty.gauge);

        if (
            userSlope.slope == 0 || lastUserClaim[_user][_bountyId] >= currentPeriod || currentPeriod >= userSlope.end
                || currentPeriod <= lastVote || currentPeriod >= bounty.endTimestamp || currentPeriod != getCurrentPeriod()
                || amountClaimed[_bountyId] == bounty.totalRewardAmount
        ) return 0;

        // Update User last claim period.
        lastUserClaim[_user][_bountyId] = currentPeriod;

        // Voting Power = userSlope * dt
        // with dt = lock_end - period.
        uint256 _bias = _getAddrBias(userSlope.slope, userSlope.end, currentPeriod);
        // Compute the reward amount based on
        // Reward / Total Votes.
        amount = _bias.mulWad(rewardPerVote[_bountyId]);
        // Compute the reward amount based on
        // the max price to pay.
        uint256 _amountWithMaxPrice = _bias.mulWad(bounty.maxRewardPerVote);
        // Distribute the _min between the amount based on votes, and price.
        amount = FixedPointMathLib.min(amount, _amountWithMaxPrice);

        // Update the amount claimed.
        uint256 _amountClaimed = amountClaimed[_bountyId];

        if (amount + _amountClaimed > bounty.totalRewardAmount) {
            amount = bounty.totalRewardAmount - _amountClaimed;
        }

        amountClaimed[_bountyId] += amount;

        uint256 feeAmount;

        if (fee != 0) {
            feeAmount = amount.mulWad(fee);
            amount -= feeAmount;
            feeAccrued[bounty.rewardToken] += feeAmount;
        }

        // Transfer to user.
        SafeTransferLib.safeTransfer(bounty.rewardToken, _recipient, amount);

        emit Claimed(_user, bounty.rewardToken, _bountyId, amount, feeAmount, currentPeriod);
    }

    /// @notice Claim rewards for a given bounty, for multiple users.
    /// @param _users Address of the user.
    /// @param _recipient Address of the recipient.
    /// @param _bountyId ID of the bounty.
    /// @return totalAmount amount of rewards claimed.
    /// @dev Same as claim, but with a for loop
    function _batchClaim(address[] calldata _users, address _recipient, uint256 _bountyId)
        internal
        nonReentrant
        notKilled
        returns (uint256 totalAmount)
    {
        uint256 currentPeriod = _updateBountyPeriod(_bountyId);

        Bounty memory bounty = bounties[_bountyId];

        uint256 length = _users.length;
        for (uint256 i = 0; i < length; i++) {
            address _user = _users[i];

            GaugeController.VotedSlope memory userSlope = gaugeController.vote_user_slopes(_user, bounty.gauge);

            uint256 _amountClaimed = amountClaimed[_bountyId];

            if (
                !_canUserClaim(
                    _user,
                    _bountyId,
                    bounty,
                    currentPeriod,
                    getCurrentPeriod(),
                    _amountClaimed,
                    userSlope.slope,
                    userSlope.end
                )
            ) continue;

            // Update User last claim period.
            lastUserClaim[_user][_bountyId] = currentPeriod;

            // Voting Power = userSlope * dt
            // with dt = lock_end - period.
            uint256 _bias = _getAddrBias(userSlope.slope, userSlope.end, currentPeriod);
            // Compute the reward amount based on
            // Reward / Total Votes.
            uint256 amount = _bias.mulWad(rewardPerVote[_bountyId]);
            // Compute the reward amount based on
            // the max price to pay.
            uint256 _amountWithMaxPrice = _bias.mulWad(bounty.maxRewardPerVote);

            // Distribute the _min between the amount based on votes, and price.
            amount = FixedPointMathLib.min(amount, _amountWithMaxPrice);

            // Update the amount claimed.
            if (amount + _amountClaimed > bounty.totalRewardAmount) {
                amount = bounty.totalRewardAmount - _amountClaimed;
            }

            amountClaimed[_bountyId] += amount;

            uint256 feeAmount;

            if (fee != 0) {
                feeAmount = amount.mulWad(fee);
                amount -= feeAmount;
                feeAccrued[bounty.rewardToken] += feeAmount;
            }

            totalAmount += amount;
        }
        SafeTransferLib.safeTransfer(bounty.rewardToken, _recipient, totalAmount);
        emit Claimed(_recipient, bounty.rewardToken, _bountyId, totalAmount, 0, currentPeriod);
        return totalAmount;
    }

    function _canUserClaim(
        address _user,
        uint256 _bountyId,
        Bounty memory _bounty,
        uint256 currentPeriod,
        uint256 gettedPeriod,
        uint256 _amountClaimed,
        uint256 _slope,
        uint256 _end
    ) internal view returns (bool) {
        uint256 lastVote = gaugeController.last_user_vote(_user, _bounty.gauge);

        if (
            isBlacklisted[_bountyId][_user] || _slope == 0 || lastUserClaim[_user][_bountyId] >= currentPeriod
                || currentPeriod >= _end || currentPeriod <= lastVote || currentPeriod >= _bounty.endTimestamp
                || currentPeriod != gettedPeriod || _amountClaimed == _bounty.totalRewardAmount
        ) {
            return false;
        }
        return true;
    }

    /// @notice Update the current period for a given bounty.
    /// @param bountyId Bounty ID.
    /// @return current/updated period.
    function _updateBountyPeriod(uint256 bountyId) internal returns (uint256) {
        Period storage _activePeriod = activePeriod[bountyId];

        uint256 currentPeriod = getCurrentPeriod();

        if (_activePeriod.id == 0 && currentPeriod == _activePeriod.timestamp && rewardPerVote[bountyId] == 0) {
            // Check if there is an upgrade in queue and update the bounty.
            _checkForUpgrade(bountyId);
            // Initialize reward per vote.
            // Only for the first period, and if not already initialized.
            _updateRewardPerToken(bountyId, currentPeriod);
        }

        // Increase Period
        if (block.timestamp >= _activePeriod.timestamp + _WEEK) {
            // Checkpoint gauge to have up to date gauge weight.
            gaugeController.checkpoint_gauge(bounties[bountyId].gauge);

            // Check if there is an upgrade in queue and update the bounty.
            _checkForUpgrade(bountyId);

            // Roll to next period.
            _rollOverToNextPeriod(bountyId, currentPeriod);

            return currentPeriod;
        }

        return _activePeriod.timestamp;
    }

    /// @notice Checks for an upgrade and update the bounty.
    function _checkForUpgrade(uint256 bountyId) internal {
        Upgrade storage upgradedBounty = upgradeBountyQueue[bountyId];

        // Check if there is an upgrade in queue.
        if (upgradedBounty.totalRewardAmount != 0) {
            // Save new values.
            bounties[bountyId].endTimestamp = upgradedBounty.endTimestamp;
            bounties[bountyId].numberOfPeriods = upgradedBounty.numberOfPeriods;
            bounties[bountyId].maxRewardPerVote = upgradedBounty.maxRewardPerVote;
            bounties[bountyId].totalRewardAmount = upgradedBounty.totalRewardAmount;

            if (activePeriod[bountyId].id == 0) {
                activePeriod[bountyId].rewardPerPeriod =
                    upgradedBounty.totalRewardAmount.mulDiv(1, upgradedBounty.numberOfPeriods);
            }

            emit BountyDurationIncrease(
                bountyId,
                upgradedBounty.numberOfPeriods,
                upgradedBounty.totalRewardAmount,
                upgradedBounty.maxRewardPerVote
            );

            // Reset the next values.
            delete upgradeBountyQueue[bountyId];
        }
    }

    /// @notice Roll over to next period.
    /// @param bountyId Bounty ID.
    /// @param currentPeriod Next period timestamp.
    function _rollOverToNextPeriod(uint256 bountyId, uint256 currentPeriod) internal {
        uint8 index = getActivePeriodPerBounty(bountyId);

        Bounty storage bounty = bounties[bountyId];

        uint256 periodsLeft = getPeriodsLeft(bountyId);
        uint256 rewardPerPeriod;

        rewardPerPeriod = bounty.totalRewardAmount - amountClaimed[bountyId];

        if (bounty.endTimestamp > currentPeriod + _WEEK && periodsLeft > 1) {
            rewardPerPeriod = rewardPerPeriod.mulDiv(1, periodsLeft);
        }

        // Get adjusted slope without blacklisted addresses.
        uint256 gaugeBias = _getAdjustedBias(bounty.gauge, bounty.blacklist, currentPeriod);

        rewardPerVote[bountyId] = rewardPerPeriod.mulDiv(_BASE_UNIT, gaugeBias);
        activePeriod[bountyId] = Period(index, currentPeriod, rewardPerPeriod);

        emit PeriodRolledOver(bountyId, index, currentPeriod, rewardPerPeriod);
    }

    /// @notice Update the amount of reward per token for a given bounty.
    /// @dev This function is only called once per Bounty.
    function _updateRewardPerToken(uint256 bountyId, uint256 currentPeriod) internal {
        Bounty storage bounty = bounties[bountyId];
        // Checkpoint gauge to have up to date gauge weight.
        gaugeController.checkpoint_gauge(bounty.gauge);

        uint256 gaugeBias = _getAdjustedBias(bounty.gauge, bounty.blacklist, currentPeriod);

        if (gaugeBias != 0) {
            rewardPerVote[bountyId] = activePeriod[bountyId].rewardPerPeriod.mulDiv(_BASE_UNIT, gaugeBias);
        }
    }

    ////////////////////////////////////////////////////////////////
    /// ---  VIEWS
    ///////////////////////////////////////////////////////////////

    /// @notice Get an estimate of the reward amount for a given user.
    /// @param user Address of the user.
    /// @param bountyId ID of the bounty.
    /// @return amount of rewards.
    /// Mainly used for UI.
    function claimable(address user, uint256 bountyId) external view returns (uint256 amount) {
        if (isBlacklisted[bountyId][user]) return 0;

        Bounty memory bounty = bounties[bountyId];
        // If there is an upgrade in progress but period hasn't been rolled over yet.
        Upgrade storage upgradedBounty = upgradeBountyQueue[bountyId];

        // Update if needed the current period.
        uint256 currentPeriod = getCurrentPeriod();
        // End timestamp of the bounty.
        uint256 endTimestamp = FixedPointMathLib.max(bounty.endTimestamp, upgradedBounty.endTimestamp);
        // Get the last_vote timestamp.
        uint256 lastVote = gaugeController.last_user_vote(user, bounty.gauge);

        GaugeController.VotedSlope memory userSlope = gaugeController.vote_user_slopes(user, bounty.gauge);

        if (
            userSlope.slope == 0 || lastUserClaim[user][bountyId] >= currentPeriod || currentPeriod >= userSlope.end
                || currentPeriod <= lastVote || currentPeriod >= endTimestamp
                || currentPeriod < getActivePeriod(bountyId).timestamp
                || amountClaimed[bountyId] >= bounty.totalRewardAmount
        ) return 0;

        uint256 _rewardPerVote = rewardPerVote[bountyId];
        // If period updated.
        if (_rewardPerVote == 0 || (_rewardPerVote > 0 && getActivePeriod(bountyId).timestamp != currentPeriod)) {
            uint256 _rewardPerPeriod;

            if (upgradedBounty.numberOfPeriods != 0) {
                // Update max reward per vote.
                bounty.maxRewardPerVote = upgradedBounty.maxRewardPerVote;
                bounty.totalRewardAmount = upgradedBounty.totalRewardAmount;
            }

            uint256 periodsLeft = endTimestamp > currentPeriod ? (endTimestamp - currentPeriod) / _WEEK : 0;
            _rewardPerPeriod = bounty.totalRewardAmount - amountClaimed[bountyId];

            if (endTimestamp > currentPeriod + _WEEK && periodsLeft > 1) {
                _rewardPerPeriod = _rewardPerPeriod.mulDiv(1, periodsLeft);
            }

            // Get Adjusted Slope without blacklisted addresses weight.
            uint256 gaugeBias = _getAdjustedBias(bounty.gauge, bounty.blacklist, currentPeriod);
            _rewardPerVote = _rewardPerPeriod.mulDiv(_BASE_UNIT, gaugeBias);
        }
        // Get user voting power.
        uint256 _bias = _getAddrBias(userSlope.slope, userSlope.end, currentPeriod);
        // Estimation of the amount of rewards.
        amount = _bias.mulWad(_rewardPerVote);
        // Compute the reward amount based on
        // the max price to pay.
        uint256 _amountWithMaxPrice = _bias.mulWad(bounty.maxRewardPerVote);
        // Distribute the _min between the amount based on votes, and price.
        amount = FixedPointMathLib.min(amount, _amountWithMaxPrice);

        uint256 _amountClaimed = amountClaimed[bountyId];
        // Update the amount claimed.
        if (amount + _amountClaimed > bounty.totalRewardAmount) {
            amount = bounty.totalRewardAmount - _amountClaimed;
        }
        // Substract fees.
        if (fee != 0) {
            amount = amount.mulWad(_BASE_UNIT - fee);
        }
    }

    ////////////////////////////////////////////////////////////////
    /// --- INTERNAL VIEWS
    ///////////////////////////////////////////////////////////////

    /// @notice Get adjusted slope from Gauge Controller for a given gauge address.
    /// Remove the weight of blacklisted addresses.
    /// @param gauge Address of the gauge.
    /// @param _addressesBlacklisted Array of blacklisted addresses.
    /// @param period   Timestamp to check vote weight.
    function _getAdjustedBias(address gauge, address[] memory _addressesBlacklisted, uint256 period)
        internal
        view
        returns (uint256 gaugeBias)
    {
        // Cache the user slope.
        GaugeController.VotedSlope memory userSlope;
        // Bias
        uint256 _bias;
        // Last Vote
        uint256 _lastVote;
        // Cache the length of the array.
        uint256 length = _addressesBlacklisted.length;
        // Cache blacklist.
        // Get the gauge slope.
        gaugeBias = gaugeController.points_weight(gauge, period).bias;

        for (uint256 i = 0; i < length;) {
            // Get the user slope.
            userSlope = gaugeController.vote_user_slopes(_addressesBlacklisted[i], gauge);
            _lastVote = gaugeController.last_user_vote(_addressesBlacklisted[i], gauge);
            if (period > _lastVote) {
                _bias = _getAddrBias(userSlope.slope, userSlope.end, period);
                gaugeBias -= _bias;
            }
            // Increment i.
            unchecked {
                ++i;
            }
        }
    }

    ////////////////////////////////////////////////////////////////
    /// --- MANAGEMENT LOGIC
    ///////////////////////////////////////////////////////////////

    /// @notice Increase Bounty duration.
    /// @param _bountyId ID of the bounty.
    /// @param _additionnalPeriods Number of periods to add.
    /// @param _increasedAmount Total reward amount to add.
    /// @param _newMaxPricePerVote Total reward amount to add.
    function increaseBountyDuration(
        uint256 _bountyId,
        uint8 _additionnalPeriods,
        uint256 _increasedAmount,
        uint256 _newMaxPricePerVote
    ) external nonReentrant notKilled onlyManager(_bountyId) {
        if (!isUpgradeable[_bountyId]) revert NOT_UPGRADEABLE();
        if (getPeriodsLeft(_bountyId) < 1) revert NO_PERIODS_LEFT();
        if (_increasedAmount == 0 || _newMaxPricePerVote == 0) {
            revert WRONG_INPUT();
        }

        Bounty storage bounty = bounties[_bountyId];
        Upgrade memory upgradedBounty = upgradeBountyQueue[_bountyId];

        SafeTransferLib.safeTransferFrom(bounty.rewardToken, msg.sender, address(this), _increasedAmount);

        if (upgradedBounty.totalRewardAmount != 0) {
            upgradedBounty = Upgrade({
                numberOfPeriods: upgradedBounty.numberOfPeriods + _additionnalPeriods,
                totalRewardAmount: upgradedBounty.totalRewardAmount + _increasedAmount,
                maxRewardPerVote: _newMaxPricePerVote,
                endTimestamp: upgradedBounty.endTimestamp + (_additionnalPeriods * _WEEK)
            });
        } else {
            upgradedBounty = Upgrade({
                numberOfPeriods: bounty.numberOfPeriods + _additionnalPeriods,
                totalRewardAmount: bounty.totalRewardAmount + _increasedAmount,
                maxRewardPerVote: _newMaxPricePerVote,
                endTimestamp: bounty.endTimestamp + (_additionnalPeriods * _WEEK)
            });
        }

        upgradeBountyQueue[_bountyId] = upgradedBounty;

        emit BountyDurationIncreaseQueued(
            _bountyId, upgradedBounty.numberOfPeriods, upgradedBounty.totalRewardAmount, _newMaxPricePerVote
        );
    }

    /// @notice Close Bounty if there is remaining.
    /// @param bountyId ID of the bounty to close.
    function closeBounty(uint256 bountyId) external nonReentrant {
        // Check if the currentPeriod is the last one.
        // If not, we can increase the duration.
        Bounty storage bounty = bounties[bountyId];
        if (bounty.manager == address(0)) revert ALREADY_CLOSED();

        // Check if there is an upgrade in queue and update the bounty.
        _checkForUpgrade(bountyId);

        if (getCurrentPeriod() >= bounty.endTimestamp || isKilled) {
            uint256 leftOver;
            Upgrade memory upgradedBounty = upgradeBountyQueue[bountyId];

            if (upgradedBounty.totalRewardAmount != 0) {
                leftOver = upgradedBounty.totalRewardAmount - amountClaimed[bountyId];
                delete upgradeBountyQueue[bountyId];
            } else {
                leftOver = bounties[bountyId].totalRewardAmount - amountClaimed[bountyId];
            }

            // Transfer the left over to the owner.
            SafeTransferLib.safeTransfer(bounty.rewardToken, bounty.manager, leftOver);
            delete bounties[bountyId].manager;

            emit BountyClosed(bountyId, leftOver);
        }
    }

    /// @notice Update Bounty Manager.
    /// @param bountyId ID of the bounty.
    /// @param newManager Address of the new manager.
    function updateManager(uint256 bountyId, address newManager) external onlyManager(bountyId) {
        if (newManager == address(0)) revert ZERO_ADDRESS();

        emit ManagerUpdated(bountyId, bounties[bountyId].manager = newManager);
    }

    ////////////////////////////////////////////////////////////////
    /// --- ONLY OWNER FUNCTIONS
    ///////////////////////////////////////////////////////////////

    /// @notice Claim fees.
    /// @param rewardTokens Array of reward tokens.
    function claimFees(address[] calldata rewardTokens) external nonReentrant {
        uint256 _feeAccrued;
        uint256 length = rewardTokens.length;

        for (uint256 i = 0; i < length;) {
            address rewardToken = rewardTokens[i];

            _feeAccrued = feeAccrued[rewardToken];
            delete feeAccrued[rewardToken];

            emit FeesCollected(rewardToken, _feeAccrued);

            SafeTransferLib.safeTransfer(rewardToken, feeCollector, _feeAccrued);

            unchecked {
                i++;
            }
        }
    }

    /// @notice Set the platform fee.
    /// @param _platformFee Platform fee.
    function setPlatformFee(uint256 _platformFee) external onlyOwner {
        if (_platformFee > 1e18) revert WRONG_INPUT();

        fee = _platformFee;

        emit FeeUpdated(_platformFee);
    }

    /// @notice Set the fee collector.
    /// @param _feeCollector Address of the fee collector.
    function setFeeCollector(address _feeCollector) external onlyOwner {
        feeCollector = _feeCollector;

        emit FeeCollectorUpdated(_feeCollector);
    }

    /// @notice Set the recipient for a given address.
    /// @param _for Address to set the recipient for.
    /// @param _recipient Address of the recipient.
    function setRecipientFor(address _for, address _recipient) external onlyOwner {
        recipient[_for] = _recipient;

        emit RecipientSet(_for, _recipient);
    }

    function setWhitelisted(address _address, bool _isWhitelisted) external onlyOwner {
        whitelisted[_address] = _isWhitelisted;

        emit WhitelistUpdated(_address, _isWhitelisted);
    }

    function kill() external onlyOwner {
        isKilled = true;
    }

    ////////////////////////////////////////////////////////////////
    /// --- UTILS FUNCTIONS
    ///////////////////////////////////////////////////////////////

    /// @notice Returns the number of periods left for a given bounty.
    /// @param bountyId ID of the bounty.
    function getPeriodsLeft(uint256 bountyId) public view returns (uint256 periodsLeft) {
        Bounty storage bounty = bounties[bountyId];

        uint256 currentPeriod = getCurrentPeriod();
        periodsLeft = bounty.endTimestamp > currentPeriod ? (bounty.endTimestamp - currentPeriod) / _WEEK : 0;
    }

    /// @notice Return the bounty object for a given ID.
    /// @param bountyId ID of the bounty.
    function getBounty(uint256 bountyId) external view returns (Bounty memory) {
        return bounties[bountyId];
    }

    /// @notice Return the bounty in queue for a given ID.
    /// @dev Can return an empty bounty if there is no upgrade.
    /// @param bountyId ID of the bounty.
    function getUpgradedBountyQueued(uint256 bountyId) external view returns (Upgrade memory) {
        return upgradeBountyQueue[bountyId];
    }

    /// @notice Return the blacklisted addresses of a bounty for a given ID.
    /// @param bountyId ID of the bounty.
    function getBlacklistedAddressesPerBounty(uint256 bountyId) external view returns (address[] memory) {
        return bounties[bountyId].blacklist;
    }

    /// @notice Return the active period running of bounty given an ID.
    /// @param bountyId ID of the bounty.
    function getActivePeriod(uint256 bountyId) public view returns (Period memory) {
        return activePeriod[bountyId];
    }

    /// @notice Return the expected current period id.
    /// @param bountyId ID of the bounty.
    function getActivePeriodPerBounty(uint256 bountyId) public view returns (uint8) {
        Bounty storage bounty = bounties[bountyId];

        uint256 currentPeriod = getCurrentPeriod();
        uint256 periodsLeft = bounty.endTimestamp > currentPeriod ? (bounty.endTimestamp - currentPeriod) / _WEEK : 0;
        // If periodsLeft is superior, then the bounty didn't start yet.
        return uint8(periodsLeft > bounty.numberOfPeriods ? 0 : bounty.numberOfPeriods - periodsLeft);
    }

    /// @notice Return the current period based on Gauge Controller rounding.
    function getCurrentPeriod() public view returns (uint256) {
        return (block.timestamp / _WEEK) * _WEEK;
    }

    /// @notice Return the bias of a given address based on its lock end date and the current period.
    /// @param userSlope User slope.
    /// @param endLockTime Lock end date of the address.
    /// @param currentPeriod Current period.
    function _getAddrBias(uint256 userSlope, uint256 endLockTime, uint256 currentPeriod)
        internal
        pure
        returns (uint256)
    {
        if (currentPeriod >= endLockTime) return 0;
        return userSlope * (endLockTime - currentPeriod);
    }

    function getVersion() external pure returns (string memory) {
        return "2.2.0";
    }
}

File 2 of 7 : Owned.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Simple single owner authorization mixin.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Owned.sol)
abstract contract Owned {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

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

    /*//////////////////////////////////////////////////////////////
                            OWNERSHIP STORAGE
    //////////////////////////////////////////////////////////////*/

    address public owner;

    modifier onlyOwner() virtual {
        require(msg.sender == owner, "UNAUTHORIZED");

        _;
    }

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(address _owner) {
        owner = _owner;

        emit OwnershipTransferred(address(0), _owner);
    }

    /*//////////////////////////////////////////////////////////////
                             OWNERSHIP LOGIC
    //////////////////////////////////////////////////////////////*/

    function transferOwnership(address newOwner) public virtual onlyOwner {
        owner = newOwner;

        emit OwnershipTransferred(msg.sender, newOwner);
    }
}

File 3 of 7 : ERC20.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

File 4 of 7 : SafeTransferLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Caution! This library won't check that a token has code, responsibility is delegated to the caller.
library SafeTransferLib {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ETH transfer has failed.
    error ETHTransferFailed();

    /// @dev The ERC20 `transferFrom` has failed.
    error TransferFromFailed();

    /// @dev The ERC20 `transfer` has failed.
    error TransferFailed();

    /// @dev The ERC20 `approve` has failed.
    error ApproveFailed();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         CONSTANTS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Suggested gas stipend for contract receiving ETH
    /// that disallows any storage writes.
    uint256 internal constant _GAS_STIPEND_NO_STORAGE_WRITES = 2300;

    /// @dev Suggested gas stipend for contract receiving ETH to perform a few
    /// storage reads and writes, but low enough to prevent griefing.
    /// Multiply by a small constant (e.g. 2), if needed.
    uint256 internal constant _GAS_STIPEND_NO_GRIEF = 100000;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       ETH OPERATIONS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Sends `amount` (in wei) ETH to `to`.
    /// Reverts upon failure.
    function safeTransferETH(address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and check if it succeeded or not.
            if iszero(call(gas(), to, amount, 0, 0, 0, 0)) {
                // Store the function selector of `ETHTransferFailed()`.
                mstore(0x00, 0xb12d13eb)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    /// The `gasStipend` can be set to a low enough value to prevent
    /// storage writes or gas griefing.
    ///
    /// If sending via the normal procedure fails, force sends the ETH by
    /// creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.
    ///
    /// Reverts if the current contract has insufficient balance.
    function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // If insufficient balance, revert.
            if lt(selfbalance(), amount) {
                // Store the function selector of `ETHTransferFailed()`.
                mstore(0x00, 0xb12d13eb)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            // Transfer the ETH and check if it succeeded or not.
            if iszero(call(gasStipend, to, amount, 0, 0, 0, 0)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                // We can directly use `SELFDESTRUCT` in the contract creation.
                // Compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758
                pop(create(amount, 0x0b, 0x16))
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with a gas stipend
    /// equal to `_GAS_STIPEND_NO_GRIEF`. This gas stipend is a reasonable default
    /// for 99% of cases and can be overriden with the three-argument version of this
    /// function if necessary.
    ///
    /// If sending via the normal procedure fails, force sends the ETH by
    /// creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.
    ///
    /// Reverts if the current contract has insufficient balance.
    function forceSafeTransferETH(address to, uint256 amount) internal {
        // Manually inlined because the compiler doesn't inline functions with branches.
        /// @solidity memory-safe-assembly
        assembly {
            // If insufficient balance, revert.
            if lt(selfbalance(), amount) {
                // Store the function selector of `ETHTransferFailed()`.
                mstore(0x00, 0xb12d13eb)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            // Transfer the ETH and check if it succeeded or not.
            if iszero(call(_GAS_STIPEND_NO_GRIEF, to, amount, 0, 0, 0, 0)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                // We can directly use `SELFDESTRUCT` in the contract creation.
                // Compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758
                pop(create(amount, 0x0b, 0x16))
            }
        }
    }

    /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    /// The `gasStipend` can be set to a low enough value to prevent
    /// storage writes or gas griefing.
    ///
    /// Simply use `gasleft()` for `gasStipend` if you don't need a gas stipend.
    ///
    /// Note: Does NOT revert upon failure.
    /// Returns whether the transfer of ETH is successful instead.
    function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
        internal
        returns (bool success)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and check if it succeeded or not.
            success := call(gasStipend, to, amount, 0, 0, 0, 0)
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      ERC20 OPERATIONS                      */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
    /// Reverts upon failure.
    ///
    /// The `from` account must have at least `amount` approved for
    /// the current contract to manage.
    function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.

            // Store the function selector of `transferFrom(address,address,uint256)`.
            mstore(0x00, 0x23b872dd)
            mstore(0x20, from) // Store the `from` argument.
            mstore(0x40, to) // Store the `to` argument.
            mstore(0x60, amount) // Store the `amount` argument.

            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    // Set success to whether the call reverted, if not we check it either
                    // returned exactly 1 (can't just be non-zero data), or had no return data.
                    or(eq(mload(0x00), 1), iszero(returndatasize())),
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                // Store the function selector of `TransferFromFailed()`.
                mstore(0x00, 0x7939f424)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }

            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Sends all of ERC20 `token` from `from` to `to`.
    /// Reverts upon failure.
    ///
    /// The `from` account must have at least `amount` approved for
    /// the current contract to manage.
    function safeTransferAllFrom(address token, address from, address to)
        internal
        returns (uint256 amount)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.

            mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
            mstore(0x20, from) // Store the `from` argument.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                    staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
                )
            ) {
                // Store the function selector of `TransferFromFailed()`.
                mstore(0x00, 0x7939f424)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }

            // Store the function selector of `transferFrom(address,address,uint256)`.
            mstore(0x00, 0x23b872dd)
            mstore(0x40, to) // Store the `to` argument.
            // The `amount` argument is already written to the memory word at 0x6a.
            amount := mload(0x60)

            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    // Set success to whether the call reverted, if not we check it either
                    // returned exactly 1 (can't just be non-zero data), or had no return data.
                    or(eq(mload(0x00), 1), iszero(returndatasize())),
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                // Store the function selector of `TransferFromFailed()`.
                mstore(0x00, 0x7939f424)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }

            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
    /// Reverts upon failure.
    function safeTransfer(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x1a, to) // Store the `to` argument.
            mstore(0x3a, amount) // Store the `amount` argument.
            // Store the function selector of `transfer(address,uint256)`,
            // left by 6 bytes (enough for 8tb of memory represented by the free memory pointer).
            // We waste 6-3 = 3 bytes to save on 6 runtime gas (PUSH1 0x224 SHL).
            mstore(0x00, 0xa9059cbb000000000000)

            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    // Set success to whether the call reverted, if not we check it either
                    // returned exactly 1 (can't just be non-zero data), or had no return data.
                    or(eq(mload(0x00), 1), iszero(returndatasize())),
                    call(gas(), token, 0, 0x16, 0x44, 0x00, 0x20)
                )
            ) {
                // Store the function selector of `TransferFailed()`.
                mstore(0x00, 0x90b8ec18)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            // Restore the part of the free memory pointer that was overwritten,
            // which is guaranteed to be zero, if less than 8tb of memory is used.
            mstore(0x3a, 0)
        }
    }

    /// @dev Sends all of ERC20 `token` from the current contract to `to`.
    /// Reverts upon failure.
    function safeTransferAll(address token, address to) internal returns (uint256 amount) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
            mstore(0x20, address()) // Store the address of the current contract.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                    staticcall(gas(), token, 0x1c, 0x24, 0x3a, 0x20)
                )
            ) {
                // Store the function selector of `TransferFailed()`.
                mstore(0x00, 0x90b8ec18)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }

            mstore(0x1a, to) // Store the `to` argument.
            // The `amount` argument is already written to the memory word at 0x3a.
            amount := mload(0x3a)
            // Store the function selector of `transfer(address,uint256)`,
            // left by 6 bytes (enough for 8tb of memory represented by the free memory pointer).
            // We waste 6-3 = 3 bytes to save on 6 runtime gas (PUSH1 0x224 SHL).
            mstore(0x00, 0xa9059cbb000000000000)

            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    // Set success to whether the call reverted, if not we check it either
                    // returned exactly 1 (can't just be non-zero data), or had no return data.
                    or(eq(mload(0x00), 1), iszero(returndatasize())),
                    call(gas(), token, 0, 0x16, 0x44, 0x00, 0x20)
                )
            ) {
                // Store the function selector of `TransferFailed()`.
                mstore(0x00, 0x90b8ec18)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            // Restore the part of the free memory pointer that was overwritten,
            // which is guaranteed to be zero, if less than 8tb of memory is used.
            mstore(0x3a, 0)
        }
    }

    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
    /// Reverts upon failure.
    function safeApprove(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x1a, to) // Store the `to` argument.
            mstore(0x3a, amount) // Store the `amount` argument.
            // Store the function selector of `approve(address,uint256)`,
            // left by 6 bytes (enough for 8tb of memory represented by the free memory pointer).
            // We waste 6-3 = 3 bytes to save on 6 runtime gas (PUSH1 0x224 SHL).
            mstore(0x00, 0x095ea7b3000000000000)

            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    // Set success to whether the call reverted, if not we check it either
                    // returned exactly 1 (can't just be non-zero data), or had no return data.
                    or(eq(mload(0x00), 1), iszero(returndatasize())),
                    call(gas(), token, 0, 0x16, 0x44, 0x00, 0x20)
                )
            ) {
                // Store the function selector of `ApproveFailed()`.
                mstore(0x00, 0x3e3f8f73)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            // Restore the part of the free memory pointer that was overwritten,
            // which is guaranteed to be zero, if less than 8tb of memory is used.
            mstore(0x3a, 0)
        }
    }

    /// @dev Returns the amount of ERC20 `token` owned by `account`.
    /// Returns zero if the `token` does not exist.
    function balanceOf(address token, address account) internal view returns (uint256 amount) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
            mstore(0x20, account) // Store the `account` argument.
            amount :=
                mul(
                    mload(0x20),
                    and( // The arguments of `and` are evaluated from right to left.
                        gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                        staticcall(gas(), token, 0x1c, 0x24, 0x20, 0x20)
                    )
                )
        }
    }
}

File 5 of 7 : ReentrancyGuard.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Gas optimized reentrancy protection for smart contracts.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ReentrancyGuard.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol)
abstract contract ReentrancyGuard {
    uint256 private locked = 1;

    modifier nonReentrant() virtual {
        require(locked == 1, "REENTRANCY");

        locked = 2;

        _;

        locked = 1;
    }
}

File 6 of 7 : GaugeController.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface GaugeController {
    struct VotedSlope {
        uint256 slope;
        uint256 power;
        uint256 end;
    }

    struct Point {
        uint256 bias;
        uint256 slope;
    }

    function vote_user_slopes(address, address) external view returns (VotedSlope memory);

    function add_gauge(address, int128) external;

    function WEIGHT_VOTE_DELAY() external view returns (uint256);

    function last_user_vote(address, address) external view returns (uint256);

    function points_weight(address, uint256) external view returns (Point memory);

    function checkpoint_gauge(address) external;

    //solhint-disable-next-line
    function gauge_types(address addr) external view returns (int128);

    //solhint-disable-next-line
    function gauge_relative_weight_write(address addr, uint256 timestamp) external returns (uint256);

    //solhint-disable-next-line
    function gauge_relative_weight(address addr) external view returns (uint256);

    //solhint-disable-next-line
    function gauge_relative_weight(address addr, uint256 timestamp) external view returns (uint256);

    //solhint-disable-next-line
    function get_total_weight() external view returns (uint256);

    //solhint-disable-next-line
    function get_gauge_weight(address addr) external view returns (uint256);

    ///@notice Allocate voting power for changing pool weights.
    function vote_for_gauge_weights(address, uint256) external;

    function add_type(string memory, uint256) external;

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

File 7 of 7 : FixedPointMathLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Arithmetic library with operations for fixed-point numbers.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/FixedPointMathLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)
library FixedPointMathLib {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The operation failed, as the output exceeds the maximum value of uint256.
    error ExpOverflow();

    /// @dev The operation failed, as the output exceeds the maximum value of uint256.
    error FactorialOverflow();

    /// @dev The operation failed, due to an multiplication overflow.
    error MulWadFailed();

    /// @dev The operation failed, either due to a
    /// multiplication overflow, or a division by a zero.
    error DivWadFailed();

    /// @dev The multiply-divide operation failed, either due to a
    /// multiplication overflow, or a division by a zero.
    error MulDivFailed();

    /// @dev The division failed, as the denominator is zero.
    error DivFailed();

    /// @dev The full precision multiply-divide operation failed, either due
    /// to the result being larger than 256 bits, or a division by a zero.
    error FullMulDivFailed();

    /// @dev The output is undefined, as the input is less-than-or-equal to zero.
    error LnWadUndefined();

    /// @dev The output is undefined, as the input is zero.
    error Log2Undefined();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         CONSTANTS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The scalar of ETH and most ERC20s.
    uint256 internal constant WAD = 1e18;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*              SIMPLIFIED FIXED POINT OPERATIONS             */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Equivalent to `(x * y) / WAD` rounded down.
    function mulWad(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`.
            if mul(y, gt(x, div(not(0), y))) {
                // Store the function selector of `MulWadFailed()`.
                mstore(0x00, 0xbac65e5b)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            z := div(mul(x, y), WAD)
        }
    }

    /// @dev Equivalent to `(x * y) / WAD` rounded up.
    function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`.
            if mul(y, gt(x, div(not(0), y))) {
                // Store the function selector of `MulWadFailed()`.
                mstore(0x00, 0xbac65e5b)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            z := add(iszero(iszero(mod(mul(x, y), WAD))), div(mul(x, y), WAD))
        }
    }

    /// @dev Equivalent to `(x * WAD) / y` rounded down.
    function divWad(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`.
            if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) {
                // Store the function selector of `DivWadFailed()`.
                mstore(0x00, 0x7c5f487d)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            z := div(mul(x, WAD), y)
        }
    }

    /// @dev Equivalent to `(x * WAD) / y` rounded up.
    function divWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`.
            if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) {
                // Store the function selector of `DivWadFailed()`.
                mstore(0x00, 0x7c5f487d)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y))
        }
    }

    /// @dev Equivalent to `x` to the power of `y`.
    /// because `x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)`.
    function powWad(int256 x, int256 y) internal pure returns (int256) {
        // Using `ln(x)` means `x` must be greater than 0.
        return expWad((lnWad(x) * y) / int256(WAD));
    }

    /// @dev Returns `exp(x)`, denominated in `WAD`.
    function expWad(int256 x) internal pure returns (int256 r) {
        unchecked {
            // When the result is < 0.5 we return zero. This happens when
            // x <= floor(log(0.5e18) * 1e18) ~ -42e18
            if (x <= -42139678854452767551) return r;

            /// @solidity memory-safe-assembly
            assembly {
                // When the result is > (2**255 - 1) / 1e18 we can not represent it as an
                // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.
                if iszero(slt(x, 135305999368893231589)) {
                    // Store the function selector of `ExpOverflow()`.
                    mstore(0x00, 0xa37bfec9)
                    // Revert with (offset, size).
                    revert(0x1c, 0x04)
                }
            }

            // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96
            // for more intermediate precision and a binary basis. This base conversion
            // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.
            x = (x << 78) / 5 ** 18;

            // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers
            // of two such that exp(x) = exp(x') * 2**k, where k is an integer.
            // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).
            int256 k = ((x << 96) / 54916777467707473351141471128 + 2 ** 95) >> 96;
            x = x - k * 54916777467707473351141471128;

            // k is in the range [-61, 195].

            // Evaluate using a (6, 7)-term rational approximation.
            // p is made monic, we'll multiply by a scale factor later.
            int256 y = x + 1346386616545796478920950773328;
            y = ((y * x) >> 96) + 57155421227552351082224309758442;
            int256 p = y + x - 94201549194550492254356042504812;
            p = ((p * y) >> 96) + 28719021644029726153956944680412240;
            p = p * x + (4385272521454847904659076985693276 << 96);

            // We leave p in 2**192 basis so we don't need to scale it back up for the division.
            int256 q = x - 2855989394907223263936484059900;
            q = ((q * x) >> 96) + 50020603652535783019961831881945;
            q = ((q * x) >> 96) - 533845033583426703283633433725380;
            q = ((q * x) >> 96) + 3604857256930695427073651918091429;
            q = ((q * x) >> 96) - 14423608567350463180887372962807573;
            q = ((q * x) >> 96) + 26449188498355588339934803723976023;

            /// @solidity memory-safe-assembly
            assembly {
                // Div in assembly because solidity adds a zero check despite the unchecked.
                // The q polynomial won't have zeros in the domain as all its roots are complex.
                // No scaling is necessary because p is already 2**96 too large.
                r := sdiv(p, q)
            }

            // r should be in the range (0.09, 0.25) * 2**96.

            // We now need to multiply r by:
            // * the scale factor s = ~6.031367120.
            // * the 2**k factor from the range reduction.
            // * the 1e18 / 2**96 factor for base conversion.
            // We do this all at once, with an intermediate result in 2**213
            // basis, so the final right shift is always by a positive amount.
            r = int256(
                (uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)
            );
        }
    }

    /// @dev Returns `ln(x)`, denominated in `WAD`.
    function lnWad(int256 x) internal pure returns (int256 r) {
        unchecked {
            /// @solidity memory-safe-assembly
            assembly {
                if iszero(sgt(x, 0)) {
                    // Store the function selector of `LnWadUndefined()`.
                    mstore(0x00, 0x1615e638)
                    // Revert with (offset, size).
                    revert(0x1c, 0x04)
                }
            }

            // We want to convert x from 10**18 fixed point to 2**96 fixed point.
            // We do this by multiplying by 2**96 / 10**18. But since
            // ln(x * C) = ln(x) + ln(C), we can simply do nothing here
            // and add ln(2**96 / 10**18) at the end.

            // Compute k = log2(x) - 96.
            int256 k;
            /// @solidity memory-safe-assembly
            assembly {
                let v := x
                k := shl(7, lt(0xffffffffffffffffffffffffffffffff, v))
                k := or(k, shl(6, lt(0xffffffffffffffff, shr(k, v))))
                k := or(k, shl(5, lt(0xffffffff, shr(k, v))))

                // For the remaining 32 bits, use a De Bruijn lookup.
                // See: https://graphics.stanford.edu/~seander/bithacks.html
                v := shr(k, v)
                v := or(v, shr(1, v))
                v := or(v, shr(2, v))
                v := or(v, shr(4, v))
                v := or(v, shr(8, v))
                v := or(v, shr(16, v))

                // forgefmt: disable-next-item
                k := sub(or(k, byte(shr(251, mul(v, shl(224, 0x07c4acdd))),
                    0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f)), 96)
            }

            // Reduce range of x to (1, 2) * 2**96
            // ln(2^k * x) = k * ln(2) + ln(x)
            x <<= uint256(159 - k);
            x = int256(uint256(x) >> 159);

            // Evaluate using a (8, 8)-term rational approximation.
            // p is made monic, we will multiply by a scale factor later.
            int256 p = x + 3273285459638523848632254066296;
            p = ((p * x) >> 96) + 24828157081833163892658089445524;
            p = ((p * x) >> 96) + 43456485725739037958740375743393;
            p = ((p * x) >> 96) - 11111509109440967052023855526967;
            p = ((p * x) >> 96) - 45023709667254063763336534515857;
            p = ((p * x) >> 96) - 14706773417378608786704636184526;
            p = p * x - (795164235651350426258249787498 << 96);

            // We leave p in 2**192 basis so we don't need to scale it back up for the division.
            // q is monic by convention.
            int256 q = x + 5573035233440673466300451813936;
            q = ((q * x) >> 96) + 71694874799317883764090561454958;
            q = ((q * x) >> 96) + 283447036172924575727196451306956;
            q = ((q * x) >> 96) + 401686690394027663651624208769553;
            q = ((q * x) >> 96) + 204048457590392012362485061816622;
            q = ((q * x) >> 96) + 31853899698501571402653359427138;
            q = ((q * x) >> 96) + 909429971244387300277376558375;
            /// @solidity memory-safe-assembly
            assembly {
                // Div in assembly because solidity adds a zero check despite the unchecked.
                // The q polynomial is known not to have zeros in the domain.
                // No scaling required because p is already 2**96 too large.
                r := sdiv(p, q)
            }

            // r is in the range (0, 0.125) * 2**96

            // Finalization, we need to:
            // * multiply by the scale factor s = 5.549…
            // * add ln(2**96 / 10**18)
            // * add k * ln(2)
            // * multiply by 10**18 / 2**96 = 5**18 >> 78

            // mul s * 5e18 * 2**96, base is now 5**18 * 2**192
            r *= 1677202110996718588342820967067443963516166;
            // add ln(2) * k * 5e18 * 2**192
            r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;
            // add ln(2**96 / 10**18) * 5e18 * 2**192
            r += 600920179829731861736702779321621459595472258049074101567377883020018308;
            // base conversion: mul 2**18 / 2**192
            r >>= 174;
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  GENERAL NUMBER UTILITIES                  */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Calculates `floor(a * b / d)` with full precision.
    /// Throws if result overflows a uint256 or when `d` is zero.
    /// Credit to Remco Bloemen under MIT license: https://2π.com/21/muldiv
    function fullMulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            // forgefmt: disable-next-item
            for {} 1 {} {
                // 512-bit multiply `[prod1 prod0] = x * y`.
                // Compute the product mod `2**256` and mod `2**256 - 1`
                // then 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`.

                // Least significant 256 bits of the product.
                let prod0 := mul(x, y)
                let mm := mulmod(x, y, not(0))
                // Most significant 256 bits of the product.
                let prod1 := sub(mm, add(prod0, lt(mm, prod0)))

                // Handle non-overflow cases, 256 by 256 division.
                if iszero(prod1) {
                    if iszero(d) {
                        // Store the function selector of `FullMulDivFailed()`.
                        mstore(0x00, 0xae47f702)
                        // Revert with (offset, size).
                        revert(0x1c, 0x04)
                    }
                    result := div(prod0, d)
                    break       
                }

                // Make sure the result is less than `2**256`.
                // Also prevents `d == 0`.
                if iszero(gt(d, prod1)) {
                    // Store the function selector of `FullMulDivFailed()`.
                    mstore(0x00, 0xae47f702)
                    // Revert with (offset, size).
                    revert(0x1c, 0x04)
                }

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

                // Make division exact by subtracting the remainder from `[prod1 prod0]`.
                // Compute remainder using mulmod.
                let remainder := mulmod(x, y, d)
                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
                // Factor powers of two out of `d`.
                // Compute largest power of two divisor of `d`.
                // Always greater or equal to 1.
                let twos := and(d, sub(0, d))
                // Divide d by power of two.
                d := div(d, twos)
                // Divide [prod1 prod0] by the factors of two.
                prod0 := div(prod0, twos)
                // Shift in bits from `prod1` into `prod0`. For this we need
                // to flip `twos` such that it is `2**256 / twos`.
                // If `twos` is zero, then it becomes one.
                prod0 := or(prod0, mul(prod1, add(div(sub(0, twos), twos), 1)))
                // Invert `d mod 2**256`
                // Now that `d` is an odd number, it has an inverse
                // modulo `2**256` such that `d * inv = 1 mod 2**256`.
                // Compute the inverse by starting with a seed that is correct
                // correct for four bits. That is, `d * inv = 1 mod 2**4`.
                let inv := xor(mul(3, d), 2)
                // Now use 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.
                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**8
                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**16
                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**32
                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**64
                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**128
                result := mul(prod0, mul(inv, sub(2, mul(d, inv)))) // inverse mod 2**256
                break
            }
        }
    }

    /// @dev Calculates `floor(x * y / d)` with full precision, rounded up.
    /// Throws if result overflows a uint256 or when `d` is zero.
    /// Credit to Uniswap-v3-core under MIT license:
    /// https://github.com/Uniswap/v3-core/blob/contracts/libraries/FullMath.sol
    function fullMulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 result) {
        result = fullMulDiv(x, y, d);
        /// @solidity memory-safe-assembly
        assembly {
            if mulmod(x, y, d) {
                if iszero(add(result, 1)) {
                    // Store the function selector of `FullMulDivFailed()`.
                    mstore(0x00, 0xae47f702)
                    // Revert with (offset, size).
                    revert(0x1c, 0x04)
                }
                result := add(result, 1)
            }
        }
    }

    /// @dev Returns `floor(x * y / d)`.
    /// Reverts if `x * y` overflows, or `d` is zero.
    function mulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to require(d != 0 && (y == 0 || x <= type(uint256).max / y))
            if iszero(mul(d, iszero(mul(y, gt(x, div(not(0), y)))))) {
                // Store the function selector of `MulDivFailed()`.
                mstore(0x00, 0xad251c27)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            z := div(mul(x, y), d)
        }
    }

    /// @dev Returns `ceil(x * y / d)`.
    /// Reverts if `x * y` overflows, or `d` is zero.
    function mulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to require(d != 0 && (y == 0 || x <= type(uint256).max / y))
            if iszero(mul(d, iszero(mul(y, gt(x, div(not(0), y)))))) {
                // Store the function selector of `MulDivFailed()`.
                mstore(0x00, 0xad251c27)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            z := add(iszero(iszero(mod(mul(x, y), d))), div(mul(x, y), d))
        }
    }

    /// @dev Returns `ceil(x / d)`.
    /// Reverts if `d` is zero.
    function divUp(uint256 x, uint256 d) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(d) {
                // Store the function selector of `DivFailed()`.
                mstore(0x00, 0x65244e4e)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            z := add(iszero(iszero(mod(x, d))), div(x, d))
        }
    }

    /// @dev Returns `max(0, x - y)`.
    function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := mul(gt(x, y), sub(x, y))
        }
    }

    /// @dev Returns the square root of `x`.
    function sqrt(uint256 x) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // `floor(sqrt(2**15)) = 181`. `sqrt(2**15) - 181 = 2.84`.
            z := 181 // The "correct" value is 1, but this saves a multiplication later.

            // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad
            // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.

            // Let `y = x / 2**r`.
            // We check `y >= 2**(k + 8)` but shift right by `k` bits
            // each branch to ensure that if `x >= 256`, then `y >= 256`.
            let r := shl(7, lt(0xffffffffffffffffffffffffffffffffff, x))
            r := or(r, shl(6, lt(0xffffffffffffffffff, shr(r, x))))
            r := or(r, shl(5, lt(0xffffffffff, shr(r, x))))
            r := or(r, shl(4, lt(0xffffff, shr(r, x))))
            z := shl(shr(1, r), z)

            // Goal was to get `z*z*y` within a small factor of `x`. More iterations could
            // get y in a tighter range. Currently, we will have y in `[256, 256*(2**16))`.
            // We ensured `y >= 256` so that the relative difference between `y` and `y+1` is small.
            // That's not possible if `x < 256` but we can just verify those cases exhaustively.

            // Now, `z*z*y <= x < z*z*(y+1)`, and `y <= 2**(16+8)`, and either `y >= 256`, or `x < 256`.
            // Correctness can be checked exhaustively for `x < 256`, so we assume `y >= 256`.
            // Then `z*sqrt(y)` is within `sqrt(257)/sqrt(256)` of `sqrt(x)`, or about 20bps.

            // For `s` in the range `[1/256, 256]`, the estimate `f(s) = (181/1024) * (s+1)`
            // is in the range `(1/2.84 * sqrt(s), 2.84 * sqrt(s))`,
            // with largest error when `s = 1` and when `s = 256` or `1/256`.

            // Since `y` is in `[256, 256*(2**16))`, let `a = y/65536`, so that `a` is in `[1/256, 256)`.
            // Then we can estimate `sqrt(y)` using
            // `sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2**18`.

            // There is no overflow risk here since `y < 2**136` after the first branch above.
            z := shr(18, mul(z, add(shr(r, x), 65536))) // A `mul()` is saved from starting `z` at 181.

            // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))

            // If `x+1` is a perfect square, the Babylonian method cycles between
            // `floor(sqrt(x))` and `ceil(sqrt(x))`. This statement ensures we return floor.
            // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division
            // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.
            // If you don't care whether the floor or ceil square root is returned, you can remove this statement.
            z := sub(z, lt(div(x, z), z))
        }
    }

    /// @dev Returns the factorial of `x`.
    function factorial(uint256 x) internal pure returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            for {} 1 {} {
                if iszero(lt(10, x)) {
                    // forgefmt: disable-next-item
                    result := and(
                        shr(mul(22, x), 0x375f0016260009d80004ec0002d00001e0000180000180000200000400001),
                        0x3fffff
                    )
                    break
                }
                if iszero(lt(57, x)) {
                    let end := 31
                    result := 8222838654177922817725562880000000
                    if iszero(lt(end, x)) {
                        end := 10
                        result := 3628800
                    }
                    for { let w := not(0) } 1 {} {
                        result := mul(result, x)
                        x := add(x, w)
                        if eq(x, end) { break }
                    }
                    break
                }
                // Store the function selector of `FactorialOverflow()`.
                mstore(0x00, 0xaba0f2a2)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Returns the log2 of `x`.
    /// Equivalent to computing the index of the most significant bit (MSB) of `x`.
    function log2(uint256 x) internal pure returns (uint256 r) {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(x) {
                // Store the function selector of `Log2Undefined()`.
                mstore(0x00, 0x5be3aa5c)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }

            r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))
            r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))
            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))

            // For the remaining 32 bits, use a De Bruijn lookup.
            // See: https://graphics.stanford.edu/~seander/bithacks.html
            x := shr(r, x)
            x := or(x, shr(1, x))
            x := or(x, shr(2, x))
            x := or(x, shr(4, x))
            x := or(x, shr(8, x))
            x := or(x, shr(16, x))

            // forgefmt: disable-next-item
            r := or(r, byte(shr(251, mul(x, shl(224, 0x07c4acdd))),
                0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f))
        }
    }

    /// @dev Returns the log2 of `x`, rounded up.
    function log2Up(uint256 x) internal pure returns (uint256 r) {
        unchecked {
            uint256 isNotPo2;
            assembly {
                isNotPo2 := iszero(iszero(and(x, sub(x, 1))))
            }
            return log2(x) + isNotPo2;
        }
    }

    /// @dev Returns the average of `x` and `y`.
    function avg(uint256 x, uint256 y) internal pure returns (uint256 z) {
        unchecked {
            z = (x & y) + ((x ^ y) >> 1);
        }
    }

    /// @dev Returns the average of `x` and `y`.
    function avg(int256 x, int256 y) internal pure returns (int256 z) {
        unchecked {
            z = (x >> 1) + (y >> 1) + (((x & 1) + (y & 1)) >> 1);
        }
    }

    /// @dev Returns the absolute value of `x`.
    function abs(int256 x) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            let mask := sub(0, shr(255, x))
            z := xor(mask, add(mask, x))
        }
    }

    /// @dev Returns the absolute distance between `x` and `y`.
    function dist(int256 x, int256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            let a := sub(y, x)
            z := xor(a, mul(xor(a, sub(x, y)), sgt(x, y)))
        }
    }

    /// @dev Returns the minimum of `x` and `y`.
    function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := xor(x, mul(xor(x, y), lt(y, x)))
        }
    }

    /// @dev Returns the minimum of `x` and `y`.
    function min(int256 x, int256 y) internal pure returns (int256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := xor(x, mul(xor(x, y), slt(y, x)))
        }
    }

    /// @dev Returns the maximum of `x` and `y`.
    function max(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := xor(x, mul(xor(x, y), gt(y, x)))
        }
    }

    /// @dev Returns the maximum of `x` and `y`.
    function max(int256 x, int256 y) internal pure returns (int256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := xor(x, mul(xor(x, y), sgt(y, x)))
        }
    }

    /// @dev Returns `x`, bounded to `minValue` and `maxValue`.
    function clamp(uint256 x, uint256 minValue, uint256 maxValue)
        internal
        pure
        returns (uint256 z)
    {
        z = min(max(x, minValue), maxValue);
    }

    /// @dev Returns `x`, bounded to `minValue` and `maxValue`.
    function clamp(int256 x, int256 minValue, int256 maxValue) internal pure returns (int256 z) {
        z = min(max(x, minValue), maxValue);
    }

    /// @dev Returns greatest common divisor of `x` and `y`.
    function gcd(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // forgefmt: disable-next-item
            for { z := x } y {} {
                let t := y
                y := mod(z, y)
                z := t
            }
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   RAW NUMBER OPERATIONS                    */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns `x + y`, without checking for overflow.
    function rawAdd(uint256 x, uint256 y) internal pure returns (uint256 z) {
        unchecked {
            z = x + y;
        }
    }

    /// @dev Returns `x + y`, without checking for overflow.
    function rawAdd(int256 x, int256 y) internal pure returns (int256 z) {
        unchecked {
            z = x + y;
        }
    }

    /// @dev Returns `x - y`, without checking for underflow.
    function rawSub(uint256 x, uint256 y) internal pure returns (uint256 z) {
        unchecked {
            z = x - y;
        }
    }

    /// @dev Returns `x - y`, without checking for underflow.
    function rawSub(int256 x, int256 y) internal pure returns (int256 z) {
        unchecked {
            z = x - y;
        }
    }

    /// @dev Returns `x * y`, without checking for overflow.
    function rawMul(uint256 x, uint256 y) internal pure returns (uint256 z) {
        unchecked {
            z = x * y;
        }
    }

    /// @dev Returns `x * y`, without checking for overflow.
    function rawMul(int256 x, int256 y) internal pure returns (int256 z) {
        unchecked {
            z = x * y;
        }
    }

    /// @dev Returns `x / y`, returning 0 if `y` is zero.
    function rawDiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := div(x, y)
        }
    }

    /// @dev Returns `x / y`, returning 0 if `y` is zero.
    function rawSDiv(int256 x, int256 y) internal pure returns (int256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := sdiv(x, y)
        }
    }

    /// @dev Returns `x % y`, returning 0 if `y` is zero.
    function rawMod(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := mod(x, y)
        }
    }

    /// @dev Returns `x % y`, returning 0 if `y` is zero.
    function rawSMod(int256 x, int256 y) internal pure returns (int256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := smod(x, y)
        }
    }

    /// @dev Returns `(x + y) % d`, return 0 if `d` if zero.
    function rawAddMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := addmod(x, y, d)
        }
    }

    /// @dev Returns `(x * y) % d`, return 0 if `d` if zero.
    function rawMulMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := mulmod(x, y, d)
        }
    }
}

Settings
{
  "remappings": [
    "solady/=lib/solady/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "solady/=lib/solady/src/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 99999999
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_gaugeController","type":"address"},{"internalType":"address","name":"_feeCollector","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ALREADY_CLOSED","type":"error"},{"inputs":[],"name":"AUTH_MANAGER_ONLY","type":"error"},{"inputs":[],"name":"INVALID_NUMBER_OF_PERIODS","type":"error"},{"inputs":[],"name":"INVALID_TOKEN","type":"error"},{"inputs":[],"name":"KILLED","type":"error"},{"inputs":[],"name":"NOT_UPGRADEABLE","type":"error"},{"inputs":[],"name":"NO_PERIODS_LEFT","type":"error"},{"inputs":[],"name":"NO_RECIPIENT","type":"error"},{"inputs":[],"name":"WHITELISTED_ONLY","type":"error"},{"inputs":[],"name":"WRONG_INPUT","type":"error"},{"inputs":[],"name":"ZERO_ADDRESS","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingReward","type":"uint256"}],"name":"BountyClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"manager","type":"address"},{"indexed":false,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint8","name":"numberOfPeriods","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"maxRewardPerVote","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPerPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalRewardAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isUpgradeable","type":"bool"}],"name":"BountyCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"numberOfPeriods","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"totalRewardAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRewardPerVote","type":"uint256"}],"name":"BountyDurationIncrease","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"numberOfPeriods","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"totalRewardAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRewardPerVote","type":"uint256"}],"name":"BountyDurationIncreaseQueued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":true,"internalType":"uint256","name":"bountyId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolFees","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeCollector","type":"address"}],"name":"FeeCollectorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"FeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"manager","type":"address"}],"name":"ManagerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"periodId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPerPeriod","type":"uint256"}],"name":"PeriodRolledOver","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"RecipientSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"bool","name":"status","type":"bool"}],"name":"WhitelistUpdated","type":"event"},{"inputs":[],"name":"MINIMUM_PERIOD","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"activePeriod","outputs":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"rewardPerPeriod","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"amountClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"batchClaimFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bounties","outputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint8","name":"numberOfPeriods","type":"uint8"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"},{"internalType":"uint256","name":"maxRewardPerVote","type":"uint256"},{"internalType":"uint256","name":"totalRewardAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"claim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"claim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"claimAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"claimAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"claimAllFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"claimFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"closeBounty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint8","name":"numberOfPeriods","type":"uint8"},{"internalType":"uint256","name":"maxRewardPerVote","type":"uint256"},{"internalType":"uint256","name":"totalRewardAmount","type":"uint256"},{"internalType":"address[]","name":"blacklist","type":"address[]"},{"internalType":"bool","name":"upgradeable","type":"bool"}],"name":"createBounty","outputs":[{"internalType":"uint256","name":"newBountyId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeAccrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeController","outputs":[{"internalType":"contract GaugeController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"getActivePeriod","outputs":[{"components":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"rewardPerPeriod","type":"uint256"}],"internalType":"struct Platform.Period","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"getActivePeriodPerBounty","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"getBlacklistedAddressesPerBounty","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"getBounty","outputs":[{"components":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint8","name":"numberOfPeriods","type":"uint8"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"},{"internalType":"uint256","name":"maxRewardPerVote","type":"uint256"},{"internalType":"uint256","name":"totalRewardAmount","type":"uint256"},{"internalType":"address[]","name":"blacklist","type":"address[]"}],"internalType":"struct Platform.Bounty","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"getPeriodsLeft","outputs":[{"internalType":"uint256","name":"periodsLeft","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"getUpgradedBountyQueued","outputs":[{"components":[{"internalType":"uint8","name":"numberOfPeriods","type":"uint8"},{"internalType":"uint256","name":"totalRewardAmount","type":"uint256"},{"internalType":"uint256","name":"maxRewardPerVote","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"internalType":"struct Platform.Upgrade","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bountyId","type":"uint256"},{"internalType":"uint8","name":"_additionnalPeriods","type":"uint8"},{"internalType":"uint256","name":"_increasedAmount","type":"uint256"},{"internalType":"uint256","name":"_newMaxPricePerVote","type":"uint256"}],"name":"increaseBountyDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"isBlacklisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isKilled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isUpgradeable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastUserClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"recipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardPerVote","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_feeCollector","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_platformFee","type":"uint256"}],"name":"setPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"setRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_for","type":"address"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"setRecipientFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"setWhitelisted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"}],"name":"updateBountyPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"updateBountyPeriods","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bountyId","type":"uint256"},{"internalType":"address","name":"newManager","type":"address"}],"name":"updateManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"upgradeBountyQueue","outputs":[{"internalType":"uint8","name":"numberOfPeriods","type":"uint8"},{"internalType":"uint256","name":"totalRewardAmount","type":"uint256"},{"internalType":"uint256","name":"maxRewardPerVote","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60a0346200012757601f620043e838819003918201601f19168301916001600160401b038311848410176200012c57808492606094604052833981010312620001275760406200004f8262000142565b6200005d6020840162000142565b926001600160a01b0392839162000075910162000142565b16928260018060a01b031991858360005416176000556040519560007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a36001805566470de4df8200006003551690600554161760055516608052614290908162000158823960805181818161048a015281816113890152818161231401528181612e0a0152818161326e01528181613424015281816136a901528181613a9201528181613b330152613ec10152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620001275756fe6080604052600436101561001257600080fd5b60003560e01c8063086146d2146129285780630888dc90146121fc578063091cc5581461218d5780630d8e6e2c146120bb5780630de056591461204157806312e8e2c314611fac5780631e96917d14611f7057806321bf936a14611f0c578063228c076c14611eb157806328c7782014611e35578063379607f514611df75780633ad86d7214611dad5780633bbed4a014611d0057806341c0e1b514611c8157806343cd235a14611c075780634ae001d814611b8e5780634fcf04f914611b1b57806351cd41e814611ae15780635749a07a14611aa55780635d34625d14611a4457806360efe334146119ff5780636b5646aa146119c3578063725acc6b146118d65780638c8f623b1461155c5780638da5cb5b1461150a5780638fac3937146114c35780638fe8a101146114825780639281aa0b146113ad57806399eecb3b1461133e578063a42dce801461128b578063aca47b7d1461123c578063b3651eea146111d6578063b6b6e3c81461110e578063b988997f14610f07578063c415b95c14610eb5578063c7da332814610e50578063d1d1bb4f14610e06578063d3c16e3014610d51578063d936547e14610ce7578063dc2f874414610c40578063dd47a77f14610bbb578063ddca3f4314610b7f578063ddd5e1b214610b32578063de4aaaf414610a76578063ee8c4bbf14610918578063ef2c4082146107ed578063f2fde38b1461073d5763fb1138131461022c57600080fd5b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff81116107385761027b9036906004016129a7565b33600052600760205260ff604060002054161561070e5760005b81811061069b57506102aa6001805414612a87565b600260015560ff6002541661067157906000906102c86024356133aa565b9260243560005260066020526040600020916103766006604051946102ec86612aec565b73ffffffffffffffffffffffffffffffffffffffff815416865273ffffffffffffffffffffffffffffffffffffffff600182015416602087015260ff600282015473ffffffffffffffffffffffffffffffffffffffff8116604089015260a01c16606087015260038101546080870152600481015460a0870152600581015460c0870152016131a3565b60e08401526000915b808310610403576020858773ffffffffffffffffffffffffffffffffffffffff6040886103b28533858585015116613160565b015116906040519182528284830152600060408301526060820152602435907f6f9c9826be5976f3f82a3490c52a83328ce2ec7be9e62dcb39c26da5148d7c7660803392a360018055604051908152f35b909193610419610414868486612bd3565b612c12565b84516040517f0f467f9800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015290911660248201529091906060818060448101038173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa8015610665578891600091610636575b50602435600052600c602052604060002054936104ee6104da614212565b835187604086015192878d6024358861320a565b15610628576105be94926105b8949273ffffffffffffffffffffffffffffffffffffffff61054193166000526010602052604060002060243560005260205281604060002055604081519101519061422c565b602435600052600d60205261056a61055e60406000205483613117565b9160a08a015190613117565b81811090821802189161057d8184612bc6565b60c0890151809111610615575b5050602435600052600c60205260406000206105a7838254612bc6565b9055600354806105c5575b50612bc6565b94612cc8565b919061037f565b6105d26105d99184613117565b8093612d54565b9173ffffffffffffffffffffffffffffffffffffffff604089015116600052600960205261060d6040600020918254612bc6565b9055386105b2565b610620929350612d54565b90388061058a565b505050946105be9150612cc8565b610658915060603d60601161065e575b6106508183612b71565b810190612d23565b386104bc565b503d610646565b6040513d6000823e3d90fd5b60046040517f63d81431000000000000000000000000000000000000000000000000000000008152fd5b73ffffffffffffffffffffffffffffffffffffffff806106bf610414848688612bd3565b166000526008602052339060406000205416036106e4576106df90612cc8565b610295565b60046040517f5a076936000000000000000000000000000000000000000000000000000000008152fd5b60046040517f59df1270000000000000000000000000000000000000000000000000000000008152fd5b600080fd5b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738577fffffffffffffffffffffffff0000000000000000000000000000000000000000610795612961565b6000549073ffffffffffffffffffffffffffffffffffffffff906107bc8284163314612a22565b169182911617600055337f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435610827612984565b81600052600660205273ffffffffffffffffffffffffffffffffffffffff90816001604060002001541633036108ee57169081156108c4576020817f5baaf19ee8739d1720c1401554ff4abe5682505ec43d3f2eb61b9dfc0abd974592600052600682526001604060002001847fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055604051908152a2005b60046040517f538ba4f9000000000000000000000000000000000000000000000000000000008152fd5b60046040517ffabbbc67000000000000000000000000000000000000000000000000000000008152fd5b34610738576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857606060e060405161095881612aec565b600081526000848201526000604082015260008382015260006080820152600060a0820152600060c0820152015260043560005260068152604060002090610a72604051926109a684612aec565b8373ffffffffffffffffffffffffffffffffffffffff91828154168252826001820154169285830193845260ff60028301546040850192808216845282606087019260a01c1682526003850154936080870194855281610a20600660048901549860a08b01998a5260c060058201549b019a8b52016131a3565b9860e08d01998a528b826040519e8f9e8f525116908d0152511660408b015251166060890152511660808701525160a08601525160c08501525160e084015251610100808401526101208301906129d8565b0390f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857610aad612961565b60243567ffffffffffffffff811161073857610acd9036906004016129a7565b919073ffffffffffffffffffffffffffffffffffffffff808316600052600860205260406000205416918215610b2a575b60005b848110610b0a57005b80610b23610b1b6001938887612bd3565b358685612cf5565b5001610b01565b915081610afe565b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b77600435610b71612984565b33612cf5565b604051908152f35b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020600354604051908152f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff811161073857610c0a9036906004016129a7565b90610c13612984565b9060005b838110610c2057005b80610c39610c316001938786612bd3565b358533612cf5565b5001610c17565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600660205260e0604060002073ffffffffffffffffffffffffffffffffffffffff8082541691816001820154169160ff6002830154600384015492600560048601549501549560405197885260208801528116604087015260a01c166060850152608084015260a083015260c0820152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385773ffffffffffffffffffffffffffffffffffffffff610d33612961565b166000526007602052602060ff604060002054166040519015158152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760006060604051610d9081612b41565b8281528260208201528260408201520152600435600052600e60205260806040600020604051610dbf81612b41565b60ff82541691828252600181015460208301908152606060036002840154936040860194855201549301928352604051938452516020840152516040830152516060820152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600c6020526020604060002054604051908152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385773ffffffffffffffffffffffffffffffffffffffff610e9c612961565b1660005260096020526020604060002054604051908152f35b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602073ffffffffffffffffffffffffffffffffffffffff60055416604051908152f35b34610738576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043590600191610f4a83805414612a87565b60028355806000526006825260406000209083820173ffffffffffffffffffffffffffffffffffffffff9384825416156110e457610f87836137b7565b610f8f614212565b6003850154118015906110d8575b610fa657858055005b6110646040946002937fe44903a04328507d74e4709cbebc6c819f9f1cd0b7cb171ba22814fcc18ecf389786600052600e855280886000208951610fe981612b41565b60ff82541681528c82015490606060038a8301948486528c8101548f850152015491015215156000146110ab5761102e905189600052600c88528a6000205490612d54565b96879489600052600e88526110588b60002060036000918281558260018201558260028201550155565b01541691541690613160565b82600052600681528584600020017fffffffffffffffffffffffff000000000000000000000000000000000000000081541690558351928352820152a18180808080858055005b50508660005260068552806110d060058a6000200154600c88528a6000205490612d54565b968794611058565b5060ff60025416610f9d565b60046040517f29606baf000000000000000000000000000000000000000000000000000000008152fd5b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611145612961565b61114d612984565b9073ffffffffffffffffffffffffffffffffffffffff809161117482600054163314612a22565b16908160005260086020526040600020921691827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557fc1416b5cdab50a9fbc872236e1aa54566c6deb40024e63a4b1737ecacf09d6f9600080a3005b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602073ffffffffffffffffffffffffffffffffffffffff80611225612961565b166000526008825260406000205416604051908152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600a602052602060ff604060002054166040519015158152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738577fe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f60206112e5612961565b73ffffffffffffffffffffffffffffffffffffffff9061130a82600054163314612a22565b16807fffffffffffffffffffffffff00000000000000000000000000000000000000006005541617600555604051908152a1005b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576113e4612961565b602435801515918282036107385761145b9073ffffffffffffffffffffffffffffffffffffffff9061141b82600054163314612a22565b169182600052600760205260406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b7ff93f9a76c1bf3444d22400a00cb9fe990e6abe9dbb333fda48859cfee864543d600080a3005b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602060ff600254166040519015158152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760206114ff6004356141aa565b60ff60405191168152f35b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b346107385760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760ff60243581811660043581830361073857604435916064356001956115b387805414612a87565b60028755806002541661067157836000526020946006865273ffffffffffffffffffffffffffffffffffffffff968789604060002001541633036108ee5785600052600a87528260406000205416156118ac57886116108761412d565b10611882578115801561187a575b6118505785600052600687526040600020600e885260406000209860405161164581612b41565b858b5416815260038c8c01549b8b83019c8d5260028101546040840152015460608201529961167f85600285019384541630903390612c80565b51156117bf5750506116a3611699606092858b5116612bb2565b92888a0151612bc6565b9701519662093a8094858102958187041490151715611790576116ea611789957fbc253f6a158b7f3743255b0764f4408f10f66d26d277929a6bbe1bdf4fd7663899612bc6565b9083604051936116f985612b41565b168352878301528360408301526060820152905b84600052600e86526003606060406000209284511697887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0085541617845584015193848b850155604081015160028501550151910155604051948594859094939260ff6060936080840197845216602083015260408201520152565b0390a18055005b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6117e2919950600392856117d7925460a01c16612bb2565b9260058a0154612bc6565b9701549662093a809485810295818704149015171561179057611829611789957fbc253f6a158b7f3743255b0764f4408f10f66d26d277929a6bbe1bdf4fd7663899612bc6565b90836040519361183885612b41565b1683528783015283604083015260608201529061170d565b60046040517f56e43e7f000000000000000000000000000000000000000000000000000000008152fd5b50831561161e565b60046040517f3bad1a57000000000000000000000000000000000000000000000000000000008152fd5b60046040517fdc370e01000000000000000000000000000000000000000000000000000000008152fd5b34610738576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff8111610738576119269036906004016129a7565b60019261193584805414612a87565b600284558360005b83811061194957508055005b6119bb61195a610414838789612bd3565b73ffffffffffffffffffffffffffffffffffffffff908181169182600052600987526040600020926000845494557f9dc46f23cfb5ddcad0ae7ea2be38d47fec07bb9382ec7e564efc69e036dd66ce88604051868152a26005541690613160565b01849061193d565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b7760043561412d565b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b77611a3b612961565b6024359061390d565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576004356000526006602052610a72611a9160066040600020016131a3565b6040519182916020835260208301906129d8565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611adf6004356133aa565b005b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602060405160028152f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385773ffffffffffffffffffffffffffffffffffffffff611b67612961565b16600052601060205260406000206024356000526020526020604060002054604051908152f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611bc5612984565b600435600052600f60205273ffffffffffffffffffffffffffffffffffffffff60406000209116600052602052602060ff604060002054166040519015158152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff811161073857611c569036906004016129a7565b9060005b828110611c6357005b80611c7a611c746001938686612bd3565b356133aa565b5001611c5a565b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611cd373ffffffffffffffffffffffffffffffffffffffff600054163314612a22565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055005b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611d37612961565b33600052600860205273ffffffffffffffffffffffffffffffffffffffff6040600020911690817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055337fc1416b5cdab50a9fbc872236e1aa54566c6deb40024e63a4b1737ecacf09d6f9600080a3005b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600d6020526020604060002054604051908152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b776004353333612cf5565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff811161073857611e849036906004016129a7565b9060005b828110611e9157005b80611eaa611ea26001938686612bd3565b353333612cf5565b5001611e88565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576060611eed60043561416a565b604080519160ff81511683526020810151602084015201516040820152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600b6020526060604060002060ff81541690600260018201549101549060405192835260208301526040820152f35b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020600454604051908152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043561200173ffffffffffffffffffffffffffffffffffffffff600054163314612a22565b670de0b6b3a76400008111611850576020817f8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c7692600355604051908152a1005b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b7761207d612961565b73ffffffffffffffffffffffffffffffffffffffff81811660009081526008855260409020541680156120b4575b60243591612cf5565b50806120ab565b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576040516120f681612b25565b600581526020907f322e322e30000000000000000000000000000000000000000000000000000000828201526040518281938252825192838284015260005b848110612176575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604080968601015201168101030190f35b818101830151868201604001528593508201612135565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600e6020526080604060002060ff815416906001810154906003600282015491015491604051938452602084015260408301526060820152f35b34610738576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857612234612961565b61223c612984565b9073ffffffffffffffffffffffffffffffffffffffff60443516604435036107385760643560ff811681036107385760c43567ffffffffffffffff81116107385761228b9036906004016129a7565b9260e435151560e43503610738576122a66001805414612a87565b600260015560ff60025416610671576040517f3f9095b700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa8015610665576128ef575b50600260ff8416106128c55760a4351580156128bb575b6118505773ffffffffffffffffffffffffffffffffffffffff6044351615801561289d575b6108c4576044353b156128735761239a60a4353033604435612c80565b60045494600186016004556123b460ff851660a435612c33565b916123bd614212565b94600160ff82160160ff81116117905760ff168062093a8081020462093a8014811517156117905762093a806123f4910287612bc6565b6040519061240182612aec565b73ffffffffffffffffffffffffffffffffffffffff8416825273ffffffffffffffffffffffffffffffffffffffff8516602083015273ffffffffffffffffffffffffffffffffffffffff60443516604083015260ff83166060830152608082015260843560a082015260a43560c082015267ffffffffffffffff8811612815578760051b604051906124966020820183612b71565b898252602082019036818a01116107385788915b818a0183106128445750505060e082015288600052600660205260e06040600020916125aa73ffffffffffffffffffffffffffffffffffffffff8251167fffffffffffffffffffffffff000000000000000000000000000000000000000090818654161785556001850173ffffffffffffffffffffffffffffffffffffffff60208501511682825416179055600285019073ffffffffffffffffffffffffffffffffffffffff6040850151169082541617815560ff6060840151167fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff000000000000000000000000000000000000000083549260a01b169116179055565b6080810151600384015560a0810151600484015560c0810151600584015501519081519167ffffffffffffffff8311612815576801000000000000000083116128155760068201548360068401558084106127e8575b5090600660208c96959493019101600052602060002060005b8381106127bb575050505073ffffffffffffffffffffffffffffffffffffffff7fbd09d6ba321593e1822a3fd27c75fcfaafc65d9ef961da9d03cf1bc0a6e924959260ff60e093836040519816885283604435166020890152166040870152608435606087015286608087015260a43560a087015260e435151560c08701521693a384600052600a6020526126df60e43560406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b62093a808301809311611790576002604051916126fb83612b09565b60008352602083019485526040830190815286600052600b60205260ff6040600020935116947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0095868554161784555160018401555191015560005b83811061276d5760208560018055604051908152f35b60019085600052600f602052604060002073ffffffffffffffffffffffffffffffffffffffff6127a1610414848988612bd3565b166000526020526040600020828582541617905501612757565b825173ffffffffffffffffffffffffffffffffffffffff16818301558c9650602090920191600101612619565b600683016000526020600020908482015b8183018110612809575050612600565b600081556001016127f9565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8335168335036107385782358152602092830192016124aa565b60046040517fd0995cf2000000000000000000000000000000000000000000000000000000008152fd5b5073ffffffffffffffffffffffffffffffffffffffff85161561237d565b5060843515612358565b60046040517f9f342962000000000000000000000000000000000000000000000000000000008152fd5b6020813d602011612920575b8161290860209383612b71565b81010312610738575180600f0b036107385785612341565b3d91506128fb565b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b77614212565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361073857565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361073857565b9181601f840112156107385782359167ffffffffffffffff8311610738576020808501948460051b01011161073857565b90815180825260208080930193019160005b8281106129f8575050505090565b835173ffffffffffffffffffffffffffffffffffffffff16855293810193928101926001016129ea565b15612a2957565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152fd5b15612a8e57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e4359000000000000000000000000000000000000000000006044820152fd5b610100810190811067ffffffffffffffff82111761281557604052565b6060810190811067ffffffffffffffff82111761281557604052565b6040810190811067ffffffffffffffff82111761281557604052565b6080810190811067ffffffffffffffff82111761281557604052565b67ffffffffffffffff811161281557604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761281557604052565b9060ff8091169116019060ff821161179057565b9190820180921161179057565b9190811015612be35760051b0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b3573ffffffffffffffffffffffffffffffffffffffff811681036107385790565b8115612c3d570490565b63ad251c276000526004601cfd5b670de0b6b3a7640000907812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f218111820215830215612c3d57020490565b92916064601c60209360405196600096879586936323b872dd855288526040526060525af13d156001835114171615612cbb57606052604052565b637939f42490526004601cfd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146117905760010190565b9190612d046001805414612a87565b600260015560ff6002541661067157612d1c92612d61565b9060018055565b90816060910312610738576040805191612d3c83612b09565b80518352602081015160208401520151604082015290565b9190820391821161179057565b929190600090828252602090600f82526040928381209373ffffffffffffffffffffffffffffffffffffffff80891695868452855260ff828420541661310c57612daa876133aa565b87845260068652828420805484517f7e418fa000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d811660048301529185169182166024820152919b9296927f00000000000000000000000000000000000000000000000000000000000000008516908984604481855afa9384156131025788946130ce575b5086517f0f467f9800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015292166024830152909190606090839060449082905afa9182156130c45786926130a4575b50815115908115613086575b8115613078575b811561306d575b50801561305f575b801561304e575b8015613037575b61302a5785612f0291898752601089528587208b8852895281868820558581519101519061422c565b888552600d8752612f25612f198587205483613117565b9160048d015490613117565b818110908218021899888552600c875283852054612f43818d612bc6565b6005830154809111613017575b5050888552600c8752838520612f678c8254612bc6565b90558460035480612fc7575b50507f6f9c9826be5976f3f82a3490c52a83328ce2ec7be9e62dcb39c26da5148d7c769694926080969492612fb18d60028195019284845416613160565b54169482519586528501528301526060820152a3565b85989650612fdc908d9592939896949d613117565b9384612fe791612d54565b9b8c9889938360028b015416815260098952208581549061300791612bc6565b9055929496918194969850612f73565b613022929c50612d54565b993880612f50565b5092985050505050505050565b50888552600c87528385205460058c015414612ed9565b50613057614212565b861415612ed2565b5060038b0154861015612ecb565b905086111538612ec3565b828601518810159150612ebc565b9050888652601088528486208a875288528685872054101590612eb5565b6130bd91925060603d811161065e576106508183612b71565b9038612ea9565b85513d88823e3d90fd5b9093508981813d83116130fb575b6130e68183612b71565b810103126130f75751926060612e42565b8780fd5b503d6130dc565b87513d8a823e3d90fd5b509096505050505050565b90807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211810261315257670de0b6b3a764000091020490565b63bac65e5b6000526004601cfd5b601692602092601a52603a52604460009384809369a9059cbb00000000000082525af13d15600183511417161561319657603a52565b6390b8ec1890526004601cfd5b9060405191828154918282526020928383019160005283600020936000905b8282106131da575050506131d892500383612b71565b565b855473ffffffffffffffffffffffffffffffffffffffff16845260019586019588955093810193909101906131c2565b8251604080517f7e418fa000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152928316602482015298999798949793909290916020919082876044817f000000000000000000000000000000000000000000000000000000000000000085165afa96871561339f5760009761336d575b5083600052600f8352846000209116600052815260ff836000205416998a15613364575b508915613344575b5050508615613339575b50851561332e575b50841561331f575b8415613314575b50508215613306575b505061330157600190565b600090565b60c0015114905038806132f6565b1415925038806132ed565b608083015181101594506132e6565b8111159450386132de565b8210159550386132d6565b8593995060108152826000209160005252600020541015953880806132cc565b159950386132c4565b90968382813d8311613398575b6133848183612b71565b8101031261339557505195386132a0565b80fd5b503d61337a565b85513d6000823e3d90fd5b600090808252602090600b8252604091828420926133c6614212565b9360ff81541615806137aa575b80613798575b61367e575b6001019485549262093a809384810180911161365157421015613405575050505050505490565b9091929394955073ffffffffffffffffffffffffffffffffffffffff807f00000000000000000000000000000000000000000000000000000000000000001686845260068352818585205416813b1561364d57849160248392885194859384927f615e523700000000000000000000000000000000000000000000000000000000845260048401525af180156136435790849161362b575b50506134a8866137b7565b6134b1866141aa565b9086845260068352848420906134c68861412d565b6134df60058401548a8852600c87528888205490612d54565b976003840154908b0190818c116135fe57927fb77c22cd311809931524bcc8d4a33a61a392e2304c8a7d476b64018e11ed6cb19a98959260809a9895928d989511806135f4575b6135d0575b508682613544600661354a9461355096541692016131a3565b90613e99565b87612c4b565b878452600d835284842055600260ff85519261356b84612b09565b169384835283830187815260ff87808601938b85528c8152600b8852209451167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008554161784555160018401555191015582519586528501528301526060820152a190565b6135509261354460066135e88b9461354a969d612c33565b9b94505050925061352b565b5060018111613526565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b61363490612b5d565b61363f57823861349d565b8280fd5b85513d86823e3d90fd5b8480fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b613687846137b7565b8386526006835281862073ffffffffffffffffffffffffffffffffffffffff807f00000000000000000000000000000000000000000000000000000000000000001681835416813b1561379457899160248392885194859384927f615e523700000000000000000000000000000000000000000000000000000000845260048401525af1801561378a57613765575b508682613544600661372f9460019796541692016131a3565b8061373d575b5090506133de565b61375490868952600b86526002858a200154612c4b565b858852600d85528388205538613735565b60019392613544600661372f949b61377d8c95612b5d565b9b94505050929350613716565b85513d8b823e3d90fd5b8980fd5b50838652600d835281862054156133d9565b50600181015485146133d3565b6000818152600e602052604090818120926001840180546137da575b5050505050565b847f2e363750a1295e75baeb02bb4277be5bbd051627ff6fa2edae8a99c91ddf5ef1916138bd60ff60036138e099015493600660205288882094600386015561386a8282541660028701907fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff000000000000000000000000000000000000000083549260a01b169116179055565b600560028201958654600482015585549182910155600b602052828a8a205416156138ea575b50541691549254875193849387859094939260ff6060936080840197845216602083015260408201520152565b0390a18152600e6020522060036000918281558260018201558260028201550155565b38808080806137d3565b6138f8908383541690612c33565b878952600b60205260028a8a20015538613890565b81600052600f602052604060002073ffffffffffffffffffffffffffffffffffffffff821660005260205260ff60406000205416613e5f578160005260066020526040600020906040519161396183612aec565b73ffffffffffffffffffffffffffffffffffffffff815416835273ffffffffffffffffffffffffffffffffffffffff600182015416602084015260ff600282015473ffffffffffffffffffffffffffffffffffffffff8116604086015260a01c1660608401526139f3600660038301549260808601938452600481015460a0870152600581015460c0870152016131a3565b60e084015283600052600e602052613a79604060002092613a12614212565b9251600385015486516040517f7e418fa000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015290911660248201529391929091602090859081906044820190565b038173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa801561066557600090613e2b575b87516040517f0f467f9800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301529091166024820152945060608580604481015b038173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa94851561066557600095613e0b575b50845115918215613dce575b508115613dbf575b8115613db4575b508015613da2575b8015613d8d575b8015613d71575b613d655786600052600d602052604060002054948515801580613d41575b50613c54575b505050613bd4613be792826040613bdb94519101519061422c565b9283613117565b9160a084015190613117565b818110908218021891600052600c6020526040600020549060c0613c0b8385612bc6565b910151809111613c43575b505060035480613c24575090565b670de0b6b3a764000090810390811161179057613c4091613117565b90565b613c4d9250612d54565b3880613c16565b909192945060ff815416613d28575b508181119082180218818111600014613d205762093a80613c848383612d54565b04905b613ca460c086015187600052600c60205260406000205490612d54565b9262093a8081019182821161179057613be794613bdb94613bd494613cfd931180613d16575b613d07575b50613cf78373ffffffffffffffffffffffffffffffffffffffff8a511660e08b015190613e99565b90612c4b565b9492819450613bb9565b613d1091612c33565b38613ccf565b5060018111613cca565b600090613c87565b600281015460a08701526001015460c086015238613c63565b905080613d4f575b38613bb3565b50846020613d5c8a61416a565b01511415613d49565b50505050505050600090565b5086600052600c60205260406000205460c08701511115613b95565b506020613d998861416a565b01518410613b8e565b50818111818318028218841015613b87565b905084111538613b7f565b60408501518610159150613b78565b73ffffffffffffffffffffffffffffffffffffffff9192501660005260106020526040600020886000526020528460406000205410159038613b70565b613e2491955060603d811161065e576106508183612b71565b9338613b64565b506020843d602011613e57575b81613e4560209383612b71565b8101031261073857613b1a9351613ac2565b3d9150613e38565b5050600090565b60405190613e7382612b09565b60006040838281528260208201520152565b8051821015612be35760209160051b010190565b92919092613ea5613e66565b5083519073ffffffffffffffffffffffffffffffffffffffff807f000000000000000000000000000000000000000000000000000000000000000016936040918251907fedba52730000000000000000000000000000000000000000000000000000000082526004918186168382015283602482015284816044818b5afa90811561339f576000916140e8575b50519860005b878110613f4a57505050505050505050565b8683613f568385613e85565b51168751907f0f467f98000000000000000000000000000000000000000000000000000000008252818c8180613fb960609788968d840190602090939293604083019473ffffffffffffffffffffffffffffffffffffffff809216845216910152565b03915afa9182156140dd576000926140c0575b505061403e84613fdc8486613e85565b5116868a8d8b5180809681947f7e418fa00000000000000000000000000000000000000000000000000000000083526020978897840190602090939293604083019473ffffffffffffffffffffffffffffffffffffffff809216845216910152565b03915afa9081156140b557600091614089575b5090508611614064575b50600101613f38565b6001919b61407c87838a61408295519101519061422c565b90612d54565b9a9061405b565b82813d83116140ae575b61409d8183612b71565b810103126133955750518038614051565b503d614093565b89513d6000823e3d90fd5b6140d69250803d1061065e576106508183612b71565b3880613fcc565b88513d6000823e3d90fd5b908582813d8311614126575b6140fe8183612b71565b810103126133955750602085519161411583612b25565b805183520151602082015238613f32565b503d6140f4565b600052600660205260406000206003614144614212565b910154600082821115614164575062093a809161416091612d54565b0490565b91505090565b614172613e66565b50600052600b602052604060002060026040519161418f83612b09565b60ff8154168352600181015460208401520154604082015290565b60ff9060009081526006602052604081206141c3614212565b6003820154818111156142065762093a806141e18693600293612d54565b04925b015460a01c16808211156141f85750501690565b6142029250612d54565b1690565b505082600283926141e4565b62093a808042048181029181830414901517156117905790565b91818110156142525761423e91612d54565b908181029181830414901517156117905790565b50505060009056fea2646970667358221220d8bf5145abb8d53f50c4649cd0e4ff1fe9a5837f27cb8ca0685f8cfc1c7615cf64736f6c63430008140033000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd000000000000000000000000f930ebbd05ef8b25b1797b9b2109ddc9b0d4306300000000000000000000000090569d8a1cf801709577b24da526118f0c83fc75

Deployed Bytecode

0x6080604052600436101561001257600080fd5b60003560e01c8063086146d2146129285780630888dc90146121fc578063091cc5581461218d5780630d8e6e2c146120bb5780630de056591461204157806312e8e2c314611fac5780631e96917d14611f7057806321bf936a14611f0c578063228c076c14611eb157806328c7782014611e35578063379607f514611df75780633ad86d7214611dad5780633bbed4a014611d0057806341c0e1b514611c8157806343cd235a14611c075780634ae001d814611b8e5780634fcf04f914611b1b57806351cd41e814611ae15780635749a07a14611aa55780635d34625d14611a4457806360efe334146119ff5780636b5646aa146119c3578063725acc6b146118d65780638c8f623b1461155c5780638da5cb5b1461150a5780638fac3937146114c35780638fe8a101146114825780639281aa0b146113ad57806399eecb3b1461133e578063a42dce801461128b578063aca47b7d1461123c578063b3651eea146111d6578063b6b6e3c81461110e578063b988997f14610f07578063c415b95c14610eb5578063c7da332814610e50578063d1d1bb4f14610e06578063d3c16e3014610d51578063d936547e14610ce7578063dc2f874414610c40578063dd47a77f14610bbb578063ddca3f4314610b7f578063ddd5e1b214610b32578063de4aaaf414610a76578063ee8c4bbf14610918578063ef2c4082146107ed578063f2fde38b1461073d5763fb1138131461022c57600080fd5b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff81116107385761027b9036906004016129a7565b33600052600760205260ff604060002054161561070e5760005b81811061069b57506102aa6001805414612a87565b600260015560ff6002541661067157906000906102c86024356133aa565b9260243560005260066020526040600020916103766006604051946102ec86612aec565b73ffffffffffffffffffffffffffffffffffffffff815416865273ffffffffffffffffffffffffffffffffffffffff600182015416602087015260ff600282015473ffffffffffffffffffffffffffffffffffffffff8116604089015260a01c16606087015260038101546080870152600481015460a0870152600581015460c0870152016131a3565b60e08401526000915b808310610403576020858773ffffffffffffffffffffffffffffffffffffffff6040886103b28533858585015116613160565b015116906040519182528284830152600060408301526060820152602435907f6f9c9826be5976f3f82a3490c52a83328ce2ec7be9e62dcb39c26da5148d7c7660803392a360018055604051908152f35b909193610419610414868486612bd3565b612c12565b84516040517f0f467f9800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015290911660248201529091906060818060448101038173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd165afa8015610665578891600091610636575b50602435600052600c602052604060002054936104ee6104da614212565b835187604086015192878d6024358861320a565b15610628576105be94926105b8949273ffffffffffffffffffffffffffffffffffffffff61054193166000526010602052604060002060243560005260205281604060002055604081519101519061422c565b602435600052600d60205261056a61055e60406000205483613117565b9160a08a015190613117565b81811090821802189161057d8184612bc6565b60c0890151809111610615575b5050602435600052600c60205260406000206105a7838254612bc6565b9055600354806105c5575b50612bc6565b94612cc8565b919061037f565b6105d26105d99184613117565b8093612d54565b9173ffffffffffffffffffffffffffffffffffffffff604089015116600052600960205261060d6040600020918254612bc6565b9055386105b2565b610620929350612d54565b90388061058a565b505050946105be9150612cc8565b610658915060603d60601161065e575b6106508183612b71565b810190612d23565b386104bc565b503d610646565b6040513d6000823e3d90fd5b60046040517f63d81431000000000000000000000000000000000000000000000000000000008152fd5b73ffffffffffffffffffffffffffffffffffffffff806106bf610414848688612bd3565b166000526008602052339060406000205416036106e4576106df90612cc8565b610295565b60046040517f5a076936000000000000000000000000000000000000000000000000000000008152fd5b60046040517f59df1270000000000000000000000000000000000000000000000000000000008152fd5b600080fd5b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738577fffffffffffffffffffffffff0000000000000000000000000000000000000000610795612961565b6000549073ffffffffffffffffffffffffffffffffffffffff906107bc8284163314612a22565b169182911617600055337f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435610827612984565b81600052600660205273ffffffffffffffffffffffffffffffffffffffff90816001604060002001541633036108ee57169081156108c4576020817f5baaf19ee8739d1720c1401554ff4abe5682505ec43d3f2eb61b9dfc0abd974592600052600682526001604060002001847fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055604051908152a2005b60046040517f538ba4f9000000000000000000000000000000000000000000000000000000008152fd5b60046040517ffabbbc67000000000000000000000000000000000000000000000000000000008152fd5b34610738576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857606060e060405161095881612aec565b600081526000848201526000604082015260008382015260006080820152600060a0820152600060c0820152015260043560005260068152604060002090610a72604051926109a684612aec565b8373ffffffffffffffffffffffffffffffffffffffff91828154168252826001820154169285830193845260ff60028301546040850192808216845282606087019260a01c1682526003850154936080870194855281610a20600660048901549860a08b01998a5260c060058201549b019a8b52016131a3565b9860e08d01998a528b826040519e8f9e8f525116908d0152511660408b015251166060890152511660808701525160a08601525160c08501525160e084015251610100808401526101208301906129d8565b0390f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857610aad612961565b60243567ffffffffffffffff811161073857610acd9036906004016129a7565b919073ffffffffffffffffffffffffffffffffffffffff808316600052600860205260406000205416918215610b2a575b60005b848110610b0a57005b80610b23610b1b6001938887612bd3565b358685612cf5565b5001610b01565b915081610afe565b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b77600435610b71612984565b33612cf5565b604051908152f35b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020600354604051908152f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff811161073857610c0a9036906004016129a7565b90610c13612984565b9060005b838110610c2057005b80610c39610c316001938786612bd3565b358533612cf5565b5001610c17565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600660205260e0604060002073ffffffffffffffffffffffffffffffffffffffff8082541691816001820154169160ff6002830154600384015492600560048601549501549560405197885260208801528116604087015260a01c166060850152608084015260a083015260c0820152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385773ffffffffffffffffffffffffffffffffffffffff610d33612961565b166000526007602052602060ff604060002054166040519015158152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760006060604051610d9081612b41565b8281528260208201528260408201520152600435600052600e60205260806040600020604051610dbf81612b41565b60ff82541691828252600181015460208301908152606060036002840154936040860194855201549301928352604051938452516020840152516040830152516060820152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600c6020526020604060002054604051908152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385773ffffffffffffffffffffffffffffffffffffffff610e9c612961565b1660005260096020526020604060002054604051908152f35b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602073ffffffffffffffffffffffffffffffffffffffff60055416604051908152f35b34610738576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043590600191610f4a83805414612a87565b60028355806000526006825260406000209083820173ffffffffffffffffffffffffffffffffffffffff9384825416156110e457610f87836137b7565b610f8f614212565b6003850154118015906110d8575b610fa657858055005b6110646040946002937fe44903a04328507d74e4709cbebc6c819f9f1cd0b7cb171ba22814fcc18ecf389786600052600e855280886000208951610fe981612b41565b60ff82541681528c82015490606060038a8301948486528c8101548f850152015491015215156000146110ab5761102e905189600052600c88528a6000205490612d54565b96879489600052600e88526110588b60002060036000918281558260018201558260028201550155565b01541691541690613160565b82600052600681528584600020017fffffffffffffffffffffffff000000000000000000000000000000000000000081541690558351928352820152a18180808080858055005b50508660005260068552806110d060058a6000200154600c88528a6000205490612d54565b968794611058565b5060ff60025416610f9d565b60046040517f29606baf000000000000000000000000000000000000000000000000000000008152fd5b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611145612961565b61114d612984565b9073ffffffffffffffffffffffffffffffffffffffff809161117482600054163314612a22565b16908160005260086020526040600020921691827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557fc1416b5cdab50a9fbc872236e1aa54566c6deb40024e63a4b1737ecacf09d6f9600080a3005b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602073ffffffffffffffffffffffffffffffffffffffff80611225612961565b166000526008825260406000205416604051908152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600a602052602060ff604060002054166040519015158152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738577fe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f60206112e5612961565b73ffffffffffffffffffffffffffffffffffffffff9061130a82600054163314612a22565b16807fffffffffffffffffffffffff00000000000000000000000000000000000000006005541617600555604051908152a1005b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd168152f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576113e4612961565b602435801515918282036107385761145b9073ffffffffffffffffffffffffffffffffffffffff9061141b82600054163314612a22565b169182600052600760205260406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b7ff93f9a76c1bf3444d22400a00cb9fe990e6abe9dbb333fda48859cfee864543d600080a3005b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602060ff600254166040519015158152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760206114ff6004356141aa565b60ff60405191168152f35b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b346107385760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760ff60243581811660043581830361073857604435916064356001956115b387805414612a87565b60028755806002541661067157836000526020946006865273ffffffffffffffffffffffffffffffffffffffff968789604060002001541633036108ee5785600052600a87528260406000205416156118ac57886116108761412d565b10611882578115801561187a575b6118505785600052600687526040600020600e885260406000209860405161164581612b41565b858b5416815260038c8c01549b8b83019c8d5260028101546040840152015460608201529961167f85600285019384541630903390612c80565b51156117bf5750506116a3611699606092858b5116612bb2565b92888a0151612bc6565b9701519662093a8094858102958187041490151715611790576116ea611789957fbc253f6a158b7f3743255b0764f4408f10f66d26d277929a6bbe1bdf4fd7663899612bc6565b9083604051936116f985612b41565b168352878301528360408301526060820152905b84600052600e86526003606060406000209284511697887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0085541617845584015193848b850155604081015160028501550151910155604051948594859094939260ff6060936080840197845216602083015260408201520152565b0390a18055005b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6117e2919950600392856117d7925460a01c16612bb2565b9260058a0154612bc6565b9701549662093a809485810295818704149015171561179057611829611789957fbc253f6a158b7f3743255b0764f4408f10f66d26d277929a6bbe1bdf4fd7663899612bc6565b90836040519361183885612b41565b1683528783015283604083015260608201529061170d565b60046040517f56e43e7f000000000000000000000000000000000000000000000000000000008152fd5b50831561161e565b60046040517f3bad1a57000000000000000000000000000000000000000000000000000000008152fd5b60046040517fdc370e01000000000000000000000000000000000000000000000000000000008152fd5b34610738576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff8111610738576119269036906004016129a7565b60019261193584805414612a87565b600284558360005b83811061194957508055005b6119bb61195a610414838789612bd3565b73ffffffffffffffffffffffffffffffffffffffff908181169182600052600987526040600020926000845494557f9dc46f23cfb5ddcad0ae7ea2be38d47fec07bb9382ec7e564efc69e036dd66ce88604051868152a26005541690613160565b01849061193d565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b7760043561412d565b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b77611a3b612961565b6024359061390d565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576004356000526006602052610a72611a9160066040600020016131a3565b6040519182916020835260208301906129d8565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611adf6004356133aa565b005b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857602060405160028152f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385773ffffffffffffffffffffffffffffffffffffffff611b67612961565b16600052601060205260406000206024356000526020526020604060002054604051908152f35b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611bc5612984565b600435600052600f60205273ffffffffffffffffffffffffffffffffffffffff60406000209116600052602052602060ff604060002054166040519015158152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff811161073857611c569036906004016129a7565b9060005b828110611c6357005b80611c7a611c746001938686612bd3565b356133aa565b5001611c5a565b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611cd373ffffffffffffffffffffffffffffffffffffffff600054163314612a22565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055005b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857611d37612961565b33600052600860205273ffffffffffffffffffffffffffffffffffffffff6040600020911690817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055337fc1416b5cdab50a9fbc872236e1aa54566c6deb40024e63a4b1737ecacf09d6f9600080a3005b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600d6020526020604060002054604051908152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b776004353333612cf5565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043567ffffffffffffffff811161073857611e849036906004016129a7565b9060005b828110611e9157005b80611eaa611ea26001938686612bd3565b353333612cf5565b5001611e88565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576060611eed60043561416a565b604080519160ff81511683526020810151602084015201516040820152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600b6020526060604060002060ff81541690600260018201549101549060405192835260208301526040820152f35b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020600454604051908152f35b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107385760043561200173ffffffffffffffffffffffffffffffffffffffff600054163314612a22565b670de0b6b3a76400008111611850576020817f8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c7692600355604051908152a1005b346107385760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b7761207d612961565b73ffffffffffffffffffffffffffffffffffffffff81811660009081526008855260409020541680156120b4575b60243591612cf5565b50806120ab565b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576040516120f681612b25565b600581526020907f322e322e30000000000000000000000000000000000000000000000000000000828201526040518281938252825192838284015260005b848110612176575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604080968601015201168101030190f35b818101830151868201604001528593508201612135565b346107385760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857600435600052600e6020526080604060002060ff815416906001810154906003600282015491015491604051938452602084015260408301526060820152f35b34610738576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261073857612234612961565b61223c612984565b9073ffffffffffffffffffffffffffffffffffffffff60443516604435036107385760643560ff811681036107385760c43567ffffffffffffffff81116107385761228b9036906004016129a7565b9260e435151560e43503610738576122a66001805414612a87565b600260015560ff60025416610671576040517f3f9095b700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd165afa8015610665576128ef575b50600260ff8416106128c55760a4351580156128bb575b6118505773ffffffffffffffffffffffffffffffffffffffff6044351615801561289d575b6108c4576044353b156128735761239a60a4353033604435612c80565b60045494600186016004556123b460ff851660a435612c33565b916123bd614212565b94600160ff82160160ff81116117905760ff168062093a8081020462093a8014811517156117905762093a806123f4910287612bc6565b6040519061240182612aec565b73ffffffffffffffffffffffffffffffffffffffff8416825273ffffffffffffffffffffffffffffffffffffffff8516602083015273ffffffffffffffffffffffffffffffffffffffff60443516604083015260ff83166060830152608082015260843560a082015260a43560c082015267ffffffffffffffff8811612815578760051b604051906124966020820183612b71565b898252602082019036818a01116107385788915b818a0183106128445750505060e082015288600052600660205260e06040600020916125aa73ffffffffffffffffffffffffffffffffffffffff8251167fffffffffffffffffffffffff000000000000000000000000000000000000000090818654161785556001850173ffffffffffffffffffffffffffffffffffffffff60208501511682825416179055600285019073ffffffffffffffffffffffffffffffffffffffff6040850151169082541617815560ff6060840151167fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff000000000000000000000000000000000000000083549260a01b169116179055565b6080810151600384015560a0810151600484015560c0810151600584015501519081519167ffffffffffffffff8311612815576801000000000000000083116128155760068201548360068401558084106127e8575b5090600660208c96959493019101600052602060002060005b8381106127bb575050505073ffffffffffffffffffffffffffffffffffffffff7fbd09d6ba321593e1822a3fd27c75fcfaafc65d9ef961da9d03cf1bc0a6e924959260ff60e093836040519816885283604435166020890152166040870152608435606087015286608087015260a43560a087015260e435151560c08701521693a384600052600a6020526126df60e43560406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b62093a808301809311611790576002604051916126fb83612b09565b60008352602083019485526040830190815286600052600b60205260ff6040600020935116947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0095868554161784555160018401555191015560005b83811061276d5760208560018055604051908152f35b60019085600052600f602052604060002073ffffffffffffffffffffffffffffffffffffffff6127a1610414848988612bd3565b166000526020526040600020828582541617905501612757565b825173ffffffffffffffffffffffffffffffffffffffff16818301558c9650602090920191600101612619565b600683016000526020600020908482015b8183018110612809575050612600565b600081556001016127f9565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8335168335036107385782358152602092830192016124aa565b60046040517fd0995cf2000000000000000000000000000000000000000000000000000000008152fd5b5073ffffffffffffffffffffffffffffffffffffffff85161561237d565b5060843515612358565b60046040517f9f342962000000000000000000000000000000000000000000000000000000008152fd5b6020813d602011612920575b8161290860209383612b71565b81010312610738575180600f0b036107385785612341565b3d91506128fb565b346107385760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610738576020610b77614212565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361073857565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361073857565b9181601f840112156107385782359167ffffffffffffffff8311610738576020808501948460051b01011161073857565b90815180825260208080930193019160005b8281106129f8575050505090565b835173ffffffffffffffffffffffffffffffffffffffff16855293810193928101926001016129ea565b15612a2957565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152fd5b15612a8e57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e4359000000000000000000000000000000000000000000006044820152fd5b610100810190811067ffffffffffffffff82111761281557604052565b6060810190811067ffffffffffffffff82111761281557604052565b6040810190811067ffffffffffffffff82111761281557604052565b6080810190811067ffffffffffffffff82111761281557604052565b67ffffffffffffffff811161281557604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761281557604052565b9060ff8091169116019060ff821161179057565b9190820180921161179057565b9190811015612be35760051b0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b3573ffffffffffffffffffffffffffffffffffffffff811681036107385790565b8115612c3d570490565b63ad251c276000526004601cfd5b670de0b6b3a7640000907812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f218111820215830215612c3d57020490565b92916064601c60209360405196600096879586936323b872dd855288526040526060525af13d156001835114171615612cbb57606052604052565b637939f42490526004601cfd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146117905760010190565b9190612d046001805414612a87565b600260015560ff6002541661067157612d1c92612d61565b9060018055565b90816060910312610738576040805191612d3c83612b09565b80518352602081015160208401520151604082015290565b9190820391821161179057565b929190600090828252602090600f82526040928381209373ffffffffffffffffffffffffffffffffffffffff80891695868452855260ff828420541661310c57612daa876133aa565b87845260068652828420805484517f7e418fa000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d811660048301529185169182166024820152919b9296927f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd8516908984604481855afa9384156131025788946130ce575b5086517f0f467f9800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015292166024830152909190606090839060449082905afa9182156130c45786926130a4575b50815115908115613086575b8115613078575b811561306d575b50801561305f575b801561304e575b8015613037575b61302a5785612f0291898752601089528587208b8852895281868820558581519101519061422c565b888552600d8752612f25612f198587205483613117565b9160048d015490613117565b818110908218021899888552600c875283852054612f43818d612bc6565b6005830154809111613017575b5050888552600c8752838520612f678c8254612bc6565b90558460035480612fc7575b50507f6f9c9826be5976f3f82a3490c52a83328ce2ec7be9e62dcb39c26da5148d7c769694926080969492612fb18d60028195019284845416613160565b54169482519586528501528301526060820152a3565b85989650612fdc908d9592939896949d613117565b9384612fe791612d54565b9b8c9889938360028b015416815260098952208581549061300791612bc6565b9055929496918194969850612f73565b613022929c50612d54565b993880612f50565b5092985050505050505050565b50888552600c87528385205460058c015414612ed9565b50613057614212565b861415612ed2565b5060038b0154861015612ecb565b905086111538612ec3565b828601518810159150612ebc565b9050888652601088528486208a875288528685872054101590612eb5565b6130bd91925060603d811161065e576106508183612b71565b9038612ea9565b85513d88823e3d90fd5b9093508981813d83116130fb575b6130e68183612b71565b810103126130f75751926060612e42565b8780fd5b503d6130dc565b87513d8a823e3d90fd5b509096505050505050565b90807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211810261315257670de0b6b3a764000091020490565b63bac65e5b6000526004601cfd5b601692602092601a52603a52604460009384809369a9059cbb00000000000082525af13d15600183511417161561319657603a52565b6390b8ec1890526004601cfd5b9060405191828154918282526020928383019160005283600020936000905b8282106131da575050506131d892500383612b71565b565b855473ffffffffffffffffffffffffffffffffffffffff16845260019586019588955093810193909101906131c2565b8251604080517f7e418fa000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152928316602482015298999798949793909290916020919082876044817f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd85165afa96871561339f5760009761336d575b5083600052600f8352846000209116600052815260ff836000205416998a15613364575b508915613344575b5050508615613339575b50851561332e575b50841561331f575b8415613314575b50508215613306575b505061330157600190565b600090565b60c0015114905038806132f6565b1415925038806132ed565b608083015181101594506132e6565b8111159450386132de565b8210159550386132d6565b8593995060108152826000209160005252600020541015953880806132cc565b159950386132c4565b90968382813d8311613398575b6133848183612b71565b8101031261339557505195386132a0565b80fd5b503d61337a565b85513d6000823e3d90fd5b600090808252602090600b8252604091828420926133c6614212565b9360ff81541615806137aa575b80613798575b61367e575b6001019485549262093a809384810180911161365157421015613405575050505050505490565b9091929394955073ffffffffffffffffffffffffffffffffffffffff807f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd1686845260068352818585205416813b1561364d57849160248392885194859384927f615e523700000000000000000000000000000000000000000000000000000000845260048401525af180156136435790849161362b575b50506134a8866137b7565b6134b1866141aa565b9086845260068352848420906134c68861412d565b6134df60058401548a8852600c87528888205490612d54565b976003840154908b0190818c116135fe57927fb77c22cd311809931524bcc8d4a33a61a392e2304c8a7d476b64018e11ed6cb19a98959260809a9895928d989511806135f4575b6135d0575b508682613544600661354a9461355096541692016131a3565b90613e99565b87612c4b565b878452600d835284842055600260ff85519261356b84612b09565b169384835283830187815260ff87808601938b85528c8152600b8852209451167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008554161784555160018401555191015582519586528501528301526060820152a190565b6135509261354460066135e88b9461354a969d612c33565b9b94505050925061352b565b5060018111613526565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b61363490612b5d565b61363f57823861349d565b8280fd5b85513d86823e3d90fd5b8480fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b613687846137b7565b8386526006835281862073ffffffffffffffffffffffffffffffffffffffff807f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd1681835416813b1561379457899160248392885194859384927f615e523700000000000000000000000000000000000000000000000000000000845260048401525af1801561378a57613765575b508682613544600661372f9460019796541692016131a3565b8061373d575b5090506133de565b61375490868952600b86526002858a200154612c4b565b858852600d85528388205538613735565b60019392613544600661372f949b61377d8c95612b5d565b9b94505050929350613716565b85513d8b823e3d90fd5b8980fd5b50838652600d835281862054156133d9565b50600181015485146133d3565b6000818152600e602052604090818120926001840180546137da575b5050505050565b847f2e363750a1295e75baeb02bb4277be5bbd051627ff6fa2edae8a99c91ddf5ef1916138bd60ff60036138e099015493600660205288882094600386015561386a8282541660028701907fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff000000000000000000000000000000000000000083549260a01b169116179055565b600560028201958654600482015585549182910155600b602052828a8a205416156138ea575b50541691549254875193849387859094939260ff6060936080840197845216602083015260408201520152565b0390a18152600e6020522060036000918281558260018201558260028201550155565b38808080806137d3565b6138f8908383541690612c33565b878952600b60205260028a8a20015538613890565b81600052600f602052604060002073ffffffffffffffffffffffffffffffffffffffff821660005260205260ff60406000205416613e5f578160005260066020526040600020906040519161396183612aec565b73ffffffffffffffffffffffffffffffffffffffff815416835273ffffffffffffffffffffffffffffffffffffffff600182015416602084015260ff600282015473ffffffffffffffffffffffffffffffffffffffff8116604086015260a01c1660608401526139f3600660038301549260808601938452600481015460a0870152600581015460c0870152016131a3565b60e084015283600052600e602052613a79604060002092613a12614212565b9251600385015486516040517f7e418fa000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015290911660248201529391929091602090859081906044820190565b038173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd165afa801561066557600090613e2b575b87516040517f0f467f9800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301529091166024820152945060608580604481015b038173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd165afa94851561066557600095613e0b575b50845115918215613dce575b508115613dbf575b8115613db4575b508015613da2575b8015613d8d575b8015613d71575b613d655786600052600d602052604060002054948515801580613d41575b50613c54575b505050613bd4613be792826040613bdb94519101519061422c565b9283613117565b9160a084015190613117565b818110908218021891600052600c6020526040600020549060c0613c0b8385612bc6565b910151809111613c43575b505060035480613c24575090565b670de0b6b3a764000090810390811161179057613c4091613117565b90565b613c4d9250612d54565b3880613c16565b909192945060ff815416613d28575b508181119082180218818111600014613d205762093a80613c848383612d54565b04905b613ca460c086015187600052600c60205260406000205490612d54565b9262093a8081019182821161179057613be794613bdb94613bd494613cfd931180613d16575b613d07575b50613cf78373ffffffffffffffffffffffffffffffffffffffff8a511660e08b015190613e99565b90612c4b565b9492819450613bb9565b613d1091612c33565b38613ccf565b5060018111613cca565b600090613c87565b600281015460a08701526001015460c086015238613c63565b905080613d4f575b38613bb3565b50846020613d5c8a61416a565b01511415613d49565b50505050505050600090565b5086600052600c60205260406000205460c08701511115613b95565b506020613d998861416a565b01518410613b8e565b50818111818318028218841015613b87565b905084111538613b7f565b60408501518610159150613b78565b73ffffffffffffffffffffffffffffffffffffffff9192501660005260106020526040600020886000526020528460406000205410159038613b70565b613e2491955060603d811161065e576106508183612b71565b9338613b64565b506020843d602011613e57575b81613e4560209383612b71565b8101031261073857613b1a9351613ac2565b3d9150613e38565b5050600090565b60405190613e7382612b09565b60006040838281528260208201520152565b8051821015612be35760209160051b010190565b92919092613ea5613e66565b5083519073ffffffffffffffffffffffffffffffffffffffff807f000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd16936040918251907fedba52730000000000000000000000000000000000000000000000000000000082526004918186168382015283602482015284816044818b5afa90811561339f576000916140e8575b50519860005b878110613f4a57505050505050505050565b8683613f568385613e85565b51168751907f0f467f98000000000000000000000000000000000000000000000000000000008252818c8180613fb960609788968d840190602090939293604083019473ffffffffffffffffffffffffffffffffffffffff809216845216910152565b03915afa9182156140dd576000926140c0575b505061403e84613fdc8486613e85565b5116868a8d8b5180809681947f7e418fa00000000000000000000000000000000000000000000000000000000083526020978897840190602090939293604083019473ffffffffffffffffffffffffffffffffffffffff809216845216910152565b03915afa9081156140b557600091614089575b5090508611614064575b50600101613f38565b6001919b61407c87838a61408295519101519061422c565b90612d54565b9a9061405b565b82813d83116140ae575b61409d8183612b71565b810103126133955750518038614051565b503d614093565b89513d6000823e3d90fd5b6140d69250803d1061065e576106508183612b71565b3880613fcc565b88513d6000823e3d90fd5b908582813d8311614126575b6140fe8183612b71565b810103126133955750602085519161411583612b25565b805183520151602082015238613f32565b503d6140f4565b600052600660205260406000206003614144614212565b910154600082821115614164575062093a809161416091612d54565b0490565b91505090565b614172613e66565b50600052600b602052604060002060026040519161418f83612b09565b60ff8154168352600181015460208401520154604082015290565b60ff9060009081526006602052604081206141c3614212565b6003820154818111156142065762093a806141e18693600293612d54565b04925b015460a01c16808211156141f85750501690565b6142029250612d54565b1690565b505082600283926141e4565b62093a808042048181029181830414901517156117905790565b91818110156142525761423e91612d54565b908181029181830414901517156117905790565b50505060009056fea2646970667358221220d8bf5145abb8d53f50c4649cd0e4ff1fe9a5837f27cb8ca0685f8cfc1c7615cf64736f6c63430008140033

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

000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd000000000000000000000000f930ebbd05ef8b25b1797b9b2109ddc9b0d4306300000000000000000000000090569d8a1cf801709577b24da526118f0c83fc75

-----Decoded View---------------
Arg [0] : _gaugeController (address): 0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD
Arg [1] : _feeCollector (address): 0xF930EBBd05eF8b25B1797b9b2109DDC9B0d43063
Arg [2] : _owner (address): 0x90569D8A1cF801709577B24dA526118f0C83Fc75

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000c128468b7ce63ea702c1f104d55a2566b13d3abd
Arg [1] : 000000000000000000000000f930ebbd05ef8b25b1797b9b2109ddc9b0d43063
Arg [2] : 00000000000000000000000090569d8a1cf801709577b24da526118f0c83fc75


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.