Kamino 백서

Kamino

원문

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

e vault allocates capital. | Rewards are calculated for each depositor based on their vault position and the vault's allocation to that reserve. Depositors claim them separately. | No | | **Autocompound Farm** | Rewards supplied in the vault's deposit asset. | Rewards are reinvested and increase the value of vault shares. | Yes, indirectly. Reinvested rewards increase the vault's assets under management, which can increase AUM fee revenue and may also contribute to performance fees. | <div> <p><Icon icon="circle-check" /> Knowledge Check</p> A curator should be able to: * Identify which vault fees generate curator revenue and where the other fees go. * Distinguish which farm rewards depositors can claim directly. </div> <CardGroup> <Card title="Yield & fees" icon="coins" href="/docs/curators/vaults/concepts/yield-and-fees"> Performance fees, AUM fees, and reward mechanics. </Card> <Card title="Configure farms" icon="tractor" href="/docs/curators/vaults/guides/configure-farms"> Set up Vault Farms, Reserve farms, and Autocompound Farms. </Card> </CardGroup> *** ## Depositor Protections Before launch, the curator decides which depositor protections are appropriate for the vault. An **Insurance Pool** provides an added layer of coverage, while **Whitelisted Reserves** keeps allocations within a set approved by Kamino. ### Insurance Pool An Insurance Pool is capital the curator deposits into a dedicated pool attached to the vault. That capital continues earning the vault's APY while it remains locked. Kamino matches the curator's contribution up to \$250,000. A \$200,000 contribution therefore creates a \$400,000 Insurance Pool, while amounts above \$250,000 receive no additional match. If the vault incurs a loss, the Insurance Pool is used to compensate depositors before the remaining loss reaches them. Coverage is limited to the pool's balance, and compensation is coordinated manually with Kamino. Withdrawing curator capital requires a 30-day cooldown. An emergency withdrawal can bypass the cooldown, but it requires approval from both the curator and Kamino's Security Council and is reserved for compensating depositors after a loss. ### Whitelisted Reserves Whitelisted Reserves limits the vault to reserves verified by Kamino. The curator decides whether to enforce the whitelist but does not decide which reserves it contains. Before enabling it, the curator should confirm that the vault's planned allocations are included in the approved set. The protection uses two settings. One prevents the curator from creating or increasing allocations outside the whitelist. The other prevents depositor funds from entering those reserves. Both settings form part of the requirements for appearing on Kamino's interface, and neither can be disabled afterward. The whitelist does not prevent withdrawals. Existing allocations can still be reduced or removed, and depositors can withdraw when liquidity is available. ### Comparing Vault Safeguards | If the curator's priority is... | Safeguard to consider | What this requires | | - | - | - | | Providing capital-backed coverage if the vault suffers a loss | Insurance Pool | Curator capital remains locked, earns the vault APY, and is used to compensate depositors after a loss. | | Preventing the vault from entering reserves outside Kamino's approved set | Whitelisted Reserves | The allocation strategy is limited to reserves Kamino has approved. | | Preserving access to reserves outside the approved set | Insurance Pool without Whitelisted Reserves | The vault retains broader allocation flexibility but does not meet the safeguard requirements for Kamino interface listing. | | Restricting reserve access without committing curator capital | Whitelisted Reserves without an Insurance Pool | Allocations are restricted, but depositors do not receive capital-backed loss coverage and the vault does not meet the safeguard requirements for Kamino interface listing. | | Meeting the safeguard requirements for Kamino interface listing | Both safeguards | Curator capital is committed and allocations remain within the approved reserve set. Multisig ownership is also required. | <div> <p>Worth checking</p> * How much curator capital can be committed to an Insurance Pool and remain subject to the 30-day withdrawal restriction. * Whether the planned allocation strategy can operate within Kamino's approved reserve set. </div> <CardGroup> <Card title="Insurance Pool" icon="shield-halved" href="/docs/curators/vaults/guides/set-up-insurance-pool"> Fund the pool, understand cooldowns, and coordinate payouts. </Card> <Card title="Whitelisted Reserves" icon="list-check" href="/docs/curators/vaults/guides/enable-whitelisted-reserves"> Enable the whitelist and confirm eligible reserves. </Card> </CardGroup> *** ## Vault Roles and Permissions Before launch, the curator decides who will manage the vault and which responsibilities can be delegated. These choices determine who can change the vault's configuration once it begins operating. ### Assigning Vault Roles A vault separates full administrative authority from routine allocation management. The curator decides which actions should remain with the primary admin and which can be delegated to another wallet or automated service. The **Vault Admin** can change the vault's settings, add or remove reserves, update allocations, and set fees. The **Allocation Admin** can adjust the weights, caps, types, and priorities of existing allocations, but cannot add reserves or change the vault's broader configuration. This allows routine allocation changes without granting full authority over the vault. The **Farm Authority** manages the vault farm during its creation. Once the farm is created, this authority transfers to the protocol and is no longer managed by the curator. ### Planning Multisig Ownership For a production vault, the Vault Admin is transferred to a Squads multisig before deposits open. The curator decides who will hold signing authority and how many approvals will be required to change the vault. Once the multisig becomes Vault Admin, changes are submitted as proposals and executed only after the approval threshold is met. This prevents a single wallet from changing the vault and makes administrative decisions visible to the other signers. Multisig ownership is also required for a vault to appear on Kamino's interface. ### Authority by Action | Action | Authority | | - | - | | Change vault settings or fees | Vault Admin | | Add or remove a reserve | Vault Admin | | Update an existing allocation | Vault Admin or Allocation Admin | | Transfer administrative authority | Vault Admin | | Manage the vault farm during creation | Farm Authority | <div> <p><Icon icon="circle-check" /> Knowledge Check</p> A curator should be able to: * Understand which allocation changes can be delegated without granting full administrative authority. * Understand why administrative authority is transferred to a multisig before launch. </div> <CardGroup> <Card title="Roles & ownership" icon="users" href="/docs/curators/vaults/concepts/roles-and-ownership"> Vault Admin, Allocation Admin, and Farm Authority. </Card> <Card title="Transfer admin" icon="key" href="/docs/curators/vaults/guides/transfer-admin"> Move ownership from a hot wallet to Squads. </Card> </CardGroup> *** ## Ongoing Vault Management Once the vault is live, the curator should watch for conditions that suggest its allocation strategy or withdrawal settings need to change. ### Adjusting the Vault | Issue | What is happening | Response | | - | - | - | | Capital remains far from its target allocations | To restore the target, the crank must withdraw capital from an overallocated reserve and move it into an underallocated reserve. It may be unable to complete that move if borrowers are using the capital in the first reserve or the second allocation has reached its cap. | Check the available liquidity in the first reserve and the cap on the second allocation. Revise the target or cap if the current configuration cannot be reached. **Vault Admin or Allocation Admin.** | | The withdrawal buffer is repeatedly exhausted | Depositors are withdrawing capital faster than the buffer is being replenished. The vault must draw from its reserve allocations, and withdrawals may be queued if that capital is unavailable. | Increase the UnallocatedWeight or UnallocatedTokensCap so more capital remains available. **Vault Admin.** | | An allocation is earning less than expected | Borrowing demand in that reserve may have fallen, reducing the interest earned by the vault. | Reduce its target weight and direct capital toward another suitable reserve. **Vault Admin or Allocation Admin.** | | A reserve has limited available liquidity | Most of the reserve's capital is already being used by borrowers. The vault may be unable to withdraw its allocation immediately. | Reduce the allocation weight or cap to limit further exposure. **Vault Admin or Allocation Admin.** | | An allocation reaches its cap as the vault grows | The reserve cannot receive more of the vault's capital, even if its target weight assigns it a larger amount. Additional capital must remain available or move to another eligible allocation. | Increase the cap if the reserve can support more exposure. Otherwise, direct additional capital elsewhere. **Vault Admin or Allocation Admin.** | ### Responding to Events | Issue | What is happening | Response | | - | - | - | | A reserve shows signs of a security issue | The vault may still be directing depositor capital into a reserve that is no longer considered suitable. Any loss in that reserve can reduce the value of the vault's holdings. | Set the allocation cap to zero to stop additional capital from entering; for a Standard allocation, its weight can also be set to zero. Remove the allocation once available capital has been withdrawn. **Vault Admin or Allocation Admin** can stop further allocation. Only the **Vault Admin** can remove the reserve. | | A reserve loss reduces the vault's assets | The vault's claim on that reserve is now worth less. This reduces the value of vault shares and may leave depositors with a loss. | Stop further allocation, assess the loss with Kamino, then use the Insurance Pool to compensate affected depositors. **Vault Admin or Allocation Admin** stops further allocation. Releasing Insurance Pool funds immediately requires the curator's designated signer and **Kamino's Security Council**. | | An unexpected allocation change appears | An Allocation Admin wallet or automated service may have changed a weight, cap, type, or priority without approval. It cannot add a new reserve or change other vault settings. | Replace or revoke the Allocation Admin, restore the intended configuration, then sync the vault toward its targets. **Vault Admin.** | | An unfamiliar Vault Admin proposal appears in Squads | A multisig signer may be compromised or someone may be attempting an unauthorized vault change. The proposal cannot execute unless it receives the required approvals. | Do not approve the proposal. Review its source and remove any compromised signer before another vault change is submitted. **Squads multisig members.** | Vaults do not have the same Emergency Council used by lending markets. Their response model relies on delegated allocation authority, the Vault Admin multisig, and the Insurance Pool's separate two-party withdrawal authority. <div> <p><Icon icon="circle-check" /> Knowledge Check</p> A curator should be able to: * Identify when allocation settings or the withdrawal buffer need to change as vault conditions evolve. * Understand which authority can make each adjustment or respond to an unexpected event. </div> *** ## Pre-launch Checklist ### Vault Strategy * [ ] The vault asset and eligible reserves have been selected. * [ ] Each allocation is designated as Standard or Conditional. * [ ] Target weights, allocation caps, and priorities have been set. ### Withdrawals and Revenue * [ ] The unallocated buffer has been sized for expected withdrawal activity. * [ ] Performance and AUM fees have been set. * [ ] Any Vault Farms or Autocompound Farms have been planned. ### Safeguards and Authority * [ ] The Insurance Pool commitment has been decided. * [ ] The planned allocations are compatible with Whitelisted Reserves. * [ ] Vault Admin will be transferred to the intended multisig. * [ ] Allocation Admin responsibilities have been assigned. ### Ongoing Management * [ ] The conditions that would require allocation or buffer changes have been defined. * [ ] The authority responsible for each change has been confirmed. * [ ] The response to a reserve loss or unexpected administrative change has been reviewed. # Earn Deposit with the API Source: https://kamino.com/docs/build/earn/recipes/earn-via-api The API generates the unsigned transaction, and the client signs it securely ## Earn Deposit with API <Steps> <Step> ### Import Dependencies Import the required packages for Solana RPC communication, transaction handling, and Kamino SDK utilities. ```typescript theme={null} import { createSolanaRpc, createSolanaRpcSubscriptions, pipe, getTransactionDecoder, getCompiledTransactionMessageDecoder, decompileTransactionMessageFetchingLookupTables, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash, addSignersToTransactionMessage, signTransactionMessageWithSigners, sendAndConfirmTransactionFactory, getSignatureFromTransaction, } from '@solana/kit'; import { parseKeypairFile } from '@kamino-finance/klend-sdk/dist/utils/signer.js'; ``` </Step> <Step> ### Configure and Initialize Set up the configuration and initialize RPC connections. ```typescript theme={null} const KEYPAIR_FILE = '/path/to/your/keypair.json'; const API_BASE_URL = 'https://api.kamino.finance'; const signer = await parseKeypairFile(KEYPAIR_FILE); const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com'); const rpcSubscriptions = createSolanaRpcSubscriptions('wss://api.mainnet-beta.solana.com'); ``` </Step> <Step> ### Call Kamino API Make a POST request to the Kamino API to build the deposit transaction. ```typescript theme={null} const response = await fetch(`${API_BASE_URL}/ktx/kvault/deposit`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ wallet: signer.address, kvault: 'HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E', amount: '1.0', }), }); if (!response.ok) { const error = await response.json(); throw new Error(`API error: ${error.message}`); } const { transaction: encodedTransaction } = await response.json(); ``` <Info> The API returns a pre-built transaction encoded in base64 format. This transaction includes Address Lookup Tables (ALTs) for efficiency. </Info> </Step> <Step> ### Decode Transaction Decode the base64-encoded transaction and extract the message bytes. ```typescript theme={null} const txBuffer = Buffer.from(encodedTransaction, 'base64'); const txMessageBytes = getTransactionDecoder().decode(txBuffer).messageBytes; const compiledMessage = getCompiledTransactionMessageDecoder().decode(txMessageBytes); ``` </Step> <Step> ### Resolve Address Lookup Tables Fetch and resolve the Address Lookup Tables from the blockchain. ```typescript theme={null} const { value: latestBlockhash } = await rpc.getLatestBlockhash({ commitment: 'finalized' }).send(); const signedTransaction = await pipe( await decompileTransactionMessageFetchingLookupTables(compiledMessage, rpc), (tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx), (tx) => setTransactionMessageFeePayerSigner(signer, tx), (tx) => addSignersToTransactionMessage([signer], tx), (tx) => signTransactionMessageWithSigners(tx) ); ``` <Info> `decompileTransactionMessageFetchingLookupTables` fetches the lookup table data from the blockchain and resolves all address references. This is required for transactions that use ALTs. </Info> <Note> A fresh blockhash is fetched and set to ensure the transaction remains valid. </Note> </Step> <Step> ### Send and Confirm Transaction Submit the signed transaction to the Solana network. ```typescript theme={null} const signature = getSignatureFromTransaction(signedTransaction); console.log(`Sending transaction with signature: ${signature}`); await sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions })(signedTransaction, { commitment: 'confirmed', skipPreflight: true, }); console.log('Deposit successful! Signature:', signature); ``` <Check> Your deposit is complete! The API built the transaction, you signed it locally (keeping your keys secure), and it was successfully submitted to the network. </Check> </Step> </Steps> # Earn Withdraw with the API Source: https://kamino.com/docs/build/earn/recipes/earn-withdraw-via-api The API generates the unsigned transaction, and the client signs it securely ## Earn Withdraw with API <Steps> <Step> ### Import Dependencies Import the required packages for Solana RPC communication, transaction handling, and Kamino SDK utilities. ```typescript theme={null} import { createSolanaRpc, createSolanaRpcSubscriptions, pipe, getTransactionDecoder, getCompiledTransactionMessageDecoder, decompileTransactionMessageFetchingLookupTables, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash, addSignersToTransactionMessage, signTransactionMessageWithSigners, sendAndConfirmTransactionFactory, getSignatureFromTransaction, } from '@solana/kit'; import { parseKeypairFile } from '@kamino-finance/klend-sdk/dist/utils/signer.js'; ``` </Step> <Step> ### Configure and Initialize Set up the configuration and initialize RPC connections. ```typescript theme={null} const KEYPAIR_FILE = '/path/to/your/keypair.json'; const API_BASE_URL = 'https://api.kamino.finance'; const signer = await parseKeypairFile(KEYPAIR_FILE); const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com'); const rpcSubscriptions = createSolanaRpcSubscriptions('wss://api.mainnet-beta.solana.com'); ``` </Step> <Step> ### Call Kamino API Make a POST request to the Kamino API to build the withdrawal transaction. ```typescript theme={null} const response = await fetch(`${API_BASE_URL}/ktx/kvault/withdraw`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ wallet: signer.address, kvault: 'HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E', amount: '1.0', }), }); if (!response.ok) { const error = await response.json(); throw new Error(`API error: ${error.message}`); } const { transaction: encodedTransaction } = await response.json(); ``` <Info> The API returns a pre-built transaction encoded in base64 format. This transaction includes Address Lookup Tables (ALTs) for efficiency. </Info> </Step> <Step> ### Decode Transaction Decode the base64-encoded transaction and extract the message bytes. ```typescript theme={null} const txBuffer = Buffer.from(encodedTransaction, 'base64'); const txMessageBytes = getTransactionDecoder().decode(txBuffer).messageBytes; const compiledMessage = getCompiledTransactionMessageDecoder().decode(txMessageBytes); ``` </Step> <Step> ### Resolve Address Lookup Tables Fetch and resolve the Address Lookup Tables from the blockchain. ```typescript theme={null} const { value: latestBlockhash } = await rpc.getLatestBlockhash({ commitment: 'finalized' }).send(); const signedTransaction = await pipe( await decompileTransactionMessageFetchingLookupTables(compiledMessage, rpc), (tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx), (tx) => setTransactionMessageFeePayerSigner(signer, tx), (tx) => addSignersToTransactionMessage([signer], tx), (tx) => signTransactionMessageWithSigners(tx)
프로젝트로 돌아가기