Contract 0xd7689cd163374fae8cb853d1d3842d4ab4c29d77

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xdab9d642fb0c84d90e9e7400372e1a2136deaca77693cc07481df941e94c644b0x6080604016401052022-08-13 0:18:42297 days 3 hrs agoMoonwell Artemis: Deployer IN  Create: StakedWell0 GLMR0.3502016945
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StakedWell

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
File 1 of 19 : StakedWell.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import "./interfaces/IERC20.sol";
import {StakedToken} from "./StakedToken.sol";

/**
 * @title StakedWell
 * @notice StakedToken with WELL token as staked token
 * @author Moonwell
 **/
contract StakedWell is StakedToken {
    string internal constant NAME = "Staked WELL";
    string internal constant SYMBOL = "stkWELL";
    uint8 internal constant DECIMALS = 18;

    /**
     * @dev Called by the proxy contract
     **/
    function initialize(
        IERC20 stakedToken,
        IERC20 rewardToken,
        uint256 cooldownSeconds,
        uint256 unstakeWindow,
        address rewardsVault,
        address emissionManager,
        uint128 distributionDuration,
        address governance
  ) external {
        __StakedToken_init(
            stakedToken,
            rewardToken,
            cooldownSeconds,
            unstakeWindow,
            rewardsVault,
            emissionManager,
            distributionDuration,
            NAME,
            SYMBOL,
            DECIMALS,
            governance
        );
    }
}

File 2 of 19 : IERC20.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 * From https://github.com/OpenZeppelin/openzeppelin-contracts
 */
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 3 of 19 : StakedToken.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import {IERC20} from "./interfaces/IERC20.sol";
import {IStakedToken} from "./interfaces/IStakedToken.sol";
import {ITransferHook} from "./interfaces/ITransferHook.sol";
import {IEcosystemReserve} from "./interfaces/IEcosystemReserve.sol";
import {ERC20WithSnapshot} from "./libraries/ERC20WithSnapshot.sol";
import {SafeERC20} from "./libraries/SafeERC20.sol";
import {DistributionTypes} from "./libraries/DistributionTypes.sol";
import {Initializable} from "./utils/Initializable.sol";
import {DistributionManager} from "./DistributionManager.sol";
import {ReentrancyGuardUpgradeable} from "./OpenZeppelin/ReentrancyGuardUpgradeable.sol";

/**
 * @title StakedToken
 * @notice Contract to stake MFAM token, tokenize the position and get rewards, inheriting from a distribution manager contract
 * @author Moonwell
 **/
contract StakedToken is IStakedToken, ERC20WithSnapshot, Initializable, DistributionManager, ReentrancyGuardUpgradeable {
    using SafeERC20 for IERC20;

    IERC20 public STAKED_TOKEN;
    IERC20 public REWARD_TOKEN;
    uint256 public COOLDOWN_SECONDS;

    /// @notice Seconds available to redeem once the cooldown period is fullfilled
    uint256 public UNSTAKE_WINDOW;

    /// @notice Address to pull from the rewards, needs to have approved this contract
    address public REWARDS_VAULT;

    mapping(address => uint256) public stakerRewardsToClaim;
    mapping(address => uint256) public stakersCooldowns;

    event Staked(address indexed from, address indexed onBehalfOf, uint256 amount);
    event Redeem(address indexed from, address indexed to, uint256 amount);

    event RewardsAccrued(address user, uint256 amount);
    event RewardsClaimed(address indexed from, address indexed to, uint256 amount);

    event Cooldown(address indexed user);

    function __StakedToken_init(
        IERC20 stakedToken,
        IERC20 rewardToken,
        uint256 cooldownSeconds,
        uint256 unstakeWindow,
        address rewardsVault,
        address emissionManager,
        uint128 distributionDuration,
        string memory name,
        string memory symbol,
        uint8 decimals,
        address governance
    ) internal initializer {
        __ReentrancyGuard_init();
        __ERC20_init_unchained(name, symbol, decimals);
        __DistributionManager_init_unchained(emissionManager, distributionDuration);
        __StakedToken_init_unchained(
            stakedToken,
            rewardToken,
            cooldownSeconds,
            unstakeWindow,
            rewardsVault,
            governance
        );
    }

    function __StakedToken_init_unchained(
        IERC20 stakedToken,
        IERC20 rewardToken,
        uint256 cooldownSeconds,
        uint256 unstakeWindow,
        address rewardsVault,
        address governance
    ) internal {
        STAKED_TOKEN = stakedToken;
        REWARD_TOKEN = rewardToken;
        COOLDOWN_SECONDS = cooldownSeconds;
        UNSTAKE_WINDOW = unstakeWindow;
        REWARDS_VAULT = rewardsVault;
        _setGovernance(ITransferHook(governance));
    }

    function stake(address onBehalfOf, uint256 amount) external override nonReentrant {
        require(amount != 0, 'INVALID_ZERO_AMOUNT');
        require(onBehalfOf != address(0), 'STAKE_ZERO_ADDRESS');
        uint256 balanceOfUser = balanceOf(onBehalfOf);

        uint256 accruedRewards = _updateUserAssetInternal(
            onBehalfOf,
            address(this),
            balanceOfUser,
            totalSupply()
        );
        if (accruedRewards != 0) {
            emit RewardsAccrued(onBehalfOf, accruedRewards);
            stakerRewardsToClaim[onBehalfOf] = stakerRewardsToClaim[onBehalfOf].add(accruedRewards);
        }

        stakersCooldowns[onBehalfOf] = getNextCooldownTimestamp(0, amount, onBehalfOf, balanceOfUser);

        _mint(onBehalfOf, amount);
        IERC20(STAKED_TOKEN).safeTransferFrom(msg.sender, address(this), amount);

        emit Staked(msg.sender, onBehalfOf, amount);
    }

    /**
     * @dev Redeems staked tokens, and stop earning rewards
     * @param to Address to redeem to
     * @param amount Amount to redeem
     **/
    function redeem(address to, uint256 amount) external override nonReentrant {
        require(amount != 0, 'INVALID_ZERO_AMOUNT');
        require(to != address(0), 'REDEEM_ZERO_ADDRESS');
        //solium-disable-next-line
        uint256 cooldownStartTimestamp = stakersCooldowns[msg.sender];
        require(
            block.timestamp > cooldownStartTimestamp.add(COOLDOWN_SECONDS),
            'INSUFFICIENT_COOLDOWN'
        );
        require(
            block.timestamp.sub(cooldownStartTimestamp.add(COOLDOWN_SECONDS)) <= UNSTAKE_WINDOW,
            'UNSTAKE_WINDOW_FINISHED'
        );
        uint256 balanceOfMessageSender = balanceOf(msg.sender);

        uint256 amountToRedeem = (amount > balanceOfMessageSender) ? balanceOfMessageSender : amount;

        _updateCurrentUnclaimedRewards(msg.sender, balanceOfMessageSender, true);

        _burn(msg.sender, amountToRedeem);

        if (balanceOfMessageSender.sub(amountToRedeem) == 0) {
            stakersCooldowns[msg.sender] = 0;
        }

        IERC20(STAKED_TOKEN).safeTransfer(to, amountToRedeem);

        emit Redeem(msg.sender, to, amountToRedeem);
    }

    /**
     * @dev Activates the cooldown period to unstake
     * - It can't be called if the user is not staking
     **/
    function cooldown() external override {
        require(balanceOf(msg.sender) != 0, "INVALID_BALANCE_ON_COOLDOWN");
        //solium-disable-next-line
        stakersCooldowns[msg.sender] = block.timestamp;

        emit Cooldown(msg.sender);
    }

    /**
     * @dev Claims an `amount` of `REWARD_TOKEN` to the address `to`
     * @param to Address to stake for
     * @param amount Amount to stake
     **/
    function claimRewards(address to, uint256 amount) external override nonReentrant {
        uint256 newTotalRewards = _updateCurrentUnclaimedRewards(
            msg.sender,
            balanceOf(msg.sender),
            false
        );
        uint256 amountToClaim = (amount == type(uint256).max) ? newTotalRewards : amount;

        stakerRewardsToClaim[msg.sender] = newTotalRewards.sub(amountToClaim, "INVALID_AMOUNT");

        IERC20(REWARD_TOKEN).safeTransferFrom(REWARDS_VAULT, to, amountToClaim);

        emit RewardsClaimed(msg.sender, to, amountToClaim);
    }

    /**
     * @dev Internal ERC20 _transfer of the tokenized staked tokens
     * @param from Address to transfer from
     * @param to Address to transfer to
     * @param amount Amount to transfer
     **/
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal override {
        uint256 balanceOfFrom = balanceOf(from);
        // Sender
        _updateCurrentUnclaimedRewards(from, balanceOfFrom, true);

        // Recipient
        if (from != to) {
            uint256 balanceOfTo = balanceOf(to);
            _updateCurrentUnclaimedRewards(to, balanceOfTo, true);

            uint256 previousSenderCooldown = stakersCooldowns[from];
            stakersCooldowns[to] = getNextCooldownTimestamp(previousSenderCooldown, amount, to, balanceOfTo);
            // if cooldown was set and whole balance of sender was transferred - clear cooldown
            if (balanceOfFrom == amount && previousSenderCooldown != 0) {
                stakersCooldowns[from] = 0;
            }
        }

        super._transfer(from, to, amount);
    }

    /**
     * @dev Updates the user state related with his accrued rewards
     * @param user Address of the user
     * @param userBalance The current balance of the user
     * @param updateStorage Boolean flag used to update or not the stakerRewardsToClaim of the user
     * @return The unclaimed rewards that were added to the total accrued
     **/
    function _updateCurrentUnclaimedRewards(
        address user,
        uint256 userBalance,
        bool updateStorage
    ) internal returns (uint256) {
        uint256 accruedRewards = _updateUserAssetInternal(
            user,
            address(this),
            userBalance,
            totalSupply()
        );
        uint256 unclaimedRewards = stakerRewardsToClaim[user].add(accruedRewards);

        if (accruedRewards != 0) {
            if (updateStorage) {
                stakerRewardsToClaim[user] = unclaimedRewards;
            }
            emit RewardsAccrued(user, accruedRewards);
        }

        return unclaimedRewards;
    }

    /**
     * @dev Calculates the how is gonna be a new cooldown timestamp depending on the sender/receiver situation
     *  - If the timestamp of the sender is "better" or the timestamp of the recipient is 0, we take the one of the recipient
     *  - Weighted average of from/to cooldown timestamps if:
     *    # The sender doesn't have the cooldown activated (timestamp 0).
     *    # The sender timestamp is expired
     *    # The sender has a "worse" timestamp
     *  - If the receiver's cooldown timestamp expired (too old), the next is 0
     * @param fromCooldownTimestamp Cooldown timestamp of the sender
     * @param amountToReceive Amount
     * @param toAddress Address of the recipient
     * @param toBalance Current balance of the receiver
     * @return The new cooldown timestamp
     **/
    function getNextCooldownTimestamp(
        uint256 fromCooldownTimestamp,
        uint256 amountToReceive,
        address toAddress,
        uint256 toBalance
    ) public returns (uint256) {
        uint256 toCooldownTimestamp = stakersCooldowns[toAddress];
        if (toCooldownTimestamp == 0) {
            return 0;
        }

        uint256 minimalValidCooldownTimestamp = block.timestamp.sub(COOLDOWN_SECONDS).sub(
            UNSTAKE_WINDOW
        );

        if (minimalValidCooldownTimestamp > toCooldownTimestamp) {
            toCooldownTimestamp = 0;
        } else {
            uint256 fromCooldownTimestampFinal = (minimalValidCooldownTimestamp > fromCooldownTimestamp)
                ? block.timestamp
                : fromCooldownTimestamp;

            if (fromCooldownTimestampFinal < toCooldownTimestamp) {
                return toCooldownTimestamp;
            } else {
                toCooldownTimestamp = (
                    amountToReceive.mul(fromCooldownTimestampFinal).add(toBalance.mul(toCooldownTimestamp))
                )
                    .div(amountToReceive.add(toBalance));
            }
        }
        stakersCooldowns[toAddress] = toCooldownTimestamp;

        return toCooldownTimestamp;
    }

    /**
     * @dev Return the total rewards pending to claim by an staker
     * @param staker The staker address
     * @return The rewards
     */
    function getTotalRewardsBalance(address staker) external view returns (uint256) {
        DistributionTypes.UserStakeInput[] memory userStakeInputs = new DistributionTypes.UserStakeInput[](1);
        userStakeInputs[0] = DistributionTypes.UserStakeInput({
            underlyingAsset: address(this),
            stakedByUser: balanceOf(staker),
            totalStaked: totalSupply()
        });
        return stakerRewardsToClaim[staker].add(_getUnclaimedRewards(staker, userStakeInputs));
    }
}

File 4 of 19 : IStakedToken.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

interface IStakedToken {
    function stake(address to, uint256 amount) external;

    function redeem(address to, uint256 amount) external;

    function cooldown() external;

    function claimRewards(address to, uint256 amount) external;
}

File 5 of 19 : ITransferHook.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

interface ITransferHook {
    function onTransfer(address from, address to, uint256 amount) external;
}

File 6 of 19 : IEcosystemReserve.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import "../interfaces/IERC20.sol";

interface IEcosystemReserve {
    function approve(IERC20 token, address recipient, uint256 amount) external;

    function transfer(IERC20 token, address recipient, uint256 amount) external;

    function setFundsAdmin(address admin) external;
}

File 7 of 19 : ERC20WithSnapshot.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import "@openzeppelin/upgrades-core/contracts/Initializable.sol";
import {ERC20} from "../libraries/ERC20.sol";
import {ITransferHook} from "../interfaces/ITransferHook.sol";

/**
 * @title ERC20WithSnapshot
 * @notice ERC20 including snapshots of balances on transfer-related actions
 * @author Moonwell
 **/
contract ERC20WithSnapshot is ERC20 {

    /// @dev snapshot of a value on a specific block, used for balances
    struct Snapshot {
        uint128 blockNumber;
        uint128 value;
    }

    mapping (address => mapping (uint256 => Snapshot)) public _snapshots;
    mapping (address => uint256) public _countsSnapshots;
    /// @dev reference to the Moonwell governance contract to call (if initialized) on _beforeTokenTransfer
    /// !!! IMPORTANT The Moonwell governance is considered a trustable contract, being its responsibility
    /// to control all potential reentrancies by calling back the this contract
    ITransferHook public _governance;

    event SnapshotDone(address owner, uint128 oldValue, uint128 newValue);

    function _setGovernance(ITransferHook governance) internal virtual {
        _governance = governance;
    }

    /**
     * @notice Gets the current votes balance for `account`
     * @param account The address to get votes balance
     * @return The number of current votes for `account`
     */
    function getCurrentVotes(address account) external view returns (uint256) {
        uint256 nCheckpoints = _countsSnapshots[account];
        return
            nCheckpoints != 0 ? _snapshots[account][nCheckpoints - 1].value : 0;
    }

    /**
     * @notice Determine the prior number of votes for an account as of a block number
     * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
     * @param account The address of the account to check
     * @param blockNumber The block number to get the vote balance at
     * @return The number of votes the account had as of the given block
     */
    function getPriorVotes(address account, uint256 blockNumber)
        external
        view
        returns (uint256)
    {
        require(blockNumber < block.number, "not yet determined");

        uint256 nCheckpoints = _countsSnapshots[account];
        if (nCheckpoints == 0) {
            return 0;
        }

        // First check most recent balance
        if (_snapshots[account][nCheckpoints - 1].blockNumber <= blockNumber) {
            return _snapshots[account][nCheckpoints - 1].value;
        }

        // Next check implicit zero balance
        if (_snapshots[account][0].blockNumber > blockNumber) {
            return 0;
        }

        uint256 lower = 0;
        uint256 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
            Snapshot memory cp = _snapshots[account][center];
            if (cp.blockNumber == blockNumber) {
                return cp.value;
            } else if (cp.blockNumber < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return _snapshots[account][lower].value;
    }

    /**
    * @dev Writes a snapshot for an owner of tokens
    * @param owner The owner of the tokens
    * @param oldValue The value before the operation that is gonna be executed after the snapshot
    * @param newValue The value after the operation
    */
    function _writeSnapshot(address owner, uint128 oldValue, uint128 newValue) internal virtual {
        uint128 currentBlock = uint128(block.number);

        uint256 ownerCountOfSnapshots = _countsSnapshots[owner];
        mapping (uint256 => Snapshot) storage snapshotsOwner = _snapshots[owner];

        // Doing multiple operations in the same block
        if (ownerCountOfSnapshots != 0 && snapshotsOwner[ownerCountOfSnapshots.sub(1)].blockNumber == currentBlock) {
            snapshotsOwner[ownerCountOfSnapshots.sub(1)].value = newValue;
        } else {
            snapshotsOwner[ownerCountOfSnapshots] = Snapshot(currentBlock, newValue);
            _countsSnapshots[owner] = ownerCountOfSnapshots.add(1);
        }

        emit SnapshotDone(owner, oldValue, newValue);
    }

    /**
    * @dev Writes a snapshot before any operation involving transfer of value: _transfer, _mint and _burn
    * - On _transfer, it writes snapshots for both "from" and "to"
    * - On _mint, only for _to
    * - On _burn, only for _from
    * @param from the from address
    * @param to the to address
    * @param amount the amount to transfer
    */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal override {
        if (from == to) {
            return;
        }

        if (from != address(0)) {
            uint256 fromBalance = balanceOf(from);
            _writeSnapshot(from, uint128(fromBalance), uint128(fromBalance.sub(amount)));
        }
        if (to != address(0)) {
            uint256 toBalance = balanceOf(to);
            _writeSnapshot(to, uint128(toBalance), uint128(toBalance.add(amount)));
        }

        // caching the Moonwell governance address to avoid multiple state loads
        ITransferHook governance = _governance;
        if (governance != ITransferHook(0)) {
            governance.onTransfer(from, to, amount);
        }
    }
}

File 8 of 19 : SafeERC20.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import {IERC20} from "../interfaces/IERC20.sol";
import {SafeMath} from "../libraries/SafeMath.sol";
import {Address} from "../libraries/Address.sol";

/**
 * @title SafeERC20
 * @dev From https://github.com/OpenZeppelin/openzeppelin-contracts
 * 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 SafeMath for uint256;
    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));
    }

    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        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 _callOptionalReturn(IERC20 token, bytes memory data) private {
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 9 of 19 : DistributionTypes.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

library DistributionTypes {
    struct AssetConfigInput {
        uint128 emissionPerSecond;
        uint256 totalStaked;
        address underlyingAsset;
    }

    struct UserStakeInput {
        address underlyingAsset;
        uint256 stakedByUser;
        uint256 totalStaked;
    }
}

File 10 of 19 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/utils/Initializable.sol)

pragma solidity 0.6.12;

/**
 * @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.
 */
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 11 of 19 : DistributionManager.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import {SafeMath} from './libraries/SafeMath.sol';
import {DistributionTypes} from './libraries/DistributionTypes.sol';
import {IDistributionManager} from './interfaces/IDistributionManager.sol';
import {IERC20} from './interfaces/IERC20.sol';

/**
 * @title DistributionManager
 * @notice Accounting contract to manage multiple staking distributions
 * @author Moonwell
 **/
contract DistributionManager is IDistributionManager {
    using SafeMath for uint256;

    struct AssetData {
        uint128 emissionPerSecond;
        uint128 lastUpdateTimestamp;
        uint256 index;
        mapping(address => uint256) users;
    }

    uint256 public DISTRIBUTION_END;

    address public EMISSION_MANAGER;

    uint8 public constant PRECISION = 18;

    mapping(address => AssetData) public assets;

    event AssetConfigUpdated(address indexed asset, uint256 emission);
    event AssetIndexUpdated(address indexed asset, uint256 index);
    event UserIndexUpdated(address indexed user, address indexed asset, uint256 index);

    function __DistributionManager_init_unchained(address emissionManager, uint256 distributionDuration) internal {
        require(emissionManager != address(0), 'ZERO_ADDRESS');
        DISTRIBUTION_END = block.timestamp.add(distributionDuration);
        EMISSION_MANAGER = emissionManager;
    }

    /**
     * @dev Configures the distribution of rewards for an asset. This method is useful because it automatically
     *      computes the amount of the asset that is staked.
     **/
    function configureAsset(uint128 emissionsPerSecond, IERC20 underlyingAsset) external override {
      require(msg.sender == EMISSION_MANAGER, 'ONLY_EMISSION_MANAGER');

      // Grab the balance of the underlying asset.
      uint256 totalStaked = underlyingAsset.balanceOf(address(this));

      // Pass data through to the configure assets function.
      _configureAssetInternal(emissionsPerSecond, totalStaked, address(underlyingAsset));
    }

    /**
     * @dev Configures the distribution of rewards for a list of assets
     * @param assetsConfigInput The list of configurations to apply
     **/
    function configureAssets(DistributionTypes.AssetConfigInput[] calldata assetsConfigInput) external override {
        require(msg.sender == EMISSION_MANAGER, 'ONLY_EMISSION_MANAGER');

        for (uint256 i = 0; i < assetsConfigInput.length; ++i) {
          _configureAssetInternal(
            assetsConfigInput[i].emissionPerSecond, 
            assetsConfigInput[i].totalStaked, 
            assetsConfigInput[i].underlyingAsset
          );
        }
    }

    function _configureAssetInternal(uint128 emissionsPerSecond, uint256 totalStaked, address underlyingAsset) internal {
      AssetData storage assetConfig = assets[underlyingAsset];

      _updateAssetStateInternal(
          underlyingAsset,
          assetConfig,
          totalStaked
      );

      assetConfig.emissionPerSecond = emissionsPerSecond;

      emit AssetConfigUpdated(
          underlyingAsset,
          emissionsPerSecond
      );
    }

    /**
     * @dev Updates the state of one distribution, mainly rewards index and timestamp
     * @param underlyingAsset The address used as key in the distribution, for example stkMFAM or the mTokens addresses on Moonwell
     * @param assetConfig Storage pointer to the distribution's config
     * @param totalStaked Current total of staked assets for this distribution
     * @return The new distribution index
     **/
    function _updateAssetStateInternal(
        address underlyingAsset,
        AssetData storage assetConfig,
        uint256 totalStaked
    ) internal returns (uint256) {
        uint256 oldIndex = assetConfig.index;
        uint128 lastUpdateTimestamp = assetConfig.lastUpdateTimestamp;

        if (block.timestamp == lastUpdateTimestamp) {
            return oldIndex;
        }

        uint256 newIndex = _getAssetIndex(
            oldIndex,
            assetConfig.emissionPerSecond,
            lastUpdateTimestamp,
            totalStaked
        );

        if (newIndex != oldIndex) {
            assetConfig.index = newIndex;
            emit AssetIndexUpdated(underlyingAsset, newIndex);
        }

        assetConfig.lastUpdateTimestamp = uint128(block.timestamp);

        return newIndex;
    }

  /**
   * @dev Updates the state of an user in a distribution
   * @param user The user's address
   * @param asset The address of the reference asset of the distribution
   * @param stakedByUser Amount of tokens staked by the user in the distribution at the moment
   * @param totalStaked Total tokens staked in the distribution
   * @return The accrued rewards for the user until the moment
   **/
  function _updateUserAssetInternal(
    address user,
    address asset,
    uint256 stakedByUser,
    uint256 totalStaked
  ) internal returns (uint256) {
    AssetData storage assetData = assets[asset];
    uint256 userIndex = assetData.users[user];
    uint256 accruedRewards = 0;

    uint256 newIndex = _updateAssetStateInternal(asset, assetData, totalStaked);

    if (userIndex != newIndex) {
      if (stakedByUser != 0) {
        accruedRewards = _getRewards(stakedByUser, newIndex, userIndex);
      }

      assetData.users[user] = newIndex;
      emit UserIndexUpdated(user, asset, newIndex);
    }

    return accruedRewards;
  }

  /**
   * @dev Used by "frontend" stake contracts to update the data of an user when claiming rewards from there
   * @param user The address of the user
   * @param stakes List of structs of the user data related with his stake
   * @return The accrued rewards for the user until the moment
   **/
  function _claimRewards(address user, DistributionTypes.UserStakeInput[] memory stakes)
    internal
    returns (uint256)
  {
    uint256 accruedRewards = 0;

    for (uint256 i = 0; i < stakes.length; ++i) {
      accruedRewards = accruedRewards.add(
        _updateUserAssetInternal(
          user,
          stakes[i].underlyingAsset,
          stakes[i].stakedByUser,
          stakes[i].totalStaked
        )
      );
    }

    return accruedRewards;
  }

  /**
   * @dev Return the accrued rewards for an user over a list of distribution
   * @param user The address of the user
   * @param stakes List of structs of the user data related with his stake
   * @return The accrued rewards for the user until the moment
   **/
  function _getUnclaimedRewards(address user, DistributionTypes.UserStakeInput[] memory stakes)
    internal
    view
    returns (uint256)
  {
    uint256 accruedRewards = 0;

    for (uint256 i = 0; i < stakes.length; ++i) {
      AssetData storage assetConfig = assets[stakes[i].underlyingAsset];
      uint256 assetIndex = _getAssetIndex(
        assetConfig.index,
        assetConfig.emissionPerSecond,
        assetConfig.lastUpdateTimestamp,
        stakes[i].totalStaked
      );

      accruedRewards = accruedRewards.add(
        _getRewards(stakes[i].stakedByUser, assetIndex, assetConfig.users[user])
      );
    }
    return accruedRewards;
  }

  /**
   * @dev Internal function for the calculation of user's rewards on a distribution
   * @param principalUserBalance Amount staked by the user on a distribution
   * @param reserveIndex Current index of the distribution
   * @param userIndex Index stored for the user, representation his staking moment
   * @return The rewards
   **/
  function _getRewards(
    uint256 principalUserBalance,
    uint256 reserveIndex,
    uint256 userIndex
  ) internal pure returns (uint256) {
    return principalUserBalance.mul(reserveIndex.sub(userIndex)).div(1e18);
  }

  /**
   * @dev Calculates the next value of an specific distribution index, with validations
   * @param currentIndex Current index of the distribution
   * @param emissionPerSecond Representing the total rewards distributed per second per asset unit, on the distribution
   * @param lastUpdateTimestamp Last moment this distribution was updated
   * @param totalBalance of tokens considered for the distribution
   * @return The new index.
   **/
  function _getAssetIndex(
    uint256 currentIndex,
    uint256 emissionPerSecond,
    uint128 lastUpdateTimestamp,
    uint256 totalBalance
  ) internal view returns (uint256) {
    if (
      emissionPerSecond == 0 ||
      totalBalance == 0 ||
      lastUpdateTimestamp == block.timestamp ||
      lastUpdateTimestamp >= DISTRIBUTION_END
    ) {
      return currentIndex;
    }

    uint256 currentTimestamp = block.timestamp > DISTRIBUTION_END
      ? DISTRIBUTION_END
      : block.timestamp;
    uint256 timeDelta = currentTimestamp.sub(lastUpdateTimestamp);
    return
      emissionPerSecond.mul(timeDelta).mul(1e18).div(totalBalance).add(
        currentIndex
      );
  }

  /**
   * @dev Returns the data of an user on a distribution
   * @param user Address of the user
   * @param asset The address of the reference asset of the distribution
   * @return The new index
   **/
  function getUserAssetData(address user, address asset) public view returns (uint256) {
    return assets[asset].users[user];
  }

  /**
   * @dev Changes the emissions manager.
   */
  function setEmissionsManager(address newEmissionsManager) external {
    require(msg.sender == EMISSION_MANAGER, 'ONLY_EMISSION_MANAGER');
    EMISSION_MANAGER = newEmissionsManager;
  }
}

File 12 of 19 : ReentrancyGuardUpgradeable.sol
pragma solidity 0.6.12;
import "../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 making 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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 13 of 19 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.4.24 <0.7.0;


/**
 * @title Initializable
 *
 * @dev Helper contract to support initializer functions. To use it, replace
 * the constructor with a function that has the `initializer` modifier.
 * WARNING: Unlike constructors, initializer functions must be manually
 * invoked. This applies both to deploying an Initializable contract, as well
 * as extending an Initializable contract via inheritance.
 * WARNING: When used with inheritance, manual care must be taken to not invoke
 * a parent initializer twice, or ensure that all initializers are idempotent,
 * because this is not dealt with automatically as with constructors.
 */
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 use in the initializer function of a contract.
   */
  modifier initializer() {
    require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");

    bool isTopLevelCall = !initializing;
    if (isTopLevelCall) {
      initializing = true;
      initialized = true;
    }

    _;

    if (isTopLevelCall) {
      initializing = false;
    }
  }

  /// @dev Returns true if and only if the function is running in the constructor
  function isConstructor() private view returns (bool) {
    // extcodesize checks the size of the code stored in an address, and
    // address returns the current address. Since the code is still not
    // deployed when running a constructor, any checks on its code size will
    // yield zero, making it an effective way to detect if a contract is
    // under construction or not.
    address self = address(this);
    uint256 cs;
    assembly { cs := extcodesize(self) }
    return cs == 0;
  }

  // Reserved storage space to allow for layout changes in the future.
  uint256[50] private ______gap;
}

File 14 of 19 : ERC20.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import {Context} from "./Context.sol";
import {IERC20} from "../interfaces/IERC20.sol";
import {IERC20Detailed} from "../interfaces/IERC20Detailed.sol";
import {SafeMath} from "./SafeMath.sol";

/**
 * @title ERC20
 * @notice Basic ERC20 implementation
 * @author Moonwell
 **/
contract ERC20 is Context, IERC20, IERC20Detailed {
    using SafeMath for uint256;

    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;
    uint256 private _totalSupply;
    string private _name;
    string private _symbol;
    uint8 private _decimals;

    function __ERC20_init_unchained(string memory name, string memory symbol, uint8 decimals) internal {
        _name = name;
        _symbol = symbol;
        _decimals = decimals;
    }

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

    /**
    * @return the symbol of the token
    **/
    function symbol() public override view returns (string memory) {
        return _symbol;
    }

    /**
    * @return the decimals of the token
    **/
    function decimals() public override view returns (uint8) {
        return _decimals;
    }

    /**
    * @return the total supply of the token
    **/
    function totalSupply() public override view returns (uint256) {
        return _totalSupply;
    }

    /**
    * @return the balance of the token
    **/
    function balanceOf(address account) public override view returns (uint256) {
        return _balances[account];
    }

    /**
    * @dev executes a transfer of tokens from msg.sender to recipient
    * @param recipient the recipient of the tokens
    * @param amount the amount of tokens being transferred
    * @return true if the transfer succeeds, false otherwise
    **/
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
    * @dev returns the allowance of spender on the tokens owned by owner
    * @param owner the owner of the tokens
    * @param spender the user allowed to spend the owner"s tokens
    * @return the amount of owner"s tokens spender is allowed to spend
    **/
    function allowance(address owner, address spender)
    public
    virtual
    override
    view
    returns (uint256)
    {
        return _allowances[owner][spender];
    }

    /**
    * @dev allows spender to spend the tokens owned by msg.sender
    * @param spender the user allowed to spend msg.sender tokens
    * @return true
    **/
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
    * @dev executes a transfer of token from sender to recipient, if msg.sender is allowed to do so
    * @param sender the owner of the tokens
    * @param recipient the recipient of the tokens
    * @param amount the amount of tokens being transferred
    * @return true if the transfer succeeds, false otherwise
    **/
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(
            sender,
            _msgSender(),
            _allowances[sender][_msgSender()].sub(amount, 'ERC20: transfer amount exceeds allowance')
        );
        return true;
    }

    /**
    * @dev increases the allowance of spender to spend msg.sender tokens
    * @param spender the user allowed to spend on behalf of msg.sender
    * @param addedValue the amount being added to the allowance
    * @return true
    **/
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
    * @dev decreases the allowance of spender to spend msg.sender tokens
    * @param spender the user allowed to spend on behalf of msg.sender
    * @param subtractedValue the amount being subtracted to the allowance
    * @return true
    **/
    function decreaseAllowance(address spender, uint256 subtractedValue)
    public
    virtual
    returns (bool)
    {
        _approve(
            _msgSender(),
            spender,
            _allowances[_msgSender()][spender].sub(
            subtractedValue,
            'ERC20: decreased allowance below zero'
            )
        );
        return true;
    }

    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), 'ERC20: transfer from the zero address');
        require(recipient != address(0), 'ERC20: transfer to the zero address');

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, 'ERC20: transfer amount exceeds balance');
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), 'ERC20: mint to the zero address');

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

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), 'ERC20: burn from the zero address');

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

        _balances[account] = _balances[account].sub(amount, 'ERC20: burn amount exceeds balance');
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), 'ERC20: approve from the zero address');
        require(spender != address(0), 'ERC20: approve to the zero address');

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

    function _setName(string memory newName) internal {
        _name = newName;
    }

    function _setSymbol(string memory newSymbol) internal {
        _symbol = newSymbol;
    }

    function _setDecimals(uint8 newDecimals) internal {
        _decimals = newDecimals;
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 15 of 19 : Context.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

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

    function _msgData() internal virtual view returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 16 of 19 : IERC20Detailed.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

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

/**
 * @dev Interface for ERC20 including metadata
 **/
interface IERC20Detailed is IERC20 {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
}

File 17 of 19 : SafeMath.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @dev From https://github.com/OpenZeppelin/openzeppelin-contracts
 * Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, 'SafeMath: addition overflow');

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, 'SafeMath: subtraction overflow');
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, 'SafeMath: multiplication overflow');

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, 'SafeMath: division by zero');
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, 'SafeMath: modulo by zero');
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 18 of 19 : Address.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @dev Collection of functions related to the address type
 * From https://github.com/OpenZeppelin/openzeppelin-contracts
 */
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) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            codehash := extcodehash(account)
        }
        return (codehash != accountHash && codehash != 0x0);
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{value: amount}('');
        require(success, 'Address: unable to send value, recipient may have reverted');
    }
}

File 19 of 19 : IDistributionManager.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import {IERC20} from "./IERC20.sol";
import {DistributionTypes} from "../libraries/DistributionTypes.sol";

interface IDistributionManager {
  function configureAsset(uint128 emissionPerSecond, IERC20 underlyingAsset) external;
  function configureAssets(DistributionTypes.AssetConfigInput[] calldata assetsConfigInput) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 999999
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"emission","type":"uint256"}],"name":"AssetConfigUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"AssetIndexUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Cooldown","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsAccrued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint128","name":"oldValue","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"newValue","type":"uint128"}],"name":"SnapshotDone","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"onBehalfOf","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"UserIndexUpdated","type":"event"},{"inputs":[],"name":"COOLDOWN_SECONDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DISTRIBUTION_END","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EMISSION_MANAGER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARDS_VAULT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKED_TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNSTAKE_WINDOW","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_countsSnapshots","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_governance","outputs":[{"internalType":"contract ITransferHook","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"_snapshots","outputs":[{"internalType":"uint128","name":"blockNumber","type":"uint128"},{"internalType":"uint128","name":"value","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"assets","outputs":[{"internalType":"uint128","name":"emissionPerSecond","type":"uint128"},{"internalType":"uint128","name":"lastUpdateTimestamp","type":"uint128"},{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"emissionsPerSecond","type":"uint128"},{"internalType":"contract IERC20","name":"underlyingAsset","type":"address"}],"name":"configureAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint128","name":"emissionPerSecond","type":"uint128"},{"internalType":"uint256","name":"totalStaked","type":"uint256"},{"internalType":"address","name":"underlyingAsset","type":"address"}],"internalType":"struct DistributionTypes.AssetConfigInput[]","name":"assetsConfigInput","type":"tuple[]"}],"name":"configureAssets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getCurrentVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromCooldownTimestamp","type":"uint256"},{"internalType":"uint256","name":"amountToReceive","type":"uint256"},{"internalType":"address","name":"toAddress","type":"address"},{"internalType":"uint256","name":"toBalance","type":"uint256"}],"name":"getNextCooldownTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getPriorVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"getTotalRewardsBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"asset","type":"address"}],"name":"getUserAssetData","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"stakedToken","type":"address"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"cooldownSeconds","type":"uint256"},{"internalType":"uint256","name":"unstakeWindow","type":"uint256"},{"internalType":"address","name":"rewardsVault","type":"address"},{"internalType":"address","name":"emissionManager","type":"address"},{"internalType":"uint128","name":"distributionDuration","type":"uint128"},{"internalType":"address","name":"governance","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newEmissionsManager","type":"address"}],"name":"setEmissionsManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"onBehalfOf","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakerRewardsToClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakersCooldowns","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50613dd5806100206000396000f3fe608060405234801561001057600080fd5b50600436106102925760003560e01c80638779588c11610160578063a9059cbb116100d8578063cbcbb5071161008c578063e856611811610071578063e8566118146104f0578063f11b818814610503578063f1cc432a1461052557610292565b8063cbcbb507146104d5578063dd62ed3e146104dd57610292565b8063adc9772e116100bd578063adc9772e1461049c578063b2a5dbfa146104af578063b4b5ea57146104c257610292565b8063a9059cbb14610481578063aaf5eb681461049457610292565b8063946776cd1161012f57806399248ea71161011457806399248ea7146104535780639a99b4f01461045b578063a457c2d71461046e57610292565b8063946776cd1461044357806395d89b411461044b57610292565b80638779588c1461040257806389e72095146104155780638dbefee214610428578063919cd40f1461043b57610292565b8063313ce5671161020e57806370a08231116101c2578063782d6fe1116101a7578063782d6fe1146103d4578063787a08a6146103e75780637e90d7ef146103ef57610292565b806370a08231146103b957806372b49d63146103cc57610292565b8063359c4a96116101f3578063359c4a961461038b578063395093511461039357806339834025146103a657610292565b8063313ce567146103635780633373ee4c1461037857610292565b80631c2f3e3d1161026557806323b872dd1161024a57806323b872dd146103275780632acbf8231461033a578063312f6b831461035b57610292565b80631c2f3e3d146102fd5780631e9a69501461031257610292565b806306fdde0314610297578063091030c3146102b5578063095ea7b3146102d557806318160ddd146102f5575b600080fd5b61029f610538565b6040516102ac91906135ff565b60405180910390f35b6102c86102c33660046132af565b6105ec565b6040516102ac9190613ca5565b6102e86102e3366004613343565b6105fe565b6040516102ac91906135f4565b6102c861061c565b610305610622565b6040516102ac919061353c565b610325610320366004613343565b61063e565b005b6102e8610335366004613303565b6108a9565b61034d610348366004613343565b61094b565b6040516102ac929190613c55565b610305610992565b61036b6109ae565b6040516102ac9190613cae565b6102c86103863660046132cb565b6109b7565b6102c86109f4565b6102e86103a1366004613343565b6109fa565b6103256103b43660046134ae565b610a55565b6102c86103c73660046132af565b610b5d565b6102c8610b85565b6102c86103e2366004613343565b610b8b565b610325610ea3565b6102c86103fd3660046132af565b610f1c565b6102c86104103660046132af565b610f2e565b6103256104233660046133fe565b610f40565b6102c86104363660046132af565b610fc8565b6102c8611091565b610305611097565b61029f6110b3565b610305611132565b610325610469366004613343565b61114e565b6102e861047c366004613343565b6112d0565b6102e861048f366004613343565b611345565b61036b611359565b6103256104aa366004613343565b61135e565b6103256104bd36600461336e565b61159d565b6102c86104d03660046132af565b611665565b61030561172a565b6102c86104eb3660046132cb565b611746565b6103256104fe3660046132af565b61177e565b6105166105113660046132af565b611816565b6040516102ac93929190613c78565b6102c86105333660046134e2565b61185a565b60038054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105e25780601f106105b7576101008083540402835291602001916105e2565b820191906000526020600020905b8154815290600101906020018083116105c557829003601f168201915b5050505050905090565b60446020526000908152604090205481565b600061061261060b611953565b8484611957565b5060015b92915050565b60025490565b60085473ffffffffffffffffffffffffffffffffffffffff1681565b6002600c541415610684576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613b93565b60405180910390fd5b6002600c55806106c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613741565b73ffffffffffffffffffffffffffffffffffffffff821661070d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613a6b565b336000908152604460205260409081902054905461072c908290611a66565b4211610764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b906137e4565b60415461078661077f60405484611a6690919063ffffffff16565b4290611aa5565b11156107be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613a34565b60006107c933610b5d565b905060008184116107da57836107dc565b815b90506107ea33836001611ae7565b506107f53382611ba6565b6107ff8282611aa5565b61081457336000908152604460205260408120555b603e546108389073ffffffffffffffffffffffffffffffffffffffff168683611cd6565b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fd12200efa34901b99367694174c3b0d32c99585fdf37c7c26892136ddd0836d9836040516108959190613ca5565b60405180910390a350506001600c55505050565b60006108b6848484611d77565b610940846108c2611953565b61093b85604051806060016040528060288152602001613d536028913973ffffffffffffffffffffffffffffffffffffffff8a1660009081526001602052604081209061090d611953565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020549190611e84565b611957565b5060015b9392505050565b60066020908152600092835260408084209091529082529020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b603e5473ffffffffffffffffffffffffffffffffffffffff1681565b60055460ff1690565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600b60209081526040808320938616835260029093019052205492915050565b60415481565b6000610612610a07611953565b8461093b8560016000610a18611953565b73ffffffffffffffffffffffffffffffffffffffff908116825260208083019390935260409182016000908120918c168152925290205490611a66565b600a5473ffffffffffffffffffffffffffffffffffffffff163314610aa6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b9061390c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190610afb90309060040161353c565b60206040518083038186803b158015610b1357600080fd5b505afa158015610b27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4b91906134ca565b9050610b58838284611eca565b505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b60405481565b6000438210610bc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613778565b73ffffffffffffffffffffffffffffffffffffffff831660009081526007602052604090205480610bfb576000915050610616565b73ffffffffffffffffffffffffffffffffffffffff841660009081526006602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff850184529091529020546fffffffffffffffffffffffffffffffff168310610ce75773ffffffffffffffffffffffffffffffffffffffff841660009081526006602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909401835292905220546fffffffffffffffffffffffffffffffff700100000000000000000000000000000000909104169050610616565b73ffffffffffffffffffffffffffffffffffffffff841660009081526006602090815260408083208380529091529020546fffffffffffffffffffffffffffffffff16831015610d3b576000915050610616565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82015b81811115610e42576002828203048103610d796131ae565b5073ffffffffffffffffffffffffffffffffffffffff871660009081526006602090815260408083208484528252918290208251808401909352546fffffffffffffffffffffffffffffffff8082168085527001000000000000000000000000000000009092041691830191909152871415610e1157602001516fffffffffffffffffffffffffffffffff1694506106169350505050565b80516fffffffffffffffffffffffffffffffff16871115610e3457819350610e3b565b6001820392505b5050610d61565b5073ffffffffffffffffffffffffffffffffffffffff8516600090815260066020908152604080832093835292905220546fffffffffffffffffffffffffffffffff7001000000000000000000000000000000009091041691505092915050565b610eac33610b5d565b610ee2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613b5c565b33600081815260446020526040808220429055517ff52f50426b32362d3e6bb8cb36b7074756b224622def6352a59eac7f66ebe6e89190a2565b60436020526000908152604090205481565b60076020526000908152604090205481565b610fbe888888888888886040518060400160405280600b81526020017f5374616b65642057454c4c0000000000000000000000000000000000000000008152506040518060400160405280600781526020017f73746b57454c4c0000000000000000000000000000000000000000000000000081525060128b611f8b565b5050505050505050565b60408051600180825281830190925260009160609190816020015b610feb6131c5565b815260200190600190039081610fe357905050905060405180606001604052803073ffffffffffffffffffffffffffffffffffffffff16815260200161103085610b5d565b815260200161103d61061c565b8152508160008151811061104d57fe5b60200260200101819052506109446110658483612122565b73ffffffffffffffffffffffffffffffffffffffff851660009081526043602052604090205490611a66565b60095481565b60425473ffffffffffffffffffffffffffffffffffffffff1681565b60048054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105e25780601f106105b7576101008083540402835291602001916105e2565b603f5473ffffffffffffffffffffffffffffffffffffffff1681565b6002600c54141561118b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613b93565b6002600c5560006111a63361119f81610b5d565b6000611ae7565b905060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83146111d757826111d9565b815b9050611225816040518060400160405280600e81526020017f494e56414c49445f414d4f554e5400000000000000000000000000000000000081525084611e849092919063ffffffff16565b33600090815260436020526040902055604254603f546112609173ffffffffffffffffffffffffffffffffffffffff91821691168684612253565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c7836040516112bd9190613ca5565b60405180910390a350506001600c555050565b60006106126112dd611953565b8461093b85604051806060016040528060258152602001613d7b6025913960016000611307611953565b73ffffffffffffffffffffffffffffffffffffffff908116825260208083019390935260409182016000908120918d16815292529020549190611e84565b6000610612611352611953565b8484611d77565b601281565b6002600c54141561139b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613b93565b6002600c55806113d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613741565b73ffffffffffffffffffffffffffffffffffffffff8216611424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613943565b600061142f83610b5d565b9050600061144684308461144161061c565b612274565b905080156114de577f2468f9268c60ad90e2d49edb0032c8a001e733ae888b3ab8e982edf535be1a76848260405161147f9291906135ce565b60405180910390a173ffffffffffffffffffffffffffffffffffffffff84166000908152604360205260409020546114b79082611a66565b73ffffffffffffffffffffffffffffffffffffffff85166000908152604360205260409020555b6114eb600084868561185a565b73ffffffffffffffffffffffffffffffffffffffff851660009081526044602052604090205561151b848461234d565b603e546115409073ffffffffffffffffffffffffffffffffffffffff16333086612253565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f5dac0c1b1112564a045ba943c9d50270893e8e826c49be8e7073adc713ab7bd7856040516112bd9190613ca5565b600a5473ffffffffffffffffffffffffffffffffffffffff1633146115ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b9061390c565b60005b81811015610b585761165d83838381811061160857fe5b61161e9260206060909202019081019150613493565b84848481811061162a57fe5b9050606002016020013585858581811061164057fe5b905060600201604001602081019061165891906132af565b611eca565b6001016115f1565b73ffffffffffffffffffffffffffffffffffffffff811660009081526007602052604081205480611697576000611711565b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8501845290915290205470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff165b6fffffffffffffffffffffffffffffffff169392505050565b600a5473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b600a5473ffffffffffffffffffffffffffffffffffffffff1633146117cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b9061390c565b600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600b60205260009081526040902080546001909101546fffffffffffffffffffffffffffffffff808316927001000000000000000000000000000000009004169083565b73ffffffffffffffffffffffffffffffffffffffff82166000908152604460205260408120548061188f57600091505061194b565b60006118b26041546118ac60405442611aa590919063ffffffff16565b90611aa5565b9050818111156118c5576000915061191f565b60008782116118d457876118d6565b425b9050828110156118eb5782935050505061194b565b61191b6118f88887611a66565b6119156119058887612442565b61190f8b86612442565b90611a66565b90612496565b9250505b5073ffffffffffffffffffffffffffffffffffffffff8416600090815260446020526040902081905590505b949350505050565b3390565b73ffffffffffffffffffffffffffffffffffffffff83166119a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613aa2565b73ffffffffffffffffffffffffffffffffffffffff82166119f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b906136ad565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590611a59908590613ca5565b60405180910390a3505050565b600082820183811015610944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b9061370a565b600061094483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e84565b600080611af885308661144161061c565b73ffffffffffffffffffffffffffffffffffffffff861660009081526043602052604081205491925090611b2c9083611a66565b90508115611b9d578315611b635773ffffffffffffffffffffffffffffffffffffffff861660009081526043602052604090208190555b7f2468f9268c60ad90e2d49edb0032c8a001e733ae888b3ab8e982edf535be1a768683604051611b949291906135ce565b60405180910390a15b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff8216611bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b9061397a565b611bff826000836124d8565b611c4981604051806060016040528060228152602001613d0b6022913973ffffffffffffffffffffffffffffffffffffffff85166000908152602081905260409020549190611e84565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902055600254611c7c9082611aa5565b60025560405160009073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611cca908590613ca5565b60405180910390a35050565b610b588363a9059cbb60e01b8484604051602401611cf59291906135ce565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261262d565b6000611d8284610b5d565b9050611d9084826001611ae7565b508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614611e73576000611dcf84610b5d565b9050611ddd84826001611ae7565b5073ffffffffffffffffffffffffffffffffffffffff8516600090815260446020526040902054611e108185878561185a565b73ffffffffffffffffffffffffffffffffffffffff86166000908152604460205260409020558284148015611e4457508015155b15611e705773ffffffffffffffffffffffffffffffffffffffff86166000908152604460205260408120555b50505b611e7e84848461277a565b50505050565b60008184841115611ec2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b91906135ff565b505050900390565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b60205260409020611efa828285612904565b5080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff851617815560405173ffffffffffffffffffffffffffffffffffffffff8316907f87fa03892a0556cb6b8f97e6d533a150d4d55fcbf275fff5fa003fa636bcc7fa90611f7d908790613c38565b60405180910390a250505050565b6008547501000000000000000000000000000000000000000000900460ff1680611fd0575060085474010000000000000000000000000000000000000000900460ff16155b612006576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613852565b6008547501000000000000000000000000000000000000000000900460ff161580156120a857600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff90911675010000000000000000000000000000000000000000001716740100000000000000000000000000000000000000001790555b6120b0612a03565b6120bb858585612b5a565b6120d787876fffffffffffffffffffffffffffffffff16612bb8565b6120e58c8c8c8c8c87612c5a565b801561211457600880547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1690555b505050505050505050505050565b600080805b835181101561224b576000600b600086848151811061214257fe5b6020908102919091018101515173ffffffffffffffffffffffffffffffffffffffff16825281019190915260400160009081206001810154815488519294506121cd926fffffffffffffffffffffffffffffffff80831692700100000000000000000000000000000000900416908a90889081106121bc57fe5b602002602001015160400151612cd7565b905061223c6122358785815181106121e157fe5b602002602001015160200151838560020160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d91565b8590611a66565b93505050806001019050612127565b509392505050565b611e7e846323b872dd60e01b858585604051602401611cf59392919061355d565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600b6020908152604080832093881683526002840190915281205490919082806122bc888588612904565b90508083146123415786156122d9576122d6878285612d91565b91505b73ffffffffffffffffffffffffffffffffffffffff808a1660008181526002870160205260409081902084905551918a16917fbb123b5c06d5408bbea3c4fef481578175cfb432e3b482c6186f02ed9086585b90612338908590613ca5565b60405180910390a35b50979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff821661239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613c01565b6123a6600083836124d8565b6002546123b39082611a66565b60025573ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020546123e69082611a66565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611cca908590613ca5565b60008261245157506000610616565b8282028284828161245e57fe5b0414610944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b906138af565b600061094483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612db3565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561251157610b58565b73ffffffffffffffffffffffffffffffffffffffff83161561255057600061253884610b5d565b905061254e84826125498186611aa5565b612e04565b505b73ffffffffffffffffffffffffffffffffffffffff82161561258a57600061257783610b5d565b905061258883826125498186611a66565b505b60085473ffffffffffffffffffffffffffffffffffffffff168015611e7e576040517f4a39314900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821690634a393149906125ff9087908790879060040161355d565b600060405180830381600087803b15801561261957600080fd5b505af1158015610fbe573d6000803e3d6000fd5b61264c8273ffffffffffffffffffffffffffffffffffffffff16612fdb565b612682576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613bca565b600060608373ffffffffffffffffffffffffffffffffffffffff16836040516126ab9190613520565b6000604051808303816000865af19150503d80600081146126e8576040519150601f19603f3d011682016040523d82523d6000602084013e6126ed565b606091505b509150915081612729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b906137af565b805115611e7e578080602001905181019061274491906133de565b611e7e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613aff565b73ffffffffffffffffffffffffffffffffffffffff83166127c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b906139d7565b73ffffffffffffffffffffffffffffffffffffffff8216612814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613650565b61281f8383836124d8565b61286981604051806060016040528060268152602001613d2d6026913973ffffffffffffffffffffffffffffffffffffffff86166000908152602081905260409020549190611e84565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822093909355908416815220546128a59082611a66565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611a59908590613ca5565b600182015482546000919070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff164281141561294557509050610944565b84546000906129699084906fffffffffffffffffffffffffffffffff168488612cd7565b90508281146129ca578086600101819055508673ffffffffffffffffffffffffffffffffffffffff167f5777ca300dfe5bead41006fbce4389794dbc0ed8d6cccebfaf94630aa04184bc826040516129c19190613ca5565b60405180910390a25b85546fffffffffffffffffffffffffffffffff428116700100000000000000000000000000000000029116178655925050509392505050565b6008547501000000000000000000000000000000000000000000900460ff1680612a48575060085474010000000000000000000000000000000000000000900460ff16155b612a7e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613852565b6008547501000000000000000000000000000000000000000000900460ff16158015612b2057600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff90911675010000000000000000000000000000000000000000001716740100000000000000000000000000000000000000001790555b612b28613014565b8015612b5757600880547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1690555b50565b8251612b6d9060039060208601906131fc565b508151612b819060049060208501906131fc565b50600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff929092169190911790555050565b73ffffffffffffffffffffffffffffffffffffffff8216612c05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b9061381b565b612c0f4282611a66565b60095550600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b603e805473ffffffffffffffffffffffffffffffffffffffff8089167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255603f8054888416908316179055604086905560418590556042805492851692909116919091179055612ccf81613167565b505050505050565b6000831580612ce4575081155b80612d00575042836fffffffffffffffffffffffffffffffff16145b80612d1f5750600954836fffffffffffffffffffffffffffffffff1610155b15612d2b57508361194b565b60006009544211612d3c5742612d40565b6009545b90506000612d60826fffffffffffffffffffffffffffffffff8716611aa5565b9050612d868761190f86611915670de0b6b3a7640000612d808c88612442565b90612442565b979650505050505050565b600061194b670de0b6b3a7640000611915612dac8686611aa5565b8790612442565b60008183612dee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b91906135ff565b506000838581612dfa57fe5b0495945050505050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526007602090815260408083205460069092529091204391908115801590612e8857506fffffffffffffffffffffffffffffffff8316816000612e63856001611aa5565b81526020810191909152604001600020546fffffffffffffffffffffffffffffffff16145b15612ee25783816000612e9c856001611aa5565b8152602081019190915260400160002080546fffffffffffffffffffffffffffffffff928316700100000000000000000000000000000000029216919091179055612f98565b6040805180820182526fffffffffffffffffffffffffffffffff80861682528681166020808401918252600087815290869052939093209151825493518216700100000000000000000000000000000000029082167fffffffffffffffffffffffffffffffff000000000000000000000000000000009094169390931716919091179055612f71826001611a66565b73ffffffffffffffffffffffffffffffffffffffff87166000908152600760205260409020555b7f2cd3c83ddac2953ee75f53265d9ea4463eaf05030e5459a1b7e63819b7ce88f7868686604051612fcb9392919061358e565b60405180910390a1505050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061194b575050151592915050565b6008547501000000000000000000000000000000000000000000900460ff1680613059575060085474010000000000000000000000000000000000000000900460ff16155b61308f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067b90613852565b6008547501000000000000000000000000000000000000000000900460ff1615801561313157600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff90911675010000000000000000000000000000000000000000001716740100000000000000000000000000000000000000001790555b6001600c558015612b5757600880547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b604080518082019091526000808252602082015290565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061323d57805160ff191683800117855561326a565b8280016001018555821561326a579182015b8281111561326a57825182559160200191906001019061324f565b5061327692915061327a565b5090565b5b80821115613276576000815560010161327b565b80356fffffffffffffffffffffffffffffffff8116811461061657600080fd5b6000602082840312156132c0578081fd5b813561094481613ce8565b600080604083850312156132dd578081fd5b82356132e881613ce8565b915060208301356132f881613ce8565b809150509250929050565b600080600060608486031215613317578081fd5b833561332281613ce8565b9250602084013561333281613ce8565b929592945050506040919091013590565b60008060408385031215613355578182fd5b823561336081613ce8565b946020939093013593505050565b60008060208385031215613380578182fd5b823567ffffffffffffffff80821115613397578384fd5b818501915085601f8301126133aa578384fd5b8135818111156133b8578485fd5b8660206060830285010111156133cc578485fd5b60209290920196919550909350505050565b6000602082840312156133ef578081fd5b81518015158114610944578182fd5b600080600080600080600080610100898b03121561341a578384fd5b883561342581613ce8565b9750602089013561343581613ce8565b96506040890135955060608901359450608089013561345381613ce8565b935060a089013561346381613ce8565b92506134728a60c08b0161328f565b915060e089013561348281613ce8565b809150509295985092959890939650565b6000602082840312156134a4578081fd5b610944838361328f565b600080604083850312156134c0578182fd5b6132e8848461328f565b6000602082840312156134db578081fd5b5051919050565b600080600080608085870312156134f7578384fd5b8435935060208501359250604085013561351081613ce8565b9396929550929360600135925050565b60008251613532818460208701613cbc565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff9390931683526fffffffffffffffffffffffffffffffff918216602084015216604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b901515815260200190565b600060208252825180602084015261361e816040850160208701613cbc565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560408201527f7373000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526013908201527f494e56414c49445f5a45524f5f414d4f554e5400000000000000000000000000604082015260600190565b60208082526012908201527f6e6f74207965742064657465726d696e65640000000000000000000000000000604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b60208082526015908201527f494e53554646494349454e545f434f4f4c444f574e0000000000000000000000604082015260600190565b6020808252600c908201527f5a45524f5f414444524553530000000000000000000000000000000000000000604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201527f647920696e697469616c697a6564000000000000000000000000000000000000606082015260800190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526015908201527f4f4e4c595f454d495353494f4e5f4d414e414745520000000000000000000000604082015260600190565b60208082526012908201527f5354414b455f5a45524f5f414444524553530000000000000000000000000000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360408201527f7300000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526017908201527f554e5354414b455f57494e444f575f46494e4953484544000000000000000000604082015260600190565b60208082526013908201527f52454445454d5f5a45524f5f4144445245535300000000000000000000000000604082015260600190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f494e56414c49445f42414c414e43455f4f4e5f434f4f4c444f574e0000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601f908201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b6fffffffffffffffffffffffffffffffff91909116815260200190565b6fffffffffffffffffffffffffffffffff92831681529116602082015260400190565b6fffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b90815260200190565b60ff91909116815260200190565b60005b83811015613cd7578181015183820152602001613cbf565b83811115611e7e5750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612b5757600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212202a7d398ef0696757cd56dd7ab48b3d642fb9f8f1226401d0246782f0dbc0fb4f64736f6c634300060c0033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.