Skip to content

Stable Pools Refactors#367

Open
johngrantuk wants to merge 7 commits intodevelopfrom
bignumber-improvements
Open

Stable Pools Refactors#367
johngrantuk wants to merge 7 commits intodevelopfrom
bignumber-improvements

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. 😃

"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.

);
}

_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! 👍

});
});
});
// 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