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

Stable Pools Refactors #367

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

Stable Pools Refactors #367

wants to merge 7 commits into from

Conversation

johngrantuk
Copy link
Member

  • Refactor stable pools to reuse same logic and maths where possible.
  • Remove PhantomStable maths as it is no longer needed (replaced by just Stable math)
  • Should make it easier to do maths adjustments as mentioned here

Copy link
Member

@brunoguerios brunoguerios left a comment

Choose a reason for hiding this comment

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

I must say it's a bit hard to follow all those changes 😅
I added comments on some items that stood out, but big changes between classes I'd have to open both and compare side by side to be able to provide more relevant feedback.
In any way, extending/reusing classes make a lot of sense and it's nice to see that kind of change in the code. 😃

@@ -53,6 +52,7 @@
"eslint": "^7.32.0",
"eslint-plugin-mocha-no-only": "^1.1.1",
"eslint-plugin-prettier": "^3.4.1",
"ethers": "^5.7.2",
Copy link
Member

Choose a reason for hiding this comment

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

Considering we already have @ethersproject imports, do we really need ethers? I wasn't able to find where you're using it.

@@ -50,129 +46,28 @@ export class ComposableStablePool extends PhantomStablePool {
);
}

_exactTokenInForTokenOut(
Copy link
Member

Choose a reason for hiding this comment

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

Was that simply being duplicated from PhantomStablePool? Is that why we were able to simply remove them?

return ZERO;
}
handleScalingAndFeeTokenIn(
swapFee: BigNumber,
Copy link
Member

Choose a reason for hiding this comment

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

Is this part of an interface? Why do we need swapFee if it's not being used?

poolPairData: PhantomStablePoolPairData,
amount: OldBigNumber
handleScalingAndFeeTokenOut(
swapFee: BigNumber,
Copy link
Member

Choose a reason for hiding this comment

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

Same here

this.amp = parseFixed(amp, MetaStablePool.AMP_DECIMALS);
this.swapFee = parseFixed(swapFee, 18);
this.totalShares = parseFixed(totalShares, 18);
super(id, address, amp, swapFee, totalShares, tokens, tokensList);
Copy link
Member

Choose a reason for hiding this comment

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

Nice that we're able to reuse other classes! 👍

@@ -145,4 +154,46 @@ describe('MetaStable', () => {
});
});
});
// context('swaps', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need this commented test? Should we remove it?

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.

2 participants