$npx -y skills add basezh/agent-skills-on-base --skill fluidInteract with Fluid Protocol — lending (ERC-4626 fTokens) and vaults (T1/T2/T3/T4). Lending: deposit, withdraw, check positions, query APY rates. Vaults: deposit collateral, borrow, repay, manage leveraged positions. Discover contracts programmatically via on-chain resolvers. No
| 1 | # Fluid Protocol |
| 2 | |
| 3 | Fluid is a DeFi protocol by Instadapp offering lending and vault products. All data reads use on-chain resolver contracts — no API dependency, no keys required. |
| 4 | |
| 5 | **On-chain first:** Every read operation goes through resolver contracts deployed at the same address on all chains. |
| 6 | |
| 7 | ## Skill Files |
| 8 | |
| 9 | | File | URL | Status | |
| 10 | | ------------------------ | -------------------------------------------------------------------------------------------------------------------- | ------- | |
| 11 | | **SKILL.md** (this file) | `https://fluid.io/skill.md` | ✅ Live | |
| 12 | | **Deployments** | [deployments.md on GitHub](https://github.com/Instadapp/fluid-contracts-public/blob/main/deployments/deployments.md) | ✅ Live | |
| 13 | | **Integration Docs** | `https://fluid-integration-docs.vercel.app/` | ✅ Live | |
| 14 | |
| 15 | --- |
| 16 | |
| 17 | # Fluid: Lending Protocol |
| 18 | |
| 19 | --- |
| 20 | |
| 21 | ## How fTokens Work (ERC-4626) |
| 22 | |
| 23 | Fluid lending tokens (fUSDC, fWETH, etc.) follow the **ERC-4626 tokenized vault standard**. This is important to understand: |
| 24 | |
| 25 | **Shares are NOT 1:1 with underlying tokens.** When you deposit USDC, you receive fUSDC *shares*. The exchange rate between shares and assets increases over time as interest accrues. |
| 26 | |
| 27 | ``` |
| 28 | Day 0: deposit 1000 USDC → receive 1000 fUSDC shares (rate: 1.000) |
| 29 | Day 90: your 1000 fUSDC shares → now worth 1010 USDC (rate: 1.010) |
| 30 | ``` |
| 31 | |
| 32 | | Concept | Description | |
| 33 | | --- | --- | |
| 34 | | **Assets** | The underlying token (USDC, WETH, etc.) | |
| 35 | | **Shares** | The fToken balance you hold (fUSDC, fWETH, etc.) | |
| 36 | | **Exchange Rate** | Increases over time. `convertToAssets(shares)` gives current value. | |
| 37 | | `deposit(assets, receiver)` | Deposit underlying → receive shares. Amount is in *assets* (e.g., USDC). | |
| 38 | | `withdraw(assets, receiver, owner)` | Specify underlying amount to withdraw. Burns the required shares. | |
| 39 | | `redeem(shares, receiver, owner)` | Specify shares to burn. Receive the equivalent underlying. | |
| 40 | | `mint(shares, receiver)` | Specify exact shares you want. Deposit the required assets. | |
| 41 | |
| 42 | > **Common mistake:** Don't assume `shares == assets`. Always use `convertToAssets()` or `convertToShares()` to convert between them. The exchange rate at genesis is approximately 1:1 but diverges over time. |
| 43 | |
| 44 | ```javascript |
| 45 | // Check how much your shares are worth |
| 46 | const shares = await fUsdc.read.balanceOf([userAddress]); |
| 47 | const currentValue = await fUsdc.read.convertToAssets([shares]); |
| 48 | console.log(`${shares} fUSDC shares = ${formatUnits(currentValue, 6)} USDC`); |
| 49 | ``` |
| 50 | |
| 51 | --- |
| 52 | |
| 53 | ## Quick Start |
| 54 | |
| 55 | No registration or API keys needed. Just call the on-chain resolver. |
| 56 | |
| 57 | ### Step 1: Pick your chain and RPC |
| 58 | |
| 59 | | Network | Chain ID | LendingResolver Address | Public RPC | |
| 60 | | -------- | -------- | -------------------------------------------- | ------------------------------ | |
| 61 | | Ethereum | 1 | `0x48D32f49aFeAEC7AE66ad7B9264f446fc11a1569` | `https://eth.llamarpc.com` | |
| 62 | | Arbitrum | 42161 | `0x48D32f49aFeAEC7AE66ad7B9264f446fc11a1569` | `https://arb1.arbitrum.io/rpc` | |
| 63 | | Base | 8453 | `0x48D32f49aFeAEC7AE66ad7B9264f446fc11a1569` | `https://mainnet.base.org` | |
| 64 | | Polygon | 137 | `0x48D32f49aFeAEC7AE66ad7B9264f446fc11a1569` | `https://polygon-rpc.com` | |
| 65 | | Plasma | 9745 | `0x48D32f49aFeAEC7AE66ad7B9264f446fc11a1569` | `https://rpc.plasma.to` | |
| 66 | |
| 67 | > Same resolver address on all chains (CREATE2 deployment). Any RPC provider works (Alchemy, Infura, QuickNode, etc.). |
| 68 | |
| 69 | ### Step 2: Query fToken data |
| 70 | |
| 71 | ```bash |
| 72 | # Get all fToken addresses on the chain |
| 73 | cast call 0x48D32f49aFeAEC7AE66ad7B9264f446fc11a1569 \ |
| 74 | "getAllFTokens()(address[])" \ |
| 75 | --rpc-url https://eth.llamarpc.com |
| 76 | |
| 77 | # Get complete data for all fTokens (APY, TVL, rates) |
| 78 | cast call 0x48D32f49aFeAEC7AE66ad7B9264f446fc11a1569 \ |
| 79 | "getFTokensEntireData()" \ |
| 80 | --rpc-url https://eth.llamarpc.com |
| 81 | ``` |
| 82 | |
| 83 | ### Step 3: Check a user position |
| 84 | |
| 85 | ```bash |
| 86 | # Get user position for fUSDC |
| 87 | cast call 0x48D32f49aFeAEC7AE66ad7B9264f446fc11a1569 \ |
| 88 | "getUserPosition(address,address)" \ |
| 89 | 0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33 \ |
| 90 | 0xYOUR_ADDRESS \ |
| 91 | --rpc-url https://eth.llamarpc.com |
| 92 | |
| 93 | # Get all user positions across every fToken |
| 94 | cast call 0x48D32f49aFeAEC7AE66ad7B9264f446fc11a1569 \ |
| 95 | "getUserPositions(address)" \ |
| 96 | 0xYOUR_ADDRESS \ |
| 97 | --rpc-url https://eth.llamarpc.com |
| 98 | ``` |
| 99 | |
| 100 | ### Step 4: Deposit or withdraw |
| 101 | |
| 102 | ```bash |
| 103 | # Deposit 1000 USDC into fUSDC (requires prior ERC-20 approval) |
| 104 | cast send 0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33 \ |
| 105 | "deposit(uint256,address)" \ |
| 106 | 1000000000 0xYOUR_ADDRESS \ |
| 107 | --rpc-url https://eth.llamarpc.com \ |
| 108 | --private-key $PRIVATE_KEY |
| 109 | |
| 110 | # Withdraw 500 USDC from f |