State variables and roles
_ammState
Struct containing the AMM’s square-root spot price, lower range price and upper range price, each being a
uint160
(In Q64.96 format). The AMM is modelled as a single UniswapV3 range order but without discrete price ticks. In order to save gas on storage ops, the three variables are packed into twouint256
slots as follows:HotWriteSlot
Struct containing parameters that get updated on every HOT swap.
hotReadSlot
Struct containing parameters that get read, but not updated, during HOT swaps:
signer
is responsible for signing theHybridOrderType
struct during HOT swaps. It can be either a EOA or an EIP-1271 compliant smart contract wallet.maxOracleDeviationBipsLower
is the maximum allowed deviation in basis points term between the square root of the oracle price, and the square root of the spot price when sqrtSpotPrice < sqrtOraclePrice. If during deposits or HOT swaps, this deviation threshold is exceeded, then we assume that the spot price is manipulated currently, and we revert the action.maxOracleDeviationBipsUpper
works exactly like maxOracleDeviationBipsLower, but is used when sqrtSpotPrice >= sqrtOraclePricemaxToken{0,1}VolumeToQuote
Maximum amount of volume thatsigner
is allowed to quote on each HOT swap.These have been implemented as absolute bounds on the per-swap volume, instead of as a fraction of current pool reserves, in order to reduce the attack surface due to how pool reserves are easy to manipulate.
manager
is expected to update these bounds as frequently as necessary, as deposits and withdrawals change reserves in the pool.WARNING: The higher these values are, the more flexibility
hotReadSlot.signer
has in filling larger HOT swaps, but it also increases the risk of losses for LPs in case of mis-priced quotes. The HOT contract trusts thatmanager
sets these values appropriately according to the needs ofliquidityProvider
.manager
Address which is responsible for:
Updating all parameters in
hotReadSlot
Pausing the HOT contract, hence acting as a circuit-breaker
Updating maximum volume of each HOT swap (
maxToken0VolumeToQuote
andmaxToken1VolumeToQuote
)
WARNING: In order to maximise the effectiveness of
manager
as a circuit breaker, and placing reasonable bounds on the amount of volume thatsigner
is allowed to quote on each HOT swap,manager
should not collude withsigner
norliquidityProvider
.liquidityProvider
Set as immutable upon initialization.
Liquidity provider is responsible for:
Depositing reserves.
Withdrawing reserves.
Set AMM position’s price bounds.
WARNING: The HOT contract makes no assumptions with regards to how reserves are managed or tokenized, and assumes that liquidityProvider
is a smart contract that implements sufficient internal protections. manager
can pause the contract at any time, should liquidityProvider
be faulty.
Last updated