Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make calc_withdraw_one_coin simulation consistent with _calc_withdraw_one_coin #86

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def remove_liquidity_imbalance(self, amounts):

def calc_withdraw_one_coin(self, token_amount, i):
xp = self.xp()
xp_reduced = xp
xp_reduced = list(xp)

Choose a reason for hiding this comment

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

thank you


D0 = self.D()
D1 = D0 - token_amount * D0 // self.tokens
Expand All @@ -166,6 +166,6 @@ def calc_withdraw_one_coin(self, token_amount, i):
self.x = [x // (p // 10 ** 18) for x, p in zip(xp_reduced, self.p)]
dy = xp_reduced[i] - self.y_D(i, D1)
self.x = [x // (p // 10 ** 18) for x, p in zip(xp, self.p)]
dy_0 = (xp[i] - new_y)
dy_0 = xp[i] - new_y

Choose a reason for hiding this comment

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

thank you


return dy, dy_0 - dy