# lyra-utils
https://github.com/lyra-finance/lyra-utils/commit/b15187c3cb8972f7ca863d8bb4d319b2b264db4e
- **no logic changes**
- add comments to array libs to clarify their limitations
https://github.com/lyra-finance/lyra-utils/commit/c81cdc3905a83c42bc55741a0d57a51c9260be0b
- **no logic changes**
- adding license
# V2-core
https://github.com/lyra-finance/v2-core/commit/c155f5bd021cc70a530477e11ffd6cc51ed8b286
- โคต๏ธ Fix to the amount of cash a bidder needed to provide
- modified again in f21f3e1 - invalidating this change
https://github.com/lyra-finance/v2-core/commit/61a83911dce82e780500d3db581bd9513415baa3
- **no logic changes**
- just deploy scripts
https://github.com/lyra-finance/v2-core/commit/541903c6816001c8049e9a53f83accaaf7510474
- ๐ก change to BalanceAdjusted event so the asset and subId can actually be read from the event without a reverse lookup table
https://github.com/lyra-finance/v2-core/commit/86d48ce664b461e17b457a7b9afa72df80548926
- **no logic changes**
- purely formatting
https://github.com/lyra-finance/v2-core/commit/f21f3e1d82d1dea440f9a066665b25caf4c942b9
- ๐ Add a guardrail around max expiry for the feeds
- We've realised if there are large cash interest rates then the MTM of options can be miscalculated (and margin requirements in SM don't account for it)
- By adding a cap to the expiry, some 10 year option (or more specifically a box) that could cause problems with this can't be opened
- This guardrail only really needed to be added to any feed, forward feed was chosen
- ๐ด Remove tracking "percentage left" in dutch auctions
- You run into issues around cash (i.e. funding or cash deposits) changing the account making it hard to actually compute the max_f properly.
- This means bids are made on the CURRENT account rather than original
- In relation to this, to minimise the chance for exploit, ALL transfers into the account (even cash) during an auction will be blocked. Funding can still be applied.
- โคต๏ธ Add a guardrail to the max diff for perp pricing
- This was reworked in the next PR, so will explain this in the next commit comment
https://github.com/lyra-finance/v2-core/commit/7152616d646d1dbde5af5d25188b8e87aa1fc46e
- ๐ด Change to add bounds to the spot diff feed. Allow them to be adjusted to the owner too.
- Potential exploit if someone was able to manipulate the perp price by pushing the price up on the CLOB (from which the feed will be derived)
- Exploit would be as follows:
- perp price starts at spot (i.e. diff = 0)
- push per price up to +10% of spot
- this is artificially inflated, so the true value of the perp is == spot
- open max leverage perps against yourself (exaggerating some params)
- i.e. 10,000 long and short perps, max leverage
- long_perp_true_value == 20M
- perp_marked_value = 22M
- long_perp_collateral == 1.1M (20x leverage)
- the difference: (marked_value - true_value) - collateral == 900k would be an insolvency when the price returns to the proper market value.
- Short perp would get paid 2M PnL + have it's original 1.1M collateral
- Long perp would OWE 900k to the system which cannot be recovered (i.e. taken from SM)
- The resolutions are:
- (already doing this off-chain) feed would provide low confidence if spot difference was above a certain threshold (i.e. start dropping at +/- 1%, go to 0 as +/- 3%)
- correlate the max leverage to the max spot diff
- We added this maxSpotDiff parameter to help ENSURE this is kept in check on-chain
- There are still concerns around large genuine difference in spot and perp price i.e. if there was another ETH merge event and they started diverging
- These can be handled with parameter adjustments through governance
- lower max leverage and wider max spot diff
- longer twap period on the perp spot diff (handled off-chain)
https://github.com/lyra-finance/v2-core/commit/99cb6b4650ce630d0a0d7b5c036137e2e2a37ee1
- ๐ด Added a guardian/manager pause functionality
- Looking at other protocols this seems like fairly common practice. Thinking about things like wBTC depeg and other black swan scenarios, this felt like a necessary addition.
- Only guardian can pause/unpause, but governance can replace the guardian
https://github.com/lyra-finance/v2-core/commit/1d21542bc472989ac8c97214f91f4d9151adee46
- ๐ Fix for smFee cache issue
https://github.com/lyra-finance/v2-core/commit/c9d9480f99dd8c4e5bf2e8e0466334ceac19f5e6
- ๐ข Tighten bounds for vol.shortTermPower/longTermPower
https://github.com/lyra-finance/v2-core/commit/444b035a234abdbc61f4ff126895765b50fa6301
- ๐ข Fixes for:
- Lines 191 to 194, there is no check to ensure ignoreAmount is less than assetBalances[i].balance
- (added safeCast)
- Lines 138 to 158, this function potentially needs an upper limit to avoid gas limit exhaustion.
- Added limit of 40
- ๐ก Also changed LyraSpotDiffFeed to not use SignedMath library min/max, as it was causing issues in matching when imported
https://github.com/lyra-finance/v2-core/commit/6510200388453774659d22aad783c27d008fcf65
- **no logic changes**
- added code license
https://github.com/lyra-finance/v2-core/commit/10bb7476bc90fd846fcf5edeb7addf5cfdb82436
- ๐ก Changed typehashes for allowanceLib to make eip712 compliant
https://github.com/lyra-finance/v2-core/commit/3b4a0c2647d789b5727c42b98a2db5bfeecc447d
- ๐ก Changed setMaxExpiries so it cannot reduce the number of expiries as that would cause freezing
# V2-matching
https://github.com/lyra-finance/v2-matching/commit/254e39b1ec4a262de155cb52afd21fec9b07a7f7
- ๐ Fix to the bypassing cooldown issue
https://github.com/lyra-finance/v2-matching/commit/fa2fe13e2d3a6a784fb1386c3c300f62b78c36c2
- **no logic changes**
- only deploy scripts
https://github.com/lyra-finance/v2-matching/commit/41365e3d17138893f227adfa98950698632808db
- ๐ข Added a single "emit" where it was missing before - so a full picture of all subaccount owners can be created using a single event
- **out of scope**: Add LyraSettlementUtil and LyraAuctionUtil helper contracts.
https://github.com/lyra-finance/v2-matching/commit/aa104cd0c5d769bc76582ecae38c6354d1aaf895
- **no logic changes**
- Add code license