Skip to content

Commit

Permalink
feat(permit2-sdk): support zksync permit2 address (#37)
Browse files Browse the repository at this point in the history
## Description

Zksync permit2 address is not 0x0000000000225e31d15943971f47ad3022f714fa, due to different create2 address computation in its zkevm. Updating permit2-sdk to support zksync.

## How Has This Been Tested?

Will test in SOR.

## Are there any breaking changes?

Not really, but we are soft deprecating the `PERMIT2_ADDRESS` constant.

## (Optional) Feedback Focus

No

## (Optional) Follow Ups

No
  • Loading branch information
jsy1218 authored Jun 7, 2024
1 parent 1d75996 commit 57ba07a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sdks/permit2-sdk/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { BigNumber } from '@ethersproject/bignumber'

// @deprecated please use permit2Address(chainId: number)
export const PERMIT2_ADDRESS = '0x000000000022D473030F116dDEE9F6B43aC78BA3'

export function permit2Address(chainId?: number): string {
switch (chainId) {
case 324:
return '0x0000000000225e31D15943971F47aD3022F714Fa'
default:
return PERMIT2_ADDRESS
}
}

export const MaxUint48 = BigNumber.from('0xffffffffffff')
export const MaxUint160 = BigNumber.from('0xffffffffffffffffffffffffffffffffffffffff')
export const MaxUint256 = BigNumber.from('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')
Expand Down

0 comments on commit 57ba07a

Please sign in to comment.