false
false
0
The new Blockscout UI is now open source! Learn how to deploy it here
- We're indexing this chain right now. Some of the counts may be inaccurate.

Contract Address Details

0xa2618Aaf4466646616Cc873F3Bd37b3FAfd385A2

Contract Name
CampaignRewardDistribution
Creator
0x7c9cfc–082749 at 0xb235a1–2c38f4
Balance
0 ETH
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
1962117
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
CampaignRewardDistribution




Optimization enabled
true
Compiler version
v0.8.4+commit.c7e474f2




Optimization runs
200
EVM Version
default




Verified at
2024-10-10T09:53:53.142888Z

contracts/CampaignRewardDistribution.sol

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";

contract CampaignRewardDistribution is OwnableUpgradeable {
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using ECDSAUpgradeable for bytes32;

    event CampaignCreated(uint256 campaignId, address rewardToken);
    event RewardClaimed(address user, uint256 campaignId, uint256 amount);

    struct Campaign {
        address rewardToken;
        uint256 claimableFrom;
        uint256 claimableUntil;
        string signaturePrefix;
    }
    mapping(uint256 => Campaign) public campaigns;
    mapping(address => mapping(uint256 => bool)) public claimed;

    address public masterSigner;
    
    function initialize(address _signerAddress) public initializer {
       __Ownable_init();
        masterSigner = _signerAddress;
    }

    function isSignatureValid(address user, uint256 campaignId, uint256 amount, bytes memory signature) public view returns(bool) {
        string memory prefix = campaigns[campaignId].signaturePrefix;
        bytes32 messagehash = keccak256(abi.encodePacked(prefix, user, campaignId, amount));
        address signerAddress = messagehash.toEthSignedMessageHash().recover(signature);
        return signerAddress == masterSigner;
    }

    function updateSignerAddress(address _masterSignerAddress) external onlyOwner {
        masterSigner = _masterSignerAddress;
    }

    function createCampaign(uint256 _campaignId, address _rewardToken, uint256 _claimableFrom, uint256 _claimableUntil, string memory _signaturePrefix) external onlyOwner {
        campaigns[_campaignId] = Campaign(_rewardToken, _claimableFrom, _claimableUntil, _signaturePrefix);
        emit CampaignCreated(_campaignId, _rewardToken);
    }

    function claim(address user, uint256 campaignId, uint256 amount, bytes memory signature) external payable {
        require(campaigns[campaignId].claimableFrom <= block.timestamp, "rewards cannot be claimed yet");
        require(campaigns[campaignId].claimableUntil >= block.timestamp, "rewards cannot be claimed anymore");
        require(!claimed[user][campaignId], "reward already claimed");
        require(isSignatureValid(user, campaignId, amount, signature), "invalid signature");
        claimed[user][campaignId] = true;
        IERC20Upgradeable(campaigns[campaignId].rewardToken).safeTransfer(user, amount);
        emit RewardClaimed(user, campaignId, amount);
    }

    function withdrawCampaignFunds(uint256 campaignId, uint256 amount) external onlyOwner {
        IERC20Upgradeable(campaigns[campaignId].rewardToken).safeTransfer(owner(), amount);

        uint256 nativeBalance = address(this).balance;
        if (nativeBalance > 0) {
            (bool success,) = payable(owner()).call{value: address(this).balance}("");
            require(success, "FAILED_TO_WITHDRAW");
        }
    }
}
        

@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

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

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _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);
    }

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

@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}
          

@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.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 IERC20Upgradeable {
    /**
     * @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-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.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 IERC20PermitUpgradeable {
    /**
     * @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);
}
          

@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol

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

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable for address;

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

    function safeTransferFrom(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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(
        IERC20PermitUpgradeable 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(IERC20Upgradeable 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");
        }
    }
}
          

@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.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 AddressUpgradeable {
    /**
     * @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 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);
            }
        }
    }
}
          

@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

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

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

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

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

@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}
          

@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../StringsUpgradeable.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSAUpgradeable {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata","storageLayout"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
              

Contract ABI

[{"type":"event","name":"CampaignCreated","inputs":[{"type":"uint256","name":"campaignId","internalType":"uint256","indexed":false},{"type":"address","name":"rewardToken","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"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":"RewardClaimed","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"campaignId","internalType":"uint256","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"rewardToken","internalType":"address"},{"type":"uint256","name":"claimableFrom","internalType":"uint256"},{"type":"uint256","name":"claimableUntil","internalType":"uint256"},{"type":"string","name":"signaturePrefix","internalType":"string"}],"name":"campaigns","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"claim","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"campaignId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"claimed","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createCampaign","inputs":[{"type":"uint256","name":"_campaignId","internalType":"uint256"},{"type":"address","name":"_rewardToken","internalType":"address"},{"type":"uint256","name":"_claimableFrom","internalType":"uint256"},{"type":"uint256","name":"_claimableUntil","internalType":"uint256"},{"type":"string","name":"_signaturePrefix","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_signerAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSignatureValid","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"campaignId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"masterSigner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateSignerAddress","inputs":[{"type":"address","name":"_masterSignerAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawCampaignFunds","inputs":[{"type":"uint256","name":"campaignId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50611652806100206000396000f3fe6080604052600436106100a75760003560e01c80638da5cb5b116100645780638da5cb5b146101b25780638fa2a9f0146101d0578063a5328c99146101f0578063c4d66de814610210578063d352c8b614610230578063f2fde38b1461025057600080fd5b8063141961bc146100ac57806320a3cd01146100e55780632ada8a321461011d5780634a0dcc21146101325780634dd6c8de14610152578063715018a61461019d575b600080fd5b3480156100b857600080fd5b506100cc6100c73660046113a5565b610270565b6040516100dc94939291906114e6565b60405180910390f35b3480156100f157600080fd5b50606754610105906001600160a01b031681565b6040516001600160a01b0390911681526020016100dc565b61013061012b366004611313565b61032d565b005b34801561013e57600080fd5b5061013061014d3660046113bd565b61054a565b34801561015e57600080fd5b5061018d61016d3660046112ea565b606660209081526000928352604080842090915290825290205460ff1681565b60405190151581526020016100dc565b3480156101a957600080fd5b50610130610611565b3480156101be57600080fd5b506033546001600160a01b0316610105565b3480156101dc57600080fd5b506101306101eb3660046112d0565b610625565b3480156101fc57600080fd5b5061013061020b366004611439565b61064f565b34801561021c57600080fd5b5061013061022b3660046112d0565b610742565b34801561023c57600080fd5b5061018d61024b366004611313565b61086f565b34801561025c57600080fd5b5061013061026b3660046112d0565b6109bf565b60656020526000908152604090208054600182015460028301546003840180546001600160a01b039094169492939192916102aa906115cb565b80601f01602080910402602001604051908101604052809291908181526020018280546102d6906115cb565b80156103235780601f106102f857610100808354040283529160200191610323565b820191906000526020600020905b81548152906001019060200180831161030657829003601f168201915b5050505050905084565b6000838152606560205260409020600101544210156103935760405162461bcd60e51b815260206004820152601d60248201527f726577617264732063616e6e6f7420626520636c61696d65642079657400000060448201526064015b60405180910390fd5b6000838152606560205260409020600201544211156103fe5760405162461bcd60e51b815260206004820152602160248201527f726577617264732063616e6e6f7420626520636c61696d656420616e796d6f726044820152606560f81b606482015260840161038a565b6001600160a01b038416600090815260666020908152604080832086845290915290205460ff161561046b5760405162461bcd60e51b81526020600482015260166024820152751c995dd85c9908185b1c9958591e4818db185a5b595960521b604482015260640161038a565b6104778484848461086f565b6104b75760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b604482015260640161038a565b6001600160a01b0380851660009081526066602090815260408083208784528252808320805460ff1916600117905560659091529020546104fa91168584610a38565b604080516001600160a01b0386168152602081018590529081018390527ff01da32686223933d8a18a391060918c7f11a3648639edd87ae013e2e27317439060600160405180910390a150505050565b610552610a8a565b604080516080810182526001600160a01b03868116825260208083018781528385018781526060850187815260008c81526065855296909620855181546001600160a01b03191695169490941784559051600184015551600283015592518051929391926105c692600385019201906111a5565b5050604080518781526001600160a01b03871660208201527f633109eec20320eded000fc1e2634211aa7e92ba3f5b15faf6dcdafca05094e492500160405180910390a15050505050565b610619610a8a565b6106236000610ae4565b565b61062d610a8a565b606780546001600160a01b0319166001600160a01b0392909216919091179055565b610657610a8a565b61068b61066c6033546001600160a01b031690565b6000848152606560205260409020546001600160a01b03169083610a38565b47801561073d5760006106a66033546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d80600081146106f0576040519150601f19603f3d011682016040523d82523d6000602084013e6106f5565b606091505b505090508061073b5760405162461bcd60e51b81526020600482015260126024820152714641494c45445f544f5f574954484452415760701b604482015260640161038a565b505b505050565b600054610100900460ff16158080156107625750600054600160ff909116105b8061077c5750303b15801561077c575060005460ff166001145b6107df5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161038a565b6000805460ff191660011790558015610802576000805461ff0019166101001790555b61080a610b36565b606780546001600160a01b0319166001600160a01b038416179055801561086b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6000838152606560205260408120600301805482919061088e906115cb565b80601f01602080910402602001604051908101604052809291908181526020018280546108ba906115cb565b80156109075780601f106108dc57610100808354040283529160200191610907565b820191906000526020600020905b8154815290600101906020018083116108ea57829003601f168201915b5050505050905060008187878760405160200161092794939291906114a2565b60405160208183030381529060405280519060200120905060006109a28561099c846040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90610b65565b6067546001600160a01b0390811691161498975050505050505050565b6109c7610a8a565b6001600160a01b038116610a2c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161038a565b610a3581610ae4565b50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261073d908490610b89565b6033546001600160a01b031633146106235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610b5d5760405162461bcd60e51b815260040161038a90611530565b610623610c5b565b6000806000610b748585610c8b565b91509150610b8181610cfb565b509392505050565b6000610bde826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610efc9092919063ffffffff16565b80519091501561073d5780806020019051810190610bfc9190611385565b61073d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161038a565b600054610100900460ff16610c825760405162461bcd60e51b815260040161038a90611530565b61062333610ae4565b600080825160411415610cc25760208301516040840151606085015160001a610cb687828585610f15565b94509450505050610cf4565b825160401415610cec5760208301516040840151610ce1868383611002565b935093505050610cf4565b506000905060025b9250929050565b6000816004811115610d1d57634e487b7160e01b600052602160045260246000fd5b1415610d265750565b6001816004811115610d4857634e487b7160e01b600052602160045260246000fd5b1415610d965760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161038a565b6002816004811115610db857634e487b7160e01b600052602160045260246000fd5b1415610e065760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161038a565b6003816004811115610e2857634e487b7160e01b600052602160045260246000fd5b1415610e815760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161038a565b6004816004811115610ea357634e487b7160e01b600052602160045260246000fd5b1415610a355760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161038a565b6060610f0b848460008561103b565b90505b9392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610f4c5750600090506003610ff9565b8460ff16601b14158015610f6457508460ff16601c14155b15610f755750600090506004610ff9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610fc9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610ff257600060019250925050610ff9565b9150600090505b94509492505050565b6000806001600160ff1b0383168161101f60ff86901c601b61157b565b905061102d87828885610f15565b935093505050935093915050565b60608247101561109c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161038a565b6001600160a01b0385163b6110f35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161038a565b600080866001600160a01b0316858760405161110f9190611486565b60006040518083038185875af1925050503d806000811461114c576040519150601f19603f3d011682016040523d82523d6000602084013e611151565b606091505b509150915061116182828661116c565b979650505050505050565b6060831561117b575081610f0e565b82511561118b5782518084602001fd5b8160405162461bcd60e51b815260040161038a919061151d565b8280546111b1906115cb565b90600052602060002090601f0160209004810192826111d35760008555611219565b82601f106111ec57805160ff1916838001178555611219565b82800160010185558215611219579182015b828111156112195782518255916020019190600101906111fe565b50611225929150611229565b5090565b5b80821115611225576000815560010161122a565b600067ffffffffffffffff8084111561125957611259611606565b604051601f8501601f19908116603f0116810190828211818310171561128157611281611606565b8160405280935085815286868601111561129a57600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b03811681146112cb57600080fd5b919050565b6000602082840312156112e1578081fd5b610f0e826112b4565b600080604083850312156112fc578081fd5b611305836112b4565b946020939093013593505050565b60008060008060808587031215611328578182fd5b611331856112b4565b93506020850135925060408501359150606085013567ffffffffffffffff81111561135a578182fd5b8501601f8101871361136a578182fd5b6113798782356020840161123e565b91505092959194509250565b600060208284031215611396578081fd5b81518015158114610f0e578182fd5b6000602082840312156113b6578081fd5b5035919050565b600080600080600060a086880312156113d4578081fd5b853594506113e4602087016112b4565b93506040860135925060608601359150608086013567ffffffffffffffff81111561140d578182fd5b8601601f8101881361141d578182fd5b61142c8882356020840161123e565b9150509295509295909350565b6000806040838503121561144b578182fd5b50508035926020909101359150565b6000815180845261147281602086016020860161159f565b601f01601f19169290920160200192915050565b6000825161149881846020870161159f565b9190910192915050565b600085516114b4818460208a0161159f565b60609590951b6bffffffffffffffffffffffff1916919094019081526014810192909252603482015260540192915050565b60018060a01b0385168152836020820152826040820152608060608201526000611513608083018461145a565b9695505050505050565b602081526000610f0e602083018461145a565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000821982111561159a57634e487b7160e01b81526011600452602481fd5b500190565b60005b838110156115ba5781810151838201526020016115a2565b8381111561073b5750506000910152565b600181811c908216806115df57607f821691505b6020821081141561160057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fdfea264697066735822122076f7cd6e1b42b0d59d957f032a8207333a08976e7129ffd1b9d3bc9b33e52b7c64736f6c63430008040033

Deployed ByteCode

0x6080604052600436106100a75760003560e01c80638da5cb5b116100645780638da5cb5b146101b25780638fa2a9f0146101d0578063a5328c99146101f0578063c4d66de814610210578063d352c8b614610230578063f2fde38b1461025057600080fd5b8063141961bc146100ac57806320a3cd01146100e55780632ada8a321461011d5780634a0dcc21146101325780634dd6c8de14610152578063715018a61461019d575b600080fd5b3480156100b857600080fd5b506100cc6100c73660046113a5565b610270565b6040516100dc94939291906114e6565b60405180910390f35b3480156100f157600080fd5b50606754610105906001600160a01b031681565b6040516001600160a01b0390911681526020016100dc565b61013061012b366004611313565b61032d565b005b34801561013e57600080fd5b5061013061014d3660046113bd565b61054a565b34801561015e57600080fd5b5061018d61016d3660046112ea565b606660209081526000928352604080842090915290825290205460ff1681565b60405190151581526020016100dc565b3480156101a957600080fd5b50610130610611565b3480156101be57600080fd5b506033546001600160a01b0316610105565b3480156101dc57600080fd5b506101306101eb3660046112d0565b610625565b3480156101fc57600080fd5b5061013061020b366004611439565b61064f565b34801561021c57600080fd5b5061013061022b3660046112d0565b610742565b34801561023c57600080fd5b5061018d61024b366004611313565b61086f565b34801561025c57600080fd5b5061013061026b3660046112d0565b6109bf565b60656020526000908152604090208054600182015460028301546003840180546001600160a01b039094169492939192916102aa906115cb565b80601f01602080910402602001604051908101604052809291908181526020018280546102d6906115cb565b80156103235780601f106102f857610100808354040283529160200191610323565b820191906000526020600020905b81548152906001019060200180831161030657829003601f168201915b5050505050905084565b6000838152606560205260409020600101544210156103935760405162461bcd60e51b815260206004820152601d60248201527f726577617264732063616e6e6f7420626520636c61696d65642079657400000060448201526064015b60405180910390fd5b6000838152606560205260409020600201544211156103fe5760405162461bcd60e51b815260206004820152602160248201527f726577617264732063616e6e6f7420626520636c61696d656420616e796d6f726044820152606560f81b606482015260840161038a565b6001600160a01b038416600090815260666020908152604080832086845290915290205460ff161561046b5760405162461bcd60e51b81526020600482015260166024820152751c995dd85c9908185b1c9958591e4818db185a5b595960521b604482015260640161038a565b6104778484848461086f565b6104b75760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b604482015260640161038a565b6001600160a01b0380851660009081526066602090815260408083208784528252808320805460ff1916600117905560659091529020546104fa91168584610a38565b604080516001600160a01b0386168152602081018590529081018390527ff01da32686223933d8a18a391060918c7f11a3648639edd87ae013e2e27317439060600160405180910390a150505050565b610552610a8a565b604080516080810182526001600160a01b03868116825260208083018781528385018781526060850187815260008c81526065855296909620855181546001600160a01b03191695169490941784559051600184015551600283015592518051929391926105c692600385019201906111a5565b5050604080518781526001600160a01b03871660208201527f633109eec20320eded000fc1e2634211aa7e92ba3f5b15faf6dcdafca05094e492500160405180910390a15050505050565b610619610a8a565b6106236000610ae4565b565b61062d610a8a565b606780546001600160a01b0319166001600160a01b0392909216919091179055565b610657610a8a565b61068b61066c6033546001600160a01b031690565b6000848152606560205260409020546001600160a01b03169083610a38565b47801561073d5760006106a66033546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d80600081146106f0576040519150601f19603f3d011682016040523d82523d6000602084013e6106f5565b606091505b505090508061073b5760405162461bcd60e51b81526020600482015260126024820152714641494c45445f544f5f574954484452415760701b604482015260640161038a565b505b505050565b600054610100900460ff16158080156107625750600054600160ff909116105b8061077c5750303b15801561077c575060005460ff166001145b6107df5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161038a565b6000805460ff191660011790558015610802576000805461ff0019166101001790555b61080a610b36565b606780546001600160a01b0319166001600160a01b038416179055801561086b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6000838152606560205260408120600301805482919061088e906115cb565b80601f01602080910402602001604051908101604052809291908181526020018280546108ba906115cb565b80156109075780601f106108dc57610100808354040283529160200191610907565b820191906000526020600020905b8154815290600101906020018083116108ea57829003601f168201915b5050505050905060008187878760405160200161092794939291906114a2565b60405160208183030381529060405280519060200120905060006109a28561099c846040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90610b65565b6067546001600160a01b0390811691161498975050505050505050565b6109c7610a8a565b6001600160a01b038116610a2c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161038a565b610a3581610ae4565b50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261073d908490610b89565b6033546001600160a01b031633146106235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610b5d5760405162461bcd60e51b815260040161038a90611530565b610623610c5b565b6000806000610b748585610c8b565b91509150610b8181610cfb565b509392505050565b6000610bde826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610efc9092919063ffffffff16565b80519091501561073d5780806020019051810190610bfc9190611385565b61073d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161038a565b600054610100900460ff16610c825760405162461bcd60e51b815260040161038a90611530565b61062333610ae4565b600080825160411415610cc25760208301516040840151606085015160001a610cb687828585610f15565b94509450505050610cf4565b825160401415610cec5760208301516040840151610ce1868383611002565b935093505050610cf4565b506000905060025b9250929050565b6000816004811115610d1d57634e487b7160e01b600052602160045260246000fd5b1415610d265750565b6001816004811115610d4857634e487b7160e01b600052602160045260246000fd5b1415610d965760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161038a565b6002816004811115610db857634e487b7160e01b600052602160045260246000fd5b1415610e065760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161038a565b6003816004811115610e2857634e487b7160e01b600052602160045260246000fd5b1415610e815760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161038a565b6004816004811115610ea357634e487b7160e01b600052602160045260246000fd5b1415610a355760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161038a565b6060610f0b848460008561103b565b90505b9392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610f4c5750600090506003610ff9565b8460ff16601b14158015610f6457508460ff16601c14155b15610f755750600090506004610ff9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610fc9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610ff257600060019250925050610ff9565b9150600090505b94509492505050565b6000806001600160ff1b0383168161101f60ff86901c601b61157b565b905061102d87828885610f15565b935093505050935093915050565b60608247101561109c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161038a565b6001600160a01b0385163b6110f35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161038a565b600080866001600160a01b0316858760405161110f9190611486565b60006040518083038185875af1925050503d806000811461114c576040519150601f19603f3d011682016040523d82523d6000602084013e611151565b606091505b509150915061116182828661116c565b979650505050505050565b6060831561117b575081610f0e565b82511561118b5782518084602001fd5b8160405162461bcd60e51b815260040161038a919061151d565b8280546111b1906115cb565b90600052602060002090601f0160209004810192826111d35760008555611219565b82601f106111ec57805160ff1916838001178555611219565b82800160010185558215611219579182015b828111156112195782518255916020019190600101906111fe565b50611225929150611229565b5090565b5b80821115611225576000815560010161122a565b600067ffffffffffffffff8084111561125957611259611606565b604051601f8501601f19908116603f0116810190828211818310171561128157611281611606565b8160405280935085815286868601111561129a57600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b03811681146112cb57600080fd5b919050565b6000602082840312156112e1578081fd5b610f0e826112b4565b600080604083850312156112fc578081fd5b611305836112b4565b946020939093013593505050565b60008060008060808587031215611328578182fd5b611331856112b4565b93506020850135925060408501359150606085013567ffffffffffffffff81111561135a578182fd5b8501601f8101871361136a578182fd5b6113798782356020840161123e565b91505092959194509250565b600060208284031215611396578081fd5b81518015158114610f0e578182fd5b6000602082840312156113b6578081fd5b5035919050565b600080600080600060a086880312156113d4578081fd5b853594506113e4602087016112b4565b93506040860135925060608601359150608086013567ffffffffffffffff81111561140d578182fd5b8601601f8101881361141d578182fd5b61142c8882356020840161123e565b9150509295509295909350565b6000806040838503121561144b578182fd5b50508035926020909101359150565b6000815180845261147281602086016020860161159f565b601f01601f19169290920160200192915050565b6000825161149881846020870161159f565b9190910192915050565b600085516114b4818460208a0161159f565b60609590951b6bffffffffffffffffffffffff1916919094019081526014810192909252603482015260540192915050565b60018060a01b0385168152836020820152826040820152608060608201526000611513608083018461145a565b9695505050505050565b602081526000610f0e602083018461145a565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000821982111561159a57634e487b7160e01b81526011600452602481fd5b500190565b60005b838110156115ba5781810151838201526020016115a2565b8381111561073b5750506000910152565b600181811c908216806115df57607f821691505b6020821081141561160057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fdfea264697066735822122076f7cd6e1b42b0d59d957f032a8207333a08976e7129ffd1b9d3bc9b33e52b7c64736f6c63430008040033