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 withallowed = true. RevertsZeroAddress()iftokenorfeedis zero; revertsBadDecimals()ifdecimals_ == 0or> 18(the18 - decnormalization in OracleLib requires this). EmitsTokenAdded.removeToken— setsallowed = false(leaves feed/staleness/decimals in place). EmitsTokenRemoved.setSequencerFeed— sets the sequencer-uptime feed and grace period. EmitsSequencerFeedSet.
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 to1..18.removeTokenonly flips theallowedflag; the other fields remain stored, so re-adding is cheap and existing baskets can still read the feed.