-
Notifications
You must be signed in to change notification settings - Fork 424
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
feat: add fee detector #338
Conversation
b8ff275
to
913f64e
Compare
913f64e
to
0baee94
Compare
8ffaf8e
to
3c4aa2e
Compare
|
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, are we planning on deprecating the old token-validator-provider? Also, are we planning on adding this to AlphaRouter or just have it exported for use in i.e. frontend?
From the slack thread, it sounds like interface will use it as FOT workaround to begin with. routing team still evaluating whether we need to take on quoting FOT after we mitigate the quote latencies. |
The old one still serves a different purpose! it categorizes based on whether the token has a fee at all, or fails on transfer. It also allows checking against multiple bases, which doesn't make as much sense here because which fee would we show if it was different depending on the base |
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.
Appreciate you jumping on this @marktoda! Handful of comments, feel free to ping me for any questions; happy to elaborate.
return { | ||
getFeesByToken: (token: Token) => | ||
tokenToResult[token.address.toLowerCase()], | ||
}; | ||
} |
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'm also not a fan of returning anonymous functions as part of the response rather than objects of a specific class.
Could we instead do:
export class TokenFeeResults {
constructor(private readonly tokenToResult: { [tokenAddress: string]: TokenFeeResult }) {}
getFeesByToken(token: Token): TokenFeeResult | undefined {
return this.tokenToResult[token.address.toLowerCase()];
}
}
and here return:
return new TokenFeeResults(tokenToResult);
constructor( | ||
private chainId: ChainId, | ||
private multicall2Provider: IMulticallProvider, | ||
private tokenFeeCache: ICache<TokenFeeResult>, |
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.
As I'm working on the router backend support for FOT, I realized that this TokenFeeProvider
is tightly coupled with the in-memory ICache
. We will need both in-memory memory (for client-side fallback), as well as dynamo caching (for routing-api distributed caches).
I think I will create another PR, meanwhile leveraging the insights and feedbacks from this PR.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Other information: