Method Signature
Description
Calculates the optimal allocation of capital across DeFi lending protocols to maximize APR while respecting constraints.Parameters
Chain to optimize for (Base or Arbitrum).
Total capital to allocate (bigint as string, in token’s smallest unit).
Token to optimize (e.g., USDC address).
Current distribution across protocols.
Protocols to consider.
Optional constraints to apply during optimization.Available constraint types:
| Kind | Required Params | Description |
|---|---|---|
MIN_PROTOCOLS | min_protocols (int) | Minimum number of protocols to use |
MAX_AMOUNT_PER_PROTOCOL | protocol (string), max_ratio (0-1) | Cap a specific protocol at a percentage of total |
MAX_ALLOCATION_AMOUNT_PER_PROTOCOL | protocol (string), max_amount (int) | Cap a specific protocol at an absolute amount |
MIN_AMOUNT | min_amount (int) | Minimum amount for any used protocol |
MIN_ALLOCATION_AMOUNT_PER_PROTOCOL | protocol (string), min_amount (int) | Minimum amount for a specific protocol |
EXCLUDE_PROTOCOL | protocol (string) | Exclude a protocol entirely |
Optional wallet address that will execute the transactions.
Return Value
Optimal allocations, APR improvement, and gas costs.
Step-by-step rebalancing actions.
Execution-ready transaction data.