> For the complete documentation index, see [llms.txt](https://docs.ariaprotocol.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ariaprotocol.xyz/technical-docs/contract-docs/ip/ipclaim.md).

# IPClaim

**Inherits:** AccessControl, Pausable, Whitelist, VaultWhitelistAdmin, UUPSUpgradeable

## State Variables

### claimedIP

```solidity
mapping(address => uint256) public claimedIP;
```

### ipToken

*Address(0) to claim native IP, otherwise ERC20*

```solidity
address public ipToken;
```

### startTime

```solidity
uint256 public startTime;
```

### endTime

```solidity
uint256 public endTime;
```

## Functions

### constructor

**Note:** oz-upgrades-unsafe-allow: constructor

```solidity
constructor();
```

### initialize

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

### depositIP

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

### claim

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

```solidity
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

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

### unpause

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

### setEndTime

```solidity
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*

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

### setStartTime

```solidity
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\*

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

### merkleRoot

```solidity
function merkleRoot() external view returns (bytes32);
```

### \_authorizeUpgrade

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

### \_transfer

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

## Events

### Claimed

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

### EndTimeSet

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

### IPDeposited

```solidity
event IPDeposited(address indexed ipToken, uint256 amount);
```

### IPTokenSet

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

### StartTimeSet

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

## Errors

### IPClaim\_\_Ended

```solidity
error IPClaim__Ended();
```

### IPClaim\_\_EndTimeBeforeStartTime

```solidity
error IPClaim__EndTimeBeforeStartTime();
```

### IPClaim\_\_NotStarted

```solidity
error IPClaim__NotStarted();
```

### IPClaim\_\_NotWhitelisted

```solidity
error IPClaim__NotWhitelisted();
```

### IPClaim\_\_StartTimeAfterEndTime

```solidity
error IPClaim__StartTimeAfterEndTime();
```

### IPClaim\_\_TransferFailed

```solidity
error IPClaim__TransferFailed();
```

### IPClaim\_\_WholeAmountClaimed

```solidity
error IPClaim__WholeAmountClaimed();
```

### IPClaim\_\_ZeroAddress

```solidity
error IPClaim__ZeroAddress();
```

### IPClaim\_\_ZeroAmount

```solidity
error IPClaim__ZeroAmount();
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ariaprotocol.xyz/technical-docs/contract-docs/ip/ipclaim.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
