> For the complete documentation index, see [llms.txt](https://docs.atoma.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.atoma.fi/using-atoma/partner-program.md).

# Partner Program

Offer Atoma vaults inside your own app and receive a share of the fees on the deposits you bring. A deposit made through your integration carries your referral code on-chain, so attribution does not depend on the Atoma website.

## What a partner receives

* **Attribution.** A wallet whose first deposit comes through your integration is recorded as referred by you. A wallet has one referrer, set once and never changed.
* **Revenue share.** A share of the performance fee charged on the deposits you referred, agreed per partner and paid monthly in USDC on Arbitrum.
* **Referral tiers.** Referred deposits count toward your referral tier and boosts in the same way as any referral. See [Referrals](https://docs.atoma.fi/using-atoma/referrals.md).

## Setup

{% stepper %}
{% step %}

#### Create a code

Open Referrals at [app.atoma.fi](https://app.atoma.fi) with the wallet that will receive payouts and choose a code: 4 to 12 letters and digits. A code is set once and cannot be changed.
{% endstep %}

{% step %}

#### Agree the terms

Send your code and payout wallet to <support@atoma.fi>. The revenue share and the payout schedule are agreed in writing before the first payout.
{% endstep %}

{% step %}

#### Integrate deposits

Replace the `deposit` call in your app with `depositWithReferral` and pass your code. Everything else stays the same.
{% endstep %}
{% endstepper %}

## Integration

Approve USDC to the vault contract, then call:

```solidity
function depositWithReferral(uint256 assets, address receiver, bytes32 code) external returns (uint256 shares);
```

| Parameter  | Value                                                                   |
| ---------- | ----------------------------------------------------------------------- |
| `assets`   | USDC amount with 6 decimals. Minimum 100 USDC.                          |
| `receiver` | The depositor's wallet. Shares are minted to it.                        |
| `code`     | Your referral code as ASCII bytes, right-padded with zeros to 32 bytes. |

Encoding the code `PARTNER`:

| Tool      | Expression                               | Result                                                               |
| --------- | ---------------------------------------- | -------------------------------------------------------------------- |
| ethers v6 | `ethers.encodeBytes32String("PARTNER")`  | `0x504152544e455200000000000000000000000000000000000000000000000000` |
| viem      | `stringToHex("PARTNER", { size: 32 })`   | same                                                                 |
| Foundry   | `cast --format-bytes32-string "PARTNER"` | same                                                                 |

| Contract                | Address                                                                                                                |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Atoma Index vault (AVS) | [`0xCC56410e1a136aF0eCEb7241c6aE394F4d8b581c`](https://arbiscan.io/address/0xCC56410e1a136aF0eCEb7241c6aE394F4d8b581c) |
| Atoma RWA vault (AVS2)  | [`0x1C788E14d8e5B446e3F71B5142e2edaBcAB36da1`](https://arbiscan.io/address/0x1C788E14d8e5B446e3F71B5142e2edaBcAB36da1) |
| USDC                    | [`0xaf88d065e77c8cC2239327C5EDb3A432268e5831`](https://arbiscan.io/address/0xaf88d065e77c8cC2239327C5EDb3A432268e5831) |

## How the call behaves

* The same rules as `deposit` apply: minimum 100 USDC, the deposit cap, and no deposits while the vault is paused.
* Shares are minted to `receiver` at the current share price.
* The contract emits `DepositReferred(receiver, code, sender)`, where `sender` is the address that made the call.
* If `receiver` already has a referrer, the deposit goes through and the code is ignored.
* A code that does not exist is ignored. A wallet cannot refer itself.
* Attribution is applied within a few minutes of the transaction and is visible on the depositor's Referrals page.

## Withdrawals

Depositors withdraw at [app.atoma.fi](https://app.atoma.fi), or your app calls `requestWithdrawal(shares)` and, after the epoch settles, `claimWithdrawal(epochId)`. Shares from a deposit can be queued for withdrawal from the next epoch. See [Withdrawals](https://docs.atoma.fi/using-atoma/withdrawals.md).

## Terms

Depositors who use your integration are bound by the Atoma [Terms of Service](https://docs.atoma.fi/legal/terms.md). Show them the Terms before their first deposit.
