Revoke Allowances

Revoke Credit Account's token approvals to external contracts.

For Solidity implementation, see Revoke Allowances.

Why

You revoke allowances when:

  • Security incident - Third-party contract may be compromised

  • Legacy cleanup - Old accounts may have stale approvals from previous Gearbox versions

  • Defense in depth - Proactively remove unnecessary approvals

Current Gearbox V3 automatically resets allowances to 1 after each interaction. However, older accounts from V2.1 may still have active allowances to external protocols.

What

revokeAdapterAllowances resets token approvals from your Credit Account to specified contracts:

  1. You specify which (spender, token) pairs to revoke

  2. Credit Account sets allowance to 1 for each pair

  3. External contracts can no longer spend those tokens

Note: Allowance is set to 1, not 0, due to gas optimization (writing non-zero to non-zero is cheaper than writing zero).

How

Check Existing Allowances

Before revoking, you might want to see what allowances exist:

Revoke All Known Adapters

If you want to revoke all adapter allowances for a token:

Gotchas

Usually Not Needed in V3

Gearbox V3 automatically resets allowances after each adapter interaction. This function exists mainly for:

  1. Legacy accounts migrated from V2.1

  2. Paranoid security posture

  3. Specific incident response

If you're using a fresh V3 account, allowances are already minimal.

Revocation Struct Format

The RevocationPair struct has two fields:

Both must be valid addresses. Invalid addresses may cause the call to revert or have no effect.

Sets to 1, Not 0

For gas efficiency, allowances are set to 1 instead of 0:

An allowance of 1 wei is functionally zero for any realistic token amount.

Can't Revoke Non-Existent Allowances

Revoking an allowance that doesn't exist (already 0 or 1) is a no-op - it won't revert, but wastes gas.

Adapter vs External Contract

Revocations target the spender (usually an adapter), not the underlying protocol:

Adapters are what actually interact with your Credit Account's tokens.

Batch Multiple Revocations

You can revoke multiple (spender, token) pairs in one call:

When to Actually Use This

Real scenarios where revocation makes sense:

  1. Third-party exploit: A protocol Gearbox integrates with gets hacked. Revoke allowances to that protocol's adapter as a precaution.

  2. Account migration: Moving from V2.1 account with old allowances to ensure clean state.

  3. Compliance requirement: Some regulatory frameworks require revoking unused approvals.

  4. Personal security policy: You want explicit control over all approvals.

For normal operations, V3's automatic reset is sufficient.

See Also

Last updated