Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xb09B886eFDe5d3aD6AF898D16DE9178c87EC4Be7
Balance 0 ETH
Nonce 1
Code Size 6261 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

6261 bytes
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80639dfa4e94116100a2578063d53f8f2a11610071578063d53f8f2a146102ae578063ddd5e1b2146102c1578063eaa4c446146102d4578063f2fde38b146102e7578063f4ea93d8146102fa57600080fd5b80639dfa4e941461026d578063b62a772f14610280578063c068e67f14610288578063d087d74d1461029b57600080fd5b8063674982a8116100e9578063674982a8146101d3578063715018a6146101e657806382df0cc6146101ee5780638da5cb5b1461020157806393f1a40b1461022657600080fd5b80631526fe271461011b57806323464906146101885780633767e253146101b6578063640d5264146101cb575b600080fd5b61012e61012936600461150d565b610303565b604080516001600160a01b039096168652602080870195909552835186820152938301516060808701919091529383015160808601529290910151151560a084015260c083015260e0820152610100015b60405180910390f35b6101a8610196366004611542565b60046020526000908152604090205481565b60405190815260200161017f565b6101c96101c4366004611564565b61037e565b005b6002546101a8565b6101c96101e13660046115d9565b610407565b6101c9610647565b6101c96101fc366004611542565b61065b565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161017f565b61025861023436600461160e565b60036020908152600092835260408084209091529082529020805460019091015482565b6040805192835260208301919091520161017f565b6101c961027b36600461160e565b6106b2565b6101a8603281565b61020e61029636600461150d565b61080d565b6101a86102a936600461160e565b610842565b6101c96102bc366004611648565b610a55565b6101c96102cf36600461160e565b610e17565b6101c96102e2366004611542565b610fa6565b6101c96102f5366004611542565b61114d565b6101a861271081565b6002818154811061031357600080fd5b6000918252602091829020600890910201805460018201546040805160808101825260028501548152600385015495810195909552600484015490850152600583015460ff161515606085015260068301546007909301546001600160a01b03909216945092919085565b8060005b81811015610401576103ef84848381811061039f5761039f6116a4565b905060600201600001358585848181106103bb576103bb6116a4565b905060600201602001358686858181106103d7576103d76116a4565b90506060020160400160208101906101e19190611542565b806103f9816116d0565b915050610382565b50505050565b61040f6111c6565b60025483106104395760405162461bcd60e51b8152600401610430906116e9565b60405180910390fd5b6001600160a01b03811661045f5760405162461bcd60e51b81526004016104309061170d565b600060028481548110610474576104746116a4565b600091825260208083206008909202909101548683526003825260408084206001600160a01b03878116865290845281852092168085526004909352909220549092506104c18186611737565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa158015610505573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610529919061174a565b101561056e5760405162461bcd60e51b81526020600482015260146024820152734552525f434c41494d5041445f42414c414e434560601b6044820152606401610430565b848260000160008282546105829190611737565b92505081905550846002878154811061059d5761059d6116a4565b906000526020600020906008020160010160008282546105bd9190611737565b90915550506001600160a01b038316600090815260046020526040812080548792906105ea908490611737565b92505081905550826001600160a01b031686856001600160a01b03167fdf3e0010ace56d171f46dc3d5ace0d953aa5af1777864cdd445a0151c302e6948860405161063791815260200190565b60405180910390a4505050505050565b61064f6111c6565b6106596000611220565b565b60025460005b818110156106ad5760008181526003602090815260408083206001600160a01b03871684529091529020541561069b5761069b81846106b2565b806106a5816116d0565b915050610661565b505050565b6106ba6111c6565b60025482106106db5760405162461bcd60e51b8152600401610430906116e9565b6001600160a01b0381166107015760405162461bcd60e51b81526004016104309061170d565b600060028381548110610716576107166116a4565b600091825260208083208684526003825260408085206001600160a01b03881686529092529083206001810154815460089094029092019450929161075b9190611763565b9050808260000160008282546107719190611763565b925050819055508083600101600082825461078c9190611763565b909155505082546001600160a01b0316600090815260046020526040812080548392906107ba908490611763565b909155505082546040518281526001600160a01b03918216918791908716907fe966a8a2984bc45aa35a23ba7ed487c358ca52584ab030e69a051b5cf88c6eb69060200160405180910390a45050505050565b600060028281548110610822576108226116a4565b60009182526020909120600890910201546001600160a01b031692915050565b60025460009083106108665760405162461bcd60e51b8152600401610430906116e9565b60006002848154811061087b5761087b6116a4565b60009182526020918290206040805160a081018252600890930290910180546001600160a01b0316835260018101548385015281516080808201845260028301548252600383015495820195909552600482015481840152600582015460ff16151560608083019190915292840181905260068201549284019290925260070154928201929092529051909150421015610919576000915050610a4f565b60008481526003602090815260408083206001600160a01b03871684528252808320815180830190925280548083526001909101549282019290925260608401519092906127109061096b9084611776565b610975919061178d565b905060006109838284611763565b905060008560400151606001516109a2578560400151602001516109a9565b6040860151515b90506000818760400151604001516109c19190611763565b9050600087604001516040015142106109da57816109f2565b8242116109e85760006109f2565b6109f28342611763565b90506000886040015160200151421015610a0d576000610a22565b82610a188387611776565b610a22919061178d565b90506000610a308288611737565b9050886020015181610a429190611763565b9a50505050505050505050505b92915050565b610a5d6111c6565b6001600160a01b038616610a835760405162461bcd60e51b81526004016104309061170d565b6127108110610ad45760405162461bcd60e51b815260206004820152601860248201527f4552525f494e5354414e545f554e4c4f434b5f524154494f00000000000000006044820152606401610430565b828510610b195760405162461bcd60e51b81526020600482015260136024820152724552525f53544152545f454d495353494f4e5360681b6044820152606401610430565b848410158015610b295750828411155b610b755760405162461bcd60e51b815260206004820152601860248201527f4552525f454e445f4f465f56455354494e475f434c49464600000000000000006044820152606401610430565b428311610bb85760405162461bcd60e51b81526020600482015260116024820152704552525f454e445f454d495353494f4e5360781b6044820152606401610430565b600254610bc760016032611763565b811115610c0e5760405162461bcd60e51b815260206004820152601560248201527411549497d3505617d413d3d314d7d0531313d5d151605a1b6044820152606401610430565b6040805160a0810182526001600160a01b03898116808352600060208085018281528651608080820189528e82528184018e90528189018d90528b1515606080840191909152888a019283528089018c815291890186815260028054600181018255975298517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace600890970296870180546001600160a01b031916919099161790975591517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf8501555180517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad0850155808301517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad1850155808801517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad2850155909401517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad38301805460ff191691151591909117905592517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad482015592517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad5909301929092558251898152908101879052909183917fcf71df2ad8f5180eea605cc5f16399aa74e3a68b2f23a5da121923b71b2ec36d910160405180910390a350505050505050565b6002548210610e385760405162461bcd60e51b8152600401610430906116e9565b6001600160a01b038116610e5e5760405162461bcd60e51b81526004016104309061170d565b6000610e6a8333610842565b905060008111610eb15760405162461bcd60e51b81526020600482015260126024820152714552525f5a45524f5f434c41494d41424c4560701b6044820152606401610430565b6000838152600360209081526040808320338452909152812060018101805491928492610edf908490611737565b92505081905550600060028581548110610efb57610efb6116a4565b9060005260206000209060080201905082816007016000828254610f1f9190611737565b909155505080546001600160a01b031660009081526004602052604081208054859290610f4d908490611763565b90915550508054610f68906001600160a01b03168585611270565b604051838152859033907f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a9060200160405180910390a35050505050565b610fae6111c6565b6001600160a01b038116610fd45760405162461bcd60e51b81526004016104309061170d565b471561106757604051600090339047908381818185875af1925050503d806000811461101c576040519150601f19603f3d011682016040523d82523d6000602084013e611021565b606091505b50509050806110655760405162461bcd60e51b815260206004820152601060248201526f08aa4a4bea8a4829ca68c8aa4be8aa8960831b6044820152606401610430565b505b6001600160a01b03811660008181526004602081905260408083205490516370a0823160e01b8152309281019290925292906370a0823190602401602060405180830381865afa1580156110bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e3919061174a565b905081811161112b5760405162461bcd60e51b81526020600482015260146024820152734552525f4e4f5f4558434553535f544f4b454e5360601b6044820152606401610430565b60006111378383611763565b90506104016001600160a01b0385163383611270565b6111556111c6565b6001600160a01b0381166111ba5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610430565b6111c381611220565b50565b6000546001600160a01b031633146106595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610430565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526106ad9286929160009161130091851690849061137d565b8051909150156106ad578080602001905181019061131e91906117af565b6106ad5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610430565b606061138c8484600085611394565b949350505050565b6060824710156113f55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610430565b600080866001600160a01b0316858760405161141191906117f0565b60006040518083038185875af1925050503d806000811461144e576040519150601f19603f3d011682016040523d82523d6000602084013e611453565b606091505b50915091506114648783838761146f565b979650505050505050565b606083156114de5782516000036114d7576001600160a01b0385163b6114d75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610430565b508161138c565b61138c83838151156114f35781518083602001fd5b8060405162461bcd60e51b8152600401610430919061180c565b60006020828403121561151f57600080fd5b5035919050565b80356001600160a01b038116811461153d57600080fd5b919050565b60006020828403121561155457600080fd5b61155d82611526565b9392505050565b6000806020838503121561157757600080fd5b823567ffffffffffffffff8082111561158f57600080fd5b818501915085601f8301126115a357600080fd5b8135818111156115b257600080fd5b8660206060830285010111156115c757600080fd5b60209290920196919550909350505050565b6000806000606084860312156115ee57600080fd5b833592506020840135915061160560408501611526565b90509250925092565b6000806040838503121561162157600080fd5b8235915061163160208401611526565b90509250929050565b80151581146111c357600080fd5b60008060008060008060c0878903121561166157600080fd5b61166a87611526565b9550602087013594506040870135935060608701359250608087013561168f8161163a565b8092505060a087013590509295509295509295565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016116e2576116e26116ba565b5060010190565b6020808252600a908201526911549497d413d3d3125160b21b604082015260600190565b60208082526010908201526f4552525f5a45524f5f4144445245535360801b604082015260600190565b80820180821115610a4f57610a4f6116ba565b60006020828403121561175c57600080fd5b5051919050565b81810381811115610a4f57610a4f6116ba565b8082028115828204841417610a4f57610a4f6116ba565b6000826117aa57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156117c157600080fd5b815161155d8161163a565b60005b838110156117e75781810151838201526020016117cf565b50506000910152565b600082516118028184602087016117cc565b9190910192915050565b602081526000825180602084015261182b8160408501602087016117cc565b601f01601f1916919091016040019291505056fea2646970667358221220787609ce691d882e18b697658e402d861d00d3917a4876ddfd2c6d9ff83aede664736f6c63430008120033

Verified Source Code Full Match

Compiler: v0.8.18+commit.87f61d96 EVM: paris Optimization: Yes (200 runs)
SDAOClaimpad.sol 237 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

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

  struct UserInfo {
    uint256 allocated;
    uint256 claimed;
  }

  struct EmissionPeriod {
    uint256 startOfEmissions;
    uint256 endOfVestingCliff;
    uint256 endOfEmissions;
    bool vestingCliffAccrues;
  }
  
  struct PoolInfo {
    address claimToken;
    uint256 allocatedAmount;

    EmissionPeriod emissionPeriod;

    uint256 instantUnlockRatio; // % of emissions to unlock instantly at start of emission period in 0.01% basis points
    uint256 totalClaimed;
  }

  struct Allocation {
    uint256 pid;
    uint256 amount;
    address user;
  }
  
  //==========  Constants  ==========
  uint256 public constant MAX_BASIS_POINTS = 10000; // 100.00% or 10k bps

  /// @dev MAX Pools allowed in the contract to avoid Block gas limits
  uint256 public constant MAX_POOLS_ALLOWED = 50;

  /** ==========  Storage  ========== */
  /// @dev Info of each launch pool.
  PoolInfo[] public poolInfo;
  
  /// @dev Info of each user that has allocated tokens.
  mapping(uint256 => mapping(address => UserInfo)) public userInfo;
  
  /// @dev Info for total reserved amount per claimtoken.
  mapping(address => uint256) public reservedAmount;
  
  // ==========  Events  ==========
  event PoolAdded(uint256 indexed pid, address indexed token, uint256 startOfEmissions, uint256 endOfEmissions);
  event Allocated(address indexed user, uint256 indexed pid, uint256 amount, address indexed token);
  event Deallocated(address indexed user, uint256 indexed pid, uint256 amount, address indexed token);
  event Claimed(address indexed user, uint256 indexed pid, uint256 amount);

  //*** External functions ***//

  /// @dev Add a new launchpad pool.
  /// Can only be called by the owner
  function createPool(address _token,
                      uint256 _startOfEmissions,
                      uint256 _endOfVestingCliff,
                      uint256 _endOfEmissions,
                      bool _vestingCliffAccrues,
                      uint256 _instantUnlockRatio)
           external onlyOwner {
    require(_token != address(0), "ERR_ZERO_ADDRESS");
    require(_instantUnlockRatio < MAX_BASIS_POINTS, "ERR_INSTANT_UNLOCK_RATIO");
    require(_startOfEmissions < _endOfEmissions, "ERR_START_EMISSIONS");
    require(_endOfVestingCliff >= _startOfEmissions
            && _endOfVestingCliff <= _endOfEmissions,
            "ERR_END_OF_VESTING_CLIFF");
    require(_endOfEmissions > block.timestamp, "ERR_END_EMISSIONS");

    uint256 pid = poolInfo.length;

    // To restrict the number of pools per contract instance
    require(pid <= MAX_POOLS_ALLOWED - 1, "ERR_MAX_POOLS_ALLOWED");

    poolInfo.push(PoolInfo({
      claimToken: _token,
      allocatedAmount: 0,
      emissionPeriod: EmissionPeriod({
                        startOfEmissions: _startOfEmissions,
                        endOfVestingCliff: _endOfVestingCliff,
                        endOfEmissions: _endOfEmissions,
                        vestingCliffAccrues: _vestingCliffAccrues
                      }),
      instantUnlockRatio: _instantUnlockRatio,
      totalClaimed: 0
    }));

    emit PoolAdded(pid, _token,  _startOfEmissions, _endOfEmissions);
  }

  // Recover any tokens accidentally sent to the contract excluding properly deposited or bought tokens
  function recoverAnyTokens(address token) external onlyOwner {
    require(token != address(0), "ERR_ZERO_ADDRESS");
    
    if(address(this).balance > 0) {
      (bool success, ) = (msg.sender).call{value: address(this).balance}("");
      require(success, "ERR_TRANSFER_ETH");
    }

    uint256 reservedTokens = reservedAmount[token];
    uint256 currentTokenBalance = IERC20(token).balanceOf(address(this));
    require(currentTokenBalance > reservedTokens, "ERR_NO_EXCESS_TOKENS");
    uint256 excessTokens = currentTokenBalance - reservedTokens;
    IERC20(token).safeTransfer(msg.sender, excessTokens); 
    
  }

  //*** External view functions ***//

  function nrOfPools() external view returns (uint256) {
    return poolInfo.length;
  }

  function getPoolClaimToken(uint256 _pid) external view returns (address) {
      return poolInfo[_pid].claimToken;
  }

  //*** Public functions ***//

  /// @dev Allocate tokens to be entitled for launch tokens.
  /// @param _pid The index of the pool. See `poolInfo`.
  /// @param _amount Token amount to deposit.
  /// @param _to The wallet entitled to claim `_amount` deposit benefit.
  function allocateFor(uint256 _pid,
                      uint256 _amount,
                      address _to)
           public onlyOwner {
    require(_pid < poolInfo.length, "ERR_POOLID");
    require(_to != address(0), "ERR_ZERO_ADDRESS");

    //PoolInfo memory pool = poolInfo[_pid];
    address claimToken = poolInfo[_pid].claimToken;
    UserInfo storage user = userInfo[_pid][_to];
    
    uint256 reservedClaimTokens = reservedAmount[claimToken];
    require(IERC20(claimToken).balanceOf(address(this)) >= _amount + reservedClaimTokens
           , "ERR_CLAIMPAD_BALANCE");

    user.allocated += _amount;
    poolInfo[_pid].allocatedAmount += _amount;
    reservedAmount[claimToken] += _amount;

    emit Allocated(_to, _pid, _amount, claimToken);
  }
  
  function bulkAllocate(Allocation[] calldata allocations) external {
     uint256 nrOfAllocations = allocations.length;
     for (uint256 i = 0; i < nrOfAllocations; i++) {
        allocateFor(allocations[i].pid, allocations[i].amount, allocations[i].user);
     }
  }
  
  function remove(uint256 _pid, address _user) public onlyOwner {
     require(_pid < poolInfo.length, "ERR_POOLID");
     require(_user != address(0), "ERR_ZERO_ADDRESS");
     PoolInfo storage pool = poolInfo[_pid];
     UserInfo storage user = userInfo[_pid][_user];
     uint256 left = user.allocated - user.claimed;
     user.allocated -= left;
     pool.allocatedAmount -= left;
     reservedAmount[pool.claimToken] -= left;
     emit Deallocated(_user, _pid, left, pool.claimToken);
  }
  
  function removeAll(address _user) external {
    uint256 pids = poolInfo.length;
    for (uint256 pid = 0; pid < pids; pid++) {
      if (userInfo[pid][_user].allocated > 0) {
         remove(pid, _user);
      }
    }     
  }

  /// @dev Claim proceeds for transaction sender to `_to`.
  /// @param _pid The index of the pool. See `poolInfo`.
  /// @param _to Receiver of rewards.
  function claim(uint256 _pid, address _to) external {
    require(_pid < poolInfo.length, "ERR_POOLID");
    require(_to != address(0), "ERR_ZERO_ADDRESS");

    uint256 claimable = claimableTokens(_pid, msg.sender);
    require(claimable > 0, "ERR_ZERO_CLAIMABLE");
	
    // Interactions
    UserInfo storage user = userInfo[_pid][msg.sender];
    user.claimed += claimable;
    PoolInfo storage pool = poolInfo[_pid];
    pool.totalClaimed += claimable;
    reservedAmount[pool.claimToken] -= claimable;

    IERC20(pool.claimToken).safeTransfer(_to, claimable);
    emit Claimed(msg.sender, _pid, claimable);
  }

  //*** Public view functions ***//
  
  /// @dev View function to see claimable tokens on frontend.
  /// @param _pid The index of the pool. See `poolInfo`.
  /// @param _user Address of user.
  /// @return claimableAmount tokens for a given user.
  function claimableTokens(uint256 _pid, address _user) public view returns (uint256 claimableAmount) {
    require(_pid < poolInfo.length, "ERR_POOLID");
    PoolInfo memory pool = poolInfo[_pid];
    if (pool.emissionPeriod.startOfEmissions > block.timestamp) {
       return 0;
    }
    UserInfo memory user = userInfo[_pid][_user];
    uint256 allocatedAmount = user.allocated;
    uint256 instantUnlockedAmount = allocatedAmount * pool.instantUnlockRatio / MAX_BASIS_POINTS;
    uint256 vestedAmount = allocatedAmount - instantUnlockedAmount;
    uint256 startOfEmissions = pool.emissionPeriod.vestingCliffAccrues 
                               ? pool.emissionPeriod.startOfEmissions 
                               : pool.emissionPeriod.endOfVestingCliff;
    uint256 totalEmissionSeconds = pool.emissionPeriod.endOfEmissions - startOfEmissions;
    uint256 emissionPassed = (block.timestamp < pool.emissionPeriod.endOfEmissions)
                             ? (block.timestamp > startOfEmissions ? block.timestamp - startOfEmissions : 0)
                             : totalEmissionSeconds;
    uint256 vestedUnlockedAmount = (block.timestamp >= pool.emissionPeriod.endOfVestingCliff)
                                   ? vestedAmount * emissionPassed / totalEmissionSeconds
                                   : 0;
    uint256 unlockedAmount = instantUnlockedAmount + vestedUnlockedAmount;
    claimableAmount = unlockedAmount - user.claimed;
  }


}
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

pragma solidity ^0.8.0;

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}
ReentrancyGuard.sol 69 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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;
    }
}
SafeERC20.sol 116 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
draft-IERC20Permit.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

Read Contract

MAX_BASIS_POINTS 0xf4ea93d8 → uint256
MAX_POOLS_ALLOWED 0xb62a772f → uint256
claimableTokens 0xd087d74d → uint256
getPoolClaimToken 0xc068e67f → address
nrOfPools 0x640d5264 → uint256
owner 0x8da5cb5b → address
poolInfo 0x1526fe27 → address, uint256, tuple, uint256, uint256
reservedAmount 0x23464906 → uint256
userInfo 0x93f1a40b → uint256, uint256

Write Contract 9 functions

These functions modify contract state and require a wallet transaction to execute.

allocateFor 0x674982a8
uint256 _pid
uint256 _amount
address _to
bulkAllocate 0x506cac2d
tuple[] allocations
claim 0xddd5e1b2
uint256 _pid
address _to
createPool 0xd53f8f2a
address _token
uint256 _startOfEmissions
uint256 _endOfVestingCliff
uint256 _endOfEmissions
bool _vestingCliffAccrues
uint256 _instantUnlockRatio
recoverAnyTokens 0xeaa4c446
address token
remove 0x9dfa4e94
uint256 _pid
address _user
removeAll 0x82df0cc6
address _user
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address