@@ -3,7 +3,7 @@ import { UsePublicClientReturnType } from "wagmi";
3
3
4
4
const EIP_1967_LOGIC_SLOT = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc" as const ;
5
5
const EIP_1967_BEACON_SLOT = "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50" as const ;
6
- // const OPEN_ZEPPELIN_IMPLEMENTATION_SLOT = "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3";
6
+ const OPEN_ZEPPELIN_IMPLEMENTATION_SLOT = "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3" as const ;
7
7
const EIP_1822_LOGIC_SLOT = "0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7" as const ;
8
8
const EIP_1167_BEACON_METHODS = [
9
9
"0x5c60da1b00000000000000000000000000000000000000000000000000000000" ,
@@ -89,7 +89,21 @@ export const detectProxyTarget = async (proxyAddress: Address, client: UsePublic
89
89
throw new Error ( "Beacon method calls failed" ) ;
90
90
} ;
91
91
92
- const detectionMethods = [ detectUsingBytecode , detectUsingEIP1967LogicSlot , detectUsingEIP1967BeaconSlot ] ;
92
+ const detectUsingOpenZeppelinSlot = async ( ) => {
93
+ const implementationAddr = await client . getStorageAt ( {
94
+ address : proxyAddress ,
95
+ slot : OPEN_ZEPPELIN_IMPLEMENTATION_SLOT ,
96
+ } ) ;
97
+ const resolvedAddress = readAddress ( implementationAddr ) ;
98
+ return resolvedAddress ;
99
+ } ;
100
+
101
+ const detectionMethods = [
102
+ detectUsingBytecode ,
103
+ detectUsingEIP1967LogicSlot ,
104
+ detectUsingEIP1967BeaconSlot ,
105
+ detectUsingOpenZeppelinSlot ,
106
+ ] ;
93
107
94
108
try {
95
109
return await Promise . any ( detectionMethods . map ( method => method ( ) ) ) ;
0 commit comments