Account Operations
A reference of all operations available on credit accounts. Each operation can be included as a call within a multicall.
Quick Reference
| Operation | SDK Helper | When to Use | Guide |
|---|---|---|---|
| Add Collateral | prepareAddCollateral() | Deposit tokens to increase health factor | Adding Collateral |
| Increase Debt | prepareIncreaseDebt() | Borrow from pool | Debt Management |
| Decrease Debt | prepareDecreaseDebt() | Repay borrowed funds | Debt Management |
| Update Quota | prepareUpdateQuota() | Enable/adjust quota token exposure | Updating Quotas |
| Withdraw Collateral | prepareWithdrawCollateral() | Remove tokens from account | Withdrawing Collateral |
| Slippage Control | Manual encoding | Protect swaps from sandwich attacks | Slippage & Safety |
| External Calls | Manual encoding | Interact with Uniswap, Curve, etc. | External Calls |
| Enable/Disable Token | Manual encoding | Explicit collateral management | Token Management |
| Price Updates | Manual encoding | Update Pyth/Redstone feeds | Slippage & Safety |
| Check Params | Manual encoding | Optimize gas, set min health factor | Slippage & Safety |
| Revoke Allowances | Manual encoding | Security measure after suspicious activity | Token Management |
SDK Helpers vs Manual Encoding
Five operations have SDK helpers via createCreditAccountService:
prepareAddCollateral(token, amount)prepareIncreaseDebt(amount)prepareDecreaseDebt(amount)prepareUpdateQuota(token, change, minQuota)prepareWithdrawCollateral(token, amount, to)
Six operations require manual encoding with viem's encodeFunctionData:
storeExpectedBalances/compareBalancesenableToken/disableTokenonDemandPriceUpdatesetFullCheckParamsrevokeAdapterAllowances
All manual encoding uses iCreditFacadeV300MulticallAbi from @gearbox-protocol/sdk.
Page Structure
Each operation guide covers:
- Why - When you need this operation
- What - What it does and how it fits the system
- How - Working TypeScript code
- Gotchas - Common mistakes and edge cases
Learn More
- Multicalls - How to build and execute multicalls
- Credit Accounts - Account data and services