# Linear Clawback Vesting Wallet

Creates a Wallet that allows the holder to claim coins linearly. The holder of the `OwnerCap` can reclaim any locked coins back. &#x20;

## Structs

### <mark style="color:blue;">**Wallet**</mark>

```rust
  struct Wallet<phantom T> has key, store {
    id: UID,
    balance: Balance<T>,
    start: u64,
    released: u64,
    duration: u64,
    clawbacked: u64
  }
```

* **balance** - Amount of tokens to give to the holder of the wallet.&#x20;
* **start** - The holder can start claiming tokens after this date.
* **released -** Total amount of \`Coin\<T>\` released so far.&#x20;
* **duration -** The duration of the vesting.
* **clawbacked -** The amount of tokens recalled.&#x20;

## Interface

### <mark style="color:blue;">new</mark>

It creates a new Wallet and two capabilities for the recipient and the clawback owner.

```rust
  public fun new<T>(
    token: Coin<T>, 
    c: &Clock, 
    start: u64, 
    duration: u64, 
    ctx: &mut TxContext
  ): (OwnerCap<ClawBackWitness>, OwnerCap<RecipientWitness>, Wallet<T>)
```

* **@param token:** A `sui::coin::Coin<T>`.
* **@param c:** The shared object `sui::clock::Clock`
* **@param start:** Dictate when the vesting schedule starts.
* **@param duration**: Dictate when the vesting schedule starts.
* **@return OwnerCap<**&#x43;lawBackWitnes&#x73;**>:** The holder of this capability can claw back the coins.
* **@return OwnerCap<**&#x52;ecipientWitnes&#x73;**>:** The holder of this capability can claim tokens according to the linear schedule.
* **@return** Wallet.

**Aborts**

* `start` is in the past.

### <mark style="color:blue;">share</mark>

**It shares the Wallet with the network.**

```rust
public fun share<T>(self: Wallet<T>)
```

* **@param self:** A Wallet.

### <mark style="color:blue;">balance</mark>

**Returns the current amount of tokens in the `self`.**

```rust
public fun balance<T>(self: &Wallet<T>): u64
```

* **@param self:** A Wallet.
* **@return** u64.

### <mark style="color:blue;">start</mark>

**Returns the vesting schedule start time.**&#x20;

```rust
public fun start<T>(self: &Wallet<T>): u64
```

* **@param self:** A Wallet.
* **@return** u64.

### <mark style="color:blue;">released</mark>

**Returns the current amount of total released tokens from the `self`.**

```rust
public fun released<T>(self: &Wallet<T>): u64
```

* **@param self:** A Wallet.
* **@return** u64.

### <mark style="color:blue;">duration</mark>

**Returns the duration of the vesting schedule.**

```rust
public fun duration<T>(self: &Wallet<T>): u64
```

* **@param self:** A Wallet.
* **@return** u64.

### <mark style="color:blue;">clawbacked</mark>

**Returns the number of tokens that were claw-backed by the holder of OwnerCap from the `self`.**

```rust
public fun clawbacked<T>(self: &Wallet<T>): u64
```

* **@param self:** A Wallet.
* **@return** u64.

### <mark style="color:blue;">vesting\_status</mark>

**Returns the current amount of coins available to the caller based on the linear schedule.**

```rust
public fun vesting_status<T>(self: &Wallet<T>, c: &Clock): u64
```

* **@param self:** A Wallet.
* **@param c:**  The `sui::clock::Clock` shared object.
* **@return** u64. A portion of the amount that can be claimed by the user.

### <mark style="color:blue;">claim</mark>

**Releases the current amount of coins available to the caller based on the linear schedule.**

```rust
public fun claim<T>(self: &mut Wallet<T>, cap: &OwnerCap<RecipientWitness>, c: &Clock, ctx: &mut TxContext): Coin<T>
```

* **@param self:** A Wallet.
* **@param cap:** The recipient capability that owns the `self`.
* **@param c:** The `sui::clock::Clock` shared object.
* **@return** Coin.

**Aborts**

* `cap` does not own the `self`.

### <mark style="color:blue;">clawback</mark>

**Returns all unreleased coins to the `cap` holder.**

```rust
public fun clawback<T>(self: &mut Wallet<T>, cap: OwnerCap<ClawBackWitness>, c: &Clock, ctx: &mut TxContext): Coin<T>
```

* **@param self:** A Wallet.
* **@param cap:** The clawback capability that owns the `self`.
* **@param c:** The `sui::clock::Clock` shared object.
* **@return** Coin.

**Aborts**

* `cap` does not own the `self`.

### <mark style="color:blue;">destroy\_zero</mark>

**Destroys a Wallet with no balance.**

```rust
public fun destroy_zero<T>(self: Wallet<T>)
```

* **@param self:** A Wallet.


---

# 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://docs.interestprotocol.com/overview/deprecated/sui-tears/defi/linear-clawback-vesting-wallet.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.
