Since both global and market configurations are not time-locked, they will apply the modifications that the admins performed instantly. But there are 2 important properties which when updated (with any valid number, this problem depends only on the side of update) will lead to a series of liquidations for the accounts with a margin around their maintenance margin - PerpMarket::maintenanceMarginRateX18
and MarginCollateralConfiguration::loanToValue
. If MMR is increased this will make all the positions below that increased percentage liquidateable and when LTV is decreased accounts having this collateral type will face instant margin reduction.
Code for LTV:
Code for MMR:
The max leverage that Zaros allows is configured based on the IMR and MMR set and we can assume that majority of the positions will be around the initial margin or below initial and above maintenance, as this is a valid scenario, since liquidation happens below MMR.
Let’s imagine the following configuration in a ETH/USD
(for sake of example assume ETH
price is $1000) market:
MMR = 5%
IMR = 10%
CollateralTypes = wBTC
with 80% LTV (for sake of example assume indexPrice = $1000)
Multiple traders open positions all with same setup:
Collateral = 1.25e18 ($1250 * 80% = $1000)
Position Size = 10e18 ($10_000) (10x leverage)
Price of wBTC falls to $550
Collateral = 1.25e18 ($687.5 * 80% = $550)
Position Size = 10e18 ($10_000) (10x leverage)
This puts the position between IMR and MMR (margin is now 5.5% of the size, since)
Admin increases the MMR without giving any time to the traders to 7% and all of the positions are wiped instantly by the liquidation bot, while they were perfectly fine in the previous configuration.
Admin decreases wBTC LTV to 50%, margin collateral immediately falls to 687.5 * 50% = 343.75 and positions are wiped again, leading to loss of the LPs, since this is how the system will behave.
This is clearly not design decision, since it can be prevented and execution happens immediately, probably the intention of Zaros team was to have all the positions above the initial margin and then update these params but this can’t happen as being b/n MMR and IMR is completely viable scenario.
Batch liquidation of the positions that are between IMR and MMR, when LTV and/or MMR are updated without being timelocked first.
Manual Review
Add timelocks for all the important operations, markets will be frequently configured by the appropriate team to align with the current DeFi landscape.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.