Negative Interest: Zeta Adjustment#599
Merged
jalextowle merged 33 commits intomainfrom Oct 11, 2023
Merged
Conversation
Contributor
Author
|
|
1f61fd0 to
7ed9d53
Compare
45ca838 to
fe7796e
Compare
2620297 to
29fda0e
Compare
fe7796e to
af25c00
Compare
1. `shareReservesDelta` and `bondReservesDelta` always refer to the amount of shares or bonds that are being added or subtracted from the share reserves. 2. `shareCurvePayment` refers to the amount of shares priced by the curve. We think of this as a payment because the LPs are paying shares in return for a proceed in bonds, `bondCurveProceeds`.
* Added a `minSharePrice` * Fixed some tests * Fixed the Rust codebase
…-mature-positions' into jalextowle/negative-interest/refactor
Base automatically changed from
jalextowle/bug/negative-interest-mature-positions
to
main
September 30, 2023 00:26
…negative-interest/zeta-adjustment
Hyperdrive Gas Benchmark
This comment was automatically generated by workflow using github-action-benchmark. |
…nterest/zeta-adjustment
Collaborator
fbd9ff9 to
6d7db94
Compare
jrhea
approved these changes
Oct 10, 2023
Contributor
jrhea
left a comment
There was a problem hiding this comment.
lgtm, just a question about one of the tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR originally included changes that modified the share adjustment logic to correct for negative interest adjustments that would break our k-invariant. These changes were mostly included in other negative interest PRs.
This PR fixes the tests related to k invariance ad path independence. We have path invariance on the curve in the sense that the effective share reserves and bond reserves coordinates are invariant under trading without liquidity changes caused by
addLiquidityandremoveLiquidity. We do not have path independence if we instead look at the triple(shareReserves, shareAdjustment, bondReserves). This can be explained by the fact that some traders may have accrued negative interest while others haven't. If the negative interest trader gets the best price available, more of the LPs liabilities or proceeds will be susceptible to the scaling from negative interest. Re-ordering trades can change the amount of negative interest adjustments that are applied to the reserves.Along with fixing tests to verify the zeta adjustment changes, this PR also includes a fix to
openShort. Prior to this PR, shorts benefitted from negative interest that accrued in their checkpoint. In extreme cases (like those of a bad hack), shorts could be opened for free. This PR closes this loophole by clamping the share price to the open share price. The_minSharePricefield gives shorts an easy way to prevent themselves from opening a short in a checkpoint with negative interest.