Collateral Check Params

Optimize gas and set minimum health factor for collateral checks.

For Solidity implementation, see Setting Collateral Check Params.

Why

You set collateral check params when:

  • Optimizing gas - Hint which tokens cover the debt to skip unnecessary oracle calls

  • Risk management - Enforce a minimum health factor above 1.0

  • Large accounts - Many enabled tokens make default checks expensive

  • Automated systems - Bots can benefit from consistent gas costs

The collateral check iterates through enabled tokens, summing value until it exceeds debt. Hints tell it which tokens to check first, potentially skipping expensive oracle calls.

What

setFullCheckParams configures two things:

  1. Collateral hints - Token masks to prioritize during the check

  2. Min health factor - Minimum acceptable HF (in basis points, 10000 = 1.0)

If you know your USDC and WETH cover the debt, pass their masks as hints. The check evaluates them first and may stop early without checking other tokens.

How

Basic Usage with Hints

Setting Higher Min Health Factor

Require account to maintain at least 1.2 HF:

Complete Example: Gas-Optimized Multicall

Gotchas

Masks, Not Addresses

The hints array takes token masks, not addresses:

Hints Are Optimization, Not Guarantee

The check still validates ALL enabled tokens - hints just change the order. If hints don't cover the debt, it continues with remaining tokens.

Min Health Factor Must Be >= 10000

You cannot set a health factor below 1.0:

Hints Don't Help Small Accounts

For accounts with few enabled tokens (< 5), hints add gas overhead without saving much. Only use for accounts with many tokens.

Order Matters in Hints Array

Tokens are checked in the order you provide:

Put your highest-value collateral first for best gas savings.

Each Check Calls Oracle Once

Without hints, the check iterates through all enabled tokens by mask order until TWV >= debt. With hints:

  1. Check hinted tokens first

  2. If TWV >= debt, stop early

  3. If not, continue with remaining tokens

Best case: hints cover debt, skip other oracle calls. Worst case: hints don't help, all tokens checked anyway.

Params Reset After Multicall

setFullCheckParams only affects the current multicall's final check. Next multicall uses defaults again.

Computing Token Masks

Token masks are powers of 2, assigned sequentially when tokens are added to the Credit Manager:

Can Combine with Other Params

Use hints for gas optimization AND min HF for risk management:

See Also

Last updated