> For the complete documentation index, see [llms.txt](https://docs.kiln.fi/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kiln.fi/v1/kiln-products/defi/smart-contract-interaction.md).

# Smart Contract interaction

Interacting with Kiln DeFi without access to Kiln Connect API or User Facing applications.

**We DO NOT recommend you proceed with this path unless you are an experienced user and have an urgent need to access the funds.**

**Please be aware of scam, if you are not sure about something, ask** [Support](/v1/working-with-kiln/support.md)**, or wait for your prefered UI to be back online.**

**Note: If you are trying to interact with the contract via a Ledger device, Ledger Live does not work currently. We would recommend you connect it with a trusted browser wallet extension, for example Rabby Wallet or Trust Wallet.  See** [**here**](https://support.ledger.com/article/4409801559569-zd) **for more info.**&#x20;

### View your position via Etherscan

1. Open your wallet address on Etherscan:
   1. eg. <https://etherscan.io/address/0x2eec5d4dcbb5c15a7924b54e6cb516a6bb0a1c3f>
2. Click on token holdings and over the ERC-20 to see names related to your preferred application, it will open the holder history filtered on your wallet, where you can find all transaction you did for this defi product.

   <figure><img src="https://1911902555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnye3yqpuOzdfrtWAlwng%2Fuploads%2F83nyJ4cGTRbDAuxpSbQP%2Fimage.png?alt=media&amp;token=c9057bf3-54b0-4bf1-9b98-b4a3c7fdfa03" alt="" width="375"><figcaption></figcaption></figure>

   1. You can already see here the amount you hold, here&#x20;
      1. 3136.22 `cwAaveUSDT`
3. On the transaction page, over the Interacted With (To) address and click on it.

   1. Eg. <https://etherscan.io/address/0x924e38bdfda04990fc78fec258e8b83b3478b1af#code>
   2.

   ```
   <figure><img src="/files/G2tdtAEdtpiAsfaJCH4K" alt=""><figcaption></figcaption></figure>
   ```
4. On the deposit contract page, navigate to the `Contract` tab and sub tab  `Read as Proxy` , find `31. maxRedeem (0xd905777e)`&#x20;
   1. Input your wallet address, and click **query.**

   2. eg. for `0x2eEC5D4dcBB5C15A7924b54E6CB516A6BB0A1C3F`  it returns: <mark style="color:purple;">`3136221376`</mark> it's the amount in USDT your principal + rewards is worth.&#x20;

   3. To see this amount in a human readable format, read the `19. decimals (0x313ce567)` function on the same page.&#x20;
      1. eg. for this defi position I receive <mark style="color:orange;">`6`</mark>` ``decimals`&#x20;
      2. You can then multiply the maxRedeem value  <mark style="color:purple;">`3136221376`</mark> to 1e-`decimals` , so here <mark style="color:purple;">`3136221376`</mark><mark style="color:$primary;">`*1e-`</mark><mark style="color:orange;">`6`</mark> <mark style="color:orange;"></mark><mark style="color:orange;">=</mark> `3 136,221376`

   4. To confirm the asset read the `11. asset (0x38d52e0f)` function on the same page, and click on the asset address, you will see the asset deposited in this defi position here. <mark style="color:$success;">`USDT`</mark>.
      1\.

      ```
      <figure><img src="/files/3KniWBBOlPbGnSDOHLfG" alt=""><figcaption></figcaption></figure>
      ```

   5. Doing so I can confirm that I own and can redeem anytime  `3 136,221376 USDT`&#x20;

### Withdraw all assets deposited aka Redeem via Etherscan

*Requirement, connnect you wallet to a browser wallet or use Wallet Connect to connect to Etherscan.*&#x20;

In this example we show how you can **withdraw all your asset from your position** in Etherscan.&#x20;

1. Find the defi position deposit contract (see [#view-your-position-via-etherscan](#view-your-position-via-etherscan "mention"))
   1. eg. <https://etherscan.io/address/0x924e38bdfda04990fc78fec258e8b83b3478b1af#code>
2. On the deposit contract page, navigate to the `Contract` tab and sub tab  `Read as Proxy` , find `12.balanceOf 0x70a08231)`&#x20;
   1. Past your wallet address and click **query**.
   2. eg. for `0x2eEC5D4dcBB5C15A7924b54E6CB516A6BB0A1C3F` , it's `3136221376` , this is the amount of shared you own, it's representing your principal + all rewards.
3. On the deposit contract page, navigate to the `Contract` tab and sub tab  `Write as Proxy` , find `16.redeem (0xba087652)`&#x20;
   1. &#x20;Input the value you got from the previous `balanceOf`  read on step 2, and your wallet for `receiver`  and `owner` . (Make sure you connect your wallet on top)
      1\.

      ```
      <figure><img src="/files/OnUE2RndtKTLb8alWJF8" alt=""><figcaption></figcaption></figure>
      ```
   2. You will be prompted in your wallet to sign the transaction.&#x20;

      <figure><img src="https://1911902555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnye3yqpuOzdfrtWAlwng%2Fuploads%2FbMauopPjkpO7oTgUwsRh%2Fimage.png?alt=media&amp;token=43b729c6-5cb5-4418-8db3-7967d030b517" alt="" width="375"><figcaption></figcaption></figure>
4. After signing this one transaction you will directly receive the assets directly in your wallet.&#x20;


---

# 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.kiln.fi/v1/kiln-products/defi/smart-contract-interaction.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.
