-
Notifications
You must be signed in to change notification settings - Fork 101
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
fix(permit): add support for usdc mainnet #3231
Changes from all commits
2290c66
d9703c4
c08c353
eb81428
e24f03a
020e7e8
458d259
86e48b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,14 @@ export async function buildEip2162PermitCallData({ | |
eip2162Utils, | ||
callDataParams, | ||
}: BuildEip2162PermitCallDataParams): Promise<string> { | ||
const callData = await eip2162Utils.buildPermitCallData(...callDataParams) | ||
// TODO: this is ugly and I'm not happy with it either | ||
// It'll probably go away when the tokens overhaul is implemented | ||
// For now, this is a problem for favourite tokens cached locally with the hardcoded name for USDC token | ||
// Using the wrong name breaks the signature. | ||
const [permitParams, chainId, _tokenName, ...rest] = callDataParams | ||
const tokenName = _tokenName === 'USD//C' ? 'USD Coin' : _tokenName | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😅 |
||
|
||
const callData = await eip2162Utils.buildPermitCallData(permitParams, chainId, tokenName, ...rest) | ||
// For some reason, the method above removes the permit selector prefix | ||
// https://github.com/1inch/permit-signed-approvals-utils/blob/master/src/eip-2612-permit.utils.ts#L92 | ||
// Adding it back | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,14 +23,14 @@ export const USDC_MAINNET = new Token( | |
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', | ||
6, | ||
'USDC', | ||
'USD//C' | ||
'USD Coin' | ||
) | ||
export const USDC_GOERLI = new Token( | ||
SupportedChainId.GOERLI, | ||
'0x07865c6e87b9f70255377e024ace6630c1eaa37f', | ||
6, | ||
'USDC', | ||
'USD//C' | ||
'USD Coin' | ||
Comment on lines
-26
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved hackishly by mapping token name |
||
) | ||
export const DAI = new Token( | ||
SupportedChainId.MAINNET, | ||
|
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.
Sorry, I didn't get the problem. I see DAI contract returns version=1, where do we get version=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.
I don't know where it comes from!
But that's what we get when calling the
version
method 🤷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.
It's very odd. I really see that version=2 in the JSON rpc response