ETH Price: $3,463.10 (+1.62%)
Gas: 6 Gwei

Contract

0xBc452fdC8F851d7c5B72e1Fe74DFB63bb793D511
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Claim Tokens197892522024-05-03 11:20:3559 days ago1714735235IN
Hedgey Finance: Claims
0 ETH0.00015455.42129102
Claim Tokens197892272024-05-03 11:15:3559 days ago1714734935IN
Hedgey Finance: Claims
0 ETH0.000562435.6330404
Claim Tokens197884852024-05-03 8:45:5959 days ago1714725959IN
Hedgey Finance: Claims
0 ETH0.000693026.38577819
Claim Tokens197856282024-05-02 23:11:4759 days ago1714691507IN
Hedgey Finance: Claims
0 ETH0.000434244
Claim Tokens197692512024-04-30 16:14:5962 days ago1714493699IN
Hedgey Finance: Claims
0 ETH0.0019659318.66330877
Claim Tokens197580882024-04-29 2:48:4763 days ago1714358927IN
Hedgey Finance: Claims
0 ETH0.00071736.80962143
Claim Tokens197521802024-04-28 6:58:5964 days ago1714287539IN
Hedgey Finance: Claims
0 ETH0.000640916.70493988
Claim Tokens197468182024-04-27 12:59:1165 days ago1714222751IN
Hedgey Finance: Claims
0 ETH0.000912538.66297457
Claim Tokens197467782024-04-27 12:50:5965 days ago1714222259IN
Hedgey Finance: Claims
0 ETH0.000997989.47417155
Claim Tokens197467542024-04-27 12:46:1165 days ago1714221971IN
Hedgey Finance: Claims
0 ETH0.000990279.40101028
Claim Tokens197241322024-04-24 8:45:2368 days ago1713948323IN
Hedgey Finance: Claims
0 ETH0.000946119.14404947
Claim Tokens197230142024-04-24 4:59:3568 days ago1713934775IN
Hedgey Finance: Claims
0 ETH0.000977249.44493246
Claim Tokens197217202024-04-24 0:38:5968 days ago1713919139IN
Hedgey Finance: Claims
0 ETH0.000790137.63654327
Claim Tokens197142162024-04-22 23:28:2369 days ago1713828503IN
Hedgey Finance: Claims
0 ETH0.000595286.22606345
Claim Tokens197139332024-04-22 22:31:1169 days ago1713825071IN
Hedgey Finance: Claims
0 ETH0.000763327.37740076
Claim Tokens197135302024-04-22 21:10:1169 days ago1713820211IN
Hedgey Finance: Claims
0 ETH0.000892999.33761537
Claim Tokens197132172024-04-22 20:06:5969 days ago1713816419IN
Hedgey Finance: Claims
0 ETH0.0011756711.36264549
Claim Tokens197129522024-04-22 19:13:3569 days ago1713813215IN
Hedgey Finance: Claims
0 ETH0.0010672411.15967846
Claim Tokens197125072024-04-22 17:44:2369 days ago1713807863IN
Hedgey Finance: Claims
0 ETH0.0012113112.67206842
Claim Tokens197124972024-04-22 17:42:2369 days ago1713807743IN
Hedgey Finance: Claims
0 ETH0.0012609913.19186677
Claim Tokens197113252024-04-22 13:45:4770 days ago1713793547IN
Hedgey Finance: Claims
0 ETH0.0013976314.61775272
Claim Tokens197112492024-04-22 13:30:3570 days ago1713792635IN
Hedgey Finance: Claims
0 ETH0.0010403214.65261517
Claim Tokens197109952024-04-22 12:39:2370 days ago1713789563IN
Hedgey Finance: Claims
0 ETH0.000905639.47064761
Claim Tokens197048512024-04-21 16:03:3571 days ago1713715415IN
Hedgey Finance: Claims
0 ETH0.000928569.79331596
Claim Tokens197048362024-04-21 16:00:3571 days ago1713715235IN
Hedgey Finance: Claims
0 ETH0.000818528.63279415
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ClaimCampaigns

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 11 : ClaimCampaigns.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

import '../libraries/TransferHelper.sol';
import '../libraries/TimelockLibrary.sol';
import '../interfaces/IVestingPlans.sol';
import '../interfaces/ILockupPlans.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';

/// @title ClaimCampaigns - The smart contract to distribute your tokens to the community via claims
/// @notice This tool allows token projects to safely, securely and efficiently distribute your tokens in large scale to your community, whereby they can claim them based on your criteria of wallet address and amount.

contract ClaimCampaigns is ReentrancyGuard {
  /// @notice the address that collects any donations given to the team
  address private donationCollector;

  /// @dev an enum defining the different types of claims to be made
  /// @param Unlocked means that tokens claimed are liquid and not locked at all
  /// @param Locked means that the tokens claimed will be locked inside a TokenLockups plan
  /// @param Vesting means the tokens claimed will be locked insite a TokenVesting plan
  enum TokenLockup {
    Unlocked,
    Locked,
    Vesting
  }

  /// @notice the struct that defines the Locked and Vesting parameters for each vesting
  /// @dev this can be ignored for Unlocked claim campaigns
  /// @param tokenLocker is the address of the TokenLockup or TokenVesting plans contract that will lock the tokens
  /// @param rate is the rate which the tokens will unlock / vest at per period. So 10 would indicate 10 tokens unlocking per period.
  /// @param start is the start date when the unlock / vesting begins
  /// @param cliff is the single cliff date for unlocking and vesting plans, when all tokens prior to the cliff remained locked and unvested
  /// @param period is the amount of seconds in each discrete period. A streaming style would have this set to 1, but a period of 1 day would be 86400, tokens only unlock at each discrete period interval
  /// @param periods is the total number of periods in the lockup, ie term_in_seconds / period.
  struct ClaimLockup {
    address tokenLocker;
    uint256 start;
    uint256 cliff;
    uint256 period;
    uint256 periods;
  }

  /// @notice Campaign is the struct that defines a claim campaign in general. The Campaign is related to a one time use, related to a merkle tree that pre defines all of the wallets and amounts those wallets can claim
  /// once the amount is 0, the campaign is ended. The campaign can also be terminated at any time.
  /// @param manager is the address of the campaign manager who is in charge of cancelling the campaign - AND if the campaign is setup for vesting, this address will be used as the vestingAdmin wallet for all of the vesting plans created
  /// the manager is typically the msg.sender wallet, but can be defined as something else in case.
  /// @param token is the address of the token to be claimed by the wallets, which is pulled into the contract during the campaign
  /// @param amount is the total amount of tokens left in the Campaign. this starts out as the entire amount in the campaign, and gets reduced each time a claim is made
  /// @param end is a unix time that can be used as a safety mechanism to put a hard end date for a campaign, this can also be far far in the future to effectively be forever claims
  /// @param tokenLockup is the enum (uint8) that describes how and if the tokens will be locked or vesting when they are claimed. If set to unlocked, claimants will just get the tokens, but if they are Locked / vesting, they will receive the NFT Tokenlockup plan or vesting plan
  /// @param root is the root of the merkle tree used for the claims.
  struct Campaign {
    address manager;
    address token;
    uint256 amount;
    uint256 end;
    TokenLockup tokenLockup;
    bytes32 root;
  }

  /// @notice this is an optional Donation that users can gift to Hedgey and team for their services. The campaign creator can define a lockup schedule of the donation of tokens, or gift them unlocked.
  /// @dev if donating tokens unlocked, set the start date to 0.
  /// @param tokenLocker is the address of the token lockup plans contract if the tokens are going to be locked
  /// @param amount is the amount of the donation
  /// @param rate is the rate the tokens unlock
  /// @param start is the start date the tokens unlock
  /// @param cliff is the cliff date the first time tokens unlock
  /// @param period is the time between each unlock
  struct Donation {
    address tokenLocker;
    uint256 amount;
    uint256 rate;
    uint256 start;
    uint256 cliff;
    uint256 period;
  }

  /// @dev we use UUIDs or CIDs to map to a specific unique campaign. The UUID or CID is typically generated when the merkle tree is created, and then that id or cid is the identifier of the file in S3 or IPFS
  mapping(bytes16 => Campaign) public campaigns;
  /// @dev the same UUID is maped to the ClaimLockup details for the specific campaign
  mapping(bytes16 => ClaimLockup) public claimLockups;
  /// @dev this maps the UUID that have already been used, so that a campaign cannot be duplicated
  mapping(bytes16 => bool) public usedIds;

  //maps campaign id to a wallet address, which is flipped to true when claimed
  mapping(bytes16 => mapping(address => bool)) public claimed;

  // events
  event CampaignStarted(bytes16 indexed id, Campaign campaign);
  event ClaimLockupCreated(bytes16 indexed id, ClaimLockup claimLockup);
  event CampaignCancelled(bytes16 indexed id);
  event TokensClaimed(bytes16 indexed id, address indexed claimer, uint256 amountClaimed, uint256 amountRemaining);
  event TokensDonated(
    bytes16 indexed id,
    address donationCollector,
    address token,
    uint256 amount,
    address tokenLocker
  );

  constructor(address _donationCollector) {
    donationCollector = _donationCollector;
  }

  /// @notice function to change the address the donations are sent to
  /// @param newCollector the address that is going to be the new recipient of donations
  function changeDonationcollector(address newCollector) external {
    require(msg.sender == donationCollector);
    donationCollector = newCollector;
  }

  /// @notice primary function for creating an unlocked claims campaign. This function will pull the amount of tokens in the campaign struct, and map the campaign to the id.
  /// @dev the merkle tree needs to be pre-generated, so that you can upload the root and the uuid for the function
  /// @param id is the uuid or CID of the file that stores the merkle tree
  /// @param campaign is the struct of the campaign info, including the total amount tokens to be distributed via claims, and the root of the merkle tree
  /// @param donation is the doantion struct that can be 0 or any amount of tokens the team wishes to donate
  function createUnlockedCampaign(
    bytes16 id,
    Campaign memory campaign,
    Donation memory donation
  ) external nonReentrant {
    require(!usedIds[id], 'in use');
    usedIds[id] = true;
    require(campaign.token != address(0), '0_address');
    require(campaign.manager != address(0), '0_manager');
    require(campaign.amount > 0, '0_amount');
    require(campaign.end > block.timestamp, 'end error');
    require(campaign.tokenLockup == TokenLockup.Unlocked, 'locked');
    TransferHelper.transferTokens(campaign.token, msg.sender, address(this), campaign.amount + donation.amount);
    if (donation.amount > 0) {
      if (donation.start > 0) {
        SafeERC20.safeIncreaseAllowance(IERC20(campaign.token), donation.tokenLocker, donation.amount);
        ILockupPlans(donation.tokenLocker).createPlan(
          donationCollector,
          campaign.token,
          donation.amount,
          donation.start,
          donation.cliff,
          donation.rate,
          donation.period
        );
      } else {
        TransferHelper.withdrawTokens(campaign.token, donationCollector, donation.amount);
      }
      emit TokensDonated(id, donationCollector, campaign.token, donation.amount, donation.tokenLocker);
    }
    campaigns[id] = campaign;
    emit CampaignStarted(id, campaign);
  }

  /// @notice primary function for creating an locked or vesting claims campaign. This function will pull the amount of tokens in the campaign struct, and map the campaign and claimLockup to the id.
  /// additionally it will check that the lockup details are valid, and perform an allowance increase to the contract for when tokens are claimed they can be pulled.
  /// @dev the merkle tree needs to be pre-generated, so that you can upload the root and the uuid for the function
  /// @param id is the uuid or CID of the file that stores the merkle tree
  /// @param campaign is the struct of the campaign info, including the total amount tokens to be distributed via claims, and the root of the merkle tree, plus the lockup type of either 1 (lockup) or 2 (vesting)
  /// @param claimLockup is the struct that defines the characteristics of the lockup for each token claimed.
  /// @param donation is the doantion struct that can be 0 or any amount of tokens the team wishes to donate
  function createLockedCampaign(
    bytes16 id,
    Campaign memory campaign,
    ClaimLockup memory claimLockup,
    Donation memory donation
  ) external nonReentrant {
    require(!usedIds[id], 'in use');
    usedIds[id] = true;
    require(campaign.token != address(0), '0_address');
    require(campaign.manager != address(0), '0_manager');
    require(campaign.amount > 0, '0_amount');
    require(campaign.end > block.timestamp, 'end error');
    require(campaign.tokenLockup != TokenLockup.Unlocked, '!locked');
    require(claimLockup.tokenLocker != address(0), 'invalide locker');
    TransferHelper.transferTokens(campaign.token, msg.sender, address(this), campaign.amount + donation.amount);
    if (donation.amount > 0) {
      if (donation.start > 0) {
        SafeERC20.safeIncreaseAllowance(IERC20(campaign.token), donation.tokenLocker, donation.amount);
        ILockupPlans(donation.tokenLocker).createPlan(
          donationCollector,
          campaign.token,
          donation.amount,
          donation.start,
          donation.cliff,
          donation.rate,
          donation.period
        );
      } else {
        TransferHelper.withdrawTokens(campaign.token, donationCollector, donation.amount);
      }
      emit TokensDonated(id, donationCollector, campaign.token, donation.amount, donation.tokenLocker);
    }
    claimLockups[id] = claimLockup;
    SafeERC20.safeIncreaseAllowance(IERC20(campaign.token), claimLockup.tokenLocker, campaign.amount);
    campaigns[id] = campaign;
    emit ClaimLockupCreated(id, claimLockup);
    emit CampaignStarted(id, campaign);
  }

  /// @notice this is the primary function for the claimants to claim their tokens
  /// @dev the claimer will need to know the uuid of the campiagn, plus have access to the amount of tokens they are claiming and the merkle tree proof
  /// @dev if the claimer doesnt have this information the function will fail as it will not pass the verify validation
  /// the leaf of each merkle tree is the hash of the wallet address plus the amount of tokens claimable
  /// @dev once a user has claimed tokens, they cannot perform a second claim
  /// @dev the amount of tokens in the campaign is reduced by the amount of the claim
  /// @param campaignId is the id of the campaign stored in storage
  /// @param proof is the merkle tree proof that maps to their unique leaf in the merkle tree
  /// @param claimAmount is the amount of tokens they are eligible to claim
  /// this function will verify and validate the eligibilty of the claim, and then process the claim, by delivering unlocked or locked / vesting tokens depending on the setup of the claim campaign.
  function claimTokens(bytes16 campaignId, bytes32[] memory proof, uint256 claimAmount) external nonReentrant {
    require(!claimed[campaignId][msg.sender], 'already claimed');
    Campaign memory campaign = campaigns[campaignId];
    require(campaign.end > block.timestamp, 'campaign ended');
    require(verify(campaign.root, proof, msg.sender, claimAmount), '!eligible');
    require(campaign.amount >= claimAmount, 'campaign unfunded');
    claimed[campaignId][msg.sender] = true;
    campaigns[campaignId].amount -= claimAmount;
    if (campaigns[campaignId].amount == 0) {
      delete campaigns[campaignId];
    }
    if (campaign.tokenLockup == TokenLockup.Unlocked) {
      TransferHelper.withdrawTokens(campaign.token, msg.sender, claimAmount);
    } else {
      ClaimLockup memory c = claimLockups[campaignId];
      uint256 rate;
      if (claimAmount % c.periods == 0) {
        rate = claimAmount / c.periods;
      } else {
        rate = claimAmount / c.periods + 1;
      }
      uint256 start = c.start == 0 ? block.timestamp : c.start;
      if (campaign.tokenLockup == TokenLockup.Locked) {
        ILockupPlans(c.tokenLocker).createPlan(msg.sender, campaign.token, claimAmount, start, c.cliff, rate, c.period);
      } else {
        IVestingPlans(c.tokenLocker).createPlan(
          msg.sender,
          campaign.token,
          claimAmount,
          start,
          c.cliff,
          rate,
          c.period,
          campaign.manager,
          false
        );
      }
    }
    emit TokensClaimed(campaignId, msg.sender, claimAmount, campaigns[campaignId].amount);
  }

  /// @notice this function allows the campaign manager to cancel an ongoing campaign at anytime. Cancelling a campaign will return any unclaimed tokens, and then prevent anyone from claiming additional tokens
  /// @param campaignId is the id of the campaign to be cancelled
  function cancelCampaign(bytes16 campaignId) external nonReentrant {
    Campaign memory campaign = campaigns[campaignId];
    require(campaign.manager == msg.sender, '!manager');
    delete campaigns[campaignId];
    delete claimLockups[campaignId];
    TransferHelper.withdrawTokens(campaign.token, msg.sender, campaign.amount);
    emit CampaignCancelled(campaignId);
  }

  /// @dev the internal verify function from the open zepellin library.
  /// this function inputs the root, proof, wallet address of the claimer, and amount of tokens, and then computes the validity of the leaf with the proof and root.
  /// @param root is the root of the merkle tree
  /// @param proof is the proof for the specific leaf
  /// @param claimer is the address of the claimer used in making the leaf
  /// @param amount is the amount of tokens to be claimed, the other piece of data in the leaf
  function verify(bytes32 root, bytes32[] memory proof, address claimer, uint256 amount) public pure returns (bool) {
    bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(claimer, amount))));
    require(MerkleProof.verify(proof, root, leaf), 'Invalid proof');
    return true;
  }
}

File 2 of 11 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 3 of 11 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 4 of 11 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 5 of 11 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @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);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

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

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * 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.isContract(address(token));
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

File 7 of 11 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     *
     * _Available since v4.7._
     */
    function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     *
     * _Available since v4.7._
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 8 of 11 : ILockupPlans.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

interface ILockupPlans {
  function createPlan(
    address recipient,
    address token,
    uint256 amount,
    uint256 start,
    uint256 cliff,
    uint256 rate,
    uint256 period
  ) external;
}

File 9 of 11 : IVestingPlans.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

interface IVestingPlans {
    function createPlan(
    address recipient,
    address token,
    uint256 amount,
    uint256 start,
    uint256 cliff,
    uint256 rate,
    uint256 period,
    address vestingAdmin,
    bool adminTransferOBO
  ) external;
}

File 10 of 11 : TimelockLibrary.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

/// @notice Library to assist with calculation methods of the balances, ends, period amounts for a given plan
/// used by both the Lockup and Vesting Plans
library TimelockLibrary {
  function min(uint256 a, uint256 b) internal pure returns (uint256 _min) {
    _min = (a <= b) ? a : b;
  }

  /// @notice function to calculate the end date of a plan based on its start, amount, rate and period
  function endDate(uint256 start, uint256 amount, uint256 rate, uint256 period) internal pure returns (uint256 end) {
    end = (amount % rate == 0) ? (amount / rate) * period + start : ((amount / rate) * period) + period + start;
  }

  /// @notice function to calculate the end period and validate that the parameters passed in are valid
  function validateEnd(
    uint256 start,
    uint256 cliff,
    uint256 amount,
    uint256 rate,
    uint256 period
  ) internal pure returns (uint256 end, bool valid) {
    require(amount > 0, '0_amount');
    require(rate > 0, '0_rate');
    require(rate <= amount, 'rate > amount');
    require(period > 0, '0_period');
    end = (amount % rate == 0) ? (amount / rate) * period + start : ((amount / rate) * period) + period + start;
    require(cliff <= end, 'cliff > end');
    valid = true;
  }

  /// @notice function to calculate the unlocked (claimable) balance, still locked balance, and the most recent timestamp the unlock would take place
  /// the most recent unlock time is based on the periods, so if the periods are 1, then the unlock time will be the same as the redemption time,
  /// however if the period more than 1 second, the latest unlock will be a discrete time stamp
  /// @param start is the start time of the plan
  /// @param cliffDate is the timestamp of the cliff of the plan
  /// @param amount is the total unclaimed amount tokens still in the vesting plan
  /// @param rate is the amount of tokens that unlock per period
  /// @param period is the seconds in each period, a 1 is a period of 1 second whereby tokens unlock every second
  /// @param currentTime is the current time being evaluated, typically the block.timestamp, but used just to check the plan is past the start or cliff
  /// @param redemptionTime is the time requested for the plan to be redeemed, this can be the same as the current time or prior to it for partial redemptions
  function balanceAtTime(
    uint256 start,
    uint256 cliffDate,
    uint256 amount,
    uint256 rate,
    uint256 period,
    uint256 currentTime,
    uint256 redemptionTime
  ) internal pure returns (uint256 unlockedBalance, uint256 lockedBalance, uint256 unlockTime) {
    if (start > currentTime || cliffDate > currentTime || redemptionTime <= start) {
      lockedBalance = amount;
      unlockTime = start;
    } else {
      uint256 periodsElapsed = (redemptionTime - start) / period;
      uint256 calculatedBalance = periodsElapsed * rate;
      unlockedBalance = min(calculatedBalance, amount);
      lockedBalance = amount - unlockedBalance;
      unlockTime = start + (period * periodsElapsed);
    }
  }

  function calculateCombinedRate(
    uint256 combinedAmount,
    uint256 combinedRates,
    uint256 start,
    uint256 period,
    uint256 targetEnd
  ) internal pure returns (uint256 rate, uint256 end) {
    uint256 numerator = combinedAmount * period;
    uint256 denominator = (combinedAmount % combinedRates == 0) ? targetEnd - start : targetEnd - start - period;
    rate = numerator / denominator;
    end = endDate(start, combinedAmount, rate, period);
  }

  function calculateSegmentRates(
    uint256 originalRate,
    uint256 originalAmount,
    uint256 planAmount,
    uint256 segmentAmount,
    uint256 start,
    uint256 end,
    uint256 period,
    uint256 cliff
  ) internal pure returns (uint256 planRate, uint256 segmentRate, uint256 planEnd, uint256 segmentEnd) {
    planRate = (originalRate * ((planAmount * (10 ** 18)) / originalAmount)) / (10 ** 18);
    segmentRate = (segmentAmount % (originalRate - planRate) == 0)
      ? (segmentAmount * period) / (end - start)
      : (segmentAmount * period) / (end - start - period);
    bool validPlanEnd;
    bool validSegmentEnd;
    (planEnd, validPlanEnd) = validateEnd(start, cliff, planAmount, planRate, period);
    (segmentEnd, validSegmentEnd) = validateEnd(start, cliff, segmentAmount, segmentRate, period);
    require(validPlanEnd && validSegmentEnd, 'invalid end date');
  }
}

File 11 of 11 : TransferHelper.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';


/// @notice Library to help safely transfer tokens and handle ETH wrapping and unwrapping of WETH
library TransferHelper {
  using SafeERC20 for IERC20;

  /// @notice Internal function used for standard ERC20 transferFrom method
  /// @notice it contains a pre and post balance check
  /// @notice as well as a check on the msg.senders balance
  /// @param token is the address of the ERC20 being transferred
  /// @param from is the remitting address
  /// @param to is the location where they are being delivered
  function transferTokens(
    address token,
    address from,
    address to,
    uint256 amount
  ) internal {
    uint256 priorBalance = IERC20(token).balanceOf(address(to));
    require(IERC20(token).balanceOf(from) >= amount, 'THL01');
    SafeERC20.safeTransferFrom(IERC20(token), from, to, amount);
    uint256 postBalance = IERC20(token).balanceOf(address(to));
    require(postBalance - priorBalance == amount, 'THL02');
  }

  /// @notice Internal function is used with standard ERC20 transfer method
  /// @notice this function ensures that the amount received is the amount sent with pre and post balance checking
  /// @param token is the ERC20 contract address that is being transferred
  /// @param to is the address of the recipient
  /// @param amount is the amount of tokens that are being transferred
  function withdrawTokens(
    address token,
    address to,
    uint256 amount
  ) internal {
    uint256 priorBalance = IERC20(token).balanceOf(address(to));
    SafeERC20.safeTransfer(IERC20(token), to, amount);
    uint256 postBalance = IERC20(token).balanceOf(address(to));
    require(postBalance - priorBalance == amount, 'THL02');
  }

}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_donationCollector","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"id","type":"bytes16"}],"name":"CampaignCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"id","type":"bytes16"},{"components":[{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"enum ClaimCampaigns.TokenLockup","name":"tokenLockup","type":"uint8"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"indexed":false,"internalType":"struct ClaimCampaigns.Campaign","name":"campaign","type":"tuple"}],"name":"CampaignStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"id","type":"bytes16"},{"components":[{"internalType":"address","name":"tokenLocker","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"periods","type":"uint256"}],"indexed":false,"internalType":"struct ClaimCampaigns.ClaimLockup","name":"claimLockup","type":"tuple"}],"name":"ClaimLockupCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"id","type":"bytes16"},{"indexed":true,"internalType":"address","name":"claimer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountClaimed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountRemaining","type":"uint256"}],"name":"TokensClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"id","type":"bytes16"},{"indexed":false,"internalType":"address","name":"donationCollector","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenLocker","type":"address"}],"name":"TokensDonated","type":"event"},{"inputs":[{"internalType":"bytes16","name":"","type":"bytes16"}],"name":"campaigns","outputs":[{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"enum ClaimCampaigns.TokenLockup","name":"tokenLockup","type":"uint8"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16","name":"campaignId","type":"bytes16"}],"name":"cancelCampaign","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newCollector","type":"address"}],"name":"changeDonationcollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"","type":"bytes16"}],"name":"claimLockups","outputs":[{"internalType":"address","name":"tokenLocker","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"periods","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16","name":"campaignId","type":"bytes16"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"claimAmount","type":"uint256"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"","type":"bytes16"},{"internalType":"address","name":"","type":"address"}],"name":"claimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16","name":"id","type":"bytes16"},{"components":[{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"enum ClaimCampaigns.TokenLockup","name":"tokenLockup","type":"uint8"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"internalType":"struct ClaimCampaigns.Campaign","name":"campaign","type":"tuple"},{"components":[{"internalType":"address","name":"tokenLocker","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"periods","type":"uint256"}],"internalType":"struct ClaimCampaigns.ClaimLockup","name":"claimLockup","type":"tuple"},{"components":[{"internalType":"address","name":"tokenLocker","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"}],"internalType":"struct ClaimCampaigns.Donation","name":"donation","type":"tuple"}],"name":"createLockedCampaign","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"id","type":"bytes16"},{"components":[{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"enum ClaimCampaigns.TokenLockup","name":"tokenLockup","type":"uint8"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"internalType":"struct ClaimCampaigns.Campaign","name":"campaign","type":"tuple"},{"components":[{"internalType":"address","name":"tokenLocker","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"}],"internalType":"struct ClaimCampaigns.Donation","name":"donation","type":"tuple"}],"name":"createUnlockedCampaign","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"","type":"bytes16"}],"name":"usedIds","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"claimer","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"verify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}]

60803461007557601f611e1438819003918201601f19168301916001600160401b0383118484101761007a5780849260209460405283398101031261007557516001600160a01b0381169081900361007557600160005560018060a01b03196001541617600155604051611d8390816100918239f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001257600080fd5b6000803560e01c806347d1e2c114610d6e57806350b4aebe14610ce7578063973dd4f91461092a578063b1e235a7146108e5578063bcecbd9d146108a7578063cff144f714610841578063d6eecb00146107d4578063eb58c5fe14610773578063efd86b62146102055763f412e4c71461008b57600080fd5b346102025760209081600319360112610202576100a66112b1565b6100ae61161e565b6001600160801b03191680825260028352604082206040516100cf816112c8565b60018060a01b03908183541681528160018401541690868101918252600284015493604082019485526003810154606083015260ff60048201541660038110156101ee5760808301526005015460a082015251821633036101be576003859685610193969752600281526101646040892060056000918281558260018201558260028201558260038201558260048201550155565b868852526000600460408820888155826001820155826002820155826003820155015551169051903390611c60565b7f88511e0182a386da19fdcadcde158de4729b63240d9a034ce75f3cb0dc5288a58280a26001815580f35b60405162461bcd60e51b815260048101879052600860248201526710b6b0b730b3b2b960c11b6044820152606490fd5b634e487b7160e01b88526021600452602488fd5b80fd5b503461020257610240366003190112610202576102206112b1565b610229366113f2565b9060a03660e319011261076f57604051610242816112fa565b60e4356001600160a01b038116810361076a57815261010435602082015261012435604082015261014435606082015261016435608082015260c03661018319011261076a57604051610294816112c8565b610184356001600160a01b038116810361076a5781526101a43560208201526101c43560408201526101e43560608201526102043560808201526102243560a08201526102df61161e565b6001600160801b031983168552600460205261030260ff6040872054161561145e565b6001600160801b0319831685526004602090815260408620805460ff1916600117905584015161033c906001600160a01b03161515611493565b8351610352906001600160a01b031615156114cb565b61036160408501511515611503565b6103706060850151421061153a565b6080840151600381101561075657156107275781516001600160a01b0316156106f0576103c060018060a01b036020860151166103b66040870151602085015190611572565b9030903390611aac565b60208101518061058c575b50506001600160801b03198216845260036020526040842061044a60018060a01b038351166bffffffffffffffffffffffff60a01b9281848254161781556020850151600182015560408501516002820155606085015160038201556004608086015191015560018060a01b0360208701511690604087015191611674565b6001600160801b0319831685526002602052604085209060018060a01b0385511681835416178255600182019060018060a01b036020870151169082541617905560408401516002820155606084015160038201556004810160808501516003811015610578579161056e93917f08e5218da97ab939144e67510d646e499712fb36e2305d6dffdf06b7447e48f9959360ff80198354169116179055600560a087015191015560806040519160018060a01b038151168352602081015160208401526040810151604084015260608101516060840152015160808201527fce04f3b9b2dfc43b1d1e78376db74a3b32c0a78daaf34efc81334908359448fc60a06001600160801b0319841692a26040519182916001600160801b03191694826115cf565b0390a26001815580f35b634e487b7160e01b87526021600452602487fd5b6060820151156106cc57506020848101518251918301516105bb9290916001600160a01b039182169116611674565b80516001546020868101519084015160608501516080860151604087015160a08801518c97939690956001600160a01b039485169490811693911690843b156106c85788968793610623926040519a8b998a988997632744bf0b60e11b895260048901611595565b03925af180156106bd576106a5575b50505b600154602085810151838201519351604080516001600160a01b03958616815292851693830193909352918101939093521660608201526001600160801b03198316907ffeb4a12f48997fec18540c56db7545a5cee8f426bb4ac5f73fc0c3f6122d580990608090a238806103cb565b6106ae90611316565b6106b9578438610632565b8480fd5b6040513d84823e3d90fd5b8880fd5b60208501516001546106eb92916001600160a01b039182169116611c60565b610635565b60405162461bcd60e51b815260206004820152600f60248201526e34b73b30b634b232903637b1b5b2b960891b6044820152606490fd5b60405162461bcd60e51b8152602060048201526007602482015266085b1bd8dad95960ca1b6044820152606490fd5b634e487b7160e01b86526021600452602486fd5b600080fd5b8280fd5b50346102025760403660031901126102025761078d6112b1565b6024356001600160a01b038116929083900361076a576040916001600160801b031916815260056020522090600052602052602060ff604060002054166040519015158152f35b503461020257602036600319011261020257604060a0916001600160801b03196107fc6112b1565b168152600360205220600180831b0381541690600181015490600281015460046003830154920154926040519485526020850152604084015260608301526080820152f35b50346102025760803660031901126102025760243567ffffffffffffffff81116108a357610873903690600401611368565b6044356001600160a01b038116810361076a576020916108999160643591600435611988565b6040519015158152f35b5080fd5b50346102025760203660031901126102025760ff60406020926001600160801b03196108d16112b1565b168152600484522054166040519015158152f35b5034610202576020366003190112610202576004356001600160a01b038181169182900361076a57600154908116330361076f576001600160a01b0319161760015580f35b5034610202576101a0366003190112610202576109456112b1565b61094e366113f2565b9060c03660e319011261076a57604051610967816112c8565b60e4356001600160a01b038116810361076a5781526101043560208201526101243560408201526101443560608201526101643560808201526101843560a08201526109b161161e565b6001600160801b03198216845260046020526109d460ff6040862054161561145e565b6001600160801b0319821684526004602090815260408520805460ff19166001179055830151610a0e906001600160a01b03161515611493565b8251610a24906001600160a01b031615156114cb565b610a3360408401511515611503565b610a426060840151421061153a565b60808301516003811015610cd357610ca557610a7760018060a01b036020850151166103b66040860151602085015190611572565b602081015180610b50575b50506001600160801b03198116835260026020526040832060018060a01b038351166bffffffffffffffffffffffff60a01b9081835416178255600182019060018060a01b03602086015116908254161790556040830151600282015560608301516003820155600481016080840151600381101561075657917f08e5218da97ab939144e67510d646e499712fb36e2305d6dffdf06b7447e48f9939161056e9360ff80198354169116179055600560a08601519101556040519182916001600160801b03191694826115cf565b606082015115610c815750602083810151825191830151610b7f9290916001600160a01b039182169116611674565b80516001546020858101519084015160608501516080860151604087015160a08801518b97939690956001600160a01b039485169490811693911690843b156106c85788968793610be7926040519a8b998a988997632744bf0b60e11b895260048901611595565b03925af180156106bd57610c69575b50505b600154602084810151838201519351604080516001600160a01b03958616815292851693830193909352918101939093521660608201526001600160801b03198216907ffeb4a12f48997fec18540c56db7545a5cee8f426bb4ac5f73fc0c3f6122d580990608090a23880610a82565b610c7290611316565b610c7d578338610bf6565b8380fd5b6020840151600154610ca092916001600160a01b039182169116611c60565b610bf9565b60405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b6044820152606490fd5b634e487b7160e01b85526021600452602485fd5b503461020257602036600319011261020257604060c0916001600160801b0319610d0f6112b1565b16815260026020522060018060a01b0390610d678282541692600183015416916002810154600382015490600560ff6004850154169301549460405196875260208701526040860152606085015260808401906113cf565b60a0820152f35b503461020257606036600319011261020257610d886112b1565b60243567ffffffffffffffff811161076f57610da8903690600401611368565b610db061161e565b6001600160801b03198216835260056020526040832033845260205260ff60408420541661127a576001600160801b0319821683526002602052604083209060405191610dfc836112c8565b60018060a01b03815416835260018060a01b036001820154166020840152600281015491604084019283526003820154916060850192835260ff60048201541660038110156101ee5760808601526005015460a08501908152915142101561124457610e6e9160443591339151611988565b15611213576044359051106111da576001600160801b03198216835260056020526040832033845260205260408320600160ff198254161790556001600160801b031982168352600260205260026040842001610ece604435825461195b565b90556001600160801b0319821683526002602052604083206002810154156111ac575b506080810151600381101561119857610f755760200151610f20906044359033906001600160a01b0316611c60565b6001600160801b0319168082526002602081815260408085209092015482516044358152918201523392917f18ee3c31d4863a37e1b4563022fa292ed3f955a41fe1e49a2e8da1b986430e2091a36001815580f35b6001600160801b03929192198316825260036020526040822090600460405192610f9e846112fa565b80546001600160a01b031684526001810154602085015260028101546040850152600381015460608501520154608083018190528015611184576044350661114d57610ff06080830151604435611968565b915b602081015180611147575042915b608081015160038110156107565760010361109e57815160209091015160408301516060909301519596958795946001600160a01b0392831694939092169190823b1561109a578694611070869260405198899788968795632744bf0b60e11b8752604435903360048901611595565b03925af180156106bd57611086575b5050610f20565b61108f90611316565b6108a357813861107f565b8680fd5b815160208201516040840151606090940151925193956001600160a01b0391821694928216939190921691833b15611143579287959492869261012495604051998a98899763050fbad760e01b89523360048a0152602489015260443560448901526064880152608487015260a486015260c485015260e4840152816101048401525af180156106bd57611134575b5090610f20565b61113d90611316565b3861112d565b8780fd5b91611000565b61115d6080830151604435611968565b6001810181116111705760010191610ff2565b634e487b7160e01b84526011600452602484fd5b634e487b7160e01b84526012600452602484fd5b634e487b7160e01b84526021600452602484fd5b6111d49060056000918281558260018201558260028201558260038201558260048201550155565b38610ef1565b60405162461bcd60e51b815260206004820152601160248201527018d85b5c185a59db881d5b999d5b991959607a1b6044820152606490fd5b60405162461bcd60e51b815260206004820152600960248201526821656c696769626c6560b81b6044820152606490fd5b60405162461bcd60e51b815260206004820152600e60248201526d18d85b5c185a59db88195b99195960921b6044820152606490fd5b60405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4818db185a5b5959608a1b6044820152606490fd5b600435906001600160801b03198216820361076a57565b60c0810190811067ffffffffffffffff8211176112e457604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176112e457604052565b67ffffffffffffffff81116112e457604052565b6040810190811067ffffffffffffffff8211176112e457604052565b90601f8019910116810190811067ffffffffffffffff8211176112e457604052565b9080601f8301121561076a5781359067ffffffffffffffff82116112e4578160051b6040519360209361139d85840187611346565b8552838086019282010192831161076a578301905b8282106113c0575050505090565b813581529083019083016113b2565b9060038210156113dc5752565b634e487b7160e01b600052602160045260246000fd5b60c090602319011261076a576040519061140b826112c8565b816001600160a01b03602435818116810361076a578252604435908116810361076a5760208201526064356040820152608435606082015260a435600381101561076a57608082015260a060c435910152565b1561146557565b60405162461bcd60e51b8152602060048201526006602482015265696e2075736560d01b6044820152606490fd5b1561149a57565b60405162461bcd60e51b8152602060048201526009602482015268305f6164647265737360b81b6044820152606490fd5b156114d257565b60405162461bcd60e51b8152602060048201526009602482015268182fb6b0b730b3b2b960b91b6044820152606490fd5b1561150a57565b60405162461bcd60e51b81526020600482015260086024820152670c17d85b5bdd5b9d60c21b6044820152606490fd5b1561154157565b60405162461bcd60e51b815260206004820152600960248201526832b7321032b93937b960b91b6044820152606490fd5b9190820180921161157f57565b634e487b7160e01b600052601160045260246000fd5b93909260c095929897969360e086019960018060a01b03809216875216602086015260408501526060840152608083015260a08201520152565b91909160a08060c0830194600180831b0380825116855260208201511660208501526040810151604085015260608101516060850152611617608082015160808601906113cf565b0151910152565b60026000541461162f576002600055565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301529394936020908290604490829086165afa90811561173757600091611704575b506116c961170294956116fd92611572565b60405163095ea7b360e01b60208201526001600160a01b039490941660248501526044808501919091528352606483611346565b611743565b565b906020823d821161172f575b8161171d60209383611346565b810103126102025750516116c96116b7565b3d9150611710565b6040513d6000823e3d90fd5b60018060a01b0316906040516117588161132a565b6020928382527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564848301526000808486829651910182855af13d1561187d573d9167ffffffffffffffff831161186957906117d3939291604051926117c688601f19601f8401160185611346565b83523d868885013e611887565b805191821591848315611845575b5050509050156117ee5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b9193818094500103126108a3578201519081151582036102025750803880846117e1565b634e487b7160e01b85526041600452602485fd5b906117d392916060915b919290156118e9575081511561189b575090565b3b156118a45790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156118fc5750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510611942575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061191f565b9190820391821161157f57565b8115611972570490565b634e487b7160e01b600052601260045260246000fd5b604080516001600160a01b03909416602080860191825285830196909652919590949093909291906119c781606081015b03601f198101835282611346565b51902084518381019182528381526119de8161132a565b519020926000935b8251851015611a3257838560051b8401015190866000838310600014611a255750506000528352846000205b93600019811461157f57600101936119e6565b9190928252855220611a12565b9150949193925003611a45575050600190565b60649250519062461bcd60e51b82526004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152fd5b15611a7f57565b60405162461bcd60e51b81526020600482015260056024820152642a2426181960d91b6044820152606490fd5b604080516370a0823160e01b8082526001600160a01b039586166004830181905291959294938316936020938488602481895afa978815611c2657600098611c31575b5086519183835216908160048201528481602481895afa908115611c2657908991600091611bf6575b5010611bca57839291611b596024928851906323b872dd60e01b87830152848201528460448201528a606482015260648152611b53816112fa565b87611743565b86519586938492835260048301525afa928315611bc05750600092611b8f575b50506117029291611b899161195b565b14611a78565b81819392933d8311611bb9575b611ba68183611346565b8101031261020257505181611b89611b79565b503d611b9c565b513d6000823e3d90fd5b855162461bcd60e51b815260048101859052600560248201526454484c303160d81b6044820152606490fd5b91508582813d8311611c1f575b611c0d8183611346565b81010312610202575088905138611b18565b503d611c03565b87513d6000823e3d90fd5b90978582813d8311611c59575b611c488183611346565b810103126102025750519638611aef565b503d611c3e565b6040516370a0823160e01b8082526001600160a01b0384811660048401819052602094909116929091908481602481875afa958615611737578791600097611d19575b5060405163a9059cbb60e01b818801526001600160a01b03909116602482810191909152604482019290925285939290611cea90611ce481606481016119b9565b86611743565b6040519485938492835260048301525afa91821561173757600092611b8f5750506117029291611b899161195b565b9150958582813d8311611d46575b611d318183611346565b81010312610202575051948690611cea611ca3565b503d611d2756fea26469706673582212209e91fbc7393bdf324aec4c6c30beaea67730a84bf4a23f212296bdf73bcf605c64736f6c634300081300330000000000000000000000005a4bc2bda1f6b9929b6efdcef4728246bec4c635

Deployed Bytecode

0x6080604052600436101561001257600080fd5b6000803560e01c806347d1e2c114610d6e57806350b4aebe14610ce7578063973dd4f91461092a578063b1e235a7146108e5578063bcecbd9d146108a7578063cff144f714610841578063d6eecb00146107d4578063eb58c5fe14610773578063efd86b62146102055763f412e4c71461008b57600080fd5b346102025760209081600319360112610202576100a66112b1565b6100ae61161e565b6001600160801b03191680825260028352604082206040516100cf816112c8565b60018060a01b03908183541681528160018401541690868101918252600284015493604082019485526003810154606083015260ff60048201541660038110156101ee5760808301526005015460a082015251821633036101be576003859685610193969752600281526101646040892060056000918281558260018201558260028201558260038201558260048201550155565b868852526000600460408820888155826001820155826002820155826003820155015551169051903390611c60565b7f88511e0182a386da19fdcadcde158de4729b63240d9a034ce75f3cb0dc5288a58280a26001815580f35b60405162461bcd60e51b815260048101879052600860248201526710b6b0b730b3b2b960c11b6044820152606490fd5b634e487b7160e01b88526021600452602488fd5b80fd5b503461020257610240366003190112610202576102206112b1565b610229366113f2565b9060a03660e319011261076f57604051610242816112fa565b60e4356001600160a01b038116810361076a57815261010435602082015261012435604082015261014435606082015261016435608082015260c03661018319011261076a57604051610294816112c8565b610184356001600160a01b038116810361076a5781526101a43560208201526101c43560408201526101e43560608201526102043560808201526102243560a08201526102df61161e565b6001600160801b031983168552600460205261030260ff6040872054161561145e565b6001600160801b0319831685526004602090815260408620805460ff1916600117905584015161033c906001600160a01b03161515611493565b8351610352906001600160a01b031615156114cb565b61036160408501511515611503565b6103706060850151421061153a565b6080840151600381101561075657156107275781516001600160a01b0316156106f0576103c060018060a01b036020860151166103b66040870151602085015190611572565b9030903390611aac565b60208101518061058c575b50506001600160801b03198216845260036020526040842061044a60018060a01b038351166bffffffffffffffffffffffff60a01b9281848254161781556020850151600182015560408501516002820155606085015160038201556004608086015191015560018060a01b0360208701511690604087015191611674565b6001600160801b0319831685526002602052604085209060018060a01b0385511681835416178255600182019060018060a01b036020870151169082541617905560408401516002820155606084015160038201556004810160808501516003811015610578579161056e93917f08e5218da97ab939144e67510d646e499712fb36e2305d6dffdf06b7447e48f9959360ff80198354169116179055600560a087015191015560806040519160018060a01b038151168352602081015160208401526040810151604084015260608101516060840152015160808201527fce04f3b9b2dfc43b1d1e78376db74a3b32c0a78daaf34efc81334908359448fc60a06001600160801b0319841692a26040519182916001600160801b03191694826115cf565b0390a26001815580f35b634e487b7160e01b87526021600452602487fd5b6060820151156106cc57506020848101518251918301516105bb9290916001600160a01b039182169116611674565b80516001546020868101519084015160608501516080860151604087015160a08801518c97939690956001600160a01b039485169490811693911690843b156106c85788968793610623926040519a8b998a988997632744bf0b60e11b895260048901611595565b03925af180156106bd576106a5575b50505b600154602085810151838201519351604080516001600160a01b03958616815292851693830193909352918101939093521660608201526001600160801b03198316907ffeb4a12f48997fec18540c56db7545a5cee8f426bb4ac5f73fc0c3f6122d580990608090a238806103cb565b6106ae90611316565b6106b9578438610632565b8480fd5b6040513d84823e3d90fd5b8880fd5b60208501516001546106eb92916001600160a01b039182169116611c60565b610635565b60405162461bcd60e51b815260206004820152600f60248201526e34b73b30b634b232903637b1b5b2b960891b6044820152606490fd5b60405162461bcd60e51b8152602060048201526007602482015266085b1bd8dad95960ca1b6044820152606490fd5b634e487b7160e01b86526021600452602486fd5b600080fd5b8280fd5b50346102025760403660031901126102025761078d6112b1565b6024356001600160a01b038116929083900361076a576040916001600160801b031916815260056020522090600052602052602060ff604060002054166040519015158152f35b503461020257602036600319011261020257604060a0916001600160801b03196107fc6112b1565b168152600360205220600180831b0381541690600181015490600281015460046003830154920154926040519485526020850152604084015260608301526080820152f35b50346102025760803660031901126102025760243567ffffffffffffffff81116108a357610873903690600401611368565b6044356001600160a01b038116810361076a576020916108999160643591600435611988565b6040519015158152f35b5080fd5b50346102025760203660031901126102025760ff60406020926001600160801b03196108d16112b1565b168152600484522054166040519015158152f35b5034610202576020366003190112610202576004356001600160a01b038181169182900361076a57600154908116330361076f576001600160a01b0319161760015580f35b5034610202576101a0366003190112610202576109456112b1565b61094e366113f2565b9060c03660e319011261076a57604051610967816112c8565b60e4356001600160a01b038116810361076a5781526101043560208201526101243560408201526101443560608201526101643560808201526101843560a08201526109b161161e565b6001600160801b03198216845260046020526109d460ff6040862054161561145e565b6001600160801b0319821684526004602090815260408520805460ff19166001179055830151610a0e906001600160a01b03161515611493565b8251610a24906001600160a01b031615156114cb565b610a3360408401511515611503565b610a426060840151421061153a565b60808301516003811015610cd357610ca557610a7760018060a01b036020850151166103b66040860151602085015190611572565b602081015180610b50575b50506001600160801b03198116835260026020526040832060018060a01b038351166bffffffffffffffffffffffff60a01b9081835416178255600182019060018060a01b03602086015116908254161790556040830151600282015560608301516003820155600481016080840151600381101561075657917f08e5218da97ab939144e67510d646e499712fb36e2305d6dffdf06b7447e48f9939161056e9360ff80198354169116179055600560a08601519101556040519182916001600160801b03191694826115cf565b606082015115610c815750602083810151825191830151610b7f9290916001600160a01b039182169116611674565b80516001546020858101519084015160608501516080860151604087015160a08801518b97939690956001600160a01b039485169490811693911690843b156106c85788968793610be7926040519a8b998a988997632744bf0b60e11b895260048901611595565b03925af180156106bd57610c69575b50505b600154602084810151838201519351604080516001600160a01b03958616815292851693830193909352918101939093521660608201526001600160801b03198216907ffeb4a12f48997fec18540c56db7545a5cee8f426bb4ac5f73fc0c3f6122d580990608090a23880610a82565b610c7290611316565b610c7d578338610bf6565b8380fd5b6020840151600154610ca092916001600160a01b039182169116611c60565b610bf9565b60405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b6044820152606490fd5b634e487b7160e01b85526021600452602485fd5b503461020257602036600319011261020257604060c0916001600160801b0319610d0f6112b1565b16815260026020522060018060a01b0390610d678282541692600183015416916002810154600382015490600560ff6004850154169301549460405196875260208701526040860152606085015260808401906113cf565b60a0820152f35b503461020257606036600319011261020257610d886112b1565b60243567ffffffffffffffff811161076f57610da8903690600401611368565b610db061161e565b6001600160801b03198216835260056020526040832033845260205260ff60408420541661127a576001600160801b0319821683526002602052604083209060405191610dfc836112c8565b60018060a01b03815416835260018060a01b036001820154166020840152600281015491604084019283526003820154916060850192835260ff60048201541660038110156101ee5760808601526005015460a08501908152915142101561124457610e6e9160443591339151611988565b15611213576044359051106111da576001600160801b03198216835260056020526040832033845260205260408320600160ff198254161790556001600160801b031982168352600260205260026040842001610ece604435825461195b565b90556001600160801b0319821683526002602052604083206002810154156111ac575b506080810151600381101561119857610f755760200151610f20906044359033906001600160a01b0316611c60565b6001600160801b0319168082526002602081815260408085209092015482516044358152918201523392917f18ee3c31d4863a37e1b4563022fa292ed3f955a41fe1e49a2e8da1b986430e2091a36001815580f35b6001600160801b03929192198316825260036020526040822090600460405192610f9e846112fa565b80546001600160a01b031684526001810154602085015260028101546040850152600381015460608501520154608083018190528015611184576044350661114d57610ff06080830151604435611968565b915b602081015180611147575042915b608081015160038110156107565760010361109e57815160209091015160408301516060909301519596958795946001600160a01b0392831694939092169190823b1561109a578694611070869260405198899788968795632744bf0b60e11b8752604435903360048901611595565b03925af180156106bd57611086575b5050610f20565b61108f90611316565b6108a357813861107f565b8680fd5b815160208201516040840151606090940151925193956001600160a01b0391821694928216939190921691833b15611143579287959492869261012495604051998a98899763050fbad760e01b89523360048a0152602489015260443560448901526064880152608487015260a486015260c485015260e4840152816101048401525af180156106bd57611134575b5090610f20565b61113d90611316565b3861112d565b8780fd5b91611000565b61115d6080830151604435611968565b6001810181116111705760010191610ff2565b634e487b7160e01b84526011600452602484fd5b634e487b7160e01b84526012600452602484fd5b634e487b7160e01b84526021600452602484fd5b6111d49060056000918281558260018201558260028201558260038201558260048201550155565b38610ef1565b60405162461bcd60e51b815260206004820152601160248201527018d85b5c185a59db881d5b999d5b991959607a1b6044820152606490fd5b60405162461bcd60e51b815260206004820152600960248201526821656c696769626c6560b81b6044820152606490fd5b60405162461bcd60e51b815260206004820152600e60248201526d18d85b5c185a59db88195b99195960921b6044820152606490fd5b60405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4818db185a5b5959608a1b6044820152606490fd5b600435906001600160801b03198216820361076a57565b60c0810190811067ffffffffffffffff8211176112e457604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176112e457604052565b67ffffffffffffffff81116112e457604052565b6040810190811067ffffffffffffffff8211176112e457604052565b90601f8019910116810190811067ffffffffffffffff8211176112e457604052565b9080601f8301121561076a5781359067ffffffffffffffff82116112e4578160051b6040519360209361139d85840187611346565b8552838086019282010192831161076a578301905b8282106113c0575050505090565b813581529083019083016113b2565b9060038210156113dc5752565b634e487b7160e01b600052602160045260246000fd5b60c090602319011261076a576040519061140b826112c8565b816001600160a01b03602435818116810361076a578252604435908116810361076a5760208201526064356040820152608435606082015260a435600381101561076a57608082015260a060c435910152565b1561146557565b60405162461bcd60e51b8152602060048201526006602482015265696e2075736560d01b6044820152606490fd5b1561149a57565b60405162461bcd60e51b8152602060048201526009602482015268305f6164647265737360b81b6044820152606490fd5b156114d257565b60405162461bcd60e51b8152602060048201526009602482015268182fb6b0b730b3b2b960b91b6044820152606490fd5b1561150a57565b60405162461bcd60e51b81526020600482015260086024820152670c17d85b5bdd5b9d60c21b6044820152606490fd5b1561154157565b60405162461bcd60e51b815260206004820152600960248201526832b7321032b93937b960b91b6044820152606490fd5b9190820180921161157f57565b634e487b7160e01b600052601160045260246000fd5b93909260c095929897969360e086019960018060a01b03809216875216602086015260408501526060840152608083015260a08201520152565b91909160a08060c0830194600180831b0380825116855260208201511660208501526040810151604085015260608101516060850152611617608082015160808601906113cf565b0151910152565b60026000541461162f576002600055565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301529394936020908290604490829086165afa90811561173757600091611704575b506116c961170294956116fd92611572565b60405163095ea7b360e01b60208201526001600160a01b039490941660248501526044808501919091528352606483611346565b611743565b565b906020823d821161172f575b8161171d60209383611346565b810103126102025750516116c96116b7565b3d9150611710565b6040513d6000823e3d90fd5b60018060a01b0316906040516117588161132a565b6020928382527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564848301526000808486829651910182855af13d1561187d573d9167ffffffffffffffff831161186957906117d3939291604051926117c688601f19601f8401160185611346565b83523d868885013e611887565b805191821591848315611845575b5050509050156117ee5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b9193818094500103126108a3578201519081151582036102025750803880846117e1565b634e487b7160e01b85526041600452602485fd5b906117d392916060915b919290156118e9575081511561189b575090565b3b156118a45790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156118fc5750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510611942575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061191f565b9190820391821161157f57565b8115611972570490565b634e487b7160e01b600052601260045260246000fd5b604080516001600160a01b03909416602080860191825285830196909652919590949093909291906119c781606081015b03601f198101835282611346565b51902084518381019182528381526119de8161132a565b519020926000935b8251851015611a3257838560051b8401015190866000838310600014611a255750506000528352846000205b93600019811461157f57600101936119e6565b9190928252855220611a12565b9150949193925003611a45575050600190565b60649250519062461bcd60e51b82526004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152fd5b15611a7f57565b60405162461bcd60e51b81526020600482015260056024820152642a2426181960d91b6044820152606490fd5b604080516370a0823160e01b8082526001600160a01b039586166004830181905291959294938316936020938488602481895afa978815611c2657600098611c31575b5086519183835216908160048201528481602481895afa908115611c2657908991600091611bf6575b5010611bca57839291611b596024928851906323b872dd60e01b87830152848201528460448201528a606482015260648152611b53816112fa565b87611743565b86519586938492835260048301525afa928315611bc05750600092611b8f575b50506117029291611b899161195b565b14611a78565b81819392933d8311611bb9575b611ba68183611346565b8101031261020257505181611b89611b79565b503d611b9c565b513d6000823e3d90fd5b855162461bcd60e51b815260048101859052600560248201526454484c303160d81b6044820152606490fd5b91508582813d8311611c1f575b611c0d8183611346565b81010312610202575088905138611b18565b503d611c03565b87513d6000823e3d90fd5b90978582813d8311611c59575b611c488183611346565b810103126102025750519638611aef565b503d611c3e565b6040516370a0823160e01b8082526001600160a01b0384811660048401819052602094909116929091908481602481875afa958615611737578791600097611d19575b5060405163a9059cbb60e01b818801526001600160a01b03909116602482810191909152604482019290925285939290611cea90611ce481606481016119b9565b86611743565b6040519485938492835260048301525afa91821561173757600092611b8f5750506117029291611b899161195b565b9150958582813d8311611d46575b611d318183611346565b81010312610202575051948690611cea611ca3565b503d611d2756fea26469706673582212209e91fbc7393bdf324aec4c6c30beaea67730a84bf4a23f212296bdf73bcf605c64736f6c63430008130033

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

0000000000000000000000005a4bc2bda1f6b9929b6efdcef4728246bec4c635

-----Decoded View---------------
Arg [0] : _donationCollector (address): 0x5a4bC2bdA1f6B9929b6efdCef4728246bEc4C635

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000005a4bc2bda1f6b9929b6efdcef4728246bec4c635


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

OVERVIEW

Hedgey Claims Campaigns allow projects to distribute unlocked, locked and vesting tokens to their community with a merkle tree based solution for thousands of users to claim their tokens in an efficient and secure manner.

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.