Skip to content

Conversation

@jalextowle
Copy link
Contributor

@jalextowle jalextowle commented Feb 4, 2023

This PR adds a naive LP allocation scheme that is safe but not fair, and a withdrawal scheme that gives the withdrawing LP no exposure to returns on the open trades that they facilitated. These schemes can be summed up as:

  • Allocation: $\Delta l = \frac{\Delta z \cdot l}{z + \tfrac{b_y}{c} - \tfrac{b_x}{c}}$
  • Withdrawal: $\Delta z = (z - \tfrac{b_x}{c}) \cdot \frac{\Delta l}{l}$

Additionally, this PR brings in several contracts from the protocol_v2 repository that provides a way for ERC20 interfaces to be deployed over an ERC1155-like token. This is used instead of ERC1155Mintable and OpenZeppelin's ERC20 implementation.

@jalextowle jalextowle requested a review from jrhea February 4, 2023 23:26
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.

Just a few comments

@jalextowle jalextowle force-pushed the jalextowle/hyperdrive/simple-lp-scheme branch from 8265e34 to 4985591 Compare February 5, 2023 04:50
@jalextowle jalextowle changed the title Naive LP Scheme Naive LP Allocation and Withdrawal Schemes Feb 5, 2023
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 bf9d949 into main Feb 5, 2023
@jalextowle jalextowle deleted the jalextowle/hyperdrive/simple-lp-scheme branch February 5, 2023 04:56
jrhea added a commit that referenced this pull request Mar 4, 2024
…enBondsInDerivativeSafe` (#786)

* Avoid unnecessary subtraction in `calculateSharesOutGivenBondsInDerivativeSafe`

* Applied the fix on the other line

---------

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.

3 participants