Whitelist

contracts/src/Whitelist.sol · Solidity 0.8.26

A governance-owned registry that maps each allowed token (the tokenized stocks and USDG) to its Chainlink price-feed metadata — feed address, maximum staleness, and token decimals — and holds the shared sequencer-uptime feed configuration consumed by OracleLib. Every Basket reads this contract for all of its oracle configuration.

  • Inherits: Ownable2Step (two-step ownership transfer). Owner is set in the constructor.

Storage

struct Entry { address feed; uint48 maxStaleness; bool allowed; uint8 decimals; }
mapping(address => Entry) private entries;   // per-token config (private; read via views)
address public sequencerFeed;                // sequencer-uptime feed; address(0) disables the check
uint48  public gracePeriod;                  // seconds to wait after a sequencer restart

Owner functions

constructor(address gov) Ownable(gov)
function addToken(address token, address feed, uint48 maxStaleness_, uint8 decimals_) external onlyOwner
function removeToken(address token) external onlyOwner
function setSequencerFeed(address feed, uint48 grace) external onlyOwner
  • addToken — adds or overwrites a token entry with allowed = true. Reverts ZeroAddress() if token or feed is zero; reverts BadDecimals() if decimals_ == 0 or > 18 (the 18 - dec normalization in OracleLib requires this). Emits TokenAdded.
  • removeToken — sets allowed = false (leaves feed/staleness/decimals in place). Emits TokenRemoved.
  • setSequencerFeed — sets the sequencer-uptime feed and grace period. Emits SequencerFeedSet.

View functions

function isAllowed(address token)     external view returns (bool)    // entries[token].allowed
function feedOf(address token)        external view returns (address) // entries[token].feed
function maxStaleness(address token)  external view returns (uint48)  // entries[token].maxStaleness
function tokenDecimals(address token) external view returns (uint8)   // entries[token].decimals

Plus the inherited Ownable2Step surface: owner(), pendingOwner(), transferOwnership(), acceptOwnership(), renounceOwnership().

Events

event TokenAdded(address indexed token, address indexed feed, uint48 maxStaleness, uint8 decimals);
event TokenRemoved(address indexed token);
event SequencerFeedSet(address indexed feed, uint48 grace);

Errors

Error Thrown when
ZeroAddress() addToken called with a zero token or feed
BadDecimals() addToken called with decimals_ == 0 or > 18

Notes

  • decimals_ is the token's own decimals (used to normalize its tracked balance in NAV), constrained to 1..18.
  • removeToken only flips the allowed flag; the other fields remain stored, so re-adding is cheap and existing baskets can still read the feed.