Gearbox Protocol Core V3 provides onchain credit and composable leverage for DeFi protocols. The integration involves interacting with three main components:
Credit Facade - User-facing interface for account management and multicalls
Credit Manager - Core logic for debt, collateral, and account state
Price Oracle - Price feeds for collateral valuation
// Open new accountaddress creditAccount = facade.openCreditAccount( msg.sender, calls, 0 // referralCode);// Or execute on existing accountfacade.multicall(creditAccount, calls);
All operations perform collateral checks at the end of execution. Ensure your multicalls maintain sufficient health factor (at least 10000 bps = 100%).
Common revert reasons:
Insufficient collateral - Health factor below minimum after operations
Debt limits violated - Debt outside [minDebt, maxDebt] range
Forbidden tokens - Attempting to increase debt or withdraw with forbidden tokens enabled
Debt update in same block - Cannot update debt twice in the same block