Commit adea1c40 authored by kf's avatar kf Committed by Kelvin Fichter

fix: correctly transform uni mainnet multicall contract

parent a38d2658
......@@ -3,6 +3,7 @@ import {
UNISWAP_V3_FACTORY_ADDRESS,
UNISWAP_V3_NFPM_ADDRESS,
UNISWAP_V3_CONTRACT_ADDRESSES,
UNISWAP_V3_MAINNET_MULTICALL,
PREDEPLOY_WIPE_ADDRESSES,
PREDEPLOY_NO_WIPE_ADDRESSES,
PREDEPLOY_NEW_NOT_ETH_ADDRESSES,
......@@ -67,6 +68,9 @@ export const classifiers: {
[AccountType.UNISWAP_V3_NFPM]: (account) => {
return hexStringEqual(account.address, UNISWAP_V3_NFPM_ADDRESS)
},
[AccountType.UNISWAP_V3_MAINNET_MULTICALL]: (account) => {
return hexStringEqual(account.address, UNISWAP_V3_MAINNET_MULTICALL)
},
[AccountType.UNISWAP_V3_POOL]: (account, data) => {
return data.pools.some((pool) => {
return hexStringEqual(pool.oldAddress, account.address)
......
......@@ -35,10 +35,14 @@ export const UNISWAP_V3_CONTRACT_ADDRESSES = [
'0xC36442b4a4522E871399CD717aBDD847Ab11FE88',
// UniswapInterfaceMulticall (OP KOVAN)
'0x1F98415757620B543A52E61c46B32eB19261F984',
// UniswapInterfaceMulticall (OP MAINNET)
'0x90f872b3d8f33f305e0250db6A2761B354f7710A',
]
export const UNISWAP_V3_KOVAN_MULTICALL =
'0x1F98415757620B543A52E61c46B32eB19261F984'
export const UNISWAP_V3_MAINNET_MULTICALL =
'0x90f872b3d8f33f305e0250db6A2761B354f7710A'
export const PREDEPLOY_WIPE_ADDRESSES = [
// L2CrossDomainMessenger
'0x4200000000000000000000000000000000000007',
......
......@@ -5,7 +5,11 @@ import {
POOL_INIT_CODE_HASH_OPTIMISM_KOVAN,
} from '@uniswap/v3-sdk'
import { sleep, add0x, remove0x, clone } from '@eth-optimism/core-utils'
import { OLD_ETH_ADDRESS, WETH_TRANSFER_ADDRESSES } from './constants'
import {
OLD_ETH_ADDRESS,
WETH_TRANSFER_ADDRESSES,
UNISWAP_V3_KOVAN_MULTICALL,
} from './constants'
import {
findAccount,
hexStringIncludes,
......@@ -226,6 +230,20 @@ export const handlers: {
code: poolCode,
}
},
[AccountType.UNISWAP_V3_MAINNET_MULTICALL]: async (account, data) => {
// When upgrading mainnet, we want to get rid of the old multicall contract and introduce a new
// multicall contract at the OP Kovan address (also the ETH mainnet address). By changing the
// address here and piping into the UNISWAP_V3_OTHER handler, we:
// (1) Get the state of the old multicall but with the new address
// (2) Query the code using the new address (required)
return handlers[AccountType.UNISWAP_V3_OTHER](
{
...account,
address: UNISWAP_V3_KOVAN_MULTICALL,
},
data
)
},
[AccountType.UNISWAP_V3_OTHER]: async (account, data) => {
let code = await data.ethProvider.getCode(account.address)
......
......@@ -55,6 +55,7 @@ export enum AccountType {
PREDEPLOY_WETH,
UNISWAP_V3_FACTORY,
UNISWAP_V3_NFPM,
UNISWAP_V3_MAINNET_MULTICALL,
UNISWAP_V3_POOL,
UNISWAP_V3_OTHER,
UNVERIFIED,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment