> For the complete documentation index, see [llms.txt](https://city-protocol.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://city-protocol.gitbook.io/docs/software-development-kit/vault/write-methods.md).

# Write Methods

#### createVault

Creates a new vault through the YieldVaultFactory.

```tsx
const hash = await client.createVault({
  factory: "0xFactoryAddress",
  name: "My Vault",
  symbol: "MVLT",
  asset: "0xUnderlyingTokenAddress",
});
```

#### deposit

Deposits underlying assets into a vault. The SDK automatically handles checking and requesting the necessary ERC-20 approval before executing the deposit.

```tsx
const hash = await client.deposit({
  vault: "0xVaultAddress",
  assets: 1000000n, // Amount in underlying token decimals
});
```

#### mint

Mints a specific target amount of vault shares. Like `deposit`, it handles approvals automatically.

```tsx
const hash = await client.mint({
  vault: "0xVaultAddress",
  shares: 1000000n, // Amount in vault share decimals (18)
});
```

#### withdraw

Withdraws assets directly from the vault. **Note:** This method only works when the cooldown mechanism is disabled.

```tsx
const hash = await client.withdraw({
  vault: "0xVaultAddress",
  assets: 500000n,
});
```

#### redeem

Redeems shares directly for underlying assets. **Note:** This method only works when the cooldown mechanism is disabled.

```tsx
const hash = await client.redeem({
  vault: "0xVaultAddress",
  shares: 500000n,
});
```

#### cooldownAssets & cooldownShares

When cooldown is enabled, direct withdrawals are blocked. Instead, users must initiate a cooldown flow.

```tsx
// Start cooldown using an asset amount
const hash1 = await client.cooldownAssets({
  vault: "0xVaultAddress",
  assets: 500000n,
});

// Or start cooldown using a share amount
const hash2 = await client.cooldownShares({
  vault: "0xVaultAddress",
  shares: 500000n,
});
```

#### claimFromAp

After a cooldown period finishes, users call this method to claim their matured assets from the aging pool.

```tsx
const hash = await client.claimFromAp({
  vault: "0xVaultAddress",
  // Optionally override recipient:
  // receiver: "0xAnotherAddress"
});
```
