XSDStablecoin is the ERC-20 contract for XSD, the BankX silver-pegged stablecoin. It extends ERC20Custom and acts as the central registry for whitelisted pool addresses — only pools registered in xsd_pools are permitted to mint or burn XSD. The contract also exposes the Chainlink oracle price queries used by the rest of the protocol.
Key Concepts
Pool registry.xsd_pools is a mapping of address → bool. Any contract added via addPool() can call pool_mint() and pool_burn_from(). Only the CollateralPool is added in the current deployment.
cap_rate — Maximum total supply that the creatorMint() function will not exceed. Set at construction.
genesis_supply — Initial supply minted at construction, split between the owner (pool bootstrap) and treasury.
PRICE_PRECISION = 1e6 — All price values returned by this contract are in 1e6 precision (6 decimal places).
burnpoolXSD — Burns XSD from the XSD/WETH AMM pool and calls sync(). Callable only by the Router. Used during XSD-for-ETH swaps to apply deflationary pressure.
burnUserXSD — Allows any user to voluntarily burn their own XSD, subject to the constraint that uncollateralised XSD supply (totalSupply - collat_XSD) remains positive.
XSDMinted(address from, address to, uint256 amount)
Pool, recipient, amount
pool_mint() call
XSDBurned(address from, address to, uint256 amount)
Initiator, contract, amount
pool_burn_from(), burnpoolXSD(), burnUserXSD()
PoolAdded(address pool_address)
New pool address
addPool()
PoolRemoved(address pool_address)
Removed pool address
removePool()
ETHUSDOracleSet(address)
New oracle address
setETHUSDOracle()
XAGUSDOracleSet(address)
New oracle address
setXAGUSDOracle()
XSDETHPoolSet(address)
Pool address
setXSDEthPool()
BankXEthPoolSet(address)
Pool address
setBankXEthPool()
Security Considerations
burnUserXSD guard. The totalSupply - collat_XSD > _xsdamount check ensures that user burns do not touch collateralised XSD, preserving the solvency accounting.
Integration Guide
interface IXSDStablecoin { function eth_usd_price() external view returns (uint256); function xag_usd_price() external view returns (uint256); function pool_mint(address m_address, uint256 m_amount) external; function pool_burn_from(address b_address, uint256 b_amount) external; function xsd_pools(address pool) external view returns (bool);}// Reading the silver peg price (USD per XSD target, 1e6 precision):uint256 xag_price = IXSDStablecoin(XSD_ADDRESS).xag_usd_price();uint256 xsd_target_usd = xag_price / 1000; // 1/1000 troy oz of silver// Checking if an address is a whitelisted pool:bool is_pool = IXSDStablecoin(XSD_ADDRESS).xsd_pools(MY_CONTRACT);