ETH Price: $1,969.46 (-2.14%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim Rewards229251672025-07-15 14:26:11229 days ago1752589571IN
0x9df47A52...5EC38d9cc
0 ETH0.000357834.30342504
Claim Rewards227092442025-06-15 10:07:35259 days ago1749982055IN
0x9df47A52...5EC38d9cc
0 ETH0.000045890.4577568
Claim Rewards227092302025-06-15 10:04:47259 days ago1749981887IN
0x9df47A52...5EC38d9cc
0 ETH0.00003980.47868815
Claim Rewards227092282025-06-15 10:04:23259 days ago1749981863IN
0x9df47A52...5EC38d9cc
0 ETH0.000041570.5
Claim Rewards226968952025-06-13 16:40:59261 days ago1749832859IN
0x9df47A52...5EC38d9cc
0 ETH0.000222242.67276527
Claim Rewards226817072025-06-11 13:46:11263 days ago1749649571IN
0x9df47A52...5EC38d9cc
0 ETH0.000448135.38940021
Claim Rewards226805902025-06-11 10:01:35263 days ago1749636095IN
0x9df47A52...5EC38d9cc
0 ETH0.000213952.57309747
Claim Rewards226683992025-06-09 17:05:59265 days ago1749488759IN
0x9df47A52...5EC38d9cc
0 ETH0.000228342.74614597
Claim Rewards226626512025-06-08 21:48:35266 days ago1749419315IN
0x9df47A52...5EC38d9cc
0 ETH0.000059970.59828759
Claim Rewards226579862025-06-08 6:09:11266 days ago1749362951IN
0x9df47A52...5EC38d9cc
0 ETH0.000050440.50319179
Claim Rewards226504602025-06-07 4:56:23267 days ago1749272183IN
0x9df47A52...5EC38d9cc
0 ETH0.000117161.16868509

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Method Block
From
To
0x6101e060225830212025-05-28 18:23:47277 days ago1748456627  Contract Creation0 ETH
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xF393E432...22116f570
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
NudgeCampaign

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

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

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { INudgeCampaign } from "./interfaces/INudgeCampaign.sol";
import "./interfaces/INudgeCampaignFactory.sol";

/// @title NudgeCampaign
/// @notice A contract for managing Nudge campaigns with token rewards
contract NudgeCampaign is INudgeCampaign, AccessControl {
  using Math for uint256;
  using SafeERC20 for IERC20;

  // Role granted to the entity which is running the campaign and managing the rewards
  bytes32 public constant CAMPAIGN_ADMIN_ROLE = keccak256("CAMPAIGN_ADMIN_ROLE");
  uint256 private constant BPS_DENOMINATOR = 10_000;
  // Denominator in parts per quadrillion
  uint256 private constant PPQ_DENOMINATOR = 1e15;
  // Special address representing the native token (ETH)
  address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

  // Factory reference
  INudgeCampaignFactory public immutable factory;

  // Campaign Configuration
  uint32 public immutable holdingPeriodInSeconds;
  address public immutable targetToken;
  address public immutable rewardToken;
  uint256 public immutable rewardPPQ;
  uint256 public immutable startTimestamp;
  address public immutable alternativeWithdrawalAddress;
  // Fee parameter in basis points (1000 = 10%)
  uint16 public immutable feeBps;
  bool public isCampaignActive;
  // Unique identifier for this campaign
  uint256 public immutable campaignId;

  // Scaling factors for 18 decimal normalization
  uint256 public immutable targetScalingFactor;
  uint256 public immutable rewardScalingFactor;

  // Campaign State
  uint256 public pID;
  uint256 public pendingRewardsIncludingFees;
  uint256 public totalReallocatedAmount;
  uint256 public accumulatedFees;
  uint256 public distributedRewards;
  // Track whether campaign was manually deactivated
  bool private _manuallyDeactivated;

  // Participations
  mapping(uint256 pID => Participation) public participations;

  /// @notice Creates a new campaign with specified parameters
  /// @param holdingPeriodInSeconds_ Duration users must hold tokens
  /// @param targetToken_ Address of token users need to hold
  /// @param rewardToken_ Address of token used for rewards
  /// @param rewardPPQ_ Amount of reward tokens earned for participating in the campaign, in parts per quadrillion
  /// @param campaignAdmin Address granted CAMPAIGN_ADMIN_ROLE
  /// @param startTimestamp_ When the campaign becomes active (0 for immediate)
  /// @param feeBps_ Nudge's fee percentage in basis points
  /// @param alternativeWithdrawalAddress_ Optional alternative address for withdrawing unallocated rewards (zero
  /// address to re-use `campaignAdmin`)
  /// @param campaignId_ Unique identifier for this campaign
  constructor(
    uint32 holdingPeriodInSeconds_,
    address targetToken_,
    address rewardToken_,
    uint256 rewardPPQ_,
    address campaignAdmin,
    uint256 startTimestamp_,
    uint16 feeBps_,
    address alternativeWithdrawalAddress_,
    uint256 campaignId_
  ) {
    if (rewardToken_ == address(0) || campaignAdmin == address(0)) {
      revert InvalidCampaignSettings();
    }

    if (startTimestamp_ != 0 && startTimestamp_ <= block.timestamp) {
      revert InvalidCampaignSettings();
    }

    factory = INudgeCampaignFactory(msg.sender);

    targetToken = targetToken_;
    rewardToken = rewardToken_;
    campaignId = campaignId_;

    // Compute scaling factors based on token decimals
    uint256 targetDecimals = targetToken_ == NATIVE_TOKEN ? 18 : IERC20Metadata(targetToken_).decimals();
    uint256 rewardDecimals = rewardToken_ == NATIVE_TOKEN ? 18 : IERC20Metadata(rewardToken_).decimals();

    // Calculate scaling factors to normalize to 18 decimals
    targetScalingFactor = 10 ** (18 - targetDecimals);
    rewardScalingFactor = 10 ** (18 - rewardDecimals);

    _grantRole(CAMPAIGN_ADMIN_ROLE, campaignAdmin);

    startTimestamp = startTimestamp_ == 0 ? block.timestamp : startTimestamp_;
    // Campaign is active if start time is now or in the past
    isCampaignActive = startTimestamp <= block.timestamp;

    rewardPPQ = rewardPPQ_;
    holdingPeriodInSeconds = holdingPeriodInSeconds_;
    feeBps = feeBps_;
    alternativeWithdrawalAddress = alternativeWithdrawalAddress_;
  }

  /// @notice Ensures the campaign is not paused
  modifier whenNotPaused() {
    if (factory.isCampaignPaused(address(this))) revert CampaignPaused();
    _;
  }

  /// @notice Restricts access to factory contract or Nudge admins
  modifier onlyFactoryOrNudgeAdmin() {
    if (!factory.hasRole(factory.NUDGE_ADMIN_ROLE(), msg.sender) && msg.sender != address(factory)) {
      revert Unauthorized();
    }
    _;
  }

  /// @notice Restricts access to Nudge operators
  modifier onlyNudgeOperator() {
    if (!factory.hasRole(factory.NUDGE_OPERATOR_ROLE(), msg.sender)) {
      revert Unauthorized();
    }
    _;
  }

  /// @notice Calculates the total reward amount (including platform fees) based on target token amount
  /// @param toAmount Amount of target tokens to calculate rewards for
  /// @return Total reward amount including platform fees, scaled to reward token decimals
  function getRewardAmountIncludingFees(uint256 toAmount) public view returns (uint256) {
    // If both tokens have 18 decimals, no scaling needed
    if (targetScalingFactor == 1 && rewardScalingFactor == 1) {
      return toAmount.mulDiv(rewardPPQ, PPQ_DENOMINATOR);
    }

    // Scale amount to 18 decimals for reward calculation
    uint256 scaledAmount = toAmount * targetScalingFactor;

    // Calculate reward in 18 decimals
    uint256 rewardAmountIn18Decimals = scaledAmount.mulDiv(rewardPPQ, PPQ_DENOMINATOR);

    // Scale back to reward token decimals
    return rewardAmountIn18Decimals / rewardScalingFactor;
  }

  /// @notice Handles token reallocation for campaign participation
  /// @param campaignId_ ID of the campaign
  /// @param userAddress Address of the participating user
  /// @param toToken Address of the token being acquired
  /// @param toAmountMinimum Minimum expected amount of tokens to be acquired
  /// @param data Additional data for the reallocation
  /// @dev Only callable by SWAP_CALLER_ROLE, handles both ERC20 and native tokens
  function handleReallocation(
    uint256 campaignId_,
    address userAddress,
    address toToken,
    uint256 toAmountMinimum,
    bytes memory data
  ) external payable whenNotPaused {
    // Check if campaign is active or can be activated
    _validateAndActivateCampaignIfReady();

    if (!factory.hasRole(factory.SWAP_CALLER_ROLE(), msg.sender)) {
      revert UnauthorizedSwapCaller();
    }

    if (toToken != targetToken) {
      revert InvalidToTokenReceived(toToken);
    }

    if (campaignId_ != campaignId) {
      revert InvalidCampaignId();
    }

    uint256 amountReceived;
    if (toToken == NATIVE_TOKEN) {
      amountReceived = msg.value;
    } else {
      if (msg.value > 0) {
        revert InvalidToTokenReceived(NATIVE_TOKEN);
      }
      IERC20 tokenReceived = IERC20(toToken);
      uint256 balanceOfSender = tokenReceived.balanceOf(msg.sender);
      uint256 balanceBefore = getBalanceOfSelf(toToken);

      SafeERC20.safeTransferFrom(tokenReceived, msg.sender, address(this), balanceOfSender);

      amountReceived = getBalanceOfSelf(toToken) - balanceBefore;
    }

    if (amountReceived < toAmountMinimum) {
      revert InsufficientAmountReceived();
    }

    _transfer(toToken, userAddress, amountReceived);

    totalReallocatedAmount += amountReceived;

    uint256 rewardAmountIncludingFees = getRewardAmountIncludingFees(amountReceived);

    uint256 rewardsAvailable = claimableRewardAmount();
    if (rewardAmountIncludingFees > rewardsAvailable) {
      revert NotEnoughRewardsAvailable();
    }

    (uint256 userRewards, uint256 fees) = calculateUserRewardsAndFees(rewardAmountIncludingFees);
    pendingRewardsIncludingFees += rewardAmountIncludingFees;

    pID++;
    // Store the participation details
    participations[pID] = Participation({
      status: ParticipationStatus.PARTICIPATING,
      userAddress: userAddress,
      toAmount: amountReceived,
      rewardAmount: userRewards,
      feeAmount: fees,
      startTimestamp: block.timestamp,
      startBlockNumber: block.number
    });

    emit NewParticipation(campaignId_, userAddress, pID, amountReceived, userRewards, fees, data);
  }

  /// @notice Checks if campaign is active or can be activated based on current timestamp
  function _validateAndActivateCampaignIfReady() internal {
    if (!isCampaignActive) {
      // Only auto-activate if campaign has not been manually deactivated
      // and if the start time has been reached
      if (!_manuallyDeactivated && block.timestamp >= startTimestamp) {
        // Automatically activate the campaign if start time reached
        isCampaignActive = true;
      } else if (block.timestamp < startTimestamp) {
        // If start time not reached, explicitly revert
        revert StartDateNotReached();
      } else {
        // If campaign was manually deactivated, revert with InactiveCampaign
        revert InactiveCampaign();
      }
    }
  }

  /// @notice Claims rewards for multiple participations
  /// @param pIDs Array of participation IDs to claim rewards for
  /// @dev Verifies holding period, caller and participation status, and handles reward distribution
  function claimRewards(uint256[] calldata pIDs) external whenNotPaused {
    if (pIDs.length == 0) {
      revert EmptyParticipationsArray();
    }

    uint256 availableBalance = getBalanceOfSelf(rewardToken);

    uint256 pIDsLength = pIDs.length;
    for (uint256 i = 0; i < pIDsLength; i++) {
      Participation storage participation = participations[pIDs[i]];

      // Check if participation exists and is valid
      if (participation.status != ParticipationStatus.PARTICIPATING) {
        revert InvalidParticipationStatus(pIDs[i]);
      }

      // Verify holding period has elapsed
      if (block.timestamp < participation.startTimestamp + holdingPeriodInSeconds) {
        revert HoldingPeriodNotElapsed(pIDs[i]);
      }

      uint256 userRewards = participation.rewardAmount;
      // Break if insufficient balance for this claim
      if (userRewards > availableBalance) {
        break;
      }

      // Update contract state
      pendingRewardsIncludingFees = pendingRewardsIncludingFees - (userRewards + participation.feeAmount);
      distributedRewards += userRewards;
      accumulatedFees = accumulatedFees + participation.feeAmount;

      // Update participation status and transfer rewards
      participation.status = ParticipationStatus.CLAIMED;
      availableBalance -= userRewards;

      _transfer(rewardToken, participation.userAddress, userRewards);

      emit NudgeRewardClaimed(pIDs[i], participation.userAddress, userRewards);
    }
  }

  /*//////////////////////////////////////////////////////////////////////////
                              ADMIN FUNCTIONS                             
  //////////////////////////////////////////////////////////////////////////*/

  /// @notice Invalidates specified participations
  /// @param pIDs Array of participation IDs to invalidate
  /// @dev Only callable by operator role
  function invalidateParticipations(uint256[] calldata pIDs) external onlyNudgeOperator {
    uint256 pIDsLength = pIDs.length;
    for (uint256 i = 0; i < pIDsLength; i++) {
      Participation storage participation = participations[pIDs[i]];

      if (participation.status != ParticipationStatus.PARTICIPATING) {
        continue;
      }

      participation.status = ParticipationStatus.INVALIDATED;
      pendingRewardsIncludingFees =
        pendingRewardsIncludingFees -
        (participation.rewardAmount + participation.feeAmount);
    }

    emit ParticipationInvalidated(pIDs);
  }

  /// @notice Withdraws unallocated rewards from the campaign
  /// @param amount Amount of rewards to withdraw
  /// @dev Only callable by campaign admin
  function withdrawRewards(uint256 amount) external onlyRole(CAMPAIGN_ADMIN_ROLE) {
    if (amount > claimableRewardAmount()) {
      revert NotEnoughRewardsAvailable();
    }

    address to = alternativeWithdrawalAddress == address(0) ? msg.sender : alternativeWithdrawalAddress;

    _transfer(rewardToken, to, amount);

    emit RewardsWithdrawn(to, amount);
  }

  /// @notice Collects accumulated fees
  /// @return feesToCollect Amount of fees collected
  /// @dev Only callable by NudgeCampaignFactory or Nudge admins
  function collectFees() external onlyFactoryOrNudgeAdmin returns (uint256 feesToCollect) {
    feesToCollect = accumulatedFees;
    accumulatedFees = 0;

    _transfer(rewardToken, factory.nudgeTreasuryAddress(), feesToCollect);

    emit FeesCollected(feesToCollect);
  }

  /// @notice Marks a campaign as active, i.e accepting new participations
  /// @param isActive New active status
  /// @dev Only callable by Nudge admins
  function setIsCampaignActive(bool isActive) external {
    if (!factory.hasRole(factory.NUDGE_ADMIN_ROLE(), msg.sender)) {
      revert Unauthorized();
    }

    if (isActive && block.timestamp < startTimestamp) {
      revert StartDateNotReached();
    }

    isCampaignActive = isActive;
    // If deactivating, mark as manually deactivated
    if (!isActive) {
      _manuallyDeactivated = true;
    } else {
      // If activating, clear the manual deactivation flag
      _manuallyDeactivated = false;
    }

    emit CampaignStatusChanged(isActive);
  }

  /// @notice Rescues tokens that were mistakenly sent to the contract
  /// @param token Address of token to rescue
  /// @dev Only callable by NUDGE_ADMIN_ROLE, can't rescue the reward token
  /// @return amount Amount of tokens rescued
  function rescueTokens(address token) external returns (uint256 amount) {
    if (!factory.hasRole(factory.NUDGE_ADMIN_ROLE(), msg.sender)) {
      revert Unauthorized();
    }

    if (token == rewardToken) {
      revert CannotRescueRewardToken();
    }

    amount = getBalanceOfSelf(token);
    if (amount > 0) {
      _transfer(token, msg.sender, amount);
      emit TokensRescued(token, amount);
    }

    return amount;
  }

  /*//////////////////////////////////////////////////////////////////////////
                              VIEW FUNCTIONS                              
  //////////////////////////////////////////////////////////////////////////*/

  /// @notice Gets the balance of the specified token for this contract
  /// @param token Address of token to check
  /// @return Balance of the token
  function getBalanceOfSelf(address token) public view returns (uint256) {
    if (token == NATIVE_TOKEN) {
      return address(this).balance;
    } else {
      return IERC20(token).balanceOf(address(this));
    }
  }

  /// @notice Calculates the amount of rewards available for distribution
  /// @return Amount of claimable rewards
  function claimableRewardAmount() public view returns (uint256) {
    return getBalanceOfSelf(rewardToken) - pendingRewardsIncludingFees - accumulatedFees;
  }

  /// @notice Calculates user rewards and fees from total reward amount
  /// @param rewardAmountIncludingFees Total reward amount including fees
  /// @return userRewards Amount of rewards for the user
  /// @return fees Amount of fees to be collected
  function calculateUserRewardsAndFees(
    uint256 rewardAmountIncludingFees
  ) public view returns (uint256 userRewards, uint256 fees) {
    fees = (rewardAmountIncludingFees * feeBps) / BPS_DENOMINATOR;
    return (rewardAmountIncludingFees - fees, fees);
  }

  /// @notice Returns comprehensive information about the campaign
  /// @return _holdingPeriodInSeconds Duration users must hold tokens
  /// @return _targetToken Address of token users need to hold
  /// @return _rewardToken Address of token used for rewards
  /// @return _rewardPPQ Reward parameter in parts per quadrillion
  /// @return _startTimestamp When the campaign becomes active
  /// @return _isCampaignActive Whether the campaign is currently active
  /// @return _pendingRewardsIncludingFees Total amount of earmarked reward tokens
  /// @return _totalReallocatedAmount Total amount of tokens reallocated
  /// @return _distributedRewards Total rewards distributed
  /// @return _claimableRewards Amount of rewards available for distribution
  /// @return _isManuallyDeactivated Whether the campaign is manually deactivated
  function getCampaignInfo()
    external
    view
    returns (
      uint32 _holdingPeriodInSeconds,
      address _targetToken,
      address _rewardToken,
      uint256 _rewardPPQ,
      uint256 _startTimestamp,
      bool _isCampaignActive,
      uint256 _pendingRewardsIncludingFees,
      uint256 _totalReallocatedAmount,
      uint256 _distributedRewards,
      uint256 _claimableRewards,
      bool _isManuallyDeactivated
    )
  {
    return (
      holdingPeriodInSeconds,
      targetToken,
      rewardToken,
      rewardPPQ,
      startTimestamp,
      isCampaignActive,
      pendingRewardsIncludingFees,
      totalReallocatedAmount,
      distributedRewards,
      claimableRewardAmount(),
      _manuallyDeactivated
    );
  }

  /*//////////////////////////////////////////////////////////////////////////
                            INTERNAL FUNCTIONS
  //////////////////////////////////////////////////////////////////////////*/
  /// @notice Internal function to transfer tokens
  /// @param token Address of token to transfer
  /// @param to Recipient address
  /// @param amount Amount to transfer
  /// @dev Handles both ERC20 and native token transfers
  function _transfer(address token, address to, uint256 amount) internal {
    if (token == NATIVE_TOKEN) {
      (bool sent, ) = to.call{ value: amount }("");
      if (!sent) revert NativeTokenTransferFailed();
    } else {
      SafeERC20.safeTransfer(IERC20(token), to, amount);
    }
  }

  /// @notice Allows contract to receive native token transfers
  receive() external payable {}

  /// @notice Fallback function to receive native token transfers
  fallback() external payable {}
}

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

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

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

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";

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

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

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

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

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

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

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

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

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

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

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

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

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

import "./IBaseNudgeCampaign.sol";

interface INudgeCampaign is IBaseNudgeCampaign {
  // Errors
  error NotEnoughRewardsAvailable();
  error InactiveCampaign();
  error StartDateNotReached();
  error InvalidCampaignSettings();
  error EmptyClaimArray();
  error HoldingPeriodNotElapsed(uint256 pID);
  error UnauthorizedCaller(uint256 pID);
  error InvalidParticipationStatus(uint256 pID);
  error NativeTokenTransferFailed();
  error EmptyParticipationsArray();
  error InvalidCampaignId();
  error CannotRescueRewardToken();

  // Events
  event ParticipationInvalidated(uint256[] pIDs);
  event RewardsWithdrawn(address to, uint256 amount);
  event FeesCollected(uint256 amount);
  event CampaignStatusChanged(bool isActive);
  event NudgeRewardClaimed(uint256 pID, address userAddress, uint256 rewardAmount);
  event TokensRescued(address token, uint256 amount);

  function collectFees() external returns (uint256);
  function invalidateParticipations(uint256[] calldata pIDs) external;
  function withdrawRewards(uint256 amount) external;
  function setIsCampaignActive(bool isActive) external;
  function claimRewards(uint256[] calldata pIDs) external;
  function rescueTokens(address token) external returns (uint256);

  // View functions
  function getBalanceOfSelf(address token) external view returns (uint256);
  function claimableRewardAmount() external view returns (uint256);
  function getRewardAmountIncludingFees(uint256 toAmount) external view returns (uint256);
  function calculateUserRewardsAndFees(
    uint256 rewardAmountIncludingFees
  ) external view returns (uint256 userRewards, uint256 fees);
  function getCampaignInfo()
    external
    view
    returns (
      uint32 _holdingPeriodInSeconds,
      address _targetToken,
      address _rewardToken,
      uint256 _rewardPPQ,
      uint256 _startTimestamp,
      bool _isCampaignActive,
      uint256 _pendingRewardsIncludingFees,
      uint256 _totalReallocatedAmount,
      uint256 _distributedRewards,
      uint256 _claimableRewards,
      bool _isManuallyDeactivated
    );
}

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

import "@openzeppelin/contracts/access/IAccessControl.sol";

interface INudgeCampaignFactory is IAccessControl {
  function NUDGE_ADMIN_ROLE() external view returns (bytes32);
  function NUDGE_OPERATOR_ROLE() external view returns (bytes32);
  function SWAP_CALLER_ROLE() external view returns (bytes32);
  function NATIVE_TOKEN() external view returns (address);

  error ZeroAddress();
  error InvalidTreasuryAddress();
  error InvalidParameter();
  error InvalidCampaign();
  error NativeTokenTransferFailed();
  error IncorrectEtherAmount();
  error InvalidFeeSetting();

  event CampaignDeployed(
    address indexed campaign,
    address indexed admin,
    address targetToken,
    address rewardToken,
    uint256 startTimestamp,
    uint256 uuid
  );
  event TreasuryUpdated(address indexed oldTreasury, address indexed newTreasury);
  event CampaignsPaused(address[] campaigns);
  event CampaignsUnpaused(address[] campaigns);
  event FeeUpdated(uint16 oldFeeBps, uint16 newFeeBps);

  function nudgeTreasuryAddress() external view returns (address);
  function isCampaign(address) external view returns (bool);
  function campaignAddresses(uint256) external view returns (address);
  function isCampaignPaused(address) external view returns (bool);

  function deployCampaign(
    uint32 holdingPeriodInSeconds,
    address targetToken,
    address rewardToken,
    uint256 rewardPPQ,
    address campaignAdmin,
    uint256 startTimestamp,
    address alternativeWithdrawalAddress,
    uint256 uuid
  )
    external
    returns (address);

  function deployAndFundCampaign(
    uint32 holdingPeriodInSeconds,
    address targetToken,
    address rewardToken,
    uint256 rewardPPQ,
    address campaignAdmin,
    uint256 startTimestamp,
    address alternativeWithdrawalAddress,
    uint256 initialRewardAmount,
    uint256 uuid
  )
    external
    payable
    returns (address);

  function getCampaignAddress(
    uint32 holdingPeriodInSeconds,
    address targetToken,
    address rewardToken,
    uint256 rewardPPQ,
    address campaignAdmin,
    uint256 startTimestamp,
    uint16 feeBps,
    address alternativeWithdrawalAddress,
    uint256 uuid
  )
    external
    view
    returns (address);

  function updateTreasuryAddress(address newTreasury) external;
  function updateFeeSetting(uint16 newFeeBps) external;
  function collectFeesFromCampaigns(address[] calldata campaigns) external;
  function pauseCampaigns(address[] calldata campaigns) external;
  function unpauseCampaigns(address[] calldata campaigns) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // 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 FailedInnerCall();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

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

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

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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

interface IBaseNudgeCampaign {
  // Errors
  error CampaignPaused();
  error UnauthorizedSwapCaller();
  error Unauthorized();
  error InsufficientAmountReceived();
  error InvalidToTokenReceived(address toToken);

  // Enums
  enum ParticipationStatus {
    PARTICIPATING,
    INVALIDATED,
    CLAIMED,
    HANDLED_OFFCHAIN
  }

  // Structs
  struct Participation {
    ParticipationStatus status;
    address userAddress;
    uint256 toAmount;
    uint256 rewardAmount;
    uint256 feeAmount;
    uint256 startTimestamp;
    uint256 startBlockNumber;
  }

  // Events
  event NewParticipation(
    uint256 indexed campaignId,
    address indexed userAddress,
    uint256 pID,
    uint256 toAmount,
    uint256 entitledRewards,
    uint256 fees,
    bytes data
  );

  // External functions
  function handleReallocation(
    uint256 campaignId,
    address userAddress,
    address toToken,
    uint256 toAmountMinimum,
    bytes memory data
  )
    external
    payable;

  // View functions
  function getBalanceOfSelf(address token) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

Settings
{
  "remappings": [
    "@prb/test/=lib/prb-test/src/",
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "prb-test/=lib/prb-test/src/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "none",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"uint32","name":"holdingPeriodInSeconds_","type":"uint32"},{"internalType":"address","name":"targetToken_","type":"address"},{"internalType":"address","name":"rewardToken_","type":"address"},{"internalType":"uint256","name":"rewardPPQ_","type":"uint256"},{"internalType":"address","name":"campaignAdmin","type":"address"},{"internalType":"uint256","name":"startTimestamp_","type":"uint256"},{"internalType":"uint16","name":"feeBps_","type":"uint16"},{"internalType":"address","name":"alternativeWithdrawalAddress_","type":"address"},{"internalType":"uint256","name":"campaignId_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"CampaignPaused","type":"error"},{"inputs":[],"name":"CannotRescueRewardToken","type":"error"},{"inputs":[],"name":"EmptyClaimArray","type":"error"},{"inputs":[],"name":"EmptyParticipationsArray","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"pID","type":"uint256"}],"name":"HoldingPeriodNotElapsed","type":"error"},{"inputs":[],"name":"InactiveCampaign","type":"error"},{"inputs":[],"name":"InsufficientAmountReceived","type":"error"},{"inputs":[],"name":"InvalidCampaignId","type":"error"},{"inputs":[],"name":"InvalidCampaignSettings","type":"error"},{"inputs":[{"internalType":"uint256","name":"pID","type":"uint256"}],"name":"InvalidParticipationStatus","type":"error"},{"inputs":[{"internalType":"address","name":"toToken","type":"address"}],"name":"InvalidToTokenReceived","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"NativeTokenTransferFailed","type":"error"},{"inputs":[],"name":"NotEnoughRewardsAvailable","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"StartDateNotReached","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[{"internalType":"uint256","name":"pID","type":"uint256"}],"name":"UnauthorizedCaller","type":"error"},{"inputs":[],"name":"UnauthorizedSwapCaller","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"CampaignStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"campaignId","type":"uint256"},{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"pID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"entitledRewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"NewParticipation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"pID","type":"uint256"},{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"NudgeRewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"pIDs","type":"uint256[]"}],"name":"ParticipationInvalidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensRescued","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"CAMPAIGN_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accumulatedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"alternativeWithdrawalAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardAmountIncludingFees","type":"uint256"}],"name":"calculateUserRewardsAndFees","outputs":[{"internalType":"uint256","name":"userRewards","type":"uint256"},{"internalType":"uint256","name":"fees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"campaignId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"pIDs","type":"uint256[]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimableRewardAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectFees","outputs":[{"internalType":"uint256","name":"feesToCollect","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract INudgeCampaignFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeBps","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getBalanceOfSelf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCampaignInfo","outputs":[{"internalType":"uint32","name":"_holdingPeriodInSeconds","type":"uint32"},{"internalType":"address","name":"_targetToken","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewardPPQ","type":"uint256"},{"internalType":"uint256","name":"_startTimestamp","type":"uint256"},{"internalType":"bool","name":"_isCampaignActive","type":"bool"},{"internalType":"uint256","name":"_pendingRewardsIncludingFees","type":"uint256"},{"internalType":"uint256","name":"_totalReallocatedAmount","type":"uint256"},{"internalType":"uint256","name":"_distributedRewards","type":"uint256"},{"internalType":"uint256","name":"_claimableRewards","type":"uint256"},{"internalType":"bool","name":"_isManuallyDeactivated","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"toAmount","type":"uint256"}],"name":"getRewardAmountIncludingFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"campaignId_","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"toAmountMinimum","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"handleReallocation","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"holdingPeriodInSeconds","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"pIDs","type":"uint256[]"}],"name":"invalidateParticipations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isCampaignActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pID","type":"uint256"}],"name":"participations","outputs":[{"internalType":"enum IBaseNudgeCampaign.ParticipationStatus","name":"status","type":"uint8"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"toAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"startBlockNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingRewardsIncludingFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"rescueTokens","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPPQ","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardScalingFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"isActive","type":"bool"}],"name":"setIsCampaignActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"targetScalingFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"targetToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReallocatedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

0x6101e0604052348015610010575f5ffd5b50604051612ee5380380612ee583398101604081905261002f91610351565b6001600160a01b038716158061004c57506001600160a01b038516155b1561006a57604051637f528cf160e11b815260040160405180910390fd5b83158015906100795750428411155b1561009757604051637f528cf160e11b815260040160405180910390fd5b336080526001600160a01b0388811660c081905290881660e0526101808290525f9073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461013857886001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561010f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061013391906103f7565b61013b565b60125b60ff1690505f6001600160a01b03891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146101ca57886001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101c591906103f7565b6101cd565b60125b60ff1690506101dd826012610432565b6101e890600a610528565b6101a0526101f7816012610432565b61020290600a610528565b6101c0526102307f018e24ce9675721209068196867f2525c191c548d07fd44e29ff6fe34d0140e48861028d565b50851561023d578561023f565b425b6101208190526001805460ff191642909211159190911790555050506101009490945263ffffffff90961660a052505061ffff9093166101605250506001600160a01b031661014052610533565b5f828152602081815260408083206001600160a01b038516845290915281205460ff1661032d575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556102e53390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610330565b505f5b92915050565b80516001600160a01b038116811461034c575f5ffd5b919050565b5f5f5f5f5f5f5f5f5f6101208a8c03121561036a575f5ffd5b895163ffffffff8116811461037d575f5ffd5b985061038b60208b01610336565b975061039960408b01610336565b60608b015190975095506103af60808b01610336565b60a08b015160c08c0151919650945061ffff811681146103cd575f5ffd5b92506103db60e08b01610336565b91505f6101008b01519050809150509295985092959850929598565b5f60208284031215610407575f5ffd5b815160ff81168114610417575f5ffd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156103305761033061041e565b6001815b6001841115610480578085048111156104645761046461041e565b600184161561047257908102905b60019390931c928002610449565b935093915050565b5f8261049657506001610330565b816104a257505f610330565b81600181146104b857600281146104c2576104de565b6001915050610330565b60ff8411156104d3576104d361041e565b50506001821b610330565b5060208310610133831016604e8410600b8410161715610501575081810a610330565b61050d5f198484610445565b805f19048211156105205761052061041e565b029392505050565b5f6104178383610488565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516128216106c45f395f818161055601528181611288015261134901525f81816104340152818161125d01526112e801525f81816105890152611b7701525f818161030601526110d001525f818161028d0152818161119001526111bf01525f81816108050152818161101b015281816118cb01528181612112015261214a01525f8181610641015281816112b60152818161131601526118aa01525f8181610879015281816109cd01528181610c7701528181610e32015281816111ec015281816115860152818161173b015261188901525f8181610401015281816118680152611b1a01525f818161072101528181610d41015261184701525f81816106a70152818161089e015281816108cd01528181610bc101528181610ee401528181610f1301528181611378015281816113a7015281816115c6015281816115f5015281816116ea0152818161175c01528181611951015281816119ea0152611a1901526128215ff3fe608060405260043610610219575f3560e01c80638ed5b0fc11610121578063c46d6d43116100a4578063e6fd48bc1161006b578063e6fd48bc146107f4578063ef9d973314610827578063f387bcac1461083a578063f3e14f1e14610853578063f7c618c11461086857005b8063c46d6d43146106c9578063c8796572146106fc578063d23fd39a14610710578063d547741f14610758578063d6290cd71461077757005b8063b36a921c116100e8578063b36a921c14610611578063bb1f969814610630578063c0cd0a0714610663578063c41adae414610682578063c45a01551461069657005b80638ed5b0fc1461057857806391d14854146105ab5780639342c8f4146105ca578063a217fddf146105e9578063a411179c146105fc57005b80633606f159116101a957806369b8b84c1161017057806369b8b84c146104c8578063717ab112146104e75780637d9e50a8146104fc5780638d792c44146105115780638e4a82791461054557005b80633606f1591461042357806336568abe1461045657806346ed11d114610475578063587f5ed7146104945780635eac6239146104a957005b806324a9d853116101ed57806324a9d853146102f55780632a6247e51461033b5780632f2ff15d146103aa57806331f7d964146103c9578063327107f7146103f057005b8062ae3bf81461021b57806301ffc9a71461024d5780631b3c17a21461027c578063248a9ca3146102c7575b005b348015610226575f5ffd5b5061023a6102353660046123f0565b61089b565b6040519081526020015b60405180910390f35b348015610258575f5ffd5b5061026c61026736600461240b565b610a81565b6040519015158152602001610244565b348015610287575f5ffd5b506102af7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610244565b3480156102d2575f5ffd5b5061023a6102e1366004612432565b5f9081526020819052604090206001015490565b348015610300575f5ffd5b506103287f000000000000000000000000000000000000000000000000000000000000000081565b60405161ffff9091168152602001610244565b348015610346575f5ffd5b50610397610355366004612432565b60086020525f908152604090208054600182015460028301546003840154600485015460059095015460ff8516956101009095046001600160a01b0316949087565b604051610244979695949392919061245d565b3480156103b5575f5ffd5b506102196103c43660046124b4565b610ab7565b3480156103d4575f5ffd5b506102af73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b3480156103fb575f5ffd5b506102af7f000000000000000000000000000000000000000000000000000000000000000081565b34801561042e575f5ffd5b5061023a7f000000000000000000000000000000000000000000000000000000000000000081565b348015610461575f5ffd5b506102196104703660046124b4565b610ae1565b348015610480575f5ffd5b5061023a61048f3660046123f0565b610b19565b34801561049f575f5ffd5b5061023a60055481565b3480156104b4575f5ffd5b506102196104c33660046124e2565b610bac565b3480156104d3575f5ffd5b506102196104e2366004612560565b610ee2565b3480156104f2575f5ffd5b5061023a60025481565b348015610507575f5ffd5b5061023a60045481565b34801561051c575f5ffd5b5061053061052b366004612432565b6110c3565b60408051928352602083019190915201610244565b348015610550575f5ffd5b5061023a7f000000000000000000000000000000000000000000000000000000000000000081565b348015610583575f5ffd5b5061023a7f000000000000000000000000000000000000000000000000000000000000000081565b3480156105b6575f5ffd5b5061026c6105c53660046124b4565b611113565b3480156105d5575f5ffd5b506102196105e4366004612432565b61113b565b3480156105f4575f5ffd5b5061023a5f81565b348015610607575f5ffd5b5061023a60035481565b34801561061c575f5ffd5b5061023a61062b366004612432565b61125a565b34801561063b575f5ffd5b5061023a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561066e575f5ffd5b5061021961067d3660046124e2565b611376565b34801561068d575f5ffd5b5061023a61157a565b3480156106a1575f5ffd5b506102af7f000000000000000000000000000000000000000000000000000000000000000081565b3480156106d4575f5ffd5b5061023a7f018e24ce9675721209068196867f2525c191c548d07fd44e29ff6fe34d0140e481565b348015610707575f5ffd5b5061023a6115c3565b34801561071b575f5ffd5b506107437f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610244565b348015610763575f5ffd5b506102196107723660046124b4565b611816565b348015610782575f5ffd5b5061078b61183a565b6040805163ffffffff9c909c168c526001600160a01b039a8b1660208d015298909916978a01979097526060890195909552608088019390935290151560a087015260c086015260e0850152610100840152610120830152151561014082015261016001610244565b3480156107ff575f5ffd5b5061023a7f000000000000000000000000000000000000000000000000000000000000000081565b61021961083536600461258f565b61193c565b348015610845575f5ffd5b5060015461026c9060ff1681565b34801561085e575f5ffd5b5061023a60065481565b348015610873575f5ffd5b506102af7f000000000000000000000000000000000000000000000000000000000000000081565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166391d148547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638537ed1f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610927573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061094b9190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa15801561098b573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109af9190612690565b6109cb576040516282b42960e81b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031603610a1d57604051637d8969bd60e11b815260040160405180910390fd5b610a2682610b19565b90508015610a7c57610a39823383611e93565b604080516001600160a01b0384168152602081018390527f68f67de89e96b13a3ea058af5fd44cc125efceb528482d539c7b43db2faa066e910160405180910390a15b919050565b5f6001600160e01b03198216637965db0b60e01b1480610ab157506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f82815260208190526040902060010154610ad181611f33565b610adb8383611f40565b50505050565b6001600160a01b0381163314610b0a5760405163334bd91960e11b815260040160405180910390fd5b610b148282611fcf565b505050565b5f73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610b46575047919050565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015610b88573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ab19190612679565b6040516338e04b1560e11b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906371c0962a90602401602060405180830381865afa158015610c0e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c329190612690565b15610c5057604051637f27963360e11b815260040160405180910390fd5b5f819003610c71576040516312670c5360e11b815260040160405180910390fd5b5f610c9b7f0000000000000000000000000000000000000000000000000000000000000000610b19565b9050815f5b81811015610edb575f60085f878785818110610cbe57610cbe6126ab565b9050602002013581526020019081526020015f2090505f6003811115610ce657610ce6612449565b815460ff166003811115610cfc57610cfc612449565b14610d3f57858583818110610d1357610d136126ab565b905060200201356040516388bd17d760e01b8152600401610d3691815260200190565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168160040154610d7591906126d3565b421015610db157858583818110610d8e57610d8e6126ab565b90506020020135604051638bd3634560e01b8152600401610d3691815260200190565b600281015484811115610dc5575050610edb565b6003820154610dd490826126d3565b600354610de191906126e6565b6003819055508060065f828254610df891906126d3565b90915550506003820154600554610e0f91906126d3565b600555815460ff19166002178255610e2781866126e6565b8254909550610e66907f00000000000000000000000000000000000000000000000000000000000000009061010090046001600160a01b031683611e93565b7f31b5917b0734921f0de659d10340b427eee593f0e9d75be467effbfd84bfca21878785818110610e9957610e996126ab565b85546040805160209384029095013585526101009091046001600160a01b03169184019190915282018490525060600160405180910390a15050600101610ca0565b5050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166391d148547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638537ed1f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f6d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f919190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610fd1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ff59190612690565b611011576040516282b42960e81b815260040160405180910390fd5b80801561103d57507f000000000000000000000000000000000000000000000000000000000000000042105b1561105b57604051632dc9a48b60e21b815260040160405180910390fd5b6001805460ff191682151517905580611080576007805460ff1916600117905561108b565b6007805460ff191690555b60405181151581527f42608d890a587157308343115fbd9ad8fd091d7ba64d81940a157d776fcf96919060200160405180910390a150565b5f806127106110f661ffff7f000000000000000000000000000000000000000000000000000000000000000016856126f9565b6111009190612724565b905061110c81846126e6565b9150915091565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b7f018e24ce9675721209068196867f2525c191c548d07fd44e29ff6fe34d0140e461116581611f33565b61116d61157a565b82111561118d57604051631267338760e31b815260040160405180910390fd5b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316156111e3577f00000000000000000000000000000000000000000000000000000000000000006111e5565b335b90506112127f00000000000000000000000000000000000000000000000000000000000000008285611e93565b604080516001600160a01b0383168152602081018590527f8a43c4352486ec339f487f64af78ca5cbf06cd47833f073d3baf3a193e50316191015b60405180910390a1505050565b5f7f000000000000000000000000000000000000000000000000000000000000000060011480156112ab57507f00000000000000000000000000000000000000000000000000000000000000006001145b156112e257610ab1827f000000000000000000000000000000000000000000000000000000000000000066038d7ea4c68000612038565b5f61130d7f0000000000000000000000000000000000000000000000000000000000000000846126f9565b90505f611342827f000000000000000000000000000000000000000000000000000000000000000066038d7ea4c68000612038565b905061136e7f000000000000000000000000000000000000000000000000000000000000000082612724565b949350505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166391d148547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663adf256f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611401573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114259190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611465573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114899190612690565b6114a5576040516282b42960e81b815260040160405180910390fd5b805f5b81811015611548575f60085f8686858181106114c6576114c66126ab565b9050602002013581526020019081526020015f2090505f60038111156114ee576114ee612449565b815460ff16600381111561150457611504612449565b1461150f5750611540565b805460ff191660011781556003810154600282015461152e91906126d3565b60035461153b91906126e6565b600355505b6001016114a8565b507f8cddf682bedc1c1e24b78b3e46e2c190bbce8e25d3061f573d9848eb0638b4bf838360405161124d929190612743565b5f6005546003546115aa7f0000000000000000000000000000000000000000000000000000000000000000610b19565b6115b491906126e6565b6115be91906126e6565b905090565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166391d148547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638537ed1f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561164f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116739190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa1580156116b3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116d79190612690565b15801561170d5750336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614155b1561172a576040516282b42960e81b815260040160405180910390fd5b60055490505f6005819055506117e07f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630da4eb876040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117b6573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117da919061277a565b83611e93565b6040518181527f860c0aa5520013080c2f65981705fcdea474d9f7c3daf954656ed5e65d692d1f9060200160405180910390a190565b5f8281526020819052604090206001015461183081611f33565b610adb8383611fcf565b5f5f5f5f5f5f5f5f5f5f5f7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060015f9054906101000a900460ff1660035460045460065461190a61157a565b60075f9054906101000a900460ff169a509a509a509a509a509a509a509a509a509a509a50909192939495969798999a565b6040516338e04b1560e11b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906371c0962a90602401602060405180830381865afa15801561199e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119c29190612690565b156119e057604051637f27963360e11b815260040160405180910390fd5b6119e86120f8565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166391d148547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663620cad996040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a73573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a979190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611ad7573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611afb9190612690565b611b1857604051631a2244f360e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614611b7557604051637d72a69360e11b81526001600160a01b0384166004820152602401610d36565b7f00000000000000000000000000000000000000000000000000000000000000008514611bb557604051636824bccd60e01b815260040160405180910390fd5b5f73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03851601611be2575034611cb5565b3415611c1757604051637d72a69360e11b815273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6004820152602401610d36565b6040516370a0823160e01b815233600482015284905f906001600160a01b038316906370a0823190602401602060405180830381865afa158015611c5d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c819190612679565b90505f611c8d87610b19565b9050611c9b833330856121a4565b80611ca588610b19565b611caf91906126e6565b93505050505b82811015611cd6576040516348879a0960e11b815260040160405180910390fd5b611ce1848683611e93565b8060045f828254611cf291906126d3565b909155505f9050611d028261125a565b90505f611d0d61157a565b905080821115611d3057604051631267338760e31b815260040160405180910390fd5b5f5f611d3b846110c3565b915091508360035f828254611d5091906126d3565b909155505060028054905f611d6483612795565b90915550506040805160e0810182525f8082526001600160a01b038c1660208084019190915282840189905260608301869052608083018590524260a08401524360c08401526002548252600890529190912081518154829060ff19166001836003811115611dd557611dd5612449565b02179055506020820151815f0160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010155606082015181600201556080820151816003015560a0820151816004015560c08201518160050155905050886001600160a01b03168a7f6c20cdeccbed14f48d4368b5f13e518890690a91c5cb1f999f44768f69a9425b6002548886868c604051611e7f9594939291906127ad565b60405180910390a350505050505050505050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03841601611f28575f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114611f01576040519150601f19603f3d011682016040523d82523d5f602084013e611f06565b606091505b5050905080610adb57604051630c08bcb960e21b815260040160405180910390fd5b610b1483838361220b565b611f3d813361223c565b50565b5f611f4b8383611113565b611fc8575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611f803390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610ab1565b505f610ab1565b5f611fda8383611113565b15611fc8575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610ab1565b5f838302815f1985870982811083820303915050805f0361206c5783828161206257612062612710565b04925050506120f1565b80841161208c5760405163227bc15360e01b815260040160405180910390fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60015460ff166121a25760075460ff1615801561213557507f00000000000000000000000000000000000000000000000000000000000000004210155b15612148576001805460ff191681179055565b7f000000000000000000000000000000000000000000000000000000000000000042101561218957604051632dc9a48b60e21b815260040160405180910390fd5b60405163952ce6dd60e01b815260040160405180910390fd5b565b6040516001600160a01b038481166024830152838116604483015260648201839052610adb9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050612279565b6040516001600160a01b03838116602483015260448201839052610b1491859182169063a9059cbb906064016121d9565b6122468282611113565b6122755760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610d36565b5050565b5f61228d6001600160a01b038416836122da565b905080515f141580156122b15750808060200190518101906122af9190612690565b155b15610b1457604051635274afe760e01b81526001600160a01b0384166004820152602401610d36565b60606120f183835f845f5f856001600160a01b031684866040516122fe91906127fe565b5f6040518083038185875af1925050503d805f8114612338576040519150601f19603f3d011682016040523d82523d5f602084013e61233d565b606091505b509150915061234d868383612357565b9695505050505050565b60608261236c57612367826123b3565b6120f1565b815115801561238357506001600160a01b0384163b155b156123ac57604051639996b31560e01b81526001600160a01b0385166004820152602401610d36565b50806120f1565b8051156123c35780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114611f3d575f5ffd5b5f60208284031215612400575f5ffd5b81356120f1816123dc565b5f6020828403121561241b575f5ffd5b81356001600160e01b0319811681146120f1575f5ffd5b5f60208284031215612442575f5ffd5b5035919050565b634e487b7160e01b5f52602160045260245ffd5b60e081016004891061247d57634e487b7160e01b5f52602160045260245ffd5b9781526001600160a01b0396909616602087015260408601949094526060850192909252608084015260a083015260c09091015290565b5f5f604083850312156124c5575f5ffd5b8235915060208301356124d7816123dc565b809150509250929050565b5f5f602083850312156124f3575f5ffd5b823567ffffffffffffffff811115612509575f5ffd5b8301601f81018513612519575f5ffd5b803567ffffffffffffffff81111561252f575f5ffd5b8560208260051b8401011115612543575f5ffd5b6020919091019590945092505050565b8015158114611f3d575f5ffd5b5f60208284031215612570575f5ffd5b81356120f181612553565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f5f5f60a086880312156125a3575f5ffd5b8535945060208601356125b5816123dc565b935060408601356125c5816123dc565b925060608601359150608086013567ffffffffffffffff8111156125e7575f5ffd5b8601601f810188136125f7575f5ffd5b803567ffffffffffffffff8111156126115761261161257b565b604051601f8201601f19908116603f0116810167ffffffffffffffff811182821017156126405761264061257b565b6040528181528282016020018a1015612657575f5ffd5b816020840160208301375f602083830101528093505050509295509295909350565b5f60208284031215612689575f5ffd5b5051919050565b5f602082840312156126a0575f5ffd5b81516120f181612553565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610ab157610ab16126bf565b81810381811115610ab157610ab16126bf565b8082028115828204841417610ab157610ab16126bf565b634e487b7160e01b5f52601260045260245ffd5b5f8261273e57634e487b7160e01b5f52601260045260245ffd5b500490565b602080825281018290525f6001600160fb1b03831115612761575f5ffd5b8260051b80856040850137919091016040019392505050565b5f6020828403121561278a575f5ffd5b81516120f1816123dc565b5f600182016127a6576127a66126bf565b5060010190565b85815284602082015283604082015282606082015260a060808201525f82518060a0840152806020850160c085015e5f60c0828501015260c0601f19601f8301168401019150509695505050505050565b5f82518060208501845e5f92019182525091905056fea164736f6c634300081c000a0000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000be9895146f7af43049ca1c1ae358b0541ea49704000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000006740944e277f7e000000000000000000000000b00413148d9d4c9f9a67389d0f704cfa4ebcf61e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6a5fee43f81440bbe68d27e74daefc3

Deployed Bytecode

0x608060405260043610610219575f3560e01c80638ed5b0fc11610121578063c46d6d43116100a4578063e6fd48bc1161006b578063e6fd48bc146107f4578063ef9d973314610827578063f387bcac1461083a578063f3e14f1e14610853578063f7c618c11461086857005b8063c46d6d43146106c9578063c8796572146106fc578063d23fd39a14610710578063d547741f14610758578063d6290cd71461077757005b8063b36a921c116100e8578063b36a921c14610611578063bb1f969814610630578063c0cd0a0714610663578063c41adae414610682578063c45a01551461069657005b80638ed5b0fc1461057857806391d14854146105ab5780639342c8f4146105ca578063a217fddf146105e9578063a411179c146105fc57005b80633606f159116101a957806369b8b84c1161017057806369b8b84c146104c8578063717ab112146104e75780637d9e50a8146104fc5780638d792c44146105115780638e4a82791461054557005b80633606f1591461042357806336568abe1461045657806346ed11d114610475578063587f5ed7146104945780635eac6239146104a957005b806324a9d853116101ed57806324a9d853146102f55780632a6247e51461033b5780632f2ff15d146103aa57806331f7d964146103c9578063327107f7146103f057005b8062ae3bf81461021b57806301ffc9a71461024d5780631b3c17a21461027c578063248a9ca3146102c7575b005b348015610226575f5ffd5b5061023a6102353660046123f0565b61089b565b6040519081526020015b60405180910390f35b348015610258575f5ffd5b5061026c61026736600461240b565b610a81565b6040519015158152602001610244565b348015610287575f5ffd5b506102af7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610244565b3480156102d2575f5ffd5b5061023a6102e1366004612432565b5f9081526020819052604090206001015490565b348015610300575f5ffd5b506103287f000000000000000000000000000000000000000000000000000000000000000081565b60405161ffff9091168152602001610244565b348015610346575f5ffd5b50610397610355366004612432565b60086020525f908152604090208054600182015460028301546003840154600485015460059095015460ff8516956101009095046001600160a01b0316949087565b604051610244979695949392919061245d565b3480156103b5575f5ffd5b506102196103c43660046124b4565b610ab7565b3480156103d4575f5ffd5b506102af73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b3480156103fb575f5ffd5b506102af7f000000000000000000000000be9895146f7af43049ca1c1ae358b0541ea4970481565b34801561042e575f5ffd5b5061023a7f000000000000000000000000000000000000000000000000000000000000000181565b348015610461575f5ffd5b506102196104703660046124b4565b610ae1565b348015610480575f5ffd5b5061023a61048f3660046123f0565b610b19565b34801561049f575f5ffd5b5061023a60055481565b3480156104b4575f5ffd5b506102196104c33660046124e2565b610bac565b3480156104d3575f5ffd5b506102196104e2366004612560565b610ee2565b3480156104f2575f5ffd5b5061023a60025481565b348015610507575f5ffd5b5061023a60045481565b34801561051c575f5ffd5b5061053061052b366004612432565b6110c3565b60408051928352602083019190915201610244565b348015610550575f5ffd5b5061023a7f000000000000000000000000000000000000000000000000000000e8d4a5100081565b348015610583575f5ffd5b5061023a7f00000000000000000000000000000000f6a5fee43f81440bbe68d27e74daefc381565b3480156105b6575f5ffd5b5061026c6105c53660046124b4565b611113565b3480156105d5575f5ffd5b506102196105e4366004612432565b61113b565b3480156105f4575f5ffd5b5061023a5f81565b348015610607575f5ffd5b5061023a60035481565b34801561061c575f5ffd5b5061023a61062b366004612432565b61125a565b34801561063b575f5ffd5b5061023a7f000000000000000000000000000000000000000000000000006740944e277f7e81565b34801561066e575f5ffd5b5061021961067d3660046124e2565b611376565b34801561068d575f5ffd5b5061023a61157a565b3480156106a1575f5ffd5b506102af7f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a181565b3480156106d4575f5ffd5b5061023a7f018e24ce9675721209068196867f2525c191c548d07fd44e29ff6fe34d0140e481565b348015610707575f5ffd5b5061023a6115c3565b34801561071b575f5ffd5b506107437f0000000000000000000000000000000000000000000000000000000000093a8081565b60405163ffffffff9091168152602001610244565b348015610763575f5ffd5b506102196107723660046124b4565b611816565b348015610782575f5ffd5b5061078b61183a565b6040805163ffffffff9c909c168c526001600160a01b039a8b1660208d015298909916978a01979097526060890195909552608088019390935290151560a087015260c086015260e0850152610100840152610120830152151561014082015261016001610244565b3480156107ff575f5ffd5b5061023a7f00000000000000000000000000000000000000000000000000000000683754b381565b61021961083536600461258f565b61193c565b348015610845575f5ffd5b5060015461026c9060ff1681565b34801561085e575f5ffd5b5061023a60065481565b348015610873575f5ffd5b506102af7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b5f7f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b03166391d148547f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b0316638537ed1f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610927573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061094b9190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa15801561098b573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109af9190612690565b6109cb576040516282b42960e81b815260040160405180910390fd5b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316826001600160a01b031603610a1d57604051637d8969bd60e11b815260040160405180910390fd5b610a2682610b19565b90508015610a7c57610a39823383611e93565b604080516001600160a01b0384168152602081018390527f68f67de89e96b13a3ea058af5fd44cc125efceb528482d539c7b43db2faa066e910160405180910390a15b919050565b5f6001600160e01b03198216637965db0b60e01b1480610ab157506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f82815260208190526040902060010154610ad181611f33565b610adb8383611f40565b50505050565b6001600160a01b0381163314610b0a5760405163334bd91960e11b815260040160405180910390fd5b610b148282611fcf565b505050565b5f73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610b46575047919050565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015610b88573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ab19190612679565b6040516338e04b1560e11b81523060048201527f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b0316906371c0962a90602401602060405180830381865afa158015610c0e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c329190612690565b15610c5057604051637f27963360e11b815260040160405180910390fd5b5f819003610c71576040516312670c5360e11b815260040160405180910390fd5b5f610c9b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48610b19565b9050815f5b81811015610edb575f60085f878785818110610cbe57610cbe6126ab565b9050602002013581526020019081526020015f2090505f6003811115610ce657610ce6612449565b815460ff166003811115610cfc57610cfc612449565b14610d3f57858583818110610d1357610d136126ab565b905060200201356040516388bd17d760e01b8152600401610d3691815260200190565b60405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000093a8063ffffffff168160040154610d7591906126d3565b421015610db157858583818110610d8e57610d8e6126ab565b90506020020135604051638bd3634560e01b8152600401610d3691815260200190565b600281015484811115610dc5575050610edb565b6003820154610dd490826126d3565b600354610de191906126e6565b6003819055508060065f828254610df891906126d3565b90915550506003820154600554610e0f91906126d3565b600555815460ff19166002178255610e2781866126e6565b8254909550610e66907f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb489061010090046001600160a01b031683611e93565b7f31b5917b0734921f0de659d10340b427eee593f0e9d75be467effbfd84bfca21878785818110610e9957610e996126ab565b85546040805160209384029095013585526101009091046001600160a01b03169184019190915282018490525060600160405180910390a15050600101610ca0565b5050505050565b7f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b03166391d148547f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b0316638537ed1f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f6d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f919190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610fd1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ff59190612690565b611011576040516282b42960e81b815260040160405180910390fd5b80801561103d57507f00000000000000000000000000000000000000000000000000000000683754b342105b1561105b57604051632dc9a48b60e21b815260040160405180910390fd5b6001805460ff191682151517905580611080576007805460ff1916600117905561108b565b6007805460ff191690555b60405181151581527f42608d890a587157308343115fbd9ad8fd091d7ba64d81940a157d776fcf96919060200160405180910390a150565b5f806127106110f661ffff7f000000000000000000000000000000000000000000000000000000000000000016856126f9565b6111009190612724565b905061110c81846126e6565b9150915091565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b7f018e24ce9675721209068196867f2525c191c548d07fd44e29ff6fe34d0140e461116581611f33565b61116d61157a565b82111561118d57604051631267338760e31b815260040160405180910390fd5b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316156111e3577f00000000000000000000000000000000000000000000000000000000000000006111e5565b335b90506112127f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488285611e93565b604080516001600160a01b0383168152602081018590527f8a43c4352486ec339f487f64af78ca5cbf06cd47833f073d3baf3a193e50316191015b60405180910390a1505050565b5f7f000000000000000000000000000000000000000000000000000000000000000160011480156112ab57507f000000000000000000000000000000000000000000000000000000e8d4a510006001145b156112e257610ab1827f000000000000000000000000000000000000000000000000006740944e277f7e66038d7ea4c68000612038565b5f61130d7f0000000000000000000000000000000000000000000000000000000000000001846126f9565b90505f611342827f000000000000000000000000000000000000000000000000006740944e277f7e66038d7ea4c68000612038565b905061136e7f000000000000000000000000000000000000000000000000000000e8d4a5100082612724565b949350505050565b7f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b03166391d148547f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b031663adf256f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611401573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114259190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611465573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114899190612690565b6114a5576040516282b42960e81b815260040160405180910390fd5b805f5b81811015611548575f60085f8686858181106114c6576114c66126ab565b9050602002013581526020019081526020015f2090505f60038111156114ee576114ee612449565b815460ff16600381111561150457611504612449565b1461150f5750611540565b805460ff191660011781556003810154600282015461152e91906126d3565b60035461153b91906126e6565b600355505b6001016114a8565b507f8cddf682bedc1c1e24b78b3e46e2c190bbce8e25d3061f573d9848eb0638b4bf838360405161124d929190612743565b5f6005546003546115aa7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48610b19565b6115b491906126e6565b6115be91906126e6565b905090565b5f7f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b03166391d148547f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b0316638537ed1f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561164f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116739190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa1580156116b3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116d79190612690565b15801561170d5750336001600160a01b037f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a11614155b1561172a576040516282b42960e81b815260040160405180910390fd5b60055490505f6005819055506117e07f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b0316630da4eb876040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117b6573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117da919061277a565b83611e93565b6040518181527f860c0aa5520013080c2f65981705fcdea474d9f7c3daf954656ed5e65d692d1f9060200160405180910390a190565b5f8281526020819052604090206001015461183081611f33565b610adb8383611fcf565b5f5f5f5f5f5f5f5f5f5f5f7f0000000000000000000000000000000000000000000000000000000000093a807f000000000000000000000000be9895146f7af43049ca1c1ae358b0541ea497047f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487f000000000000000000000000000000000000000000000000006740944e277f7e7f00000000000000000000000000000000000000000000000000000000683754b360015f9054906101000a900460ff1660035460045460065461190a61157a565b60075f9054906101000a900460ff169a509a509a509a509a509a509a509a509a509a509a50909192939495969798999a565b6040516338e04b1560e11b81523060048201527f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b0316906371c0962a90602401602060405180830381865afa15801561199e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119c29190612690565b156119e057604051637f27963360e11b815260040160405180910390fd5b6119e86120f8565b7f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b03166391d148547f000000000000000000000000ab9c22396bd8ca98e7cf08e8872878676509b6a16001600160a01b031663620cad996040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a73573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a979190612679565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611ad7573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611afb9190612690565b611b1857604051631a2244f360e01b815260040160405180910390fd5b7f000000000000000000000000be9895146f7af43049ca1c1ae358b0541ea497046001600160a01b0316836001600160a01b031614611b7557604051637d72a69360e11b81526001600160a01b0384166004820152602401610d36565b7f00000000000000000000000000000000f6a5fee43f81440bbe68d27e74daefc38514611bb557604051636824bccd60e01b815260040160405180910390fd5b5f73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03851601611be2575034611cb5565b3415611c1757604051637d72a69360e11b815273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6004820152602401610d36565b6040516370a0823160e01b815233600482015284905f906001600160a01b038316906370a0823190602401602060405180830381865afa158015611c5d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c819190612679565b90505f611c8d87610b19565b9050611c9b833330856121a4565b80611ca588610b19565b611caf91906126e6565b93505050505b82811015611cd6576040516348879a0960e11b815260040160405180910390fd5b611ce1848683611e93565b8060045f828254611cf291906126d3565b909155505f9050611d028261125a565b90505f611d0d61157a565b905080821115611d3057604051631267338760e31b815260040160405180910390fd5b5f5f611d3b846110c3565b915091508360035f828254611d5091906126d3565b909155505060028054905f611d6483612795565b90915550506040805160e0810182525f8082526001600160a01b038c1660208084019190915282840189905260608301869052608083018590524260a08401524360c08401526002548252600890529190912081518154829060ff19166001836003811115611dd557611dd5612449565b02179055506020820151815f0160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010155606082015181600201556080820151816003015560a0820151816004015560c08201518160050155905050886001600160a01b03168a7f6c20cdeccbed14f48d4368b5f13e518890690a91c5cb1f999f44768f69a9425b6002548886868c604051611e7f9594939291906127ad565b60405180910390a350505050505050505050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03841601611f28575f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114611f01576040519150601f19603f3d011682016040523d82523d5f602084013e611f06565b606091505b5050905080610adb57604051630c08bcb960e21b815260040160405180910390fd5b610b1483838361220b565b611f3d813361223c565b50565b5f611f4b8383611113565b611fc8575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611f803390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610ab1565b505f610ab1565b5f611fda8383611113565b15611fc8575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610ab1565b5f838302815f1985870982811083820303915050805f0361206c5783828161206257612062612710565b04925050506120f1565b80841161208c5760405163227bc15360e01b815260040160405180910390fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60015460ff166121a25760075460ff1615801561213557507f00000000000000000000000000000000000000000000000000000000683754b34210155b15612148576001805460ff191681179055565b7f00000000000000000000000000000000000000000000000000000000683754b342101561218957604051632dc9a48b60e21b815260040160405180910390fd5b60405163952ce6dd60e01b815260040160405180910390fd5b565b6040516001600160a01b038481166024830152838116604483015260648201839052610adb9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050612279565b6040516001600160a01b03838116602483015260448201839052610b1491859182169063a9059cbb906064016121d9565b6122468282611113565b6122755760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610d36565b5050565b5f61228d6001600160a01b038416836122da565b905080515f141580156122b15750808060200190518101906122af9190612690565b155b15610b1457604051635274afe760e01b81526001600160a01b0384166004820152602401610d36565b60606120f183835f845f5f856001600160a01b031684866040516122fe91906127fe565b5f6040518083038185875af1925050503d805f8114612338576040519150601f19603f3d011682016040523d82523d5f602084013e61233d565b606091505b509150915061234d868383612357565b9695505050505050565b60608261236c57612367826123b3565b6120f1565b815115801561238357506001600160a01b0384163b155b156123ac57604051639996b31560e01b81526001600160a01b0385166004820152602401610d36565b50806120f1565b8051156123c35780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114611f3d575f5ffd5b5f60208284031215612400575f5ffd5b81356120f1816123dc565b5f6020828403121561241b575f5ffd5b81356001600160e01b0319811681146120f1575f5ffd5b5f60208284031215612442575f5ffd5b5035919050565b634e487b7160e01b5f52602160045260245ffd5b60e081016004891061247d57634e487b7160e01b5f52602160045260245ffd5b9781526001600160a01b0396909616602087015260408601949094526060850192909252608084015260a083015260c09091015290565b5f5f604083850312156124c5575f5ffd5b8235915060208301356124d7816123dc565b809150509250929050565b5f5f602083850312156124f3575f5ffd5b823567ffffffffffffffff811115612509575f5ffd5b8301601f81018513612519575f5ffd5b803567ffffffffffffffff81111561252f575f5ffd5b8560208260051b8401011115612543575f5ffd5b6020919091019590945092505050565b8015158114611f3d575f5ffd5b5f60208284031215612570575f5ffd5b81356120f181612553565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f5f5f60a086880312156125a3575f5ffd5b8535945060208601356125b5816123dc565b935060408601356125c5816123dc565b925060608601359150608086013567ffffffffffffffff8111156125e7575f5ffd5b8601601f810188136125f7575f5ffd5b803567ffffffffffffffff8111156126115761261161257b565b604051601f8201601f19908116603f0116810167ffffffffffffffff811182821017156126405761264061257b565b6040528181528282016020018a1015612657575f5ffd5b816020840160208301375f602083830101528093505050509295509295909350565b5f60208284031215612689575f5ffd5b5051919050565b5f602082840312156126a0575f5ffd5b81516120f181612553565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610ab157610ab16126bf565b81810381811115610ab157610ab16126bf565b8082028115828204841417610ab157610ab16126bf565b634e487b7160e01b5f52601260045260245ffd5b5f8261273e57634e487b7160e01b5f52601260045260245ffd5b500490565b602080825281018290525f6001600160fb1b03831115612761575f5ffd5b8260051b80856040850137919091016040019392505050565b5f6020828403121561278a575f5ffd5b81516120f1816123dc565b5f600182016127a6576127a66126bf565b5060010190565b85815284602082015283604082015282606082015260a060808201525f82518060a0840152806020850160c085015e5f60c0828501015260c0601f19601f8301168401019150509695505050505050565b5f82518060208501845e5f92019182525091905056fea164736f6c634300081c000a

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.