delvtech / hyperdrive

An automated market maker for fixed and variable yield with on-demand terms.
Apache License 2.0
28 stars 3 forks source link

Implemented a price discovery circuit breaker on `addLiquidity` and `initialize` #1067

Closed jalextowle closed 2 months ago

jalextowle commented 3 months ago

Resolved Issues

Description

This PR adds a simple check to addLiquidity() and initialize() to ensure that when liquidity is added, a spot rate of 0% is still achievable.

Review Checklists

Please check each item before approving the pull request. While going through the checklist, it is recommended to leave comments on items that are referenced in the checklist to make sure that they are reviewed. If there are multiple reviewers, copy the checklists into sections titled ## [Reviewer Name]. If the PR doesn't touch Solidity, the corresponding checklist can be removed.

[[Reviewer Name]]

github-actions[bot] commented 3 months ago

Hyperdrive Gas Benchmark

Benchmark suite Current: 4ea19f3a6b3b6b6c183dec652769aca5ecc29b2d Previous: e0a849d0a60c781a8fd91131d1e0dec3f4e8d498 Deviation Status
addLiquidity: min 33937 gas 33937 gas 0% 🟰
addLiquidity: avg 197433 gas 155512 gas 26.9568% 🚨
addLiquidity: max 474972 gas 429217 gas 10.6601% 🚨
checkpoint: min 40316 gas 40316 gas 0% 🟰
checkpoint: avg 144492 gas 144473 gas 0.0132% 🚨
checkpoint: max 256115 gas 255724 gas 0.1529% 🚨
closeLong: min 31361 gas 31361 gas 0% 🟰
closeLong: avg 135909 gas 135905 gas 0.0029% 🚨
closeLong: max 2539376 gas 2539376 gas 0% 🟰
closeShort: min 31327 gas 31327 gas 0% 🟰
closeShort: avg 131329 gas 131160 gas 0.1289% 🚨
closeShort: max 271293 gas 270901 gas 0.1447% 🚨
initialize: min 31283 gas 31349 gas -0.2105% βœ…
initialize: avg 352639 gas 333267 gas 5.8128% 🚨
initialize: max 420898 gas 399530 gas 5.3483% 🚨
openLong: min 33437 gas 33370 gas 0.2008% 🚨
openLong: avg 174338 gas 173125 gas 0.7006% 🚨
openLong: max 333832 gas 333607 gas 0.0674% 🚨
openShort: min 34003 gas 33936 gas 0.1974% 🚨
openShort: avg 174309 gas 168549 gas 3.4174% 🚨
openShort: max 415072 gas 415253 gas -0.0436% βœ…
redeemWithdrawalShares: min 31251 gas 31251 gas 0% 🟰
redeemWithdrawalShares: avg 75199 gas 75281 gas -0.1089% βœ…
redeemWithdrawalShares: max 305243 gas 305243 gas 0% 🟰
removeLiquidity: min 31279 gas 31301 gas -0.0703% βœ…
removeLiquidity: avg 214954 gas 214959 gas -0.0023% βœ…
removeLiquidity: max 403632 gas 403654 gas -0.0055% βœ…

This comment was automatically generated by workflow using github-action-benchmark.