Contract 0x24800215a713695e19d7a75bb4921f884bcd9809

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x8f11e252f5b9a3e67123a277ac973aa17b7f0f21ac039ceaccf0abf702ec636bUpdate Minted Bo...39906872022-08-03 15:23:5052 days 21 hrs ago0xa16226396d79dc7b3bc70de0daca4eef11742a9e IN  0x24800215a713695e19d7a75bb4921f884bcd98090 CRO0.247736827510
0xac231487b434e656a42b84367659941dbf7a5fb50d2975c4fad09b5129af8f6f0x6080604039906162022-08-03 15:17:0452 days 21 hrs ago0xa16226396d79dc7b3bc70de0daca4eef11742a9e IN  Create: FeeDistributor0 CRO5.5465075598840
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FeeDistributor

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 8 : FeeDistributor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract FeeDistributor is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    uint256 public TOTAL_SHARES;
    IERC20 public wcroToken;
    address public treasury;
    address public mintedBoost;
    uint256 public treasuryShares;
    uint256 public mintedBoostShares;

    uint256 public periodEndBlock;
    uint256 public rewardDurationInBlocks;
    uint256 public currentRewardsPerBlock;
    uint256 public lastUpdatedBlock;

    event UpdateTreasury(address _newTreasury, address _oldTreasury);
    event UpdateMintedBoost(address _newMintedBoost, address _oldMintedBoost);
    event UpdateShares(uint256 treasuryShares, uint256 mintedBoostShares);
    event SetupMintedBoost(address mintedBoost);

    /**
     * @notice Constructor
     * @dev this contract is a fee receipient to minted exchange rewards
     * @dev It handles the wcro fee distribution
     * @dev accumlated rewards are distributed per block over a period
     * @param _mintedBoostShares percentage shares of mintedBoost
     * @param _treasuryShares percentage shares of treasury
     * @param _rewardDurationInBlocks duration of each reward round
     */
    constructor(
        address _wcroToken,
        uint256 _mintedBoostShares,
        address _treasury,
        uint256 _treasuryShares,
        uint256 _rewardDurationInBlocks
    ) {
        require(_treasuryShares > 0, "FeeDistributor: treasuryShares is 0");
        require(_mintedBoostShares > 0, "FeeDistributor: mintedBoostShares is 0");
        require(_rewardDurationInBlocks > 0, "FeeDistributor: rewardDurationInBlocks is 0");

        wcroToken = IERC20(_wcroToken);
        treasury = _treasury;
        treasuryShares = _treasuryShares;
        mintedBoostShares = _mintedBoostShares;
        rewardDurationInBlocks = _rewardDurationInBlocks;

        periodEndBlock = block.number + rewardDurationInBlocks;
        lastUpdatedBlock = block.number;
        TOTAL_SHARES = _treasuryShares + _mintedBoostShares;
    }

    function updateTreasury(address _newTreasury) external onlyOwner {
        require(_newTreasury != address(0), "Invalid address");
        require(_newTreasury != treasury, "treasury already exist");
        address _oldTreasury = treasury;
        treasury = _newTreasury;
        emit UpdateTreasury(_newTreasury, _oldTreasury);
    }

    function updateMintedBoost(address _newMintedBoost) external onlyOwner {
        require(_newMintedBoost != address(0), "Invalid address");
        require(_newMintedBoost != mintedBoost, "mintedBoost already exist");
        address _oldmintedBoost = mintedBoost;
        mintedBoost = _newMintedBoost;
        emit UpdateMintedBoost(_newMintedBoost, _oldmintedBoost);
    }

    function updateShares(uint256 _treasuryShares, uint256 _mintedBoostShares) external onlyOwner {
        require(_treasuryShares > 0, "FeeDistributor: treasuryShares is 0");
        require(_mintedBoostShares > 0, "FeeDistributor: mintedBoostShares is 0");
        treasuryShares = _treasuryShares;
        mintedBoostShares = _mintedBoostShares;
        TOTAL_SHARES = _treasuryShares + _mintedBoostShares;
        emit UpdateShares(treasuryShares, mintedBoostShares);
    }

    function updateRewards() external nonReentrant {
        _updateRewards();
    }

    function _updateRewards() internal {
        require(mintedBoost != address(0), "FeeDistributor: mintedBoost doesn't exist");
        if (block.number <= periodEndBlock) {
            _releaseTradingRewards();
        } else {
            // block.number > periodEndBlock implies end of the perious reward round and start of the new
            // to accomdate we distributed pending rewards of previous round,
            // sets the new reward round and distribute the rewards of current reward round
            _releaseTradingRewards();
            _updateRewardPerBlock();
            _releaseTradingRewards();
        }
    }

    /**
     * @notice send wcro reward to MintedBoost
     * @dev this only send the wcro reward for this period, call _updateRewardPerBlock to update to next period
     */
    function _releaseTradingRewards() internal {
        // limits the rewards to the current reward round wrt _lastUpdatedBlock
        (uint256 multiplier, uint256 _lastUpdatedBlock) = _getMultiplier();
        if (currentRewardsPerBlock > 0) {
            uint256 amountToTransfer = multiplier * currentRewardsPerBlock;
            wcroToken.safeTransfer(mintedBoost, amountToTransfer);
        }
        lastUpdatedBlock = _lastUpdatedBlock;
    }

    /**
    * @notice starts new reward round, splits the accumlated rewards and send treasury reward share upfront
              sets the currentRewardsPerBlock for the new reward round
    */
    function _updateRewardPerBlock() internal {
        if (block.number > periodEndBlock) {
            (uint256 tradingRewards, uint256 treasuryRewards) = getRewardShares();
            periodEndBlock = block.number + rewardDurationInBlocks;
            // for gas saving reason, when tradingRewards > 0, treasuryReward will be > 0
            if (tradingRewards > 0) {
                wcroToken.safeTransfer(treasury, treasuryRewards);
                // reward duration = lapsed period from lastUpdatedBlock + rewardDurationInBlocks
                currentRewardsPerBlock = (tradingRewards / (periodEndBlock - lastUpdatedBlock));
            } else {
                currentRewardsPerBlock = 0;
            }
        }
    }

    /**
     * @return rewards between MintedBoost and treasury
     */
    function getRewardShares() public view returns (uint256, uint256) {
        uint256 rewards = wcroToken.balanceOf(address(this));
        uint256 tradingRewards = (rewards * mintedBoostShares) / TOTAL_SHARES;
        uint256 treasuryRewards = rewards - tradingRewards;
        return (tradingRewards, treasuryRewards);
    }

    /**
     * @return pending wcro reward for MintedBoost
     */
    function getPendingRewards() external view returns (uint256) {
        if (mintedBoost == address(0)) {
            return 0;
        }

        if (block.number <= periodEndBlock) {
            (uint256 multiplier, ) = _getMultiplier();
            return multiplier * currentRewardsPerBlock;
        } else {
            // calculate current round reward
            (uint256 multiplier, ) = _getMultiplier();
            uint256 pendingRewardsForCurrentRound = multiplier * currentRewardsPerBlock;

            // calculate next round reward
            uint256 rewards = wcroToken.balanceOf(address(this)) - pendingRewardsForCurrentRound;
            uint256 tradingRewards = (rewards * mintedBoostShares) / TOTAL_SHARES;
            uint256 nextPeriodEndBlock = block.number + rewardDurationInBlocks;
            uint256 nextRewardPerBlock = (tradingRewards / (nextPeriodEndBlock - periodEndBlock));
            uint256 pendingRewardsForNextRound = (block.number - periodEndBlock) * nextRewardPerBlock;

            return pendingRewardsForCurrentRound + pendingRewardsForNextRound;
        }
    }

    function _getMultiplier() internal view returns (uint256, uint256) {
        if (block.number <= periodEndBlock) {
            return (block.number - lastUpdatedBlock, block.number);
        } else {
            // considers only pending rewards in previous round
            return (periodEndBlock - lastUpdatedBlock, periodEndBlock);
        }
    }
}

File 2 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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);
    }
}

File 3 of 8 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

    constructor() {
        _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;
    }
}

File 4 of 8 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

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

pragma solidity ^0.8.0;

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

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

File 6 of 8 : 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);
}

File 7 of 8 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 8 of 8 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_wcroToken","type":"address"},{"internalType":"uint256","name":"_mintedBoostShares","type":"uint256"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_treasuryShares","type":"uint256"},{"internalType":"uint256","name":"_rewardDurationInBlocks","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"mintedBoost","type":"address"}],"name":"SetupMintedBoost","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newMintedBoost","type":"address"},{"indexed":false,"internalType":"address","name":"_oldMintedBoost","type":"address"}],"name":"UpdateMintedBoost","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"treasuryShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintedBoostShares","type":"uint256"}],"name":"UpdateShares","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newTreasury","type":"address"},{"indexed":false,"internalType":"address","name":"_oldTreasury","type":"address"}],"name":"UpdateTreasury","type":"event"},{"inputs":[],"name":"TOTAL_SHARES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRewardsPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdatedBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintedBoost","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintedBoostShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardDurationInBlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newMintedBoost","type":"address"}],"name":"updateMintedBoost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_treasuryShares","type":"uint256"},{"internalType":"uint256","name":"_mintedBoostShares","type":"uint256"}],"name":"updateShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newTreasury","type":"address"}],"name":"updateTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wcroToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506040516200121238038062001212833981016040819052620000349162000243565b6200003f33620001d6565b6001805581620000a25760405162461bcd60e51b815260206004820152602360248201527f4665654469737472696275746f723a207472656173757279536861726573206960448201526207320360ec1b60648201526084015b60405180910390fd5b60008411620001035760405162461bcd60e51b815260206004820152602660248201527f4665654469737472696275746f723a206d696e746564426f6f7374536861726560448201526507320697320360d41b606482015260840162000099565b60008111620001695760405162461bcd60e51b815260206004820152602b60248201527f4665654469737472696275746f723a207265776172644475726174696f6e496e60448201526a0426c6f636b7320697320360ac1b606482015260840162000099565b600380546001600160a01b038088166001600160a01b0319928316179092556004805492861692909116919091179055600682905560078490556009819055620001b4814362000296565b60085543600b55620001c7848362000296565b60025550620002bb9350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200023e57600080fd5b919050565b600080600080600060a086880312156200025b578081fd5b620002668662000226565b9450602086015193506200027d6040870162000226565b6060870151608090970151959894975095949392505050565b60008219821115620002b657634e487b7160e01b81526011600452602481fd5b500190565b610f4780620002cb6000396000f3fe608060405234801561001057600080fd5b50600436106101205760003560e01c806385e3f997116100ad578063baec8b0f11610071578063baec8b0f14610226578063be1c8bd01461022f578063d9621f9e14610238578063f2fde38b14610240578063f90ce5ba1461025357600080fd5b806385e3f997146101dd5780638da5cb5b146101e657806395610bb1146101f75780639ea84a151461020a578063a3f7cbea1461021d57600080fd5b8063442da82f116100f4578063442da82f1461019357806361d027b31461019c57806364790208146101af578063715018a6146101c25780637f51bb1f146101ca57600080fd5b8062d8c928146101255780631a567dc21461014757806323d256ef146101725780633e158b0c14610189575b600080fd5b61012d61025c565b604080519283526020830191909152015b60405180910390f35b60055461015a906001600160a01b031681565b6040516001600160a01b03909116815260200161013e565b61017b600a5481565b60405190815260200161013e565b610191610315565b005b61017b60085481565b60045461015a906001600160a01b031681565b6101916101bd366004610ded565b610380565b6101916104a3565b6101916101d8366004610d8e565b6104b7565b61017b60025481565b6000546001600160a01b031661015a565b60035461015a906001600160a01b031681565b610191610218366004610d8e565b6105b6565b61017b60095481565b61017b60065481565b61017b60075481565b61017b6106bc565b61019161024e366004610d8e565b610829565b61017b600b5481565b6003546040516370a0823160e01b8152306004820152600091829182916001600160a01b0316906370a082319060240160206040518083038186803b1580156102a457600080fd5b505afa1580156102b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102dc9190610dd5565b90506000600254600754836102f19190610e95565b6102fb9190610e75565b905060006103098284610eb4565b91959194509092505050565b6002600154141561036d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260015561037a6108a2565b60018055565b610388610935565b600082116103e45760405162461bcd60e51b815260206004820152602360248201527f4665654469737472696275746f723a207472656173757279536861726573206960448201526207320360ec1b6064820152608401610364565b600081116104435760405162461bcd60e51b815260206004820152602660248201527f4665654469737472696275746f723a206d696e746564426f6f7374536861726560448201526507320697320360d41b6064820152608401610364565b600682905560078190556104578183610e5d565b6002556006546007546040517f4c4bc59340dcade5200be42047434758dbee54be8425c0139cf6db4ceec56f8e9261049792908252602082015260400190565b60405180910390a15050565b6104ab610935565b6104b5600061098f565b565b6104bf610935565b6001600160a01b0381166105075760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610364565b6004546001600160a01b038281169116141561055e5760405162461bcd60e51b81526020600482015260166024820152751d1c99585cdd5c9e48185b1c9958591e48195e1a5cdd60521b6044820152606401610364565b600480546001600160a01b038381166001600160a01b03198316811790935560408051938452911660208301819052917fd101a15f9e9364a1c0a7c4cc8eb4cd9220094e83353915b0c74e09f72ec73edb9101610497565b6105be610935565b6001600160a01b0381166106065760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610364565b6005546001600160a01b03828116911614156106645760405162461bcd60e51b815260206004820152601960248201527f6d696e746564426f6f737420616c7265616479206578697374000000000000006044820152606401610364565b600580546001600160a01b038381166001600160a01b03198316811790935560408051938452911660208301819052917f77eb1f1d31eec686cedb8c57ea528ef1628f0854063b8ffa4bab67b95b93f04f9101610497565b6005546000906001600160a01b03166106d55750600090565b60085443116106ff5760006106e86109df565b509050600a54816106f99190610e95565b91505090565b60006107096109df565b5090506000600a548261071c9190610e95565b6003546040516370a0823160e01b815230600482015291925060009183916001600160a01b0316906370a082319060240160206040518083038186803b15801561076557600080fd5b505afa158015610779573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079d9190610dd5565b6107a79190610eb4565b90506000600254600754836107bc9190610e95565b6107c69190610e75565b90506000600954436107d89190610e5d565b90506000600854826107ea9190610eb4565b6107f49084610e75565b9050600081600854436108079190610eb4565b6108119190610e95565b905061081d8187610e5d565b97505050505050505090565b610831610935565b6001600160a01b0381166108965760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610364565b61089f8161098f565b50565b6005546001600160a01b031661090c5760405162461bcd60e51b815260206004820152602960248201527f4665654469737472696275746f723a206d696e746564426f6f737420646f65736044820152681b89dd08195e1a5cdd60ba1b6064820152608401610364565b600854431161091d576104b5610a1b565b610925610a1b565b61092d610a6b565b6104b5610a1b565b6000546001600160a01b031633146104b55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610364565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806008544311610a0057600b546109f89043610eb4565b924392509050565b600b54600854610a109190610eb4565b600854915091509091565b600080610a266109df565b600a54919350915015610a65576000600a5483610a439190610e95565b600554600354919250610a63916001600160a01b03908116911683610ae2565b505b600b5550565b6008544311156104b557600080610a8061025c565b9150915060095443610a929190610e5d565b6008558115610ad957600454600354610ab8916001600160a01b03918216911683610ae2565b600b54600854610ac89190610eb4565b610ad29083610e75565b600a555050565b6000600a555050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b34908490610b39565b505050565b6000610b8e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c0b9092919063ffffffff16565b805190915015610b345780806020019051810190610bac9190610db5565b610b345760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610364565b6060610c1a8484600085610c24565b90505b9392505050565b606082471015610c855760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610364565b6001600160a01b0385163b610cdc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610364565b600080866001600160a01b03168587604051610cf89190610e0e565b60006040518083038185875af1925050503d8060008114610d35576040519150601f19603f3d011682016040523d82523d6000602084013e610d3a565b606091505b5091509150610d4a828286610d55565b979650505050505050565b60608315610d64575081610c1d565b825115610d745782518084602001fd5b8160405162461bcd60e51b81526004016103649190610e2a565b600060208284031215610d9f578081fd5b81356001600160a01b0381168114610c1d578182fd5b600060208284031215610dc6578081fd5b81518015158114610c1d578182fd5b600060208284031215610de6578081fd5b5051919050565b60008060408385031215610dff578081fd5b50508035926020909101359150565b60008251610e20818460208701610ecb565b9190910192915050565b6020815260008251806020840152610e49816040850160208701610ecb565b601f01601f19169190910160400192915050565b60008219821115610e7057610e70610efb565b500190565b600082610e9057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615610eaf57610eaf610efb565b500290565b600082821015610ec657610ec6610efb565b500390565b60005b83811015610ee6578181015183820152602001610ece565b83811115610ef5576000848401525b50505050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220f1d7d87297a2429d7955b5601df0aaa162cb3374235781571b072aeefe93b57364736f6c634300080400330000000000000000000000005c7f8a570d578ed84e63fdfa7b1ee72deae1ae230000000000000000000000000000000000000000000000000000000000000032000000000000000000000000ba68f42eb91ed5ba22af3e62148975e1dd9d231800000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000019e79

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

0000000000000000000000005c7f8a570d578ed84e63fdfa7b1ee72deae1ae230000000000000000000000000000000000000000000000000000000000000032000000000000000000000000ba68f42eb91ed5ba22af3e62148975e1dd9d231800000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000019e79

-----Decoded View---------------
Arg [0] : _wcroToken (address): 0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23
Arg [1] : _mintedBoostShares (uint256): 50
Arg [2] : _treasury (address): 0xba68f42eb91ed5ba22af3e62148975e1dd9d2318
Arg [3] : _treasuryShares (uint256): 50
Arg [4] : _rewardDurationInBlocks (uint256): 106105

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000005c7f8a570d578ed84e63fdfa7b1ee72deae1ae23
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [2] : 000000000000000000000000ba68f42eb91ed5ba22af3e62148975e1dd9d2318
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [4] : 0000000000000000000000000000000000000000000000000000000000019e79


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.