ParamRegistry
Inherits: IParamRegistry, AccessControl, Constants
Author: luoyhang003
Centralized registry for protocol parameters, including fee rates, deposit caps, tolerances, and operational flags.
Controlled via role-based access and timelocks (D0, D1, D3). Provides getter and setter functions for configuration parameters used across deposit, redemption, and pricing logic.
State Variables
D0_TIMELOCK_ROLE
Role controlling same-day (D0) parameter changes.
bytes32 public constant D0_TIMELOCK_ROLE = keccak256("D0_TIMELOCK_ROLE");
D1_TIMELOCK_ROLE
Role controlling 1-day delay (D1) parameter changes.
bytes32 public constant D1_TIMELOCK_ROLE = keccak256("D1_TIMELOCK_ROLE");
D3_TIMELOCK_ROLE
Role controlling 3-day delay (D3) parameter changes.
bytes32 public constant D3_TIMELOCK_ROLE = keccak256("D3_TIMELOCK_ROLE");
EXCHANGE_RATE_MAX_UPPER_DEVIATION_BPS
Maximum allowed upper deviation in exchange rate (bps).
uint256 public constant EXCHANGE_RATE_MAX_UPPER_DEVIATION_BPS = 200;
EXCHANGE_RATE_MAX_LOWER_DEVIATION_BPS
Maximum allowed lower deviation in exchange rate (bps).
uint256 public constant EXCHANGE_RATE_MAX_LOWER_DEVIATION_BPS = 200;
STABLECOIN_PRICE_MAX_DEVIATION_BPS
Maximum allowed deviation in stablecoin prices (bps).
uint256 public constant STABLECOIN_PRICE_MAX_DEVIATION_BPS = 500;
VOLATILE_ASSET_PRICE_MAX_DEVIATION_BPS
Maximum allowed deviation in volatile asset prices (bps).
uint256 public constant VOLATILE_ASSET_PRICE_MAX_DEVIATION_BPS = 5000;
PRICE_UPDATE_MIN_INTERVAL
Minimum interval allowed for price updates.
uint256 public constant PRICE_UPDATE_MIN_INTERVAL = 1 hours;
PRICE_MAX_VALIDITY_DURATION
Maximum validity period for price feeds.
uint256 public constant PRICE_MAX_VALIDITY_DURATION = 7 days;
MAX_MINT_FEE_RATE
Maximum allowed mint fee rate (bps).
uint256 public constant MAX_MINT_FEE_RATE = 100;
MAX_REDEEM_FEE_RATE
Maximum allowed redeem fee rate (bps).
uint256 public constant MAX_REDEEM_FEE_RATE = 100;
_exchangeRateMaxUpperToleranceBps
Current configured upper tolerance for exchange rate deviation.
uint256 private _exchangeRateMaxUpperToleranceBps = 100;
_exchangeRateMaxLowerToleranceBps
Current configured lower tolerance for exchange rate deviation.
uint256 private _exchangeRateMaxLowerToleranceBps = 50;
_stablecoinPriceToleranceBps
Current configured stablecoin price tolerance.
uint256 private _stablecoinPriceToleranceBps = 100;
_volatileAssetPriceToleranceBps
Current configured volatile asset price tolerance.
uint256 private _volatileAssetPriceToleranceBps = 500;
_priceUpdateInterval
Minimum interval between price updates.
uint256 private _priceUpdateInterval = 6 hours;
_price_validity_duration
Maximum validity period for cached price feeds.
uint256 private _price_validity_duration = 3 days;
_total_deposit_cap
Global cap on total deposits across all assets.
uint256 private _total_deposit_cap = type(uint256).max;
_fee_recipient
Address receiving collected fees.
address private _fee_recipient;
_forfeit_treasury
Address receiving forfeited assets (treasury).
address private _forfeit_treasury;
_mintFeeRate
Mapping of mint fee rates by asset.
mapping(address => uint256) private _mintFeeRate;
_redeemFeeRate
Mapping of redeem fee rates by asset.
mapping(address => uint256) private _redeemFeeRate;
_depositEnabled
Deposit enablement flags by asset.
mapping(address => bool) private _depositEnabled;
_redeemEnabled
Redeem enablement flags by asset.
mapping(address => bool) private _redeemEnabled;
_tokenDepositCap
Deposit caps for individual assets.
mapping(address => uint256) private _tokenDepositCap;
Functions
constructor
Deploys the ParamRegistry contract with initial roles and recipients.
Ensures none of the provided addresses are zero.
constructor(
address _admin,
address _d0Timelock,
address _d1Timelock,
address _d3Timelock,
address _feeRecipient,
address _forfeitTreasury
);
Parameters
| Name | Type | Description |
|---|---|---|
_admin | address | Address to be assigned DEFAULT_ADMIN_ROLE. |
_d0Timelock | address | Address for D0 timelock role (immediate changes). |
_d1Timelock | address | Address for D1 timelock role (delayed changes). |
_d3Timelock | address | Address for D3 timelock role (longer delays). |
_feeRecipient | address | Address to receive protocol fees. |
_forfeitTreasury | address | Address to receive forfeited assets. |
getExchangeRateMaxUpperToleranceBps
Returns the current upper tolerance for exchange rate deviation.
function getExchangeRateMaxUpperToleranceBps() external view returns (uint256);
getExchangeRateMaxLowerToleranceBps
Returns the current lower tolerance for exchange rate deviation.
function getExchangeRateMaxLowerToleranceBps() external view returns (uint256);
getStablecoinPriceToleranceBps
Returns the current stablecoin price tolerance in bps.
function getStablecoinPriceToleranceBps() external view returns (uint256);
getVolatileAssetPriceToleranceBps
Returns the current volatile asset price tolerance in bps.
function getVolatileAssetPriceToleranceBps() external view returns (uint256);
getPriceUpdateInterval
Returns the minimum interval between price updates.
function getPriceUpdateInterval() external view returns (uint256);
getPriceValidityDuration
Returns the maximum validity duration of cached prices.
function getPriceValidityDuration() external view returns (uint256);
getMintFeeRate
Returns the configured mint fee rate for a given asset.
function getMintFeeRate(address _asset) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | The address of the asset. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The mint fee rate in basis points. |
getRedeemFeeRate
Returns the configured redeem fee rate for a given asset.
function getRedeemFeeRate(address _asset) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | The address of the asset. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The redeem fee rate in basis points. |
getDepositEnabled
Returns whether deposits are enabled for a given asset.
function getDepositEnabled(address _asset) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | The address of the asset. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if deposits are enabled, false otherwise. |
getRedeemEnabled
Returns whether redemptions are enabled for a given asset.
function getRedeemEnabled(address _asset) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | The address of the asset. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if redemptions are enabled, false otherwise. |
getTotalDepositCap
Returns the global deposit cap.
function getTotalDepositCap() external view returns (uint256);
getTokenDepositCap
Returns the deposit cap for a specific asset.
function getTokenDepositCap(address _asset) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | The address of the asset. |
getFeeRecipient
Returns the address of the fee recipient.
function getFeeRecipient() external view returns (address);
getForfeitTreasury
Returns the address of the forfeited assets treasury.
function getForfeitTreasury() external view returns (address);
setExchangeRateMaxUpperToleranceBps
Updates the maximum upper tolerance for exchange rate deviation.
Only callable by {D0_TIMELOCK_ROLE}.
function setExchangeRateMaxUpperToleranceBps(uint256 _bps) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_bps | uint256 | New tolerance value in basis points. |
setExchangeRateMaxLowerToleranceBps
Updates the maximum lower tolerance for exchange rate deviation.
Only callable by {D0_TIMELOCK_ROLE}.
function setExchangeRateMaxLowerToleranceBps(uint256 _bps) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_bps | uint256 | New tolerance value in basis points. |
setStablecoinPriceToleranceBps
Updates the stablecoin price tolerance.
Only callable by {D0_TIMELOCK_ROLE}.
function setStablecoinPriceToleranceBps(uint256 _bps) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_bps | uint256 | New tolerance value in basis points. |
setVolatileAssetPriceToleranceBps
Updates the volatile asset price tolerance.
Only callable by {D0_TIMELOCK_ROLE}.
function setVolatileAssetPriceToleranceBps(uint256 _bps) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_bps | uint256 | New tolerance value in basis points. |
setPriceUpdateInterval
Updates the minimum price update interval.
Only callable by {D0_TIMELOCK_ROLE}.
function setPriceUpdateInterval(uint256 _interval) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_interval | uint256 | New interval in seconds. |
setPriceValidityDuration
Updates the validity duration of price feeds.
Only callable by {D1_TIMELOCK_ROLE}.
function setPriceValidityDuration(uint256 _duration) external onlyRole(D1_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_duration | uint256 | New duration in seconds. |
setMintFeeRate
Sets the mint fee rate for an asset.
Only callable by {D0_TIMELOCK_ROLE}.
function setMintFeeRate(address _asset, uint256 _rate) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | Address of the asset. |
_rate | uint256 | New fee rate in bps. |
setRedeemFeeRate
Sets the redeem fee rate for an asset.
Only callable by {D3_TIMELOCK_ROLE}.
function setRedeemFeeRate(address _asset, uint256 _rate) external onlyRole(D3_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | Address of the asset. |
_rate | uint256 | New fee rate in bps. |
setDepositEnabled
Enables or disables deposits for an asset.
Only callable by {D0_TIMELOCK_ROLE}.
function setDepositEnabled(address _asset, bool _enabled) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | Asset address. |
_enabled | bool | True to enable, false to disable. |
setRedeemEnabled
Enables or disables redemption for an asset.
Only callable by {D3_TIMELOCK_ROLE}.
function setRedeemEnabled(address _asset, bool _enabled) external onlyRole(D3_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | Asset address. |
_enabled | bool | True to enable, false to disable. |
setTotalDepositCap
Sets the global deposit cap.
Only callable by {D0_TIMELOCK_ROLE}.
function setTotalDepositCap(uint256 _cap) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_cap | uint256 | New total deposit cap. |
setTokenDepositCap
Sets the deposit cap for a specific asset.
Only callable by {D0_TIMELOCK_ROLE}.
function setTokenDepositCap(address _asset, uint256 _cap) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | address | Asset address. |
_cap | uint256 | New cap value. |
setFeeRecipient
Updates the fee recipient address.
Only callable by {D0_TIMELOCK_ROLE}.
function setFeeRecipient(address _feeRecipient) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_feeRecipient | address | New recipient address. |
setForfeitTreasury
Updates the forfeited assets treasury address.
Only callable by {D0_TIMELOCK_ROLE}.
function setForfeitTreasury(address _forfeitTreasury) external onlyRole(D0_TIMELOCK_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_forfeitTreasury | address | New treasury address. |