-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support Pair default fee in RouterV2 #122
base: main
Are you sure you want to change the base?
Conversation
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.
LGTM
let fee = match contract_ref.call().get_fee().try_invoke() { | ||
Ok(Ok(fee)) => fee, | ||
// is not a Pair contract. | ||
let token_0 = match contract_ref.call().get_token_0().try_invoke() { |
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.
Why suddenly like this & why obtain token0 and token1 differently?
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.
Because the Pair
contract may not implement get_fee()
, however, it must implement get_token_0()
and get_token_1()
.
Given that get_token_0()
call is successful, we assume that the contract is a Pair
, and there's no need to control the invocation of the get_token_1()
.
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.
Thank you sir
No description provided.