ETH Price: $3,261.50 (+4.73%)
Gas: 2.17 Gwei
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AngleDistributor

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 14 : AngleDistributor.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.7;

import "./AngleDistributorEvents.sol";

/// @title AngleDistributor
/// @author Forked from contracts developed by Curve and Frax and adapted by Angle Core Team
/// - ERC20CRV.vy (https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/ERC20CRV.vy)
/// - FraxGaugeFXSRewardsDistributor.sol (https://github.com/FraxFinance/frax-solidity/blob/master/src/hardhat/contracts/Curve/FraxGaugeFXSRewardsDistributor.sol)
/// @notice All the events used in `AngleDistributor` contract
contract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable, AccessControlUpgradeable {
    using SafeERC20 for IERC20;

    /// @notice Role for governors only
    bytes32 public constant GOVERNOR_ROLE = keccak256("GOVERNOR_ROLE");
    /// @notice Role for the guardian
    bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");

    /// @notice Length of a week in seconds
    uint256 public constant WEEK = 3600 * 24 * 7;

    /// @notice Time at which the emission rate is updated
    uint256 public constant RATE_REDUCTION_TIME = WEEK;

    /// @notice Reduction of the emission rate
    uint256 public constant RATE_REDUCTION_COEFFICIENT = 1007827884862117171; // 1.5 ^ (1/52) * 10**18

    /// @notice Base used for computation
    uint256 public constant BASE = 10**18;

    /// @notice Maps the address of a gauge to the last time this gauge received rewards
    mapping(address => uint256) public lastTimeGaugePaid;

    /// @notice Maps the address of a gauge to whether it was killed or not
    /// A gauge killed in this contract cannot receive any rewards
    mapping(address => bool) public killedGauges;

    /// @notice Maps the address of a type >= 2 gauge to a delegate address responsible
    /// for giving rewards to the actual gauge
    mapping(address => address) public delegateGauges;

    /// @notice Maps the address of a gauge delegate to whether this delegate supports the `notifyReward` interface
    /// and is therefore built for automation
    mapping(address => bool) public isInterfaceKnown;

    /// @notice Address of the ANGLE token given as a reward
    IERC20 public rewardToken;

    /// @notice Address of the `GaugeController` contract
    IGaugeController public controller;

    /// @notice Address responsible for pulling rewards of type >= 2 gauges and distributing it to the
    /// associated contracts if there is not already an address delegated for this specific contract
    address public delegateGauge;

    /// @notice ANGLE current emission rate, it is first defined in the initializer and then updated every week
    uint256 public rate;

    /// @notice Timestamp at which the current emission epoch started
    uint256 public startEpochTime;

    /// @notice Amount of ANGLE tokens distributed through staking at the start of the epoch
    /// This is an informational variable used to track how much has been distributed through liquidity mining
    uint256 public startEpochSupply;

    /// @notice Index of the current emission epoch
    /// Here also, this variable is not useful per se inside the smart contracts of the protocol, it is
    /// just an informational variable
    uint256 public miningEpoch;

    /// @notice Whether ANGLE distribution through this contract is on or no
    bool public distributionsOn;

    /// @notice Constructor of the contract
    /// @param _rewardToken Address of the ANGLE token
    /// @param _controller Address of the GaugeController
    /// @param _initialRate Initial ANGLE emission rate
    /// @param _startEpochSupply Amount of ANGLE tokens already distributed via liquidity mining
    /// @param governor Governor address of the contract
    /// @param guardian Address of the guardian of this contract
    /// @param _delegateGauge Address that will be used to pull rewards for type 2 gauges
    /// @dev After this contract is created, the correct amount of ANGLE tokens should be transferred to the contract
    /// @dev The `_delegateGauge` can be the zero address
    function initialize(
        address _rewardToken,
        address _controller,
        uint256 _initialRate,
        uint256 _startEpochSupply,
        address governor,
        address guardian,
        address _delegateGauge
    ) external initializer {
        require(
            _controller != address(0) && _rewardToken != address(0) && guardian != address(0) && governor != address(0),
            "0"
        );
        rewardToken = IERC20(_rewardToken);
        controller = IGaugeController(_controller);
        startEpochSupply = _startEpochSupply;
        miningEpoch = 0;
        // Some ANGLE tokens should be sent to the contract directly after initialization
        rate = _initialRate;
        delegateGauge = _delegateGauge;
        distributionsOn = false;
        startEpochTime = block.timestamp;
        _setRoleAdmin(GOVERNOR_ROLE, GOVERNOR_ROLE);
        _setRoleAdmin(GUARDIAN_ROLE, GOVERNOR_ROLE);
        _setupRole(GUARDIAN_ROLE, guardian);
        _setupRole(GOVERNOR_ROLE, governor);
        _setupRole(GUARDIAN_ROLE, governor);
    }

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer {}

    // ======================== Internal Functions =================================

    /// @notice Internal function to distribute rewards to a gauge
    /// @param gaugeAddr Address of the gauge to distribute rewards to
    /// @return weeksElapsed Weeks elapsed since the last call
    /// @return rewardTally Amount of rewards distributed to the gauge
    /// @dev The reason for having an internal function is that it's called by the `distributeReward` and the
    /// `distributeRewardToMultipleGauges`
    /// @dev Although they would need to be performed all the time this function is called, this function does not
    /// contain checks on whether distribution is on, and on whether rate should be reduced. These are done in each external
    /// function calling this function for gas efficiency
    function _distributeReward(address gaugeAddr) internal returns (uint256 weeksElapsed, uint256 rewardTally) {
        // Checking if the gauge has been added or if it still possible to distribute rewards to this gauge
        int128 gaugeType = IGaugeController(controller).gauge_types(gaugeAddr);
        require(gaugeType >= 0 && !killedGauges[gaugeAddr], "110");

        // Calculate the elapsed time in weeks.
        uint256 lastTimePaid = lastTimeGaugePaid[gaugeAddr];

        // Edge case for first reward for this gauge
        if (lastTimePaid == 0) {
            weeksElapsed = 1;
            if (gaugeType == 0) {
                // We give a full approval for the gauges with type zero which correspond to the staking
                // contracts of the protocol
                rewardToken.safeApprove(gaugeAddr, type(uint256).max);
            }
        } else {
            // Truncation desired
            weeksElapsed = (block.timestamp - lastTimePaid) / WEEK;
            // Return early here for 0 weeks instead of throwing, as it could have bad effects in other contracts
            if (weeksElapsed == 0) {
                return (0, 0);
            }
        }
        rewardTally = 0;
        // We use this variable to keep track of the emission rate across different weeks
        uint256 weeklyRate = rate;
        for (uint256 i = 0; i < weeksElapsed; i++) {
            uint256 relWeightAtWeek;
            if (i == 0) {
                // Mutative, for the current week: makes sure the weight is checkpointed. Also returns the weight.
                relWeightAtWeek = controller.gauge_relative_weight_write(gaugeAddr, block.timestamp);
            } else {
                // View
                relWeightAtWeek = controller.gauge_relative_weight(gaugeAddr, (block.timestamp - WEEK * i));
            }
            rewardTally += (weeklyRate * relWeightAtWeek * WEEK) / BASE;

            // To get the rate of the week prior from the current rate we just have to multiply by the weekly division
            // factor
            // There may be some precisions error: inferred previous values of the rate may be different to what we would
            // have had if the rate had been computed correctly in these weeks: we expect from empirical observations
            // this `weeklyRate` to be inferior to what the `rate` would have been
            weeklyRate = (weeklyRate * RATE_REDUCTION_COEFFICIENT) / BASE;
        }

        // Update the last time paid, rounded to the closest week
        // in order not to have an ever moving time on when to call this function
        lastTimeGaugePaid[gaugeAddr] = (block.timestamp / WEEK) * WEEK;

        // If the `gaugeType >= 2`, this means that the gauge is a gauge on another chain (and corresponds to tokens
        // that need to be bridged) or is associated to an external contract of the Angle Protocol
        if (gaugeType >= 2) {
            // If it is defined, we use the specific delegate attached to the gauge
            address delegate = delegateGauges[gaugeAddr];
            if (delegate == address(0)) {
                // If not, we check if a delegate common to all gauges with type >= 2 can be used
                delegate = delegateGauge;
            }
            if (delegate != address(0)) {
                // In the case where the gauge has a delegate (specific or not), then rewards are transferred to this gauge
                rewardToken.safeTransfer(delegate, rewardTally);
                // If this delegate supports a specific interface, then rewards sent are notified through this
                // interface
                if (isInterfaceKnown[delegate]) {
                    IAngleMiddlemanGauge(delegate).notifyReward(gaugeAddr, rewardTally);
                }
            } else {
                rewardToken.safeTransfer(gaugeAddr, rewardTally);
            }
        } else if (gaugeType == 1) {
            // This is for the case of Perpetual contracts which need to be able to receive their reward tokens
            rewardToken.safeTransfer(gaugeAddr, rewardTally);
            IStakingRewards(gaugeAddr).notifyRewardAmount(rewardTally);
        } else {
            // Mainnet: Pay out the rewards directly to the gauge
            // Potentially override the gauge address
            address delegate = delegateGauges[gaugeAddr];
            if (delegate != address(0)) {
                rewardToken.safeTransfer(delegate, rewardTally);
            } else {
                ILiquidityGauge(gaugeAddr).deposit_reward_token(address(rewardToken), rewardTally);
            }
        }
        emit RewardDistributed(gaugeAddr, rewardTally);
    }

    /// @notice Updates mining rate and supply at the start of the epoch
    /// @dev Any modifying mining call must also call this
    /// @dev It is possible that more than one week past between two calls of this function, and for this reason
    /// this function has been slightly modified from Curve implementation by Angle Team
    function _updateMiningParameters() internal {
        // When entering this function, we always have: `(block.timestamp - startEpochTime) / RATE_REDUCTION_TIME >= 1`
        uint256 epochDelta = (block.timestamp - startEpochTime) / RATE_REDUCTION_TIME;

        // Storing intermediate values for the rate and for the `startEpochSupply`
        uint256 _rate = rate;
        uint256 _startEpochSupply = startEpochSupply;

        startEpochTime += RATE_REDUCTION_TIME * epochDelta;
        miningEpoch += epochDelta;

        for (uint256 i = 0; i < epochDelta; i++) {
            // Updating the intermediate values of the `startEpochSupply`
            _startEpochSupply += _rate * RATE_REDUCTION_TIME;
            _rate = (_rate * BASE) / RATE_REDUCTION_COEFFICIENT;
        }
        rate = _rate;
        startEpochSupply = _startEpochSupply;
        emit UpdateMiningParameters(block.timestamp, _rate, _startEpochSupply);
    }

    /// @notice Toggles the fact that a gauge delegate can be used for automation or not and therefore supports
    /// the `notifyReward` interface
    /// @param _delegateGauge Address of the gauge to change
    function _toggleInterfaceKnown(address _delegateGauge) internal {
        bool isInterfaceKnownMem = isInterfaceKnown[_delegateGauge];
        isInterfaceKnown[_delegateGauge] = !isInterfaceKnownMem;
        emit InterfaceKnownToggled(_delegateGauge, !isInterfaceKnownMem);
    }

    // ================= Permissionless External Functions =========================

    /// @notice Distributes rewards to a staking contract (also called gauge)
    /// @param gaugeAddr Address of the gauge to send tokens too
    /// @return weeksElapsed Number of weeks elapsed since the last time rewards were distributed
    /// @return rewardTally Amount of tokens sent to the gauge
    /// @dev Anyone can call this function to distribute rewards to the different staking contracts
    function distributeReward(address gaugeAddr) external nonReentrant returns (uint256, uint256) {
        // Checking if distribution is on
        require(distributionsOn == true, "109");
        // Updating rate distribution parameters if need be
        if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {
            _updateMiningParameters();
        }
        return _distributeReward(gaugeAddr);
    }

    /// @notice Distributes rewards to multiple staking contracts
    /// @param gauges Addresses of the gauge to send tokens too
    /// @dev Anyone can call this function to distribute rewards to the different staking contracts
    /// @dev Compared with the `distributeReward` function, this function sends rewards to multiple
    /// contracts at the same time
    function distributeRewardToMultipleGauges(address[] memory gauges) external nonReentrant {
        // Checking if distribution is on
        require(distributionsOn == true, "109");
        // Updating rate distribution parameters if need be
        if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {
            _updateMiningParameters();
        }
        for (uint256 i = 0; i < gauges.length; i++) {
            _distributeReward(gauges[i]);
        }
    }

    /// @notice Updates mining rate and supply at the start of the epoch
    /// @dev Callable by any address, but only once per epoch
    function updateMiningParameters() external {
        require(block.timestamp >= startEpochTime + RATE_REDUCTION_TIME, "108");
        _updateMiningParameters();
    }

    // ========================= Governor Functions ================================

    /// @notice Withdraws ERC20 tokens that could accrue on this contract
    /// @param tokenAddress Address of the ERC20 token to withdraw
    /// @param to Address to transfer to
    /// @param amount Amount to transfer
    /// @dev Added to support recovering LP Rewards and other mistaken tokens
    /// from other systems to be distributed to holders
    /// @dev This function could also be used to recover ANGLE tokens in case the rate got smaller
    function recoverERC20(
        address tokenAddress,
        address to,
        uint256 amount
    ) external onlyRole(GOVERNOR_ROLE) {
        // If the token is the ANGLE token, we need to make sure that governance is not going to withdraw
        // too many tokens and that it'll be able to sustain the weekly distribution forever
        // This check assumes that `distributeReward` has been called for gauges and that there are no gauges
        // which have not received their past week's rewards
        if (tokenAddress == address(rewardToken)) {
            uint256 currentBalance = rewardToken.balanceOf(address(this));
            // The amount distributed till the end is `rate * WEEK / (1 - RATE_REDUCTION_FACTOR)` where
            // `RATE_REDUCTION_FACTOR = BASE / RATE_REDUCTION_COEFFICIENT` which translates to:
            require(
                currentBalance >=
                    ((rate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE) + amount,
                "4"
            );
        }
        IERC20(tokenAddress).safeTransfer(to, amount);
        emit Recovered(tokenAddress, to, amount);
    }

    /// @notice Sets a new gauge controller
    /// @param _controller Address of the new gauge controller
    function setGaugeController(address _controller) external onlyRole(GOVERNOR_ROLE) {
        require(_controller != address(0), "0");
        controller = IGaugeController(_controller);
        emit GaugeControllerUpdated(_controller);
    }

    /// @notice Sets a new delegate gauge for pulling rewards of a type >= 2 gauges or of all type >= 2 gauges
    /// @param gaugeAddr Gauge to change the delegate of
    /// @param _delegateGauge Address of the new gauge delegate related to `gaugeAddr`
    /// @param toggleInterface Whether we should toggle the fact that the `_delegateGauge` is built for automation or not
    /// @dev This function can be used to remove delegating or introduce the pulling of rewards to a given address
    /// @dev If `gaugeAddr` is the zero address, this function updates the delegate gauge common to all gauges with type >= 2
    /// @dev The `toggleInterface` parameter has been added for convenience to save one transaction when adding a gauge delegate
    /// which supports the `notifyReward` interface
    function setDelegateGauge(
        address gaugeAddr,
        address _delegateGauge,
        bool toggleInterface
    ) external onlyRole(GOVERNOR_ROLE) {
        if (gaugeAddr != address(0)) {
            delegateGauges[gaugeAddr] = _delegateGauge;
        } else {
            delegateGauge = _delegateGauge;
        }
        emit DelegateGaugeUpdated(gaugeAddr, _delegateGauge);

        if (toggleInterface) {
            _toggleInterfaceKnown(_delegateGauge);
        }
    }

    /// @notice Changes the ANGLE emission rate
    /// @param _newRate New ANGLE emission rate
    /// @dev It is important to be super wary when calling this function and to make sure that `distributeReward`
    /// has been called for all gauges in the past weeks. If not, gauges may get an incorrect distribution of ANGLE rewards
    /// for these past weeks based on the new rate and not on the old rate
    /// @dev Governance should thus make sure to call this function rarely and when it does to do it after the weekly `distributeReward`
    /// calls for all existing gauges
    /// @dev As this function assumes that `distributeReward` has been called during the week, it also assumes that the `startEpochSupply`
    /// parameter has been put up to date
    function setRate(uint256 _newRate) external onlyRole(GOVERNOR_ROLE) {
        // Checking if the new rate is compatible with the amount of ANGLE tokens this contract has in balance
        // This check assumes, like this function, that `distributeReward` has correctly been called before
        require(
            rewardToken.balanceOf(address(this)) >=
                ((_newRate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE),
            "4"
        );
        rate = _newRate;
        emit RateUpdated(_newRate);
    }

    /// @notice Toggles the status of a gauge to either killed or unkilled
    /// @param gaugeAddr Gauge to toggle the status of
    /// @dev It is impossible to kill a gauge in the `GaugeController` contract, for this reason killing of gauges
    /// takes place in the `AngleDistributor` contract
    /// @dev This means that people could vote for a gauge in the gauge controller contract but that rewards are not going
    /// to be distributed to it in the end: people would need to remove their weights on the gauge killed to end the diminution
    /// in rewards
    /// @dev In the case of a gauge being killed, this function resets the timestamps at which this gauge has been approved and
    /// disapproves the gauge to spend the token
    /// @dev It should be cautiously called by governance as it could result in less ANGLE overall rewards than initially planned
    /// if people do not remove their voting weights to the killed gauge
    function toggleGauge(address gaugeAddr) external onlyRole(GOVERNOR_ROLE) {
        bool gaugeKilledMem = killedGauges[gaugeAddr];
        if (!gaugeKilledMem) {
            delete lastTimeGaugePaid[gaugeAddr];
            rewardToken.safeApprove(gaugeAddr, 0);
        }
        killedGauges[gaugeAddr] = !gaugeKilledMem;
        emit GaugeToggled(gaugeAddr, !gaugeKilledMem);
    }

    // ========================= Guardian Function =================================

    /// @notice Halts or activates distribution of rewards
    function toggleDistributions() external onlyRole(GUARDIAN_ROLE) {
        bool distributionsOnMem = distributionsOn;
        distributionsOn = !distributionsOnMem;
        emit DistributionsToggled(!distributionsOnMem);
    }

    /// @notice Notifies that the interface of a gauge delegate is known or has changed
    /// @param _delegateGauge Address of the gauge to change
    /// @dev Gauge delegates that are built for automation should be toggled
    function toggleInterfaceKnown(address _delegateGauge) external onlyRole(GUARDIAN_ROLE) {
        _toggleInterfaceKnown(_delegateGauge);
    }
}

File 2 of 14 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 3 of 14 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    uint256 private _status;

    function __ReentrancyGuard_init() internal initializer {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal initializer {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

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

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

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

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

File 7 of 14 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 8 of 14 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "../interfaces/IAccessControl.sol";

/**
 * @dev This contract is fully forked from OpenZeppelin `AccessControlUpgradeable`.
 * The only difference is the removal of the ERC165 implementation as it's not
 * needed in Angle.
 *
 * Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, IAccessControl {
    function __AccessControl_init() internal initializer {
        __AccessControl_init_unchained();
    }

    function __AccessControl_init_unchained() internal initializer {}

    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, msg.sender);
        _;
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external override {
        require(account == msg.sender, "71");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal {
        emit RoleAdminChanged(role, getRoleAdmin(role), adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) internal {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, msg.sender);
        }
    }

    function _revokeRole(bytes32 role, address account) internal {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, msg.sender);
        }
    }

    uint256[49] private __gap;
}

File 9 of 14 : IAccessControl.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

/// @title IAccessControl
/// @author Forked from OpenZeppelin
/// @notice Interface for `AccessControl` contracts
interface IAccessControl {
    function hasRole(bytes32 role, address account) external view returns (bool);

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

    function grantRole(bytes32 role, address account) external;

    function revokeRole(bytes32 role, address account) external;

    function renounceRole(bytes32 role, address account) external;
}

File 10 of 14 : IAngleMiddlemanGauge.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

/// @title IAngleMiddlemanGauge
/// @author Angle Core Team
/// @notice Interface for the `AngleMiddleman` contract
interface IAngleMiddlemanGauge {
    function notifyReward(address gauge, uint256 amount) external;
}

File 11 of 14 : IGaugeController.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

interface IGaugeController {
    //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, uint256 timestamp) external view returns (uint256);
}

File 12 of 14 : ILiquidityGauge.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

interface ILiquidityGauge {
    // solhint-disable-next-line
    function staking_token() external returns (address stakingToken);

    // solhint-disable-next-line
    function deposit_reward_token(address _rewardToken, uint256 _amount) external;

    function deposit(
        uint256 _value,
        address _addr,
        // solhint-disable-next-line
        bool _claim_rewards
    ) external;

    // solhint-disable-next-line
    function claim_rewards(address _addr) external;

    // solhint-disable-next-line
    function claim_rewards(address _addr, address _receiver) external;
}

File 13 of 14 : IStakingRewards.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

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

/// @title IStakingRewardsFunctions
/// @author Angle Core Team
/// @notice Interface for the staking rewards contract that interact with the `RewardsDistributor` contract
interface IStakingRewardsFunctions {
    function notifyRewardAmount(uint256 reward) external;

    function recoverERC20(
        address tokenAddress,
        address to,
        uint256 tokenAmount
    ) external;

    function setNewRewardsDistribution(address newRewardsDistribution) external;
}

/// @title IStakingRewards
/// @author Angle Core Team
/// @notice Previous interface with additionnal getters for public variables
interface IStakingRewards is IStakingRewardsFunctions {
    function rewardToken() external view returns (IERC20);
}

File 14 of 14 : AngleDistributorEvents.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.7;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import "../interfaces/IGaugeController.sol";
import "../interfaces/ILiquidityGauge.sol";
import "../interfaces/IAngleMiddlemanGauge.sol";
import "../interfaces/IStakingRewards.sol";

import "../external/AccessControlUpgradeable.sol";

/// @title AngleDistributorEvents
/// @author Angle Core Team
/// @notice All the events used in `AngleDistributor` contract
contract AngleDistributorEvents {
    event DelegateGaugeUpdated(address indexed _gaugeAddr, address indexed _delegateGauge);
    event DistributionsToggled(bool _distributionsOn);
    event GaugeControllerUpdated(address indexed _controller);
    event GaugeToggled(address indexed gaugeAddr, bool newStatus);
    event InterfaceKnownToggled(address indexed _delegateGauge, bool _isInterfaceKnown);
    event RateUpdated(uint256 _newRate);
    event Recovered(address indexed tokenAddress, address indexed to, uint256 amount);
    event RewardDistributed(address indexed gaugeAddr, uint256 rewardTally);
    event UpdateMiningParameters(uint256 time, uint256 rate, uint256 supply);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_gaugeAddr","type":"address"},{"indexed":true,"internalType":"address","name":"_delegateGauge","type":"address"}],"name":"DelegateGaugeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_distributionsOn","type":"bool"}],"name":"DistributionsToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_controller","type":"address"}],"name":"GaugeControllerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gaugeAddr","type":"address"},{"indexed":false,"internalType":"bool","name":"newStatus","type":"bool"}],"name":"GaugeToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_delegateGauge","type":"address"},{"indexed":false,"internalType":"bool","name":"_isInterfaceKnown","type":"bool"}],"name":"InterfaceKnownToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_newRate","type":"uint256"}],"name":"RateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gaugeAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardTally","type":"uint256"}],"name":"RewardDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"supply","type":"uint256"}],"name":"UpdateMiningParameters","type":"event"},{"inputs":[],"name":"BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GUARDIAN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATE_REDUCTION_COEFFICIENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATE_REDUCTION_TIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WEEK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract IGaugeController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"delegateGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"delegateGauges","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gaugeAddr","type":"address"}],"name":"distributeReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"gauges","type":"address[]"}],"name":"distributeRewardToMultipleGauges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributionsOn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_controller","type":"address"},{"internalType":"uint256","name":"_initialRate","type":"uint256"},{"internalType":"uint256","name":"_startEpochSupply","type":"uint256"},{"internalType":"address","name":"governor","type":"address"},{"internalType":"address","name":"guardian","type":"address"},{"internalType":"address","name":"_delegateGauge","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isInterfaceKnown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"killedGauges","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastTimeGaugePaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"miningEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gaugeAddr","type":"address"},{"internalType":"address","name":"_delegateGauge","type":"address"},{"internalType":"bool","name":"toggleInterface","type":"bool"}],"name":"setDelegateGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"setGaugeController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newRate","type":"uint256"}],"name":"setRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startEpochSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startEpochTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleDistributions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gaugeAddr","type":"address"}],"name":"toggleGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegateGauge","type":"address"}],"name":"toggleInterfaceKnown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateMiningParameters","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50600054610100900460ff16806200002c575060005460ff16155b620000945760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000b7576000805461ffff19166101011790555b8015620000ca576000805461ff00191690555b50612eba80620000db6000396000f3fe608060405234801561001057600080fd5b50600436106102405760003560e01c80636a3a1cbf11610145578063ccc57490116100bd578063eee62ac01161008c578063f77c479111610071578063f77c479114610559578063f7c618c114610579578063f905c0831461059957600080fd5b8063eee62ac014610546578063f4359ce5146104e257600080fd5b8063ccc57490146104f4578063d547741f1461051b578063dd5fbc9a1461052e578063ec342ad01461053757600080fd5b8063a217fddf11610114578063b72f0a2f116100f9578063b72f0a2f146104cf578063b87b5616146104e2578063cb626ae2146104ec57600080fd5b8063a217fddf146104a7578063af45d0df146104af57600080fd5b80636a3a1cbf146103c35780636b5cfefe146103e357806391d1485414610406578063a0ca59f01461044c57600080fd5b8063248a9ca3116101d8578063305d6d5f116101a757806336568abe1161018c57806336568abe146103945780633e785737146103a757806364ef6dd4146103ba57600080fd5b8063305d6d5f1461037957806334fcf4371461038157600080fd5b8063248a9ca31461031357806324ea54f4146103365780632c4e722e1461035d5780632f2ff15d1461036657600080fd5b8063174688971161021457806317468897146102ad5780631814a5b1146102e05780631f8a7edf146102f757806321609bbf1461030457600080fd5b806291d2b814610245578063092193ab1461025a5780631171bda914610287578063139ea9b41461029a575b600080fd5b610258610253366004612919565b6105ac565b005b61026d610268366004612919565b6106c9565b604080519283526020830191909152015b60405180910390f35b61025861029536600461297b565b6107e5565b6102586102a8366004612934565b610a23565b6102d06102bb366004612919565b60686020526000908152604090205460ff1681565b604051901515815260200161027e565b6102e9606d5481565b60405190815260200161027e565b6070546102d09060ff1681565b6102e9670dfc861f1ff0953381565b6102e9610321366004612b36565b60009081526033602052604090206001015490565b6102e97f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504181565b6102e9606c5481565b610258610374366004612b4f565b610b72565b610258610b9d565b61025861038f366004612b36565b610c33565b6102586103a2366004612b4f565b610de0565b6102586103b53660046129b7565b610e6d565b6102e9606f5481565b6102e96103d1366004612919565b60656020526000908152604090205481565b6102d06103f1366004612919565b60666020526000908152604090205460ff1681565b6102d0610414366004612b4f565b600091825260336020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b61048261045a366004612919565b60676020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161027e565b6102e9600081565b606b546104829073ffffffffffffffffffffffffffffffffffffffff1681565b6102586104dd366004612919565b6111fb565b6102e962093a8081565b610258611317565b6102e97f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b610258610529366004612b4f565b61139b565b6102e9606e5481565b6102e9670de0b6b3a764000081565b610258610554366004612a2f565b6113c1565b606a546104829073ffffffffffffffffffffffffffffffffffffffff1681565b6069546104829073ffffffffffffffffffffffffffffffffffffffff1681565b6102586105a7366004612919565b61150e565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d78133611542565b73ffffffffffffffffffffffffffffffffffffffff8216610659576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f300000000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556040517ff3d6907bf00dd37e685d19085134f0fab4ced80b96963ef3e992dc7ac0324c5490600090a25050565b60008060026001541415610739576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610650565b6002600190815560705460ff161515146107af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f31303900000000000000000000000000000000000000000000000000000000006044820152606401610650565b62093a80606d546107c09190612ca5565b42106107ce576107ce611614565b6107d783611727565b600180559094909350915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556108108133611542565b60695473ffffffffffffffffffffffffffffffffffffffff85811691161415610995576069546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561089d57600080fd5b505afa1580156108b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d59190612b9e565b9050826108f2670de0b6b3a7640000670dfc861f1ff09533612d35565b62093a80670dfc861f1ff09533606c5461090c9190612cf8565b6109169190612cf8565b6109209190612cbd565b61092a9190612ca5565b811015610993576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f34000000000000000000000000000000000000000000000000000000000000006044820152606401610650565b505b6109b673ffffffffffffffffffffffffffffffffffffffff85168484611ee5565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b64884604051610a1591815260200190565b60405180910390a350505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610a4e8133611542565b73ffffffffffffffffffffffffffffffffffffffff841615610ac25773ffffffffffffffffffffffffffffffffffffffff848116600090815260676020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016918516919091179055610b03565b606b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fe8c02e063c8958a09592bd47f86567ffc358244cae7a91f26807ca8e3a70a0de60405160405180910390a38115610b6c57610b6c83611fb9565b50505050565b600082815260336020526040902060010154610b8e8133611542565b610b988383612049565b505050565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a5041610bc88133611542565b6070805460ff811680157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090921682179092556040519081527fa47e236370e478b9d163098c7c1f4f67b6efbb6683eeb0a669f04f302653779d906020015b60405180910390a15050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610c5e8133611542565b610c78670de0b6b3a7640000670dfc861f1ff09533612d35565b62093a80610c8e670dfc861f1ff0953385612cf8565b610c989190612cf8565b610ca29190612cbd565b6069546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a082319060240160206040518083038186803b158015610d0b57600080fd5b505afa158015610d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d439190612b9e565b1015610dab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f34000000000000000000000000000000000000000000000000000000000000006044820152606401610650565b606c8290556040518281527fe65c987b2e4668e09ba867026921588005b2b2063607a1e7e7d91683c8f91b7b90602001610c27565b73ffffffffffffffffffffffffffffffffffffffff81163314610e5f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f37310000000000000000000000000000000000000000000000000000000000006044820152606401610650565b610e698282612106565b5050565b600054610100900460ff1680610e86575060005460ff16155b610f12576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610650565b600054610100900460ff16158015610f5157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b73ffffffffffffffffffffffffffffffffffffffff871615801590610f8b575073ffffffffffffffffffffffffffffffffffffffff881615155b8015610fac575073ffffffffffffffffffffffffffffffffffffffff831615155b8015610fcd575073ffffffffffffffffffffffffffffffffffffffff841615155b611033576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f30000000000000000000000000000000000000000000000000000000000000006044820152606401610650565b6069805473ffffffffffffffffffffffffffffffffffffffff808b167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255606a80548a8416908316179055606e8790556000606f55606c889055606b805492851692909116919091179055607080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905542606d556110fa7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55806121c1565b6111447f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50417f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556121c1565b61116e7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504184612215565b6111987f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5585612215565b6111c27f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504185612215565b80156111f157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050505050505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556112268133611542565b73ffffffffffffffffffffffffffffffffffffffff821660009081526066602052604090205460ff168061128d5773ffffffffffffffffffffffffffffffffffffffff808416600090815260656020526040812081905560695461128d921690859061221f565b73ffffffffffffffffffffffffffffffffffffffff831660008181526066602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016851590811790915591519182527ff585f0f5078ec648738dbc4c4618f033a3f0d81e1602b044649d736d33ebac67910160405180910390a2505050565b62093a80606d546113289190612ca5565b421015611391576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f31303800000000000000000000000000000000000000000000000000000000006044820152606401610650565b611399611614565b565b6000828152603360205260409020600101546113b78133611542565b610b988383612106565b6002600154141561142e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610650565b6002600190815560705460ff161515146114a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f31303900000000000000000000000000000000000000000000000000000000006044820152606401610650565b62093a80606d546114b59190612ca5565b42106114c3576114c3611614565b60005b8151811015611506576114f18282815181106114e4576114e4612e15565b6020026020010151611727565b505080806114fe90612dad565b9150506114c6565b505060018055565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50416115398133611542565b610e6982611fb9565b600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610e695761159a8173ffffffffffffffffffffffffffffffffffffffff1660146123b0565b6115a58360206123b0565b6040516020016115b6929190612bd3565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261065091600401612c54565b600062093a80606d54426116289190612d35565b6116329190612cbd565b606c54606e54919250906116498362093a80612cf8565b606d600082825461165a9190612ca5565b9250508190555082606f60008282546116739190612ca5565b90915550600090505b838110156116d65761169162093a8084612cf8565b61169b9083612ca5565b9150670dfc861f1ff095336116b8670de0b6b3a764000085612cf8565b6116c29190612cbd565b9250806116ce81612dad565b91505061167c565b50606c829055606e81905560408051428152602081018490529081018290527f27e46362a1e6129b6dd539c984ce739291a97128dfcaeca1255e8ac83abd94419060600160405180910390a1505050565b606a546040517f3f9095b700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526000928392839290911690633f9095b79060240160206040518083038186803b15801561179957600080fd5b505afa1580156117ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d19190612b7b565b9050600081600f0b1215801561180d575073ffffffffffffffffffffffffffffffffffffffff841660009081526066602052604090205460ff16155b611873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f31313000000000000000000000000000000000000000000000000000000000006044820152606401610650565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260656020526040902054806118f7576001935081600f0b600014156118f2576069546118f29073ffffffffffffffffffffffffffffffffffffffff16867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61221f565b611923565b62093a806119058242612d35565b61190f9190612cbd565b935083611923575060009485945092505050565b606c5460009350835b85811015611b39576000816119ed57606a546040517f6472eee100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a8116600483015242602483015290911690636472eee190604401602060405180830381600087803b1580156119ae57600080fd5b505af11580156119c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e69190612b9e565b9050611ac7565b606a5473ffffffffffffffffffffffffffffffffffffffff1663d3078c9489611a198562093a80612cf8565b611a239042612d35565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff9092166004830152602482015260440160206040518083038186803b158015611a8c57600080fd5b505afa158015611aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac49190612b9e565b90505b670de0b6b3a764000062093a80611ade8386612cf8565b611ae89190612cf8565b611af29190612cbd565b611afc9087612ca5565b9550670de0b6b3a7640000611b19670dfc861f1ff0953385612cf8565b611b239190612cbd565b9250508080611b3190612dad565b91505061192c565b5062093a80611b488142612cbd565b611b529190612cf8565b73ffffffffffffffffffffffffffffffffffffffff87166000908152606560205260409020556002600f84900b12611cf25773ffffffffffffffffffffffffffffffffffffffff8087166000908152606760205260409020541680611bcc5750606b5473ffffffffffffffffffffffffffffffffffffffff165b73ffffffffffffffffffffffffffffffffffffffff811615611cc857606954611c0c9073ffffffffffffffffffffffffffffffffffffffff168287611ee5565b73ffffffffffffffffffffffffffffffffffffffff811660009081526068602052604090205460ff1615611cc3576040517fe324718000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88811660048301526024820187905282169063e324718090604401600060405180830381600087803b158015611caa57600080fd5b505af1158015611cbe573d6000803e3d6000fd5b505050505b611cec565b606954611cec9073ffffffffffffffffffffffffffffffffffffffff168887611ee5565b50611e8d565b82600f0b60011415611da757606954611d229073ffffffffffffffffffffffffffffffffffffffff168786611ee5565b6040517f3c6b16ab0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff871690633c6b16ab90602401600060405180830381600087803b158015611d8a57600080fd5b505af1158015611d9e573d6000803e3d6000fd5b50505050611e8d565b73ffffffffffffffffffffffffffffffffffffffff808716600090815260676020526040902054168015611dfe57606954611df99073ffffffffffffffffffffffffffffffffffffffff168287611ee5565b611e8b565b6069546040517f93f7aa6700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015260248101879052908816906393f7aa6790604401600060405180830381600087803b158015611e7257600080fd5b505af1158015611e86573d6000803e3d6000fd5b505050505b505b8573ffffffffffffffffffffffffffffffffffffffff167fe34918ff1c7084970068b53fd71ad6d8b04e9f15d3886cbf006443e6cdc52ea685604051611ed591815260200190565b60405180910390a2505050915091565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610b989084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526125fa565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260686020908152604091829020805460ff811680157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff009092168217909255925192835292917fef1fcfc5b60bfbf5c191cfb9774cbd1d1a56987bd13658cec7705bffc7c01d4e910160405180910390a25050565b600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610e6957600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1615610e6957600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600082815260336020526040902060010154819060405184907fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff90600090a460009182526033602052604090912060010155565b610e698282612049565b8015806122ce57506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561229457600080fd5b505afa1580156122a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122cc9190612b9e565b155b61235a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610650565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610b989084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611f37565b606060006123bf836002612cf8565b6123ca906002612ca5565b67ffffffffffffffff8111156123e2576123e2612e44565b6040519080825280601f01601f19166020018201604052801561240c576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061244357612443612e15565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124a6576124a6612e15565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006124e2846002612cf8565b6124ed906001612ca5565b90505b600181111561258a577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061252e5761252e612e15565b1a60f81b82828151811061254457612544612e15565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361258381612d78565b90506124f0565b5083156125f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610650565b9392505050565b600061265c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166127069092919063ffffffff16565b805190915015610b98578080602001905181019061267a9190612b19565b610b98576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610650565b6060612715848460008561271d565b949350505050565b6060824710156127af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610650565b843b612817576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610650565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516128409190612bb7565b60006040518083038185875af1925050503d806000811461287d576040519150601f19603f3d011682016040523d82523d6000602084013e612882565b606091505b509150915061289282828661289d565b979650505050505050565b606083156128ac5750816125f3565b8251156128bc5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106509190612c54565b803573ffffffffffffffffffffffffffffffffffffffff8116811461291457600080fd5b919050565b60006020828403121561292b57600080fd5b6125f3826128f0565b60008060006060848603121561294957600080fd5b612952846128f0565b9250612960602085016128f0565b9150604084013561297081612e73565b809150509250925092565b60008060006060848603121561299057600080fd5b612999846128f0565b92506129a7602085016128f0565b9150604084013590509250925092565b600080600080600080600060e0888a0312156129d257600080fd5b6129db886128f0565b96506129e9602089016128f0565b95506040880135945060608801359350612a05608089016128f0565b9250612a1360a089016128f0565b9150612a2160c089016128f0565b905092959891949750929550565b60006020808385031215612a4257600080fd5b823567ffffffffffffffff80821115612a5a57600080fd5b818501915085601f830112612a6e57600080fd5b813581811115612a8057612a80612e44565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715612ac357612ac3612e44565b604052828152858101935084860182860187018a1015612ae257600080fd5b600095505b83861015612b0c57612af8816128f0565b855260019590950194938601938601612ae7565b5098975050505050505050565b600060208284031215612b2b57600080fd5b81516125f381612e73565b600060208284031215612b4857600080fd5b5035919050565b60008060408385031215612b6257600080fd5b82359150612b72602084016128f0565b90509250929050565b600060208284031215612b8d57600080fd5b815180600f0b81146125f357600080fd5b600060208284031215612bb057600080fd5b5051919050565b60008251612bc9818460208701612d4c565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612c0b816017850160208801612d4c565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612c48816028840160208801612d4c565b01602801949350505050565b6020815260008251806020840152612c73816040850160208701612d4c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115612cb857612cb8612de6565b500190565b600082612cf3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612d3057612d30612de6565b500290565b600082821015612d4757612d47612de6565b500390565b60005b83811015612d67578181015183820152602001612d4f565b83811115610b6c5750506000910152565b600081612d8757612d87612de6565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ddf57612ddf612de6565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114612e8157600080fd5b5056fea2646970667358221220356d9b9e526dec231a629cadfc5c47766084ff07cbd51cb231cf33abf430826564736f6c63430008070033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102405760003560e01c80636a3a1cbf11610145578063ccc57490116100bd578063eee62ac01161008c578063f77c479111610071578063f77c479114610559578063f7c618c114610579578063f905c0831461059957600080fd5b8063eee62ac014610546578063f4359ce5146104e257600080fd5b8063ccc57490146104f4578063d547741f1461051b578063dd5fbc9a1461052e578063ec342ad01461053757600080fd5b8063a217fddf11610114578063b72f0a2f116100f9578063b72f0a2f146104cf578063b87b5616146104e2578063cb626ae2146104ec57600080fd5b8063a217fddf146104a7578063af45d0df146104af57600080fd5b80636a3a1cbf146103c35780636b5cfefe146103e357806391d1485414610406578063a0ca59f01461044c57600080fd5b8063248a9ca3116101d8578063305d6d5f116101a757806336568abe1161018c57806336568abe146103945780633e785737146103a757806364ef6dd4146103ba57600080fd5b8063305d6d5f1461037957806334fcf4371461038157600080fd5b8063248a9ca31461031357806324ea54f4146103365780632c4e722e1461035d5780632f2ff15d1461036657600080fd5b8063174688971161021457806317468897146102ad5780631814a5b1146102e05780631f8a7edf146102f757806321609bbf1461030457600080fd5b806291d2b814610245578063092193ab1461025a5780631171bda914610287578063139ea9b41461029a575b600080fd5b610258610253366004612919565b6105ac565b005b61026d610268366004612919565b6106c9565b604080519283526020830191909152015b60405180910390f35b61025861029536600461297b565b6107e5565b6102586102a8366004612934565b610a23565b6102d06102bb366004612919565b60686020526000908152604090205460ff1681565b604051901515815260200161027e565b6102e9606d5481565b60405190815260200161027e565b6070546102d09060ff1681565b6102e9670dfc861f1ff0953381565b6102e9610321366004612b36565b60009081526033602052604090206001015490565b6102e97f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504181565b6102e9606c5481565b610258610374366004612b4f565b610b72565b610258610b9d565b61025861038f366004612b36565b610c33565b6102586103a2366004612b4f565b610de0565b6102586103b53660046129b7565b610e6d565b6102e9606f5481565b6102e96103d1366004612919565b60656020526000908152604090205481565b6102d06103f1366004612919565b60666020526000908152604090205460ff1681565b6102d0610414366004612b4f565b600091825260336020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b61048261045a366004612919565b60676020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161027e565b6102e9600081565b606b546104829073ffffffffffffffffffffffffffffffffffffffff1681565b6102586104dd366004612919565b6111fb565b6102e962093a8081565b610258611317565b6102e97f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b610258610529366004612b4f565b61139b565b6102e9606e5481565b6102e9670de0b6b3a764000081565b610258610554366004612a2f565b6113c1565b606a546104829073ffffffffffffffffffffffffffffffffffffffff1681565b6069546104829073ffffffffffffffffffffffffffffffffffffffff1681565b6102586105a7366004612919565b61150e565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d78133611542565b73ffffffffffffffffffffffffffffffffffffffff8216610659576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f300000000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556040517ff3d6907bf00dd37e685d19085134f0fab4ced80b96963ef3e992dc7ac0324c5490600090a25050565b60008060026001541415610739576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610650565b6002600190815560705460ff161515146107af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f31303900000000000000000000000000000000000000000000000000000000006044820152606401610650565b62093a80606d546107c09190612ca5565b42106107ce576107ce611614565b6107d783611727565b600180559094909350915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556108108133611542565b60695473ffffffffffffffffffffffffffffffffffffffff85811691161415610995576069546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561089d57600080fd5b505afa1580156108b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d59190612b9e565b9050826108f2670de0b6b3a7640000670dfc861f1ff09533612d35565b62093a80670dfc861f1ff09533606c5461090c9190612cf8565b6109169190612cf8565b6109209190612cbd565b61092a9190612ca5565b811015610993576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f34000000000000000000000000000000000000000000000000000000000000006044820152606401610650565b505b6109b673ffffffffffffffffffffffffffffffffffffffff85168484611ee5565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b64884604051610a1591815260200190565b60405180910390a350505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610a4e8133611542565b73ffffffffffffffffffffffffffffffffffffffff841615610ac25773ffffffffffffffffffffffffffffffffffffffff848116600090815260676020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016918516919091179055610b03565b606b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fe8c02e063c8958a09592bd47f86567ffc358244cae7a91f26807ca8e3a70a0de60405160405180910390a38115610b6c57610b6c83611fb9565b50505050565b600082815260336020526040902060010154610b8e8133611542565b610b988383612049565b505050565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a5041610bc88133611542565b6070805460ff811680157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090921682179092556040519081527fa47e236370e478b9d163098c7c1f4f67b6efbb6683eeb0a669f04f302653779d906020015b60405180910390a15050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610c5e8133611542565b610c78670de0b6b3a7640000670dfc861f1ff09533612d35565b62093a80610c8e670dfc861f1ff0953385612cf8565b610c989190612cf8565b610ca29190612cbd565b6069546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a082319060240160206040518083038186803b158015610d0b57600080fd5b505afa158015610d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d439190612b9e565b1015610dab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f34000000000000000000000000000000000000000000000000000000000000006044820152606401610650565b606c8290556040518281527fe65c987b2e4668e09ba867026921588005b2b2063607a1e7e7d91683c8f91b7b90602001610c27565b73ffffffffffffffffffffffffffffffffffffffff81163314610e5f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f37310000000000000000000000000000000000000000000000000000000000006044820152606401610650565b610e698282612106565b5050565b600054610100900460ff1680610e86575060005460ff16155b610f12576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610650565b600054610100900460ff16158015610f5157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b73ffffffffffffffffffffffffffffffffffffffff871615801590610f8b575073ffffffffffffffffffffffffffffffffffffffff881615155b8015610fac575073ffffffffffffffffffffffffffffffffffffffff831615155b8015610fcd575073ffffffffffffffffffffffffffffffffffffffff841615155b611033576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f30000000000000000000000000000000000000000000000000000000000000006044820152606401610650565b6069805473ffffffffffffffffffffffffffffffffffffffff808b167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255606a80548a8416908316179055606e8790556000606f55606c889055606b805492851692909116919091179055607080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905542606d556110fa7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55806121c1565b6111447f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50417f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556121c1565b61116e7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504184612215565b6111987f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5585612215565b6111c27f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504185612215565b80156111f157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050505050505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556112268133611542565b73ffffffffffffffffffffffffffffffffffffffff821660009081526066602052604090205460ff168061128d5773ffffffffffffffffffffffffffffffffffffffff808416600090815260656020526040812081905560695461128d921690859061221f565b73ffffffffffffffffffffffffffffffffffffffff831660008181526066602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016851590811790915591519182527ff585f0f5078ec648738dbc4c4618f033a3f0d81e1602b044649d736d33ebac67910160405180910390a2505050565b62093a80606d546113289190612ca5565b421015611391576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f31303800000000000000000000000000000000000000000000000000000000006044820152606401610650565b611399611614565b565b6000828152603360205260409020600101546113b78133611542565b610b988383612106565b6002600154141561142e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610650565b6002600190815560705460ff161515146114a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f31303900000000000000000000000000000000000000000000000000000000006044820152606401610650565b62093a80606d546114b59190612ca5565b42106114c3576114c3611614565b60005b8151811015611506576114f18282815181106114e4576114e4612e15565b6020026020010151611727565b505080806114fe90612dad565b9150506114c6565b505060018055565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50416115398133611542565b610e6982611fb9565b600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610e695761159a8173ffffffffffffffffffffffffffffffffffffffff1660146123b0565b6115a58360206123b0565b6040516020016115b6929190612bd3565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261065091600401612c54565b600062093a80606d54426116289190612d35565b6116329190612cbd565b606c54606e54919250906116498362093a80612cf8565b606d600082825461165a9190612ca5565b9250508190555082606f60008282546116739190612ca5565b90915550600090505b838110156116d65761169162093a8084612cf8565b61169b9083612ca5565b9150670dfc861f1ff095336116b8670de0b6b3a764000085612cf8565b6116c29190612cbd565b9250806116ce81612dad565b91505061167c565b50606c829055606e81905560408051428152602081018490529081018290527f27e46362a1e6129b6dd539c984ce739291a97128dfcaeca1255e8ac83abd94419060600160405180910390a1505050565b606a546040517f3f9095b700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526000928392839290911690633f9095b79060240160206040518083038186803b15801561179957600080fd5b505afa1580156117ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d19190612b7b565b9050600081600f0b1215801561180d575073ffffffffffffffffffffffffffffffffffffffff841660009081526066602052604090205460ff16155b611873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f31313000000000000000000000000000000000000000000000000000000000006044820152606401610650565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260656020526040902054806118f7576001935081600f0b600014156118f2576069546118f29073ffffffffffffffffffffffffffffffffffffffff16867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61221f565b611923565b62093a806119058242612d35565b61190f9190612cbd565b935083611923575060009485945092505050565b606c5460009350835b85811015611b39576000816119ed57606a546040517f6472eee100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a8116600483015242602483015290911690636472eee190604401602060405180830381600087803b1580156119ae57600080fd5b505af11580156119c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e69190612b9e565b9050611ac7565b606a5473ffffffffffffffffffffffffffffffffffffffff1663d3078c9489611a198562093a80612cf8565b611a239042612d35565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff9092166004830152602482015260440160206040518083038186803b158015611a8c57600080fd5b505afa158015611aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac49190612b9e565b90505b670de0b6b3a764000062093a80611ade8386612cf8565b611ae89190612cf8565b611af29190612cbd565b611afc9087612ca5565b9550670de0b6b3a7640000611b19670dfc861f1ff0953385612cf8565b611b239190612cbd565b9250508080611b3190612dad565b91505061192c565b5062093a80611b488142612cbd565b611b529190612cf8565b73ffffffffffffffffffffffffffffffffffffffff87166000908152606560205260409020556002600f84900b12611cf25773ffffffffffffffffffffffffffffffffffffffff8087166000908152606760205260409020541680611bcc5750606b5473ffffffffffffffffffffffffffffffffffffffff165b73ffffffffffffffffffffffffffffffffffffffff811615611cc857606954611c0c9073ffffffffffffffffffffffffffffffffffffffff168287611ee5565b73ffffffffffffffffffffffffffffffffffffffff811660009081526068602052604090205460ff1615611cc3576040517fe324718000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88811660048301526024820187905282169063e324718090604401600060405180830381600087803b158015611caa57600080fd5b505af1158015611cbe573d6000803e3d6000fd5b505050505b611cec565b606954611cec9073ffffffffffffffffffffffffffffffffffffffff168887611ee5565b50611e8d565b82600f0b60011415611da757606954611d229073ffffffffffffffffffffffffffffffffffffffff168786611ee5565b6040517f3c6b16ab0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff871690633c6b16ab90602401600060405180830381600087803b158015611d8a57600080fd5b505af1158015611d9e573d6000803e3d6000fd5b50505050611e8d565b73ffffffffffffffffffffffffffffffffffffffff808716600090815260676020526040902054168015611dfe57606954611df99073ffffffffffffffffffffffffffffffffffffffff168287611ee5565b611e8b565b6069546040517f93f7aa6700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015260248101879052908816906393f7aa6790604401600060405180830381600087803b158015611e7257600080fd5b505af1158015611e86573d6000803e3d6000fd5b505050505b505b8573ffffffffffffffffffffffffffffffffffffffff167fe34918ff1c7084970068b53fd71ad6d8b04e9f15d3886cbf006443e6cdc52ea685604051611ed591815260200190565b60405180910390a2505050915091565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610b989084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526125fa565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260686020908152604091829020805460ff811680157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff009092168217909255925192835292917fef1fcfc5b60bfbf5c191cfb9774cbd1d1a56987bd13658cec7705bffc7c01d4e910160405180910390a25050565b600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610e6957600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1615610e6957600082815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600082815260336020526040902060010154819060405184907fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff90600090a460009182526033602052604090912060010155565b610e698282612049565b8015806122ce57506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561229457600080fd5b505afa1580156122a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122cc9190612b9e565b155b61235a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610650565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610b989084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611f37565b606060006123bf836002612cf8565b6123ca906002612ca5565b67ffffffffffffffff8111156123e2576123e2612e44565b6040519080825280601f01601f19166020018201604052801561240c576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061244357612443612e15565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124a6576124a6612e15565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006124e2846002612cf8565b6124ed906001612ca5565b90505b600181111561258a577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061252e5761252e612e15565b1a60f81b82828151811061254457612544612e15565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361258381612d78565b90506124f0565b5083156125f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610650565b9392505050565b600061265c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166127069092919063ffffffff16565b805190915015610b98578080602001905181019061267a9190612b19565b610b98576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610650565b6060612715848460008561271d565b949350505050565b6060824710156127af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610650565b843b612817576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610650565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516128409190612bb7565b60006040518083038185875af1925050503d806000811461287d576040519150601f19603f3d011682016040523d82523d6000602084013e612882565b606091505b509150915061289282828661289d565b979650505050505050565b606083156128ac5750816125f3565b8251156128bc5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106509190612c54565b803573ffffffffffffffffffffffffffffffffffffffff8116811461291457600080fd5b919050565b60006020828403121561292b57600080fd5b6125f3826128f0565b60008060006060848603121561294957600080fd5b612952846128f0565b9250612960602085016128f0565b9150604084013561297081612e73565b809150509250925092565b60008060006060848603121561299057600080fd5b612999846128f0565b92506129a7602085016128f0565b9150604084013590509250925092565b600080600080600080600060e0888a0312156129d257600080fd5b6129db886128f0565b96506129e9602089016128f0565b95506040880135945060608801359350612a05608089016128f0565b9250612a1360a089016128f0565b9150612a2160c089016128f0565b905092959891949750929550565b60006020808385031215612a4257600080fd5b823567ffffffffffffffff80821115612a5a57600080fd5b818501915085601f830112612a6e57600080fd5b813581811115612a8057612a80612e44565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715612ac357612ac3612e44565b604052828152858101935084860182860187018a1015612ae257600080fd5b600095505b83861015612b0c57612af8816128f0565b855260019590950194938601938601612ae7565b5098975050505050505050565b600060208284031215612b2b57600080fd5b81516125f381612e73565b600060208284031215612b4857600080fd5b5035919050565b60008060408385031215612b6257600080fd5b82359150612b72602084016128f0565b90509250929050565b600060208284031215612b8d57600080fd5b815180600f0b81146125f357600080fd5b600060208284031215612bb057600080fd5b5051919050565b60008251612bc9818460208701612d4c565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612c0b816017850160208801612d4c565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612c48816028840160208801612d4c565b01602801949350505050565b6020815260008251806020840152612c73816040850160208701612d4c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115612cb857612cb8612de6565b500190565b600082612cf3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612d3057612d30612de6565b500290565b600082821015612d4757612d47612de6565b500390565b60005b83811015612d67578181015183820152602001612d4f565b83811115610b6c5750506000910152565b600081612d8757612d87612de6565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ddf57612ddf612de6565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114612e8157600080fd5b5056fea2646970667358221220356d9b9e526dec231a629cadfc5c47766084ff07cbd51cb231cf33abf430826564736f6c63430008070033

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

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.