# Credit Configurator

> Markdown export of the Gearbox Protocol documentation page for agents and retrieval systems.

Canonical page: https://docs.gearbox.finance/developers/gm-ref-cc
Source file: content/developers/gm-ref-cc.mdx
Section router: https://docs.gearbox.finance/developers/llms.txt
Section full export: https://docs.gearbox.finance/developers/llms-full.txt

The **CreditConfiguratorV3** is the administrative gateway for the Credit Suite. It validates parameter changes and propagates them to the Credit Manager and Credit Facade. It does not store configuration state itself -- it acts as a validation and access-control layer.

```
User/DAO -> CreditConfiguratorV3 (validation) -> CreditManagerV3/CreditFacadeV3 (state)
```

---

## Write Methods

### Token & Collateral Management

#### addCollateralToken

Registers a new collateral token with an initial liquidation threshold.

```solidity
function addCollateralToken(address token, uint16 liquidationThreshold) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | ERC-20 token to add |
| `liquidationThreshold` | `uint16` | Initial LT in basis points (e.g., 8500 = 85%) |

**Validation:** Token must have a price feed in PriceOracle, be quoted in PoolQuotaKeeper, and LT cannot exceed the underlying token's LT.

**Access:** Configurator role only.

---

#### setLiquidationThreshold

Sets the liquidation threshold for a collateral token immediately.

```solidity
function setLiquidationThreshold(address token, uint16 liquidationThreshold) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | Collateral token |
| `liquidationThreshold` | `uint16` | New LT in basis points |

**Access:** Configurator role only.

---

#### rampLiquidationThreshold

Gradually changes a token's liquidation threshold over time to prevent sudden liquidation cascades.

```solidity
function rampLiquidationThreshold(
    address token,
    uint16 ltFinal,
    uint40 rampStart,
    uint24 rampDuration
) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | Collateral token |
| `ltFinal` | `uint16` | Target LT after ramping completes |
| `rampStart` | `uint40` | Timestamp when ramping begins |
| `rampDuration` | `uint24` | Duration of linear interpolation (seconds) |

**Access:** Configurator role only. The current LT is linearly interpolated between the initial and final values over the ramp period.

---

#### forbidToken

Marks a token as forbidden (high-risk). Forbidden tokens still count toward collateral (with safe pricing) but quota increases and balance increases are restricted.

```solidity
function forbidToken(address token) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | Token to forbid |

**Access:** Pausable Admin (no DAO vote required).

---

#### allowToken

Restores normal status to a previously forbidden token.

```solidity
function allowToken(address token) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `token` | `address` | Token to allow |

**Access:** Configurator role only.

---

### Fee Management

#### setFees

Configures liquidation fees and premiums.

```solidity
function setFees(
    uint16 feeLiquidation,
    uint16 liquidationPremium,
    uint16 feeLiquidationExpired,
    uint16 liquidationPremiumExpired
) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `feeLiquidation` | `uint16` | DAO fee on standard liquidations (bps) |
| `liquidationPremium` | `uint16` | Reward for liquidators (bps) |
| `feeLiquidationExpired` | `uint16` | DAO fee for expired account liquidations (bps) |
| `liquidationPremiumExpired` | `uint16` | Liquidator reward for expired accounts (bps) |

**Constraints:** `feeLiquidation <= liquidationPremium`, `feeLiquidationExpired <= feeLiquidation`, and `liquidationPremium + feeLiquidation < 100%`.

**Access:** Configurator role only.

---

### Debt Limits

#### setDebtLimits

Sets the minimum and maximum debt bounds per Credit Account.

```solidity
function setDebtLimits(uint128 newMinDebt, uint128 newMaxDebt) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `newMinDebt` | `uint128` | Minimum principal (must have non-zero USD value) |
| `newMaxDebt` | `uint128` | Maximum principal |

**Validation:** `minDebt <= maxDebt`. Safety ratio ensures min debt is large enough to make liquidation economical.

**Access:** Configurator role only.

---

#### setMaxDebtPerBlockMultiplier

Sets the per-block borrowing cap multiplier.

```solidity
function setMaxDebtPerBlockMultiplier(uint8 multiplier) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `multiplier` | `uint8` | Multiplier applied to maxDebt for per-block limit |

**Access:** Configurator role only.

---

#### forbidBorrowing

Emergency action that immediately halts all new borrowing by setting the per-block multiplier to 0.

```solidity
function forbidBorrowing() external;
```

**Access:** Pausable Admin (no DAO vote required).

---

### Adapter Management

#### allowAdapter

Registers an adapter for a target DeFi protocol.

```solidity
function allowAdapter(address adapter) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `adapter` | `address` | Adapter contract address |

**Validation:** Adapter must implement `creditManager()` returning this Credit Manager and `targetContract()` returning the DeFi protocol. Cannot target the Facade or Manager itself.

**Access:** Configurator role only.

---

#### forbidAdapter

Removes a registered adapter.

```solidity
function forbidAdapter(address adapter) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `adapter` | `address` | Adapter to remove |

**Access:** Configurator role only.

---

### System Upgrades

#### setPriceOracle

Switches to a new price oracle implementation.

```solidity
function setPriceOracle(address newPriceOracle) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `newPriceOracle` | `address` | New PriceOracle contract |

**Access:** Configurator role only. New oracle must support all configured collateral tokens.

---

#### setCreditFacade

Migrates to a new Credit Facade, optionally copying existing parameters.

```solidity
function setCreditFacade(address newCreditFacade, bool migrateParams) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `newCreditFacade` | `address` | New CreditFacade contract |
| `migrateParams` | `bool` | Whether to copy debt limits and other parameters |

**Access:** Configurator role only.

---

#### upgradeCreditConfigurator

Transfers the configurator role to a new contract.

```solidity
function upgradeCreditConfigurator(address newCreditConfigurator) external;
```

| Parameter | Type | Description |
| --- | --- | --- |
| `newCreditConfigurator` | `address` | New CreditConfigurator contract |

**Access:** Configurator role only.

---

## View Methods

### creditManager

Returns the Credit Manager this configurator manages.

```solidity
function creditManager() external view returns (address);
```

---

### creditFacade

Returns the current Credit Facade address.

```solidity
function creditFacade() external view returns (address);
```

---

### underlying

Returns the underlying token address.

```solidity
function underlying() external view returns (address);
```

---

## Events

### AddCollateralToken

```solidity
event AddCollateralToken(address indexed token, uint16 liquidationThreshold);
```

Emitted when a new collateral token is registered.

### SetLiquidationThreshold

```solidity
event SetLiquidationThreshold(address indexed token, uint16 liquidationThreshold);
```

Emitted when a token's LT is changed immediately.

### RampLiquidationThreshold

```solidity
event RampLiquidationThreshold(
    address indexed token,
    uint16 ltFinal,
    uint40 rampStart,
    uint24 rampDuration
);
```

Emitted when a gradual LT change is initiated.

### ForbidToken

```solidity
event ForbidToken(address indexed token);
```

Emitted when a token is marked as forbidden.

### AllowToken

```solidity
event AllowToken(address indexed token);
```

Emitted when a forbidden token is restored.

### SetFees

```solidity
event SetFees(
    uint16 feeLiquidation,
    uint16 liquidationPremium,
    uint16 feeLiquidationExpired,
    uint16 liquidationPremiumExpired
);
```

Emitted when liquidation fees are updated.

### SetDebtLimits

```solidity
event SetDebtLimits(uint128 minDebt, uint128 maxDebt);
```

Emitted when debt bounds are changed.

### AllowAdapter

```solidity
event AllowAdapter(address indexed adapter, address indexed targetContract);
```

Emitted when an adapter is registered.

### ForbidAdapter

```solidity
event ForbidAdapter(address indexed adapter);
```

Emitted when an adapter is removed.

### SetCreditFacade

```solidity
event SetCreditFacade(address indexed creditFacade);
```

Emitted when the Credit Facade is upgraded.

### SetPriceOracle

```solidity
event SetPriceOracle(address indexed priceOracle);
```

Emitted when the price oracle is changed.

### UpgradeCreditConfigurator

```solidity
event UpgradeCreditConfigurator(address indexed creditConfigurator);
```

Emitted when the configurator itself is upgraded.

---

## Access Control

| Role | Capabilities |
| --- | --- |
| **Configurator** | All structural changes: tokens, fees, adapters, debt limits, upgrades |
| **Pausable Admin** | Emergency actions: `forbidToken`, `forbidBorrowing` (no DAO vote required) |

The Credit Manager and Facade verify all configuration calls originate from the registered Configurator via the `creditConfiguratorOnly` modifier.

---

## Related Pages

- [Credit Manager](https://docs.gearbox.finance/developers/gm-ref-cm) -- Core accounting engine
- [Credit Facade](https://docs.gearbox.finance/developers/gm-ref-cf) -- User-facing interface
- [Pool (PoolV3)](https://docs.gearbox.finance/developers/gm-ref-pool) -- Liquidity pool
- [Smart Contracts Overview](https://docs.gearbox.finance/developers/gm-contracts) -- Full contract architecture
