Skip to content

Conversation

@jalextowle
Copy link
Contributor

@jalextowle jalextowle commented Feb 6, 2023

This PR adds accounting to the closeShort flow that pays out as many outstanding short withdrawal shares as possible. The withdrawal proceeds that will be attributed to the withdrawal pool are equivalent to the proceeds obtained from closing a long position because LPs take on a long position when a short is opened. The withdrawal proceeds (in shares) is equal to $z_1$, the amount of shares the short pays to the pool at closing. The withdrawal proceeds (in shares) are debited from the share reserves at the same time that the share proceeds of the short are debited from the share reserves. Mathematically, this can be represented as $z += z_1 - t \cdot z_1$, where $t$ is the proportion of shorts being closed that are attributed to the withdrawal pool. If $t = 0$, then the accounting is identical to the current system. If $t =1$, then $z$ is isn't updated at all, which gives value of the bonds sold by the LP to the withdrawal pool.

@jalextowle jalextowle force-pushed the jalextowle/hyperdrive/short-withdrawal-token-accounting branch from b78bdff to b837bdd Compare February 6, 2023 23:33
@jalextowle jalextowle changed the base branch from main to jalextowle/hyperdrive/long-withdrawal-token-accounting February 6, 2023 23:33
@jalextowle jalextowle marked this pull request as ready for review February 6, 2023 23:55
@jalextowle jalextowle requested review from aleph-v and jrhea February 7, 2023 16:47
@jalextowle jalextowle force-pushed the jalextowle/hyperdrive/long-withdrawal-token-accounting branch from c82c9ac to f213a51 Compare February 7, 2023 18:43
@jalextowle jalextowle force-pushed the jalextowle/hyperdrive/short-withdrawal-token-accounting branch from a571c30 to f264d86 Compare February 7, 2023 20:48
@jalextowle jalextowle force-pushed the jalextowle/hyperdrive/long-withdrawal-token-accounting branch from cc24c33 to 115cf8d Compare February 8, 2023 16:16
Base automatically changed from jalextowle/hyperdrive/long-withdrawal-token-accounting to main February 8, 2023 16:18
Copy link
Contributor

@jrhea jrhea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jalextowle jalextowle merged commit a556981 into main Feb 8, 2023
@jalextowle jalextowle deleted the jalextowle/hyperdrive/short-withdrawal-token-accounting branch February 8, 2023 20:48
jrhea added a commit that referenced this pull request Feb 28, 2024
…773)

* Addressed the fix to the factory requested by Spearbit

* Update contracts/src/libraries/Constants.sol

---------

Co-authored-by: Jonny Rhea <5555162+jrhea@users.noreply.github.com>
jalextowle added a commit that referenced this pull request Feb 29, 2024
…773)

* Addressed the fix to the factory requested by Spearbit

* Update contracts/src/libraries/Constants.sol

---------

Co-authored-by: Jonny Rhea <5555162+jrhea@users.noreply.github.com>
jalextowle added a commit that referenced this pull request Feb 29, 2024
…773)

* Addressed the fix to the factory requested by Spearbit

* Update contracts/src/libraries/Constants.sol

---------

Co-authored-by: Jonny Rhea <5555162+jrhea@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants