Maple Finance 백서

Maple Finance

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 4쪽

f="https://sepolia.etherscan.io/address/0x7679CBe9aE66298114AC6dAC73487B63ac023c0b">0x7679CBe9aE66298114AC6dAC73487B63ac023c0b</a></td></tr><tr><td>SyrupRouter</td><td><a href="https://sepolia.etherscan.io/address/0x0B703919cF2d30DbB18bAD6feBe8F0eA4F191918">0x0B703919cF2d30DbB18bAD6feBe8F0eA4F191918</a></td></tr><tr><td>WithdrawalManagerQueue</td><td><a href="https://sepolia.etherscan.io/address/0xbBe2Bf30b76729a4eB75bf40ceD47A58000AE1D3">0xbBe2Bf30b76729a4eB75bf40ceD47A58000AE1D3</a></td></tr><tr><td>USDT</td><td><a href="https://sepolia.etherscan.io/address/0x658DAE0F3388892692A213494E1CbB04844Df0A3">0x658DAE0F3388892692A213494E1CbB04844Df0A3</a></td></tr></tbody></table> **syrupUSDG** <table><thead><tr><th width="234.72265625">Contract</th><th>Address</th></tr></thead><tbody><tr><td>PoolV2</td><td><a href="https://sepolia.etherscan.io/address/0x0f40d60293433a64bb8da7e4dfd9d13399ed319e">0x0f40d60293433a64bb8da7e4dfd9d13399ed319e</a></td></tr><tr><td>SyrupRouter</td><td><a href="https://sepolia.etherscan.io/address/0x1d090d34e0b64f9327c0a6b89741a5bd29c886b1">0x1d090d34e0b64f9327c0a6b89741a5bd29c886b1</a></td></tr><tr><td>WithdrawalManagerQueue</td><td><a href="https://sepolia.etherscan.io/address/0x1fd917c8c64070c151a163e16b10d2225781cc43">0x1fd917c8c64070c151a163e16b10d2225781cc43</a></td></tr><tr><td>USDG</td><td><a href="https://sepolia.etherscan.io/address/0x83a103743ee75e36d89d377603c06eee5f8ed1ab">0x83a103743ee75e36d89d377603c06eee5f8ed1ab</a></td></tr></tbody></table> **Shared (Global)** <table><thead><tr><th width="225">Contract</th><th>Address</th></tr></thead><tbody><tr><td>PoolPermissionManager</td><td><a href="https://sepolia.etherscan.io/address/0xd3BAaf866ccd5AF28b3caA2b4aC92E3FAaC8432B">0xd3BAaf866ccd5AF28b3caA2b4aC92E3FAaC8432B</a></td></tr></tbody></table> {% endtab %} {% endtabs %} ### 3. Testing on Sepolia Contact <partnerships@maple.finance> for test `USDC/USDT/USDG` and access. See the Sepolia tab above for addresses. *** ## Deposit ### 1. Determine Lender Authorization (onchain) Use `PoolPermissionManager` to verify lender authorization for a specific pool. You can derive the manager onchain from the Pool. {% code overflow="wrap" lineNumbers="true" expandable="true" %} ```solidity interface IPool { function manager() external view returns (address); } interface IPoolManager { function poolPermissionManager() external view returns (address); } interface IPoolPermissionManager { function hasPermission(address poolManager, address lender, bytes32 functionId) external view returns (bool); // Optional introspection helpers function lenderBitmaps(address lender) external view returns (uint256); function poolBitmaps(address poolManager, bytes32 functionId) external view returns (uint256); } function getPoolPermissionManager(address pool) internal view returns (address) { address manager = IPool(pool).manager(); return IPoolManager(manager).poolPermissionManager(); } function isAuthorizedToDeposit(address pool, address lender) internal view returns (bool) { address manager = IPool(pool).manager(); address ppm = IPoolManager(manager).poolPermissionManager(); return IPoolPermissionManager(ppm).hasPermission(manager, lender, "P:deposit"); } ``` {% endcode %} Onchain permission checks are equivalent to a bitmap AND comparison. A lender is authorized for a function if all required bits in the pool’s bitmap are present in the lender’s bitmap: * Condition: `(poolBitmap & lenderBitmap) == poolBitmap` Example (optional introspection, prefer `hasPermission` in production): {% code overflow="wrap" lineNumbers="true" expandable="true" %} ```solidity function isAuthorizedBitmaps(address pool, address lender) internal view returns (bool) { address manager = IPool(pool).manager(); address ppm = IPoolManager(manager).poolPermissionManager(); // Per-function pool bitmap for deposits uint256 poolBitmap = IPoolPermissionManager(ppm).poolBitmaps(manager, "P:deposit"); uint256 lenderBitmap = IPoolPermissionManager(ppm).lenderBitmaps(lender); return (poolBitmap & lenderBitmap) == poolBitmap; } ``` {% endcode %} Mainnet `PoolPermissionManager` (for reference): `0xBe10aDcE8B6E3E02Db384E7FaDA5395DD113D8b3` ### 2. Retrieve Authorization Signature If not authorized, contact <partnerships@maple.finance> to obtain: * `bitmap`, `deadline`, `v`, `r`, `s` * `depositData` - conventionally `"0:<integrator-name>"`, encoded as `bytes32`. Keep within 32 bytes when hex-encoded. ### 3. Execute the Deposit Minimal SC calls (lender must hold sufficient USDC/USDT): {% code overflow="wrap" lineNumbers="true" expandable="true" %} ```solidity interface IERC20 { function approve(address spender, uint256 amount) external returns (bool); } interface ISyrupRouter { function deposit(uint256 amount, bytes32 depositData) external returns (uint256 shares); function authorizeAndDeposit( uint256 bitmap, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amount, bytes32 depositData ) external returns (uint256 shares); } function depositAuthorized( address asset, address router, uint256 amount, bytes32 depositData ) external { IERC20(asset).approve(router, amount); ISyrupRouter(router).deposit(amount, depositData); } function authorizeAndDeposit( address asset, address router, uint256 amount, bytes32 depositData, uint256 bitmap, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external { IERC20(asset).approve(router, amount); ISyrupRouter(router).authorizeAndDeposit(bitmap, deadline, v, r, s, amount, depositData); } ``` {% endcode %} {% hint style="info" %} Deposit data * Replace `0:<integrator-name>` with your integrator identifier (e.g. `0:acme-protocol`). * Maple will provide the final `depositData` for production. * Must be passed as `bytes32` (32-byte hex). {% endhint %} *** ## Withdraw ### 1. Retrieve Lender’s Balance {% code overflow="wrap" lineNumbers="true" expandable="true" %} ```solidity interface IPool { function balanceOf(address account) external view returns (uint256); function convertToExitAssets(uint256 shares) external view returns (uint256); } function getLenderPosition(address pool, address lender) external view returns (uint256 shares, uint256 exitAssets) { shares = IPool(pool).balanceOf(lender); exitAssets = IPool(pool).convertToExitAssets(shares); } ``` {% endcode %} ### 2. Calculate Shares to Redeem Use full balance for full redemption, or compute shares for a specific asset amount. {% code overflow="wrap" lineNumbers="true" expandable="true" %} ```solidity interface IPool { function convertToExitShares(uint256 assets) external view returns (uint256); } function sharesForAssets(address pool, uint256 assetAmount) external view returns (uint256) { return IPool(pool).convertToExitShares(assetAmount); } ``` {% endcode %} ### 3. Execute the Withdrawal Submit a withdrawal request to the pool. {% code overflow="wrap" lineNumbers="true" %} ```solidity interface IPool { function requestRedeem(uint256 shares, address receiver) external returns (uint256); } function requestWithdrawal(address pool, uint256 shares, address receiver) external { IPool(pool).requestRedeem(shares, receiver); } ``` {% endcode %} Withdrawals are processed automatically by Maple. If there is sufficient liquidity in the pool, the withdrawal will be processed within a few minutes. Expected processing time is typically less than 2 days, but it can take up to 30 days depending on available liquidity. *** ## Edge Cases * Not authorized → use `authorizeAndDeposit` with signature * Insufficient allowance → call `approve(router, amount)` before depositing *** ## FAQ <details> <summary>Why must deposits go through SyrupRouter?</summary> Authorization and routing are enforced via \`SyrupRouter\` and \`PoolPermissionManager\`. This ensures only authorized lenders can deposit. </details> <details> <summary>What is depositData and who provides it?</summary> \`depositData\` is provided by Maple. It typically follows \`0:\` and your company name. It must be provided as a \`bytes32\` value (32-byte hex). </details> <details> <summary>How do I verify lender authorization onchain?</summary> Read `lenderBitmaps(lender)` and `poolBitmaps(pool)` in `PoolPermissionManager` and check `(lenderBitmap ^ poolBitmap) == poolBitmap`. </details> <details> <summary>Do I need authorization for smart contract integration?</summary> Yes, authorization is required for all Syrup deposits. Syrup protocol is built by Maple, which uses a permissioning system for institutional-grade security. **Authorization Process** 1. Contact us at <partnerships@maple.finance> for eligibility verification 2. Receive authorization signature parameters 3. Use `authorizeAndDeposit` or `authorizeAndDepositWithPermit` for first deposit 4. Subsequent deposits only need `deposit` or `depositWithPermit` Once authorized, the permission persists across all Syrup pools and future deposits. </details> <details> <summary>How do withdrawals work?</summary> Withdrawals follow a queue-based system: 1. **Request**: Call `requestRedeem()` to enter the withdrawal queue 2. **Queue Position**: Withdrawals are processed first-in, first-out (FIFO) 3. **Processing**: When pool liquidity is available, withdrawals are automatically processed 4. **Completion**: Assets are sent directly to the wallet (no additional transaction required) **Timeline** * Expected processing time is typically less than 2 days * During low liquidity periods, it may take up to 30 days * No penalties for withdrawing, but yield stops accumulating once withdrawal is requested </details> <details> <summary>How long do withdrawals take?</summary> syrupUSDC & syrupUSDT normally have instant liquidity, but in rare cases withdrawals can take around 24h with the maximum possible time being 30 days. You can see the available funds to withdraw in the Liquidity section of the [Details page](https://app.maple.finance/earn/details). </details> <details> <summary>How can I get the APY data for syrupUSDC or syrupUSDT?</summary> Querying the GraphQL API is the simplest way to get APY data for syrupUSDC or syrupUSDT into your app. **Example request** ``` { poolV2(id: "0x80ac24aa929eaf5013f6436cda2a7ba190f5cc0b") { name weeklyApy monthlyApy } syrupGlobals { dripsYieldBoost } } ``` **This returns** ``` { "data": { "poolV2": { "name": "Syrup USDC", "weeklyApy": "69937809610000000000000000000", "monthlyApy": "67212806350000000000000000000" }, "syrupGlobals": { "apy": "69731920498003078965054825961", "dripsYieldBoost": "0" } } } ``` You can get the APY % by using the fomula: `APY % = rawValue / 1e28` In the example above, the monthly base APY is 6.97%. Drips have been discontinued after Q4 2025 in favour of rewards distributed via Merkl for using partner products. You can discard `dripsYieldBoost` going forward. Read more: [Drips Rewards](/syrupusdc-usdt-usdg-for-lenders/drips-rewards) </details> <details> <summary>How can I get the price received on redemption for syrupUSDC or syrupUSDT?</summary> syrupUSDC and syrupUSDT are redeemed at the smart contract exchange rate at the point of processing the withdrawal, incurring no slippage. You can get the spot exchange rate for syrupUSDC to USDC or syrupUSDT to USDT by querying the GraphQL API. **Example request** ``` { account(id: "0xyourwallet") { poolV2Positions { pool { asset { symbol decimals } id name } lendingBalance totalShares } } } ``` **This returns** ``` { "data": { "account": { "poolV2Positions": [ { "pool": { "asset": { "symbol": "USDC", "decimals": 6 }, "id": "0x80ac24aa929eaf5013f6436cda2a7ba190f5cc0b", "name": "Syrup USDC" }, "lendingBalance": "3102053352414", "totalShares": "2742550894631" } ] } } } ``` The ratio of `lendingBalance` / `totalShares` is the spot exchange rate. </details> # Crosschain (Solana, L2s and others) <table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="image">Cover image</th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><p><strong>Asset Integration</strong></p><p>Access syrupUSDC &#x26; syrupUSDT across multiple blockchains. Find contract addresses, price oracles, and bridge contracts.</p></td><td></td><td><a href="https://2107472351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MLg9y0GYo0LxapRXEes%2Fuploads%2Fgit-blob-93dc6eb9e6f43223d00f6d4ca7d8556d3d899bc6%2FSyrupUSD_crosschain.png?alt=media">SyrupUSD_crosschain.png</a></td><td><a href="/integrate/crosschain/syrupusd-crosschain">Asset Integration: Crosschain</a></td></tr><tr><td><strong>syrupUSDC</strong> <strong>Mint/Redeem</strong></td><td>Enable syrupUSDC deposits and withdrawals in your app via CCIP on chains other than Ethereum. For wallets, apps, DEXes, custody solutions etc.</td><td><a href="https://2107472351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MLg9y0GYo0LxapRXEes%2Fuploads%2Fgit-blob-aa4aef509ad7485037e02a2d0d771c56f323cc7b%2FBackend_integration.png?alt=media">Backend_integration.png</a></td><td><a href="/integrate/crosschain/syrupusdc-native-mint-redeem">syrupUSDC Native Mint/Redeem</a></td></tr></tbody></table> # Asset Integration: Crosschain Access syrupUSDC, syrupUSDT and syrupUSDG across multiple blockchains using CCIP. Find contract addresses, oracles, and bridge contracts for Solana, Arbitrum, Base, Plasma etc. syrupUSDC, syrupUSDT and syrupUSDG use Chainlink Crosschain Interoperability Protocol (CCIP) to facilitate bridging and holding on chains other than Ethereum mainnet. CCIP handles secure crosschain token movement and message delivery, so you don’t need to build a custom bridge. Both tokens have 6 decimals across all chains. ## Mainnet Addresses ### syrupUSDC {% tabs %} {% tab title="Solana" %} <table><thead><tr><th width="229.61029052734375">Type</th><th>Address</th></tr></thead><tbody><tr><td>Token</td><td><a href="https://solscan.io/token/AvZZF1YaZDziPY2RCK4oJrRVrbN3mTD9NL24hPeaZeUj">AvZZF1YaZDziPY2RCK4oJrRVrbN3mTD9NL24hPeaZeUj</a></td></tr><tr><td>Pool</td><td><a href="https://solscan.io/account/HrTBpF3LqSxXnjnYdR4htnBLyMHNZ6eNaDZGPundvHbm">HrTBpF3LqSxXnjnYdR4htnBLyMHNZ6eNaDZGPundvHbm</a></td></tr><tr><td>Receiver (Mint/Redeem)</td><td><a href="https://etherscan.io/address/0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4">0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4</a></td></tr><tr><td>Price Feed (syrupUSDC/USDC)</td><td><a href="https://solscan.io/account/3TP6aEQ1VEt4VhwkpzccjVfvJUnvUDkziQ7pLFvZxir5">3TP6aEQ1VEt4VhwkpzccjVfvJUnvUDkziQ7pLFvZxir5</a></td></tr></tbody></table> {% endtab %} {% tab title="Arbitrum" %} <table><thead><tr><th width="230.1944580078125">Type</th><th>Address</th></tr></thead><tbody><tr><td>Token</td><td><a href="https://arbiscan.io/token/0x41ca7586cc1311807b4605fbb748a3b8862b42b5">0x41CA7586cC1311807B4605fBB748a3B8862b42b5</a></td></tr><tr><td>Pool</td><td><a href="https://arbiscan.io/address/0x660975730059246a68521a3e2fbd4740173100f5">0x660975730059246A68521a3e2FBD4740173100f5</a></td></tr><tr><td>Receiver (Mint/Redeem)</td><td><a href="https://etherscan.io/address/0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4">0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4</a></td></tr><tr><td>Price Feed (syrupUSDC/USDC)</td><td><a href="https://arbiscan.io/address/0xF8722c901675C4F2F7824E256B8A6477b2c105FB">0xF8722c901675C4F2F7824E256B8A6477b2c105FB</a></td></tr></tbody></table> {% endtab %} {% tab title="Base" %} <table><thead><tr><th width="230.497314453125">Type</th><th>Address</th></tr></thead><tbody><tr><td>Token</td><td><a href="https://basescan.org/token/0x660975730059246a68521a3e2fbd4740173100f5">0x660975730059246A68521a3e2FBD4740173100f5</a></td></tr><tr><td>Pool</td><td><a href="https://basescan.org/address/0xa36955b2bc12aee77ff7519482d16c7b86dbe42a">0xA36955b2Bc12Aee77FF7519482D16C7B86DBe42a</a></td></tr><tr><td>Receiver (Mint/Redeem)</td><td><a href="https://etherscan.io/address/0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4">0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4</a></td></tr><tr><td>Price Feed (syrupUSDC/USDC)</td><td><a href="https://basescan.org/address/0x311D3A3faA1d5939c681E33C2CDAc041FF388EB2">0x311D3A3faA1d5939c681E33C2CDAc041FF388EB2</a></td></tr></tbody></table> {% endtab %} {% tab title="Ink" %} <table><thead><tr><th width="229.8880615234375">Type</th><th>Address</th></tr></thead><tbody><tr><td>Token</td><td><a href="https://explorer.inkonchain.com/address/0x3c23e6FB09064e9A64829Fa8FEe27Ad19A27Bfa9">0x3c23e6FB09064e9A64829Fa8FEe27Ad19A27Bfa9</a></td></tr><tr><td>Pool</td><td><a href="https://explorer.inkonchain.com/address/0xa3361ff0d9cA1cBA31335a3280eECe47f1a08F43">0xa3361ff0d9cA1cBA31335a3280eECe47f1a08F43</a></td></tr><tr><td>Receiver (Mint/Redeem)</td><td><a href="https://etherscan.io/address/0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4">0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4</a></td></tr><tr><td>Price Feed (syrupUSDC/USDC)</td><td><a href="https://explorer.inkonchain.com/address/0x8B7CdBdE0109a838cb539FF40f4ca5C18b9ad7a7">0x8B7CdBdE0109a838cb539FF40f4ca5C18b9ad7a7</a></td></tr></tbody></table> {% endtab %} {% tab title="Monad" %} <table><thead><tr><th width="229.8880615234375">Type</th><th>Address</th></tr></thead><tbody><tr><td>Token</td><td><a href="https://monadscan.com/address/0xaB6e5a0C3799d020c790D34F7B2C02639e238AF7">0xaB6e5a0C3799d020c790D34F7B2C02639e238AF7</a></td></tr><tr><td>Pool</td><td><a href="https://monadscan.com/address/0x4eA35565147A7A6BfDAF7e605BDCdA4BD039A540">0x4eA35565147A7A6BfDAF7e605BDCdA4BD039A540</a></td></tr><tr><td>Receiver (Mint/Redeem)</td><td><a href="https://etherscan.io/address/0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4">0x02B6A75c5D1F430F0614dc5AC8aD5F9D35fbA2c4</a></td></tr><tr><td>Price Feed (syrupUSDC/USDC)</td><td><a href="https://monadscan.com/address/0xaeC21ef8f7aA33687c647BFEDaA8CD7F7855973F">0xaeC21ef8f7aA33687c647BFEDaA8CD7F7855973F</a></td></tr></tbody></table> {% endtab %} {% tab title="Tempo" %} <table><thead><tr><th width="229.57122802734375">Type</th><th>Address</th></tr></thead><tbody><tr><td>Token</td><td><a href="https://explore.tempo.xyz/address/0x20c0000000000000000000008191667423F70E67">0x20c0000000000000000000008191667423F70E67</a></td></tr><tr><td>Pool</td><td><a href="https://explore.tempo.xyz/address/0xEe71b1a542BeeDf2270437fDEaC190Bd9abBCB19">0xEe71b1a542BeeDf2270437fDEaC190Bd9abBCB19</a></td></tr><tr><td>Price Feed (syrupUSDC/USD)</td><td><a href="https://explore.tempo.xyz/address/0x14150E642cA7392e33bB5F0141c131c1e5Ac1D10">0x14150E642cA7392e33bB5F0141c131c1e5Ac1D10</a></td></tr></tbody></table> *Note: syrupUSDC on Tempo is a* [*TIP-20 token*](https://docs.tempo.xyz/protocol/tip20/overview)*. Bridging works the same via CCIP.* {% endtab %} {% tab title="Robinhood" %} <table><thead><tr><th width="229.8880615234375">Type</th><th>Address</th></tr></thead><tbody><tr><td>Token</td><td><a href="https://robinhoodchain.blockscout.com/address/0xC6a4854eeB493224d5f9485E12Dd3A81f22EEE14">0xC6a4854eeB493224d5f9485E12Dd3A81f22EEE14</a></td></tr><tr><td>Pool</td><td><a href="https://robinhoodchain.blockscout.com/address/0x50056397CF6ccF50D1748e95c32EC361951ee6F9">0x50056397CF6ccF50D1748e95c32EC361951ee6F9</a></td></tr><tr><td>Price Feed (syrupUSDC/USDC)</td><td><a href="https://robinhoodchain.blockscout.com/address/0x6317f016FA3e312C4625dee51d32b43a223011f8">0x6317f016FA3e312C4625dee51d32b43a223011f8</a></td></tr></tbody></table> {% endtab %} {% tab title="Arc" %} <table><thead><tr><th width="230.33941650390625">Type</th><th>Address</th></tr></thead><tbody><tr><td>Token</td><td><a href="https://explorer.arc.io/token/0x0dc6b79f3c3854e4d74514fd4d29be6c96beee39">0x0dC6b79F3c3854E4d74514fD4d29BE6c96Beee39</a></td></tr><tr><td>Pool</td><td><a href="https://explorer.arc.io/token/0x6be14E674f741faa78da2fEcF00870C8B753A0BB">0x6be14E674f741faa78da2fEcF00870C8B75
프로젝트로 돌아가기