Skip to content

Adding support for Abstract Layer 2 in sdk-core #377

@Jakub-Kliment

Description

@Jakub-Kliment

Dear Uniswap team,

Following up on this proposal: https://gov.uniswap.org/t/rfc-deploy-uniswap-v3-on-abstract/25206, I would like to propose adding support for the Abstract Layer 2 chain in the sdk-core package since all major contracts are already deployed and integrating Abstract would greatly facilitate development and adoption on this emerging L2.

Proposed changes:

  • add chain id in sdks/sdk-core/src/chains.ts
export enum ChainId {
  ...
  ABSTRACT = 2741,
}

export const SUPPORTED_CHAINS = [
  ...
  ChainId.ABSTRACT,
] as const
  • add the correct addresses based on the proposal (to be verified) in sdks/sdk-core/src/addresses.ts
...
export const V2_FACTORY_ADDRESSES: AddressMap = {
  ...
  [ChainId.ABSTRACT]: '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f',
}

export const V2_ROUTER_ADDRESSES: AddressMap = {
  ...
  [ChainId.ABSTRACT]: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
}

...

// v3 addresses on Abstract
const ABSTRACT_ADDRESSES: ChainAddresses = {
  v3CoreFactoryAddress: '0xA1160e73B63F322ae88cC2d8E700833e71D0b2a1',
  multicallAddress: '0x9CA4dcb2505fbf536F6c54AA0a77C79f4fBC35C0',
  quoterAddress: '0x117Fc8DEf58147016f92bAE713533dDB828aBB7e',

  nonfungiblePositionManagerAddress: '0xfA928D3ABc512383b8E5E77edd2d5678696084F9',
  tickLensAddress: '0x9c7d30F93812f143b6Efa673DB8448EfCB9f747E',
  swapRouter02Address: '0x2cB10Ac97F2C3dAEDEaB7b72DbaEb681891f51B8',
}

export const CHAIN_TO_ADDRESSES_MAP: Record<SupportedChainsType, ChainAddresses> = {
  ...
  [ChainId.ABSTRACT]: ABSTRACT_ADDRESSES,
}
  • add the WETH address on Abstract to sdks/sdk-core/src/entities/weth9.ts
export const WETH9: { [chainId: number]: Token } = {
  ...
  2741: new Token(2741, '0x3439153EB7AF838Ad19d56E1571FBD09333C2809', 18, 'WETH', 'Wrapped Ether'),
}

[EDIT]

  • add chain configuration for universal router in sdks/universal-router-sdk/utils/constants.ts
export const CHAIN_CONFIGS: { [key: number]: ChainConfig } = {
  ...
  // abstract
  [1]: {
    weth: '0x3439153EB7AF838Ad19d56E1571FBD09333C2809',
    routerConfigs: {
      [UniversalRouterVersion.V1_2]: {
        address: '0x0',
        creationBlock: 0,
      },
      [UniversalRouterVersion.V2_0]: {
        address: '0xE1b076ea612Db28a0d768660e4D81346c02ED75e',
        creationBlock: 66790,
      },
    },
  },
}
  • add chain id to switch of permit2Address in sdks/permit2-sdk/src/constants.ts
export function permit2Address(chainId?: number): string {
  switch (chainId) {
    case 324:
    case 2741:
      return '0x0000000000225e31D15943971F47aD3022F714Fa'
    default:
      return PERMIT2_ADDRESS
  }
}

Thanks for considering this integration!
Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions