Stable Pool
Stable Pools provide fixed pricing for tokens, ideal for use cases where consistent value is essential, such as stablecoins or tightly controlled economies. Unlike Standard Pools, the market price in a Stable Pool remains constant, with fees applied to buy and sell transactions.
Flow of Funds:
Market Pricing:
Stable Pool Settings:
Stable Pools include straightforward adjustable parameters:
- Buy Fee: Additional cost applied to token purchases, defined as a percentage of the stable price.
- Sell Fee: Reduction applied to token sales, defined as a percentage of the stable price.
Guardrails:
To maintain predictability and user trust, Stable Pools enforce immutable fee limits established during deployment:
- Fee Limits: Caps on buy and sell fees to prevent excessive transaction costs.
Transactions
Buy:
A buyer will pay the market value of the tokens plus the creator buy fee.
Sell:
A seller will receive the market value of the tokens less the creator sell fee.
Spend:
A spender will receive no market value for their tokens, market value will instead be transferred to the creator share.
Data Types
StablePoolInitializationParameters
This struct defines parameters used for stable pool initialization.
- initialSupplyRecipient: Address to receive the initial supply amount.
- initialSupplyAmount: Initial amount of supply to mint to the initial supply recipient.
- maxBuyFeeBPS: Immutable maximum buy fee rate in BPS that may be set by the creator.
- maxSellFeeBPS: Immutable maximum sell fee rate in BPS that may be set by the creator.
- initialBuyParameters: Initial settings for buy parameters.
- initialSellParameters: Initial settings for sell parameters.
- stablePairedPricePerToken: Immutable ratio of paired token to pool token for stable pricing.
struct StablePoolInitializationParameters {
address initialSupplyRecipient;
uint256 initialSupplyAmount;
uint256 maxBuyFeeBPS;
uint256 maxSellFeeBPS;
StablePoolBuyParameters initialBuyParameters;
StablePoolSellParameters initialSellParameters;
PairedPricePerToken stablePairedPricePerToken;
}
StablePoolBuyParameters
This struct defines parameters used for buys.
- buyFeeBPS: Buy fee rate in BPS that will be applied to a buy order.
struct StablePoolBuyParameters {
uint16 buyFeeBPS;
}
StablePoolSellParameters
This struct defines parameters used for sells.
- sellFeeBPS: Sell fee rate in BPS that will be subtracted from a sell order.
struct StablePoolSellParameters {
uint16 sellFeeBPS;
}
PairedPricePerToken
This struct defines parameters used for spends.
- numerator: The numerator for the ratio of paired token to pool token that will be the stable price of a token before fees.
- denominator: The denominator for the ratio of paired token to pool token that will be the stable price of a token before fees.
struct PairedPricePerToken {
uint96 numerator;
uint96 denominator;
}
Stable Pool Functions
The following functions are specific to Stable Pools. Platforms integrating TokenMaster with Stable Pools should use these functions to update token settings, retrieve the current settings, and retrieve the guardrail settings for display purposes.
// Administrative functions.
function setBuyParameters(StablePoolBuyParameters calldata _buyParameters) external;
function setSellParameters(StablePoolSellParameters calldata _sellParameters) external;
// Current settings and guardrails.
function getBuyParameters() external view returns(StablePoolBuyParameters memory);
function getSellParameters() external view returns(StablePoolSellParameters memory);
function getStablePriceRatio() external view returns(uint96 numerator, uint96 denominator);
function getParameterGuardrails() external view returns (uint16 maxBuyFeeBPS, uint16 maxSellFeeBPS);
Stable Pool Events
Platforms integrating TokenMaster should index the following events on all tokens that are relevant to the platform to know when a token's buy or sell parameters need to be checked for updates.
/// @dev Emitted when the token's buy settings have been updated.
event BuyParametersUpdated();
/// @dev Emitted when the token's sell settings have been updated.
event SellParametersUpdated();
