> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# DAMM v1 Farming Changelog

> Track DAMM v1 farming release notes, breaking changes, and upgrade guidance for the farming program and TypeScript SDK.

> [!TIP]
>
> Track DAMM v1 farming releases here.

**farming 0.2.2**

Program deprecation

> [!NOTE]
>
> The farming crate stays at `0.2.2`. The deprecation is in [reward-pool-internal #3](https://github.com/MeteoraAg/reward-pool-internal/pull/3), which is open. `@meteora-ag/farming-sdk@1.1.0` is the version in that pull request. npm still publishes [`@meteora-ag/farming-sdk@1.0.18`](https://www.npmjs.com/package/@meteora-ag/farming-sdk).

> [!WARNING]
>
> **Breaking release.** `initialize_pool`, `create_user`, `deposit`, `fund`, `authorize_funder`, `deauthorize_funder`, `toggle_permission`, `unpause`, and `migrate_farming_rate` fail with `Deprecated` (6012). Stakers exit with `withdraw`, `claim`, and `close_user`.

## Release summary

| Component | Version | PR |
| - | - | - |
| Program | `0.2.2` | [reward-pool-internal #3](https://github.com/MeteoraAg/reward-pool-internal/pull/3) |
| TypeScript SDK | `1.1.0` | [reward-pool-internal #3](https://github.com/MeteoraAg/reward-pool-internal/pull/3) |

The SDK package in this pull request is `@meteora-ag/farming-sdk`.

## What We Shipped

* Deprecated new farms, new user accounts, new stakes, and reward funding
* Left `withdraw`, `claim`, and `close_user` as the staker exit
* Left `pause`, `withdraw_extra_token`, and `close_pool` for the pool authority after the reward period
* Added `closeUser` to the TypeScript SDK

## What To Do

<table>
  <thead>
    <tr>
      <th>Integrators</th>
      <th>What Changed</th>
      <th>What To Do</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>**Partners**</td>

      <td>
        <ul>
          <li>`initialize_pool`, `fund`, `authorize_funder`, `deauthorize_funder`, `toggle_permission`, `unpause`, and `migrate_farming_rate` fail with `Deprecated` (6012).</li>
          <li>`pause` still runs after `reward_duration_end`. `unpause` fails, so a pause stays in place.</li>
          <li>`close_pool` requires the pool to be paused, the reward period to have ended, `user_stake_count == 0`, and `staking_vault.amount == 0`.</li>
        </ul>
      </td>

      <td>
        <ul>
          <li>Stop creating farms and stop funding rewards.</li>
          <li>Leave funded rewards in place until `reward_duration_end`. Stakers claim through that time.</li>
          <li>After the reward period, `pause` the pool, `withdraw_extra_token` for any stake tokens above `total_staked`, wait until every user account is closed, then `close_pool`.</li>
          <li>Skip `migrate_farming_rate`. `get_reward_a_rate` and `get_reward_b_rate` read the u128 rate, and read the legacy u64 rate when the u128 rate is zero.</li>
        </ul>
      </td>
    </tr>
  </tbody>
</table>

## Program: `farming` `0.2.2`

Program ID (mainnet and devnet): `FarmuwXPWXvefWUeqFAa5w6rifLkq5X6E8bimYvrhCB1`

[Program PR #3](https://github.com/MeteoraAg/reward-pool-internal/pull/3)

### Changed

* Upgrade to Anchor 1.2.1. The program is built for SBPF v3. Single-reward pools still pass one token account for reward A and reward B. Those accounts are marked `dup` so Anchor 1.2 accepts the duplicate mutable account.
* Funded pools keep distributing rewards until `reward_duration_end`. `fund` no longer extends that time.
* `withdraw`, `claim`, `close_user`, `pause`, `withdraw_extra_token`, and `close_pool` keep working. `pause` still requires `reward_duration_end > 0` and a current time after `reward_duration_end`.
* `close_user` still requires `balance_staked == 0`, `reward_a_per_token_pending == 0`, and `reward_b_per_token_pending == 0`. It decreases `user_stake_count` by 1 and returns the rent to the owner.
* `close_pool` still requires `paused`, `reward_duration_end > 0`, a current time after `reward_duration_end`, `user_stake_count == 0`, and an empty staking vault. The authority signs. Remaining reward vault balances go to the refundee token accounts, and the vaults and pool account are closed.

### Deprecated

* `initialize_pool`, `create_user`, `deposit`, `fund`, `authorize_funder`, `deauthorize_funder`, `toggle_permission`, `unpause`, and `migrate_farming_rate` always fail with `Deprecated` (6012). Their accounts and instruction data are unchanged.
* `migrate_farming_rate` is unused. `Pool::get_reward_a_rate` and `Pool::get_reward_b_rate` return `reward_*_rate_u128`, or `_reward_*_rate` when the u128 rate is zero.

> [!WARNING]
>
> Stop creating farms. Do not fund a farming pool, and do not stake LP into one.

## TypeScript SDK: `@meteora-ag/farming-sdk` `1.1.0`

[SDK PR #3](https://github.com/MeteoraAg/reward-pool-internal/pull/3)

> [!TIP]
>
> `@meteora-ag/farming-sdk@1.1.0` is the version in PR #3. It is not on npm yet. npm still publishes [`@meteora-ag/farming-sdk@1.0.18`](https://www.npmjs.com/package/@meteora-ag/farming-sdk).

### Added

* `closeUser`. Closes the user account and returns its rent to the owner. The program allows it once nothing is staked and no reward is pending.
* Re-exports the farming IDL and constants from the package entrypoint.

### Deprecated

* `deposit`. The method still builds a transaction. The program rejects `deposit`, and `create_user` when the user account is missing, with `Deprecated` (6012). Exit with `withdraw`, `claim`, and `closeUser`.

### Changed

* The exit is one transaction: `withdraw` the full balance when it is above zero, then `claim` when there is a reward or a stake was withdrawn, then `closeUser`. When the staking mint is also a reward mint, `withdraw` and `claim` can both create that token account. Keep one of those create instructions.
* `getUserBalance` throws when the wallet has no user account in the farm.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.