Enabling/Disabling Tokens

Explicitly manage which tokens count as collateral.

For Solidity implementation, see Enabling and Disabling Tokens.

Why

You manually enable/disable tokens when:

  • Direct transfers - Tokens sent directly to Credit Account aren't auto-enabled

  • Gas optimization - Disable unused tokens to reduce collateral check cost

  • Risk management - Prevent certain tokens from counting in health factor

  • Edge cases - Override automatic enable/disable behavior

Most of the time you don't need this - tokens auto-enable/disable based on balance changes. But sometimes manual control is necessary.

What

Non-quoted tokens have automatic enable/disable behavior:

Balance Change
Action

0/1 to > 1

Auto-enable

> 1 to 0/1

Auto-disable

enableToken and disableToken let you override this when needed.

Important: These functions only work on non-quoted tokens. Quota tokens can only be enabled/disabled via updateQuota.

How

Enable a Token

Disable a Token

Enable Token After Direct Transfer

If someone sends tokens directly to your Credit Account:

Disable Unused Tokens to Save Gas

Each enabled token requires a price oracle call during collateral check. Disable tokens with zero balance:

Gotchas

No-Op for Quota Tokens

Calling enableToken or disableToken on a quota token does nothing:

Cannot Enable Forbidden Tokens

Some tokens are marked as "forbidden" and cannot be enabled:

Forbidden tokens must be swapped away, not disabled.

Auto-Enable Usually Works

Adapter calls and standard operations auto-enable tokens when balance increases:

You only need manual enable when:

  • Tokens are transferred directly to Credit Account (not via adapter)

  • You want to enable a zero-balance token preemptively

Max Enabled Tokens Limit

Each Credit Manager has a maximum number of enabled tokens per account. Exceeding this reverts the multicall:

Disabled Tokens Still on Account

Disabling a token doesn't remove it from the account - it just excludes it from health factor calculation. The balance remains:

Warning: Don't keep significant value in disabled tokens. During liquidation, liquidators can withdraw disabled tokens on top of their normal premium.

Balance of 1 is "Zero"

Gearbox treats balance of 0 and 1 the same (due to ERC20 rounding issues). Auto-disable triggers at balance <= 1:

See Also

Last updated