# Entities in Vesting Data Structure

**1. UserVestings**

```
 type UserVestings []string
```

**Description:** Represents an array of vesting identifiers associated with a user.

**2. UserVestingsData**

```
 type UserVestingsData struct {
	UserVestings []string `json:"userVestings"`
 }
```

**Description:** Represents the vesting data specific to a user. It contains an array of vesting identifiers associated with the user.

* **userVestings**: A list of vesting IDs assigned to the user.

**3. Beneficiary**

```
 type Beneficiary struct {
	TotalAllocations string `json:"totalAllocations"`
	ClaimedAmount    string `json:"claimedAmount"`
 }
```

**Description:** Stores information regarding token allocations and claims of a specific beneficiary.

* **totalAllocations**: The total number of tokens allocated to the beneficiary.
* **claimedAmount**: The number of tokens claimed by the beneficiary.

**4. VestingPeriod**

```
 type VestingPeriod struct {
	TotalSupply         string `json:"totalSupply"`
	CliffStartTimestamp uint64 `json:"cliffStartTimestamp"`
	StartTimestamp      uint64 `json:"startTimestamp"`
	EndTimestamp        uint64 `json:"endTimestamp"`
	Duration            uint64 `json:"duration"`
	TGE                 uint64 `json:"tge"`
 }
```

**Description:** Defines the timeline and total supply associated with a specific vesting schedule.

* **totalSupply**: Total token supply for this vesting schedule.
* **cliffStartTimestamp**: Timestamp indicating when the cliff period starts.
* **startTimestamp**: Timestamp marking the beginning of the vesting period.
* **endTimestamp**: Timestamp indicating the end of the vesting period.
* **duration**: The total duration of the vesting period in seconds.
* **tge**: It is the percentage of tokens unlocked at the Token Generation Event (TGE) moment.

**5. VestingData**

```
 type VestingData struct {
	VestingPeriod *VestingPeriod `json:"vestingPeriod"`
	ClaimedAmount string         `json:"claimedAmount"`
 }
```

**Description:** Contains details related to vesting schedules and claimed amounts.

* **vestingPeriod**: A reference to the vesting period data.
* **claimedAmount**: The total claimed amount for the vesting schedule.

**6. ClaimsWithAllVestings**

```
 type ClaimsWithAllVestings struct {
	TotalAmount  string   `json:"totalAmount"`
	UserVestings []string `json:"userVestings"`
	Amounts      []string `json:"amounts"`
 }
```

**Description:** Holds data about claims made by a user across multiple vesting schedules.

* **totalAmount**: The total claimed amount across all vesting schedules.
* **userVestings**: List of user-specific vesting IDs.
* **amounts**: Individual claimed amounts corresponding to each vesting ID.

**7. VestingDurationsData**

```
 type VestingDurationsData struct {
	UserVestings     []string `json:"userVestings"`
	VestingDurations []uint64 `json:"vestingDurations"`
 }
```

**Description:** Tracks the vesting durations for each vesting schedule associated with a user.

* **userVestings**: List of vesting IDs associated with the user.
* **vestingDurations**: Duration of each vesting schedule in seconds.

**8. AllocationsWithAllVestings**

```
 type AllocationsWithAllVestings struct {
	UserVestings     []string `json:"userVestings"`
	TotalAllocations []string `json:"totalAllocations"`
 }
```

**Description:** Records the total token allocations across all vesting schedules for a user.

* **userVestings**: List of vesting IDs for the user.
* **totalAllocations**: Total allocated tokens corresponding to each vesting ID.

**9. TotalClaimsWithAllVestings**

```
 type TotalClaimsWithAllVestings struct {
	UserVestings []string `json:"userVestings"`
	TotalClaims  []string `json:"totalClaims"`
 }
```

**Description:** Tracks the total claimed tokens across all vesting schedules associated with a user.

* **userVestings**: List of vesting IDs for the user.
* **totalClaims**: Total claimed amounts for each vesting ID.

## Error Definitions in Vesting Contract <a href="#error-definitions-in-vesting-contract" id="error-definitions-in-vesting-contract"></a>

**1. ErrNoBeneficiaries**

Error message: `"NoBeneficiaries"`

**Description:** Occurs when no beneficiaries are found for the vesting allocation.

**2. ErrCannotBeZero**

Error message: `"CannotBeZero"`

**Description:** Triggered when a required value cannot be zero, such as allocation amounts or vesting durations.

**3. ErrContractAddressAlreadySet**

Error message: `"ContractAddressAlreadySet"`

**Description:** Indicates that the contract address has already been initialized and cannot be modified.

**4. ErrNonPositiveVestingAmount**

Error message: `"NonPositiveVestingAmount"`

**Description:** Raised when the vesting amount provided is zero or negative.

**5. ErrNothingToClaim**

Error message: `"NothingToClaim"`

**Description:** Occurs when a user attempts to claim tokens but no vested amount is available.

**6. ErrTokenAlreadySet**

Error message: `"TokenAlreadySet"`

**Description:** Indicates that the token contract address has already been set and cannot be changed.

**7. ErrDurationCannotBeZeroForClaimAmount**

Error message: `"DurationCannotBeZero"`

**Description:** Raised when the duration is set to zero, making claims impossible.

**8. ErrTotalAllocationCannotBeNonPositive**

Error message: `"TotalAllocationCannotBeNonPositive"`

**Description:** Triggered when the total allocation provided is zero or negative.

**9. ErrInitialUnlockCannotBeNegative**

Error message: `"InitialUnlockCannotBeNegative"`

**Description:** Occurs when the initial unlock amount provided is negative.

**10. ErrInvalidUserAddress**

**Description:** Occurs when an invalid user address is provided.

Example: `"InvalidUserAddress for userAddress %s"`

**11. ErrDurationCannotBeZero**

**Description:** Raised when the vesting duration for a specific vesting ID is set to zero.

Example: `"DurationCannotBeZero for vestingID %s"`

**12. ErrTotalSupplyCannotBeNonPositive**

**Description:** Triggered when the total supply of tokens is zero or negative.

Example: `"TotalSupplyCannotBeNonPositive for vestingID %s"`

**13. ErrInvalidAmount**

**Description:** Occurs when an invalid token amount is provided for a specific entity.

Example: `"InvalidAmount for %s with value %s for amount %s"`

**14. ErrOnlyAfterVestingStart**

**Description:** Raised when an action is attempted before the vesting period starts.

Example: `"OnlyAfterVestingStart for vesting ID %s"`

**15. ErrInvalidContractAddress**

**Description:** Indicates an invalid contract address.

Example: `"InvalidContractAddress for address %s"`

**16. ErrArraysLengthMismatch**

**Description:** Occurs when two arrays of related data have mismatched lengths.

Example: `"ArraysLengthMismatch: length1: %d, length2: %d"`

**17. ErrTotalSupplyReached**

**Description:** Raised when the total supply for a vesting type has been reached.

Example: `"TotalSupplyReached for vesting type: %s"`

**18. ErrZeroVestingAmount**

**Description:** Occurs when the vesting amount for a beneficiary is zero.

Example: `"ZeroVestingAmount for beneficiary: %s"`

**19. ErrBeneficiaryAlreadyExists**

**Description:** Raised when a beneficiary is already registered.

Example: `"BeneficiaryAlreadyExists for beneficiary: %s"`

**20. ErrUserVestingsAlreadyExists**

**Description:** Occurs when user vestings are already recorded.

Example: `"UserVestingsAlreadyExists for beneficiary: %s"`

**21. ErrClaimAmountExceedsVestingAmount**

**Description:** Triggered when the claim amount exceeds the allocated vesting amount.

Example: `"ClaimAmountExceedsVestingAmount for vesting ID %s and beneficiary %s: claimAmount=%s, totalAllocations=%s"`

**22. ErrInvalidVestingID**

**Description:** Occurs when an invalid vesting ID is provided.

Example: `"InvalidVestingID for vestingID: %s"`


---

# Agent Instructions: 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:

```
GET https://kalp-network.gitbook.io/gini-smartcontracts-documentation/entities-in-vesting-data-structure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
