false
false
0

Contract Address Details

0x7f178a2410597FE8168B0605F900d68353C3dd5b

Contract Name
FortunaRewardManager
Creator
0x999c86–2e47a2 at 0x955bc3–d6a669
Balance
0 SGB
Tokens
Fetching tokens...
Transactions
69,995 Transactions
Transfers
191,957 Transfers
Gas Used
25,256,283,017
Last Balance Update
58938526
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
FortunaRewardManager




Optimization enabled
true
Compiler version
v0.8.9+commit.e5eed63a




Optimization runs
200
Verified at
2022-07-22T16:10:39.773754Z

Constructor Arguments

0000000000000000000000001b00870092a929d160492daf8e734b4bca0332660000000000000000000000009e2e6c16803878c18e54ed74f05aeafcce4646260000000000000000000000003157537399860305ebe9e7fd17cfa00aae291c8200000000000000000000000000000000000000000000000000000000000082350000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000af0000000000000000000000000000000000000000000000004b728dd78183e6000000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b

Arg [0] (address) : 0x1b00870092a929d160492daf8e734b4bca033266
Arg [1] (address) : 0x9e2e6c16803878c18e54ed74f05aeafcce464626
Arg [2] (address) : 0x3157537399860305ebe9e7fd17cfa00aae291c82
Arg [3] (uint256) : 33333
Arg [4] (uint256[3]) : d–¯
Arg [5] (uint256) : 5436563656920000000
Arg [6] (uint256) : 1000000000000000000
Arg [7] (uint256) : 25
Arg [8] (uint256) : 0
Arg [9] (uint256) : 43

              

contracts/FortunaRewardManager.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

import "./IFortuna.sol";
import "./IFtsoRewardManager.sol";
import "./IFtsoManager.sol";
import "./DelegationTracker.sol";
import "./Multiplier.sol";
import "./FortunaRewards.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

contract FortunaRewardManager is
    FortunaRewards,
    DelegationTracker,
    Multiplier,
    Pausable
{
    using SafeMath for uint256;

    event RewardClaimed(
        address indexed whoClaimed,
        address indexed sentTo,
        uint256 rewardEpoch,
        uint256 amount
    );

    uint256 public immutable priceToken;
    uint256 public immutable priceNat;

    uint256 public fundingRatio;
    uint256 public genMultiplier;

    address public provider;

    IFortuna public token;

    // Flare smart contracts
    IVPToken public vpToken;
    IFtsoRewardManager public ftsoRewardManager;
    IFtsoManager public ftsoManager;

    uint256 public firstRewardEpoch;

    constructor(
        address _provider,
        IFortuna _token,
        IERC1155 multiplierToken,
        uint256 multiplierId,
        uint256[3] memory multipliers,
        uint256 _priceToken,
        uint256 _priceNat,
        uint256 _fundingRatio,
        uint256 _genMultiplier,
        uint256 _firstRewardEpoch
    )
        DelegationTracker()
        Multiplier(multiplierToken, multiplierId, multipliers)
    {
        provider = _provider;
        token = _token;
        priceToken = _priceToken;
        priceNat = _priceNat;
        fundingRatio = _fundingRatio;
        genMultiplier = _genMultiplier;
        firstRewardEpoch = _firstRewardEpoch;
    }

    function getStateOfRewards(address beneficiary, uint256 rewardEpoch)
        external
        view
        returns (
            uint256 rewardAmount,
            bool claimed,
            bool claimable
        )
    {
        uint256 claimedReward = rewards[beneficiary][rewardEpoch].amount;
        if (claimedReward > 0) rewardAmount = claimedReward;
        else (rewardAmount, ) = getRewardAmount(beneficiary, rewardEpoch);

        claimed = rewardClaimed(beneficiary, rewardEpoch);

        claimable =
            rewardEpoch >= firstRewardEpoch &&
            rewardEpoch >= ftsoRewardManager.getRewardEpochToExpireNext() &&
            rewardEpoch < ftsoManager.getCurrentRewardEpoch();
    }

    function getEpochsWithUnclaimedRewards(address beneficiary)
        external
        view
        returns (uint256[] memory)
    {
        uint256 start = ftsoRewardManager.getRewardEpochToExpireNext();
        if (start < firstRewardEpoch) start = firstRewardEpoch;
        uint256 latestClaimableEpoch = ftsoManager.getCurrentRewardEpoch() - 1;

        uint256 count = 0;
        uint256 i;
        for (i = start; i <= latestClaimableEpoch; i++) {
            if (!rewardClaimed(beneficiary, i)) {
                (uint256 rewardAmount, ) = getRewardAmount(beneficiary, i);
                if (rewardAmount > 0) count++;
            }
        }

        uint256[] memory epochs = new uint256[](count);
        uint256 j = 0;
        for (i = start; i <= latestClaimableEpoch; i++) {
            if (!rewardClaimed(beneficiary, i)) {
                (uint256 rewardAmount, ) = getRewardAmount(beneficiary, i);
                if (rewardAmount > 0) {
                    epochs[j] = i;
                    j++;
                }
            }
        }

        return epochs;
    }

    function getTotalUnclaimedRewards(address beneficiary)
        external
        view
        returns (uint256)
    {
        uint256 start = ftsoRewardManager.getRewardEpochToExpireNext();
        if (start < firstRewardEpoch) start = firstRewardEpoch;
        uint256 latestClaimableEpoch = ftsoManager.getCurrentRewardEpoch() - 1;

        uint256 total;
        for (uint256 epoch = start; epoch <= latestClaimableEpoch; epoch++) {
            if (rewardClaimed(beneficiary, epoch)) continue;
            (uint256 amount, ) = getRewardAmount(beneficiary, epoch);
            total = total.add(amount);
        }

        return total;
    }

    function getEpochReward(uint256 rewardEpoch)
        public
        view
        returns (
            uint256 totalReward,
            uint256 claimedReward,
            bool claimable
        )
    {
        if (rewardEpoch < firstRewardEpoch) return (0, 0, false);

        (uint256 providerRewardNat, bool _claimable) = getProviderNatReward(
            rewardEpoch
        );

        claimable = _claimable;

        if (providerRewardNat > 0) {
            totalReward = providerRewardNat
                .mul(fundingRatio)
                .div(100)
                .mul(priceToken)
                .div(priceNat);

            if (genMultiplier > 0) {
                totalReward = totalReward.add(
                    totalReward.mul(genMultiplier).div(100)
                );
            }
        }

        claimedReward = getTotalClaimedReward(rewardEpoch);
    }

    function claimReward(address recipient, uint256[] memory rewardEpochs)
        external
    {
        for (uint256 i = 0; i < rewardEpochs.length; i++) {
            _claimReward(recipient, rewardEpochs[i]);
        }
    }

    function _claimReward(address recipient, uint256 rewardEpoch)
        private
        whenNotPaused
    {
        require(!rewardClaimed(msg.sender, rewardEpoch), "Already claimed");

        (uint256 tokenAmount, bool claimable) = getRewardAmount(
            msg.sender,
            rewardEpoch
        );

        require(claimable, "Epoch not claimable");

        uint256 tokenBalance = token.balanceOf(address(this));
        if (tokenBalance < tokenAmount) {
            uint256 diff = tokenAmount.sub(tokenBalance);
            token.mint(address(this), diff);
        }

        if (tokenAmount > 0) {
            setClaimedReward(msg.sender, rewardEpoch, tokenAmount);
            token.transfer(recipient, tokenAmount);

            emit RewardClaimed(msg.sender, recipient, rewardEpoch, tokenAmount);
        }
    }

    function getProviderNatReward(uint256 rewardEpoch)
        private
        view
        returns (uint256 providerReward, bool claimable)
    {
        (
            address[] memory _dataProviders,
            uint256[] memory _rewardAmounts,
            bool[] memory _claimed,
            bool _claimable
        ) = ftsoRewardManager.getStateOfRewards(provider, rewardEpoch);

        claimable = _claimable;

        uint256 index;
        bool found;

        for (uint256 i = 0; i < _dataProviders.length; i++) {
            if (_dataProviders[i] == provider) {
                index = i;
                found = true;
            }
        }
        if (!found) return (0, false);

        providerReward = _rewardAmounts[index];
    }

    function getTotalVotePower(uint256 rewardEpoch)
        private
        view
        returns (uint256)
    {
        uint256 blockNumber = ftsoManager.getRewardEpochVotePowerBlock(
            rewardEpoch
        );
        return vpToken.votePowerOfAt(provider, blockNumber);
    }

    function getRewardAmount(address beneficiary, uint256 rewardEpoch)
        private
        view
        returns (uint256 amount, bool claimable)
    {
        uint256 natDelegated = getDelegatedAmount(
            provider,
            vpToken,
            ftsoManager,
            beneficiary,
            rewardEpoch
        );

        (
            uint256 totalReward,
            uint256 claimedReward,
            bool _claimable
        ) = getEpochReward(rewardEpoch);

        claimable = _claimable;

        uint256 totalDelegated = getTotalVotePower(rewardEpoch);

        (, amount) = totalReward.mul(natDelegated).tryDiv(totalDelegated);

        amount = maybeMultiply(beneficiary, amount);
    }

    function setContracts(
        IVPToken _vpToken,
        IFtsoRewardManager _rewardManager,
        IFtsoManager _ftsoManager
    ) external onlyOwner {
        vpToken = _vpToken;
        ftsoRewardManager = _rewardManager;
        ftsoManager = _ftsoManager;
    }

    function config(uint256 _fundingRatio, uint256 _genMultiplier)
        external
        onlyOwner
    {
        fundingRatio = _fundingRatio;
        genMultiplier = _genMultiplier;
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }
}
        

@openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

@openzeppelin/contracts/security/Pausable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
          

@openzeppelin/contracts/token/ERC1155/IERC1155.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}
          

@openzeppelin/contracts/token/ERC20/ERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

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

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

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

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

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

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

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

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

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

@openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol

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

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

@openzeppelin/contracts/utils/Context.sol

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

pragma solidity ^0.8.0;

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

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

@openzeppelin/contracts/utils/introspection/IERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
          

@openzeppelin/contracts/utils/math/SafeMath.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // 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 (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @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) {
        return a + b;
    }

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

    /**
     * @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) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting 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 a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting 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) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * 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) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}
          

contracts/DelegationTracker.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

import "./IVPToken.sol";
import "./IFtsoManager.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

contract DelegationTracker {
    using SafeMath for uint256;

    function getDelegatedAmount(
        address provider,
        IVPToken vpToken,
        IFtsoManager ftsoManager,
        address delegator,
        uint256 rewardEpoch
    ) internal view returns (uint256) {
        uint256 vpBlock = ftsoManager.getRewardEpochVotePowerBlock(rewardEpoch);
        uint256 bal = vpToken.balanceOfAt(delegator, vpBlock);
        (
            address[] memory addresses,
            uint256[] memory _bips,
            uint256 count,

        ) = vpToken.delegatesOfAt(delegator, vpBlock);

        uint256 bips;
        for (uint256 i = 0; i < count; i++) {
            if (addresses[i] == provider) {
                bips = _bips[i];
            }
        }

        (, uint256 amount) = bal.mul(bips).tryDiv(10000);

        return amount;
    }
}
          

contracts/FortunaRewards.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

contract FortunaRewards {
    struct RewardStatus {
        uint256 amount;
        bool claimed;
    }

    mapping(address => mapping(uint256 => RewardStatus)) internal rewards;

    // Each reward epoch's amount of total rewards claimed
    mapping(uint256 => uint256) private totalClaimedRewards;

    function rewardClaimed(address beneficiary, uint256 rewardEpoch)
        internal
        view
        returns (bool)
    {
        return rewards[beneficiary][rewardEpoch].claimed;
    }

    function getTotalClaimedReward(uint256 rewardEpoch)
        internal
        view
        returns (uint256)
    {
        return totalClaimedRewards[rewardEpoch];
    }

    function setClaimedReward(
        address beneficiary,
        uint256 rewardEpoch,
        uint256 amount
    ) internal {
        require(
            !rewards[beneficiary][rewardEpoch].claimed,
            "rewards already set"
        );

        if (amount > 0) {
            addToTotalReward(rewardEpoch, amount);

            RewardStatus storage status = rewards[beneficiary][rewardEpoch];

            status.amount = amount;
            status.claimed = true;
        }
    }

    function addToTotalReward(uint256 rewardEpoch, uint256 amount) private {
        totalClaimedRewards[rewardEpoch] += amount;
    }
}
          

contracts/IFortuna.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

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

interface IFortuna is IERC20 {
    function mint(address account, uint256 amount) external;
}
          

contracts/IFtsoManager.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

interface IFtsoManager {
    function getCurrentRewardEpoch() external view returns (uint256);

    function getRewardEpochVotePowerBlock(uint256 _rewardEpoch)
        external
        view
        returns (uint256);

    function getCurrentPriceEpochData()
        external
        view
        returns (
            uint256 _priceEpochId,
            uint256 _priceEpochStartTimestamp,
            uint256 _priceEpochEndTimestamp,
            uint256 _priceEpochRevealEndTimestamp,
            uint256 _currentTimestamp
        );

    function getPriceEpochConfiguration()
        external
        view
        returns (
            uint256 _firstPriceEpochStartTs,
            uint256 _priceEpochDurationSeconds,
            uint256 _revealEpochDurationSeconds
        );
}
          

contracts/IFtsoRewardManager.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

interface IFtsoRewardManager {
    function getRewardEpochToExpireNext() external view returns (uint256);

    function getStateOfRewards(address _beneficiary, uint256 _rewardEpoch)
        external
        view
        returns (
            address[] memory _dataProviders,
            uint256[] memory _rewardAmounts,
            bool[] memory _claimed,
            bool _claimable
        );
}
          

contracts/IVPToken.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IVPToken {
    /**
     * @dev Queries the token balance of `_owner` at a specific `_blockNumber`.
     * @param _owner The address from which the balance will be retrieved.
     * @param _blockNumber The block number when the balance is queried.
     * @return The balance at `_blockNumber`.
     **/
    function balanceOfAt(address _owner, uint256 _blockNumber)
        external
        view
        returns (uint256);

    /**
     * @notice Get the vote power delegation `delegationAddresses`
     *  and `pcts` of `_who`. Returned in two separate positional arrays.
     * @param _who The address to get delegations.
     * @param _blockNumber The block for which we want to know the delegations.
     * @return _delegateAddresses Positional array of delegation addresses.
     * @return _bips Positional array of delegation percents specified in basis points (1/100 or 1 percent)
     * @return _count The number of delegates.
     * @return _delegationMode The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2).
     */
    function delegatesOfAt(address _who, uint256 _blockNumber)
        external
        view
        returns (
            address[] memory _delegateAddresses,
            uint256[] memory _bips,
            uint256 _count,
            uint256 _delegationMode
        );

    /**
     * @notice Get the vote power of `_owner` at block `_blockNumber`
     * @param _owner The address to get voting power.
     * @param _blockNumber The block number at which to fetch.
     * @return Vote power of `_owner` at `_blockNumber`.
     */
    function votePowerOfAt(address _owner, uint256 _blockNumber)
        external
        view
        returns (uint256);
}
          

contracts/Multiplier.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

/// @notice reward multiplication for token holders
contract Multiplier is Ownable {
    using SafeMath for uint256;

    IERC1155 public multiplierToken;
    uint256 public multiplierId;
    uint256[3] public multipliers;

    constructor(
        IERC1155 _multiplierToken,
        uint256 _multiplierId,
        uint256[3] memory _multipliers
    ) {
        multiplierToken = _multiplierToken;
        multiplierId = _multiplierId;
        multipliers = _multipliers;
    }

    function maybeMultiply(address account, uint256 amount)
        internal
        view
        returns (uint256)
    {
        if (amount == 0) return 0;

        uint256 balance = multiplierToken.balanceOf(account, multiplierId);
        uint256 multiplier;
        if (balance == 1) multiplier = multipliers[0];
        if (balance == 2) multiplier = multipliers[1];
        if (balance >= 3) multiplier = multipliers[2];
        (, uint256 extra) = amount.mul(multiplier).tryDiv(1000);
        return amount.add(extra);
    }

    function setRatios(uint256[3] memory _multipliers) external onlyOwner {
        multipliers = _multipliers;
    }
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_provider","internalType":"address"},{"type":"address","name":"_token","internalType":"contract IFortuna"},{"type":"address","name":"multiplierToken","internalType":"contract IERC1155"},{"type":"uint256","name":"multiplierId","internalType":"uint256"},{"type":"uint256[3]","name":"multipliers","internalType":"uint256[3]"},{"type":"uint256","name":"_priceToken","internalType":"uint256"},{"type":"uint256","name":"_priceNat","internalType":"uint256"},{"type":"uint256","name":"_fundingRatio","internalType":"uint256"},{"type":"uint256","name":"_genMultiplier","internalType":"uint256"},{"type":"uint256","name":"_firstRewardEpoch","internalType":"uint256"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RewardClaimed","inputs":[{"type":"address","name":"whoClaimed","internalType":"address","indexed":true},{"type":"address","name":"sentTo","internalType":"address","indexed":true},{"type":"uint256","name":"rewardEpoch","internalType":"uint256","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimReward","inputs":[{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256[]","name":"rewardEpochs","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"config","inputs":[{"type":"uint256","name":"_fundingRatio","internalType":"uint256"},{"type":"uint256","name":"_genMultiplier","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"firstRewardEpoch","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IFtsoManager"}],"name":"ftsoManager","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IFtsoRewardManager"}],"name":"ftsoRewardManager","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"fundingRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"genMultiplier","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"totalReward","internalType":"uint256"},{"type":"uint256","name":"claimedReward","internalType":"uint256"},{"type":"bool","name":"claimable","internalType":"bool"}],"name":"getEpochReward","inputs":[{"type":"uint256","name":"rewardEpoch","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getEpochsWithUnclaimedRewards","inputs":[{"type":"address","name":"beneficiary","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"rewardAmount","internalType":"uint256"},{"type":"bool","name":"claimed","internalType":"bool"},{"type":"bool","name":"claimable","internalType":"bool"}],"name":"getStateOfRewards","inputs":[{"type":"address","name":"beneficiary","internalType":"address"},{"type":"uint256","name":"rewardEpoch","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalUnclaimedRewards","inputs":[{"type":"address","name":"beneficiary","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"multiplierId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC1155"}],"name":"multiplierToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"multipliers","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"priceNat","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"priceToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"provider","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setContracts","inputs":[{"type":"address","name":"_vpToken","internalType":"contract IVPToken"},{"type":"address","name":"_rewardManager","internalType":"contract IFtsoRewardManager"},{"type":"address","name":"_ftsoManager","internalType":"contract IFtsoManager"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRatios","inputs":[{"type":"uint256[3]","name":"_multipliers","internalType":"uint256[3]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IFortuna"}],"name":"token","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IVPToken"}],"name":"vpToken","inputs":[]}]
              

Contract Creation Code

0x60c06040523480156200001157600080fd5b50604051620021d2380380620021d28339810160408190526200003491620001a9565b8787876200004233620000ce565b600380546001600160a01b0319166001600160a01b03851617815560048390556200007290600590839062000120565b50506008805460ff191690555050600b80546001600160a01b039b8c166001600160a01b031991821617909155600c80549a909b1699169890981790985560809290925260a052600955505050600a91909155601055620002ae565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b826003810192821562000151579160200282015b828111156200015157825182559160200191906001019062000134565b506200015f92915062000163565b5090565b5b808211156200015f576000815560010162000164565b6001600160a01b03811681146200019057600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b6000806000806000806000806000806101808b8d031215620001ca57600080fd5b8a51620001d7816200017a565b809a50506020808c0151620001ec816200017a565b60408d0151909a50620001ff816200017a565b8099505060608c015197508c609f8d01126200021a57600080fd5b604051606081016001600160401b03811182821017156200023f576200023f62000193565b6040528060e08e018f8111156200025557600080fd5b60808f015b818110156200027357805183529184019184016200025a565b5082995080519850505050506101008b015193506101208b015192506101408b015191506101608b015190509295989b9194979a5092959850565b60805160a051611ef0620002e2600039600081816103a801526109d901526000818161021601526109fd0152611ef06000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c8063a4472c10116100f9578063d418634a11610097578063e07142bb11610071578063e07142bb146103a3578063e407fb2b146103ca578063f2fde38b146103dd578063fc0c546a146103f057600080fd5b8063d418634a14610357578063d7484db214610387578063d8b37c9c1461039a57600080fd5b8063b2af870a116100d3578063b2af870a146102fe578063b3066d4914610311578063b4a2043d14610324578063c78391f41461034457600080fd5b8063a4472c10146102a8578063ac7fc263146102d8578063b0771ab0146102eb57600080fd5b80633f4ba83a11610166578063715018a611610140578063715018a6146102745780638456cb591461027c5780638da5cb5b1461028457806393a1c2841461029557600080fd5b80633f4ba83a14610241578063509f5f901461024b5780635c975abb1461025e57600080fd5b8063085d4883146101ae578063107f72b7146101de57806311a7aaaa146101f5578063170eeb25146102085780632ff6fe7614610211578063347e50b014610238575b600080fd5b600b546101c1906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101e7600a5481565b6040519081526020016101d5565b600f546101c1906001600160a01b031681565b6101e760095481565b6101e77f000000000000000000000000000000000000000000000000000000000000000081565b6101e760105481565b610249610403565b005b600d546101c1906001600160a01b031681565b60085460ff1660405190151581526020016101d5565b610249610440565b610249610474565b6002546001600160a01b03166101c1565b6003546101c1906001600160a01b031681565b6102bb6102b636600461189f565b6104a6565b6040805193845291151560208401521515908201526060016101d5565b6101e76102e63660046118cb565b610625565b6102496102f93660046118e4565b61063c565b61024961030c366004611971565b610671565b61024961031f366004611a1c565b6106b7565b610337610332366004611a67565b610720565b6040516101d59190611a84565b610249610352366004611ac8565b610963565b61036a6103653660046118cb565b61099e565b6040805193845260208401929092521515908201526060016101d5565b600e546101c1906001600160a01b031681565b6101e760045481565b6101e77f000000000000000000000000000000000000000000000000000000000000000081565b6101e76103d8366004611a67565b610a8f565b6102496103eb366004611a67565b610c16565b600c546101c1906001600160a01b031681565b6002546001600160a01b031633146104365760405162461bcd60e51b815260040161042d90611b46565b60405180910390fd5b61043e610cb1565b565b6002546001600160a01b0316331461046a5760405162461bcd60e51b815260040161042d90611b46565b61043e6000610d44565b6002546001600160a01b0316331461049e5760405162461bcd60e51b815260040161042d90611b46565b61043e610d96565b6001600160a01b0382166000908152602081815260408083208484529091528120548190819080156104da578093506104e8565b6104e48686610e11565b5093505b6104f28686610e92565b9250601054851015801561058b5750600e60009054906101000a90046001600160a01b03166001600160a01b0316633e7ff8576040518163ffffffff1660e01b815260040160206040518083038186803b15801561054f57600080fd5b505afa158015610563573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105879190611b7b565b8510155b801561061b5750600f60009054906101000a90046001600160a01b03166001600160a01b031663e7c830d46040518163ffffffff1660e01b815260040160206040518083038186803b1580156105e057600080fd5b505afa1580156105f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106189190611b7b565b85105b9150509250925092565b6005816003811061063557600080fd5b0154905081565b6002546001600160a01b031633146106665760405162461bcd60e51b815260040161042d90611b46565b600991909155600a55565b60005b81518110156106b2576106a08383838151811061069357610693611b94565b6020026020010151610ec1565b806106aa81611bc0565b915050610674565b505050565b6002546001600160a01b031633146106e15760405162461bcd60e51b815260040161042d90611b46565b600d80546001600160a01b039485166001600160a01b031991821617909155600e805493851693821693909317909255600f8054919093169116179055565b60606000600e60009054906101000a90046001600160a01b03166001600160a01b0316633e7ff8576040518163ffffffff1660e01b815260040160206040518083038186803b15801561077257600080fd5b505afa158015610786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107aa9190611b7b565b90506010548110156107bb57506010545b60006001600f60009054906101000a90046001600160a01b03166001600160a01b031663e7c830d46040518163ffffffff1660e01b815260040160206040518083038186803b15801561080d57600080fd5b505afa158015610821573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108459190611b7b565b61084f9190611bdb565b90506000825b8281116108a1576108668682610e92565b61088f5760006108768783610e11565b509050801561088d578261088981611bc0565b9350505b505b8061089981611bc0565b915050610855565b60008267ffffffffffffffff8111156108bc576108bc611906565b6040519080825280602002602001820160405280156108e5578160200160208202803683370190505b50905060008592505b848311610958576108ff8884610e92565b61094657600061090f8985610e11565b5090508015610944578383838151811061092b5761092b611b94565b60209081029190910101528161094081611bc0565b9250505b505b8261095081611bc0565b9350506108ee565b509695505050505050565b6002546001600160a01b0316331461098d5760405162461bcd60e51b815260040161042d90611b46565b61099a6005826003611837565b5050565b60008060006010548410156109bb57506000915081905080610a88565b6000806109c786611183565b935091508290508115610a7457610a427f0000000000000000000000000000000000000000000000000000000000000000610a367f0000000000000000000000000000000000000000000000000000000000000000610a3c6064610a36600954896112c690919063ffffffff16565b906112d9565b906112c6565b600a5490955015610a7457610a71610a6a6064610a36600a54896112c690919063ffffffff16565b86906112e5565b94505b600086815260016020526040902054935050505b9193909250565b600080600e60009054906101000a90046001600160a01b03166001600160a01b0316633e7ff8576040518163ffffffff1660e01b815260040160206040518083038186803b158015610ae057600080fd5b505afa158015610af4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b189190611b7b565b9050601054811015610b2957506010545b60006001600f60009054906101000a90046001600160a01b03166001600160a01b031663e7c830d46040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7b57600080fd5b505afa158015610b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb39190611b7b565b610bbd9190611bdb565b90506000825b828111610c0d57610bd48682610e92565b15610bde57610bfb565b6000610bea8783610e11565b509050610bf783826112e5565b9250505b80610c0581611bc0565b915050610bc3565b50949350505050565b6002546001600160a01b03163314610c405760405162461bcd60e51b815260040161042d90611b46565b6001600160a01b038116610ca55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161042d565b610cae81610d44565b50565b60085460ff16610cfa5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161042d565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60085460ff1615610ddc5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161042d565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d273390565b600b54600d54600f5460009283928392610e3c926001600160a01b03908116928116911688886112f1565b90506000806000610e4c8761099e565b9250925092508094506000610e608861151d565b9050610e7681610e7086886112c6565b90611626565b9750610e8490508988611657565b965050505050509250929050565b6001600160a01b03821660009081526020818152604080832084845290915290206001015460ff165b92915050565b60085460ff1615610f075760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161042d565b610f113382610e92565b15610f505760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b604482015260640161042d565b600080610f5d3384610e11565b9150915080610fa45760405162461bcd60e51b815260206004820152601360248201527245706f6368206e6f7420636c61696d61626c6560681b604482015260640161042d565b600c546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610fe857600080fd5b505afa158015610ffc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110209190611b7b565b90508281101561109d5760006110368483611752565b600c546040516340c10f1960e01b8152306004820152602481018390529192506001600160a01b0316906340c10f1990604401600060405180830381600087803b15801561108357600080fd5b505af1158015611097573d6000803e3d6000fd5b50505050505b821561117c576110ae33858561175e565b600c5460405163a9059cbb60e01b81526001600160a01b038781166004830152602482018690529091169063a9059cbb90604401602060405180830381600087803b1580156110fc57600080fd5b505af1158015611110573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111349190611c07565b5060408051858152602081018590526001600160a01b0387169133917f7a84a08b02c91f3c62d572853f966fc799bbd121e8ad7833a4494ab8dcfcb404910160405180910390a35b5050505050565b600e54600b54604051630a4472c160e41b81526001600160a01b039182166004820152602481018490526000928392839283928392839291169063a4472c109060440160006040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261121a9190810190611ce1565b935093509350935080945060008060005b865181101561128857600b5487516001600160a01b039091169088908390811061125757611257611b94565b60200260200101516001600160a01b0316141561127657809250600191505b8061128081611bc0565b91505061122b565b508061129f57506000988998509650505050505050565b8482815181106112b1576112b1611b94565b60200260200101519750505050505050915091565b60006112d28284611dd7565b9392505050565b60006112d28284611e0c565b60006112d28284611e2e565b604051637976d5ad60e11b81526004810182905260009081906001600160a01b0386169063f2edab5a9060240160206040518083038186803b15801561133657600080fd5b505afa15801561134a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136e9190611b7b565b60405163277166bf60e11b81526001600160a01b03868116600483015260248201839052919250600091881690634ee2cd7e9060440160206040518083038186803b1580156113bc57600080fd5b505afa1580156113d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f49190611b7b565b60405163ed475a7960e01b81526001600160a01b03878116600483015260248201859052919250600091829182918b169063ed475a799060440160006040518083038186803b15801561144657600080fd5b505afa15801561145a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114829190810190611e46565b50919450925090506000805b828110156114f8578c6001600160a01b03168582815181106114b2576114b2611b94565b60200260200101516001600160a01b031614156114e6578381815181106114db576114db611b94565b602002602001015191505b806114f081611bc0565b91505061148e565b50600061150b612710610e7088856112c6565b9e9d5050505050505050505050505050565b600f54604051637976d5ad60e11b81526004810183905260009182916001600160a01b039091169063f2edab5a9060240160206040518083038186803b15801561156657600080fd5b505afa15801561157a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159e9190611b7b565b600d54600b54604051631257fcdb60e31b81526001600160a01b0391821660048201526024810184905292935016906392bfe6d89060440160206040518083038186803b1580156115ee57600080fd5b505afa158015611602573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d29190611b7b565b6000808261163957506000905080611650565b600183858161164a5761164a611df6565b04915091505b9250929050565b60008161166657506000610ebb565b60035460048054604051627eeac760e11b81526000936001600160a01b03169262fdd58e926116ab928992016001600160a01b03929092168252602082015260400190565b60206040518083038186803b1580156116c357600080fd5b505afa1580156116d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fb9190611b7b565b90506000816001141561170d57506005545b816002141561171b57506006545b6003821061172857506007545b600061173a6103e8610e7087856112c6565b9150611748905085826112e5565b9695505050505050565b60006112d28284611bdb565b6001600160a01b03831660009081526020818152604080832085845290915290206001015460ff16156117c95760405162461bcd60e51b81526020600482015260136024820152721c995dd85c991cc8185b1c9958591e481cd95d606a1b604482015260640161042d565b80156106b2576117d98282611810565b6001600160a01b0392909216600090815260208181526040808320938352929052209081556001908101805460ff19169091179055565b6000828152600160205260408120805483929061182e908490611e2e565b90915550505050565b8260038101928215611865579160200282015b8281111561186557825182559160200191906001019061184a565b50611871929150611875565b5090565b5b808211156118715760008155600101611876565b6001600160a01b0381168114610cae57600080fd5b600080604083850312156118b257600080fd5b82356118bd8161188a565b946020939093013593505050565b6000602082840312156118dd57600080fd5b5035919050565b600080604083850312156118f757600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561194557611945611906565b604052919050565b600067ffffffffffffffff82111561196757611967611906565b5060051b60200190565b6000806040838503121561198457600080fd5b823561198f8161188a565b915060208381013567ffffffffffffffff8111156119ac57600080fd5b8401601f810186136119bd57600080fd5b80356119d06119cb8261194d565b61191c565b81815260059190911b820183019083810190888311156119ef57600080fd5b928401925b82841015611a0d578335825292840192908401906119f4565b80955050505050509250929050565b600080600060608486031215611a3157600080fd5b8335611a3c8161188a565b92506020840135611a4c8161188a565b91506040840135611a5c8161188a565b809150509250925092565b600060208284031215611a7957600080fd5b81356112d28161188a565b6020808252825182820181905260009190848201906040850190845b81811015611abc57835183529284019291840191600101611aa0565b50909695505050505050565b600060608284031215611ada57600080fd5b82601f830112611ae957600080fd5b6040516060810181811067ffffffffffffffff82111715611b0c57611b0c611906565b604052806060840185811115611b2157600080fd5b845b81811015611b3b578035835260209283019201611b23565b509195945050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611b8d57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bd457611bd4611baa565b5060010190565b600082821015611bed57611bed611baa565b500390565b80518015158114611c0257600080fd5b919050565b600060208284031215611c1957600080fd5b6112d282611bf2565b600082601f830112611c3357600080fd5b81516020611c436119cb8361194d565b82815260059290921b84018101918181019086841115611c6257600080fd5b8286015b84811015610958578051611c798161188a565b8352918301918301611c66565b600082601f830112611c9757600080fd5b81516020611ca76119cb8361194d565b82815260059290921b84018101918181019086841115611cc657600080fd5b8286015b848110156109585780518352918301918301611cca565b60008060008060808587031215611cf757600080fd5b845167ffffffffffffffff80821115611d0f57600080fd5b611d1b88838901611c22565b9550602091508187015181811115611d3257600080fd5b611d3e89828a01611c86565b955050604087015181811115611d5357600080fd5b87019050601f81018813611d6657600080fd5b8051611d746119cb8261194d565b81815260059190911b8201830190838101908a831115611d9357600080fd5b928401925b82841015611db857611da984611bf2565b82529284019290840190611d98565b8096505050505050611dcc60608601611bf2565b905092959194509250565b6000816000190483118215151615611df157611df1611baa565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611e2957634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611e4157611e41611baa565b500190565b60008060008060808587031215611e5c57600080fd5b845167ffffffffffffffff80821115611e7457600080fd5b611e8088838901611c22565b95506020870151915080821115611e9657600080fd5b50611ea387828801611c86565b60408701516060909701519598909750935050505056fea26469706673582212200a1f4d02a7e2bf793527680f9f80b700b32c8e21cad7b9c5d73312965d7e904064736f6c634300080900330000000000000000000000001b00870092a929d160492daf8e734b4bca0332660000000000000000000000009e2e6c16803878c18e54ed74f05aeafcce4646260000000000000000000000003157537399860305ebe9e7fd17cfa00aae291c8200000000000000000000000000000000000000000000000000000000000082350000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000af0000000000000000000000000000000000000000000000004b728dd78183e6000000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106101a95760003560e01c8063a4472c10116100f9578063d418634a11610097578063e07142bb11610071578063e07142bb146103a3578063e407fb2b146103ca578063f2fde38b146103dd578063fc0c546a146103f057600080fd5b8063d418634a14610357578063d7484db214610387578063d8b37c9c1461039a57600080fd5b8063b2af870a116100d3578063b2af870a146102fe578063b3066d4914610311578063b4a2043d14610324578063c78391f41461034457600080fd5b8063a4472c10146102a8578063ac7fc263146102d8578063b0771ab0146102eb57600080fd5b80633f4ba83a11610166578063715018a611610140578063715018a6146102745780638456cb591461027c5780638da5cb5b1461028457806393a1c2841461029557600080fd5b80633f4ba83a14610241578063509f5f901461024b5780635c975abb1461025e57600080fd5b8063085d4883146101ae578063107f72b7146101de57806311a7aaaa146101f5578063170eeb25146102085780632ff6fe7614610211578063347e50b014610238575b600080fd5b600b546101c1906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101e7600a5481565b6040519081526020016101d5565b600f546101c1906001600160a01b031681565b6101e760095481565b6101e77f0000000000000000000000000000000000000000000000004b728dd78183e60081565b6101e760105481565b610249610403565b005b600d546101c1906001600160a01b031681565b60085460ff1660405190151581526020016101d5565b610249610440565b610249610474565b6002546001600160a01b03166101c1565b6003546101c1906001600160a01b031681565b6102bb6102b636600461189f565b6104a6565b6040805193845291151560208401521515908201526060016101d5565b6101e76102e63660046118cb565b610625565b6102496102f93660046118e4565b61063c565b61024961030c366004611971565b610671565b61024961031f366004611a1c565b6106b7565b610337610332366004611a67565b610720565b6040516101d59190611a84565b610249610352366004611ac8565b610963565b61036a6103653660046118cb565b61099e565b6040805193845260208401929092521515908201526060016101d5565b600e546101c1906001600160a01b031681565b6101e760045481565b6101e77f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b6101e76103d8366004611a67565b610a8f565b6102496103eb366004611a67565b610c16565b600c546101c1906001600160a01b031681565b6002546001600160a01b031633146104365760405162461bcd60e51b815260040161042d90611b46565b60405180910390fd5b61043e610cb1565b565b6002546001600160a01b0316331461046a5760405162461bcd60e51b815260040161042d90611b46565b61043e6000610d44565b6002546001600160a01b0316331461049e5760405162461bcd60e51b815260040161042d90611b46565b61043e610d96565b6001600160a01b0382166000908152602081815260408083208484529091528120548190819080156104da578093506104e8565b6104e48686610e11565b5093505b6104f28686610e92565b9250601054851015801561058b5750600e60009054906101000a90046001600160a01b03166001600160a01b0316633e7ff8576040518163ffffffff1660e01b815260040160206040518083038186803b15801561054f57600080fd5b505afa158015610563573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105879190611b7b565b8510155b801561061b5750600f60009054906101000a90046001600160a01b03166001600160a01b031663e7c830d46040518163ffffffff1660e01b815260040160206040518083038186803b1580156105e057600080fd5b505afa1580156105f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106189190611b7b565b85105b9150509250925092565b6005816003811061063557600080fd5b0154905081565b6002546001600160a01b031633146106665760405162461bcd60e51b815260040161042d90611b46565b600991909155600a55565b60005b81518110156106b2576106a08383838151811061069357610693611b94565b6020026020010151610ec1565b806106aa81611bc0565b915050610674565b505050565b6002546001600160a01b031633146106e15760405162461bcd60e51b815260040161042d90611b46565b600d80546001600160a01b039485166001600160a01b031991821617909155600e805493851693821693909317909255600f8054919093169116179055565b60606000600e60009054906101000a90046001600160a01b03166001600160a01b0316633e7ff8576040518163ffffffff1660e01b815260040160206040518083038186803b15801561077257600080fd5b505afa158015610786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107aa9190611b7b565b90506010548110156107bb57506010545b60006001600f60009054906101000a90046001600160a01b03166001600160a01b031663e7c830d46040518163ffffffff1660e01b815260040160206040518083038186803b15801561080d57600080fd5b505afa158015610821573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108459190611b7b565b61084f9190611bdb565b90506000825b8281116108a1576108668682610e92565b61088f5760006108768783610e11565b509050801561088d578261088981611bc0565b9350505b505b8061089981611bc0565b915050610855565b60008267ffffffffffffffff8111156108bc576108bc611906565b6040519080825280602002602001820160405280156108e5578160200160208202803683370190505b50905060008592505b848311610958576108ff8884610e92565b61094657600061090f8985610e11565b5090508015610944578383838151811061092b5761092b611b94565b60209081029190910101528161094081611bc0565b9250505b505b8261095081611bc0565b9350506108ee565b509695505050505050565b6002546001600160a01b0316331461098d5760405162461bcd60e51b815260040161042d90611b46565b61099a6005826003611837565b5050565b60008060006010548410156109bb57506000915081905080610a88565b6000806109c786611183565b935091508290508115610a7457610a427f0000000000000000000000000000000000000000000000000de0b6b3a7640000610a367f0000000000000000000000000000000000000000000000004b728dd78183e600610a3c6064610a36600954896112c690919063ffffffff16565b906112d9565b906112c6565b600a5490955015610a7457610a71610a6a6064610a36600a54896112c690919063ffffffff16565b86906112e5565b94505b600086815260016020526040902054935050505b9193909250565b600080600e60009054906101000a90046001600160a01b03166001600160a01b0316633e7ff8576040518163ffffffff1660e01b815260040160206040518083038186803b158015610ae057600080fd5b505afa158015610af4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b189190611b7b565b9050601054811015610b2957506010545b60006001600f60009054906101000a90046001600160a01b03166001600160a01b031663e7c830d46040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7b57600080fd5b505afa158015610b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb39190611b7b565b610bbd9190611bdb565b90506000825b828111610c0d57610bd48682610e92565b15610bde57610bfb565b6000610bea8783610e11565b509050610bf783826112e5565b9250505b80610c0581611bc0565b915050610bc3565b50949350505050565b6002546001600160a01b03163314610c405760405162461bcd60e51b815260040161042d90611b46565b6001600160a01b038116610ca55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161042d565b610cae81610d44565b50565b60085460ff16610cfa5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161042d565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60085460ff1615610ddc5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161042d565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d273390565b600b54600d54600f5460009283928392610e3c926001600160a01b03908116928116911688886112f1565b90506000806000610e4c8761099e565b9250925092508094506000610e608861151d565b9050610e7681610e7086886112c6565b90611626565b9750610e8490508988611657565b965050505050509250929050565b6001600160a01b03821660009081526020818152604080832084845290915290206001015460ff165b92915050565b60085460ff1615610f075760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161042d565b610f113382610e92565b15610f505760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b604482015260640161042d565b600080610f5d3384610e11565b9150915080610fa45760405162461bcd60e51b815260206004820152601360248201527245706f6368206e6f7420636c61696d61626c6560681b604482015260640161042d565b600c546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610fe857600080fd5b505afa158015610ffc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110209190611b7b565b90508281101561109d5760006110368483611752565b600c546040516340c10f1960e01b8152306004820152602481018390529192506001600160a01b0316906340c10f1990604401600060405180830381600087803b15801561108357600080fd5b505af1158015611097573d6000803e3d6000fd5b50505050505b821561117c576110ae33858561175e565b600c5460405163a9059cbb60e01b81526001600160a01b038781166004830152602482018690529091169063a9059cbb90604401602060405180830381600087803b1580156110fc57600080fd5b505af1158015611110573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111349190611c07565b5060408051858152602081018590526001600160a01b0387169133917f7a84a08b02c91f3c62d572853f966fc799bbd121e8ad7833a4494ab8dcfcb404910160405180910390a35b5050505050565b600e54600b54604051630a4472c160e41b81526001600160a01b039182166004820152602481018490526000928392839283928392839291169063a4472c109060440160006040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261121a9190810190611ce1565b935093509350935080945060008060005b865181101561128857600b5487516001600160a01b039091169088908390811061125757611257611b94565b60200260200101516001600160a01b0316141561127657809250600191505b8061128081611bc0565b91505061122b565b508061129f57506000988998509650505050505050565b8482815181106112b1576112b1611b94565b60200260200101519750505050505050915091565b60006112d28284611dd7565b9392505050565b60006112d28284611e0c565b60006112d28284611e2e565b604051637976d5ad60e11b81526004810182905260009081906001600160a01b0386169063f2edab5a9060240160206040518083038186803b15801561133657600080fd5b505afa15801561134a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136e9190611b7b565b60405163277166bf60e11b81526001600160a01b03868116600483015260248201839052919250600091881690634ee2cd7e9060440160206040518083038186803b1580156113bc57600080fd5b505afa1580156113d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f49190611b7b565b60405163ed475a7960e01b81526001600160a01b03878116600483015260248201859052919250600091829182918b169063ed475a799060440160006040518083038186803b15801561144657600080fd5b505afa15801561145a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114829190810190611e46565b50919450925090506000805b828110156114f8578c6001600160a01b03168582815181106114b2576114b2611b94565b60200260200101516001600160a01b031614156114e6578381815181106114db576114db611b94565b602002602001015191505b806114f081611bc0565b91505061148e565b50600061150b612710610e7088856112c6565b9e9d5050505050505050505050505050565b600f54604051637976d5ad60e11b81526004810183905260009182916001600160a01b039091169063f2edab5a9060240160206040518083038186803b15801561156657600080fd5b505afa15801561157a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159e9190611b7b565b600d54600b54604051631257fcdb60e31b81526001600160a01b0391821660048201526024810184905292935016906392bfe6d89060440160206040518083038186803b1580156115ee57600080fd5b505afa158015611602573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d29190611b7b565b6000808261163957506000905080611650565b600183858161164a5761164a611df6565b04915091505b9250929050565b60008161166657506000610ebb565b60035460048054604051627eeac760e11b81526000936001600160a01b03169262fdd58e926116ab928992016001600160a01b03929092168252602082015260400190565b60206040518083038186803b1580156116c357600080fd5b505afa1580156116d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fb9190611b7b565b90506000816001141561170d57506005545b816002141561171b57506006545b6003821061172857506007545b600061173a6103e8610e7087856112c6565b9150611748905085826112e5565b9695505050505050565b60006112d28284611bdb565b6001600160a01b03831660009081526020818152604080832085845290915290206001015460ff16156117c95760405162461bcd60e51b81526020600482015260136024820152721c995dd85c991cc8185b1c9958591e481cd95d606a1b604482015260640161042d565b80156106b2576117d98282611810565b6001600160a01b0392909216600090815260208181526040808320938352929052209081556001908101805460ff19169091179055565b6000828152600160205260408120805483929061182e908490611e2e565b90915550505050565b8260038101928215611865579160200282015b8281111561186557825182559160200191906001019061184a565b50611871929150611875565b5090565b5b808211156118715760008155600101611876565b6001600160a01b0381168114610cae57600080fd5b600080604083850312156118b257600080fd5b82356118bd8161188a565b946020939093013593505050565b6000602082840312156118dd57600080fd5b5035919050565b600080604083850312156118f757600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561194557611945611906565b604052919050565b600067ffffffffffffffff82111561196757611967611906565b5060051b60200190565b6000806040838503121561198457600080fd5b823561198f8161188a565b915060208381013567ffffffffffffffff8111156119ac57600080fd5b8401601f810186136119bd57600080fd5b80356119d06119cb8261194d565b61191c565b81815260059190911b820183019083810190888311156119ef57600080fd5b928401925b82841015611a0d578335825292840192908401906119f4565b80955050505050509250929050565b600080600060608486031215611a3157600080fd5b8335611a3c8161188a565b92506020840135611a4c8161188a565b91506040840135611a5c8161188a565b809150509250925092565b600060208284031215611a7957600080fd5b81356112d28161188a565b6020808252825182820181905260009190848201906040850190845b81811015611abc57835183529284019291840191600101611aa0565b50909695505050505050565b600060608284031215611ada57600080fd5b82601f830112611ae957600080fd5b6040516060810181811067ffffffffffffffff82111715611b0c57611b0c611906565b604052806060840185811115611b2157600080fd5b845b81811015611b3b578035835260209283019201611b23565b509195945050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611b8d57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bd457611bd4611baa565b5060010190565b600082821015611bed57611bed611baa565b500390565b80518015158114611c0257600080fd5b919050565b600060208284031215611c1957600080fd5b6112d282611bf2565b600082601f830112611c3357600080fd5b81516020611c436119cb8361194d565b82815260059290921b84018101918181019086841115611c6257600080fd5b8286015b84811015610958578051611c798161188a565b8352918301918301611c66565b600082601f830112611c9757600080fd5b81516020611ca76119cb8361194d565b82815260059290921b84018101918181019086841115611cc657600080fd5b8286015b848110156109585780518352918301918301611cca565b60008060008060808587031215611cf757600080fd5b845167ffffffffffffffff80821115611d0f57600080fd5b611d1b88838901611c22565b9550602091508187015181811115611d3257600080fd5b611d3e89828a01611c86565b955050604087015181811115611d5357600080fd5b87019050601f81018813611d6657600080fd5b8051611d746119cb8261194d565b81815260059190911b8201830190838101908a831115611d9357600080fd5b928401925b82841015611db857611da984611bf2565b82529284019290840190611d98565b8096505050505050611dcc60608601611bf2565b905092959194509250565b6000816000190483118215151615611df157611df1611baa565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611e2957634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611e4157611e41611baa565b500190565b60008060008060808587031215611e5c57600080fd5b845167ffffffffffffffff80821115611e7457600080fd5b611e8088838901611c22565b95506020870151915080821115611e9657600080fd5b50611ea387828801611c86565b60408701516060909701519598909750935050505056fea26469706673582212200a1f4d02a7e2bf793527680f9f80b700b32c8e21cad7b9c5d73312965d7e904064736f6c63430008090033