> For the complete documentation index, see [llms.txt](https://docs.idle.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.idle.finance/other/guides/deposit-funds-smart-contracts.md).

# Deposit funds through smart contracts

Other > Guides > Deposit funds through smart contracts

This tutorial will guide you in the process of depositing new funds into Idle directly from the smart contracts in case the website has limited access or is down.&#x20;

### **Before you start**

To ensure a smooth process be sure to have the following items ready:

* A supported EVM wallet (*Metamask*, *Coinbase wallet*,  Rabby)
* Underlying assets (DAI, USDC, USDT, WETH)
* Ether (ETH) to cover network fees (i.e. gas)

### A. Approve spending&#x20;

1. Visit the block explorer of the chain you want to deposit in (such as [Etherscan](https://etherscan.io/), [Polygonscan](https://polygonscan.com/), and [Optimistic Etherscan](https://optimistic.etherscan.io/))
2. On the block explorer, look for the token address you want to deposit. Always double-check the address with official token resources
3. Once found, visit the contract page, click on the *Contract* tab, and then on *Write Contract.* If you see the *Write as Proxy* option listed, use this one instead

<figure><img src="https://4022236167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lw-v0NTae0RVW1spR9R%2Fuploads%2Fr1FPNV75OBAc8RKrnaOJ%2FUSDC.png?alt=media&amp;token=9e9da380-eb72-4e4e-9a10-574420038e2b" alt=""><figcaption></figcaption></figure>

4. Click on *Connect to Web3* to connect your wallet
5. In the first method usually, you have the *Approve* function. You will need to input:
   * the *Spender*, i.e. the Idle's vault address (NB -  use the *CDO* address for [Yield Tranches](/developers/yield-tranches/deployed-contracts.md))
   * the *Value*, i.e. the amount you want to deposit unit converted. You can use [this tool](https://etherscan.io/unitconverter) to easily convert in multiple formats. Be careful in using the right amount of decimals for the token! NB - USDC and USDT have 6 decimals (10^6), DAI and WETH have 18 decimals (10^18)

<figure><img src="https://4022236167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lw-v0NTae0RVW1spR9R%2Fuploads%2F1RXxnONLbfObfiTBz8Wl%2FapproveSpending.png?alt=media&amp;token=8c465041-506f-49d8-8ec4-0b4a93c844a6" alt=""><figcaption></figcaption></figure>

6. Click on Write and execute your transaction

### B. Deposit

7. Visit the vaults' addresses of [Best Yield](/developers/best-yield/deployed-contracts.md) and [Yield Tranches](/developers/yield-tranches/deployed-contracts.md) and select the one you want to deposit to. For YTs, you need to always use the contract tagged as *CDO*
8. Follow the same steps above (3, 4) and then select the function [`mintIdleToken`](/developers/best-yield/methods/mintidletoken.md) for BY (in the `bool` parameter write `True`) or [`depositAA`](/developers/yield-tranches/methods/depositaa.md), [`depositBB`](/developers/yield-tranches/methods/depositbb.md) for YTs (where AA stands for Senior and BB for Junior)

<figure><img src="https://4022236167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lw-v0NTae0RVW1spR9R%2Fuploads%2FfJKYfYq3k7a4dLbqvKyO%2FmintIdleToken.png?alt=media&amp;token=fe294a22-31d5-41da-9bfd-c4cab7c2836b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4022236167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lw-v0NTae0RVW1spR9R%2Fuploads%2FjUGIBcWc90xGea1qbEc5%2FdepositAA-BB.png?alt=media&amp;token=bc61ab3e-381a-4375-b302-5f746565d3b9" alt=""><figcaption></figcaption></figure>

9. Input the amount you want to deposit, unit converted. Same as the point 5 above.&#x20;
10. Click on *Write* and execute your Tx. If successful, you will see an outflow of the token selected and an inflow of the Idle's vault LP tokens.&#x20;

{% hint style="info" %}
The same process can be done through a multisig, i.e. a smart contract, by building the Tx using the *Transaction Builder* app. Safe fetches automatically the proper ABI of the contract.&#x20;
{% endhint %}

Need further help? Check our [guides](/other/guides.md) list or get in contact on [Discord](https://discord.com/invite/mpySAJp).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.idle.finance/other/guides/deposit-funds-smart-contracts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
