-
Notifications
You must be signed in to change notification settings - Fork 139
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
base: develop
Are you sure you want to change the base?
Conversation
johngrantuk
commented
Feb 23, 2023
- 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
There was a problem hiding this 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", |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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', () => { |
There was a problem hiding this comment.
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?