ISlippageStorage
Title: ISlippageStorage
Author: Quantillon Labs - Nicolas Bellengé - @chewbaccoin
Interface for the Quantillon SlippageStorage contract
Stores on-chain slippage data published by an off-chain service. Provides rate-limited writes via WRITER_ROLE and config management via MANAGER_ROLE.
Note: security-contact: team@quantillon.money
Functions
initialize
Initialize the contract
function initialize(
address admin,
address writer,
uint48 minInterval,
uint16 deviationThreshold,
address treasury
) external;
Parameters
| Name | Type | Description |
|---|---|---|
admin | address | Address with DEFAULT_ADMIN_ROLE |
writer | address | Address with WRITER_ROLE (publisher service wallet) |
minInterval | uint48 | Minimum seconds between updates (rate limit) |
deviationThreshold | uint16 | Deviation in bps that bypasses rate limit |
treasury | address | Treasury address for recovery functions |
updateSlippage
Publish a new slippage snapshot on-chain
WRITER_ROLE only. Rate-limited: rejects if within minUpdateInterval unless |newWorstCaseBps - lastWorstCaseBps| > deviationThresholdBps.
function updateSlippage(uint128 midPrice, uint128 depthEur, uint16 worstCaseBps, uint16 spreadBps) external;
Parameters
| Name | Type | Description |
|---|---|---|
midPrice | uint128 | EUR/USD mid price (18 decimals) |
depthEur | uint128 | Total ask depth in EUR (18 decimals) |
worstCaseBps | uint16 | Worst-case slippage across buckets (bps) |
spreadBps | uint16 | Bid-ask spread (bps) |
setMinUpdateInterval
Update the minimum interval between updates
function setMinUpdateInterval(uint48 newInterval) external;
Parameters
| Name | Type | Description |
|---|---|---|
newInterval | uint48 | New interval in seconds |
setDeviationThreshold
Update the deviation threshold that bypasses rate limit
function setDeviationThreshold(uint16 newThreshold) external;
Parameters
| Name | Type | Description |
|---|---|---|
newThreshold | uint16 | New threshold in bps |
pause
Pause the contract (blocks updateSlippage)
function pause() external;
unpause
Unpause the contract
function unpause() external;
getSlippage
Get the current slippage snapshot
function getSlippage() external view returns (SlippageSnapshot memory snapshot);
Returns
| Name | Type | Description |
|---|---|---|
snapshot | SlippageSnapshot | The latest SlippageSnapshot struct |
getSlippageAge
Get seconds since the last on-chain update
function getSlippageAge() external view returns (uint256 age);
Returns
| Name | Type | Description |
|---|---|---|
age | uint256 | Seconds since last update (0 if never updated) |
minUpdateInterval
Get the current minimum update interval
function minUpdateInterval() external view returns (uint48 interval);
Returns
| Name | Type | Description |
|---|---|---|
interval | uint48 | Seconds |
deviationThresholdBps
Get the current deviation threshold
function deviationThresholdBps() external view returns (uint16 threshold);
Returns
| Name | Type | Description |
|---|---|---|
threshold | uint16 | Bps |
recoverToken
Recover ERC20 tokens accidentally sent to the contract
function recoverToken(address token, uint256 amount) external;
Parameters
| Name | Type | Description |
|---|---|---|
token | address | Token address |
amount | uint256 | Amount to recover |
recoverETH
Recover ETH accidentally sent to the contract
function recoverETH() external;
Events
SlippageUpdated
Emitted when slippage data is updated on-chain
event SlippageUpdated(uint128 midPrice, uint16 worstCaseBps, uint16 spreadBps, uint128 depthEur, uint48 timestamp);
ConfigUpdated
Emitted when a config parameter is changed
event ConfigUpdated(string indexed param, uint256 oldValue, uint256 newValue);
TreasuryUpdated
Emitted when treasury address is updated
event TreasuryUpdated(address indexed newTreasury);
ETHRecovered
Emitted when ETH is recovered from the contract
event ETHRecovered(address indexed to, uint256 amount);
Structs
SlippageSnapshot
Packed on-chain slippage snapshot (2 storage slots)
struct SlippageSnapshot {
uint128 midPrice; // EUR/USD mid price (18 decimals)
uint128 depthEur; // Total ask depth in EUR (18 decimals)
uint16 worstCaseBps; // Worst-case slippage across buckets (bps)
uint16 spreadBps; // Bid-ask spread (bps)
uint48 timestamp; // Block timestamp of update
uint48 blockNumber; // Block number of update
}