IPClaim

Inherits: AccessControl, Pausable, Whitelist, VaultWhitelistAdmin, UUPSUpgradeable

State Variables

claimedIP

mapping(address => uint256) public claimedIP;

ipToken

Address(0) to claim native IP, otherwise ERC20

address public ipToken;

startTime

uint256 public startTime;

endTime

uint256 public endTime;

Functions

constructor

Note: oz-upgrades-unsafe-allow: constructor

constructor();

initialize

function initialize(bytes32 _merkleRoot, address _admin) external initializer;

depositIP

function depositIP() external payable onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE);

claim

Can only claim once, even if merkle tree updates a user's amount

function claim(bytes32[] calldata _proof, uint256 _amount) external whenNotPaused;

Parameters

Name
Type
Description

_proof

bytes32[]

Merkle proof for the user

_amount

uint256

The whole amount of $IP the user is entitled to claim

pause

function pause() external onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE) whenNotPaused;

unpause

function unpause() external onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE) whenPaused;

setEndTime

function setEndTime(uint256 _endTime) external onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE);

setIPToken

Admin can change token to be claimed at any time without any checks - made on purpose

If address(0) is set, it means ETH/IP is being claimed

function setIPToken(address _ipToken) external onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE);

setStartTime

function setStartTime(uint256 _startTime) external onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE);

withdrawAnyToken

*Admin can withdraw any token, at any time, including the IP token, without any checks

  • made on purpose*

function withdrawAnyToken(address _token, address _to, uint256 _amount)
    external
    onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE);

merkleRoot

function merkleRoot() external view returns (bytes32);

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation)
    internal
    override
    onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE);

_transfer

function _transfer(address _token, address payable _to, uint256 _amount) internal;

Events

Claimed

event Claimed(address indexed account, uint256 indexed amount);

EndTimeSet

event EndTimeSet(uint256 indexed oldEndTime, uint256 indexed newEndTime);

IPDeposited

event IPDeposited(address indexed ipToken, uint256 amount);

IPTokenSet

event IPTokenSet(address indexed oldIPToken, address indexed newIPToken);

StartTimeSet

event StartTimeSet(uint256 indexed oldStartTime, uint256 indexed newStartTime);

Errors

IPClaim__Ended

error IPClaim__Ended();

IPClaim__EndTimeBeforeStartTime

error IPClaim__EndTimeBeforeStartTime();

IPClaim__NotStarted

error IPClaim__NotStarted();

IPClaim__NotWhitelisted

error IPClaim__NotWhitelisted();

IPClaim__StartTimeAfterEndTime

error IPClaim__StartTimeAfterEndTime();

IPClaim__TransferFailed

error IPClaim__TransferFailed();

IPClaim__WholeAmountClaimed

error IPClaim__WholeAmountClaimed();

IPClaim__ZeroAddress

error IPClaim__ZeroAddress();

IPClaim__ZeroAmount

error IPClaim__ZeroAmount();