@@ -26,13 +26,16 @@ export async function upgradeProxy(
26
26
const upgradeTo = await getUpgrader ( provider , Contract , proxyAddress ) ;
27
27
const { impl : nextImpl } = await deployProxyImpl ( Contract , opts , proxyAddress ) ;
28
28
const call = encodeCall ( Contract , opts . call ) ;
29
- await upgradeTo ( nextImpl , call ) ;
29
+ const { tx : txHash } = await upgradeTo ( nextImpl , call ) ;
30
30
31
31
Contract . address = proxyAddress ;
32
- return new Contract ( proxyAddress ) ;
32
+ Contract . transactionHash = txHash ;
33
+ const contract = new Contract ( proxyAddress ) ;
34
+ contract . transactionHash = txHash ;
35
+ return contract ;
33
36
}
34
37
35
- type Upgrader = ( nextImpl : string , call ?: string ) => Promise < void > ;
38
+ type Upgrader = ( nextImpl : string , call ?: string ) => Promise < { tx : string } > ;
36
39
37
40
async function getUpgrader (
38
41
provider : EthereumProvider ,
@@ -47,7 +50,9 @@ async function getUpgrader(
47
50
const TransparentUpgradeableProxyFactory = getTransparentUpgradeableProxyFactory ( contractTemplate ) ;
48
51
const proxy = new TransparentUpgradeableProxyFactory ( proxyAddress ) ;
49
52
50
- return ( nextImpl , call ) => ( call ? proxy . upgradeToAndCall ( nextImpl , call ) : proxy . upgradeTo ( nextImpl ) ) ;
53
+ return ( nextImpl , call ) => {
54
+ return call ? proxy . upgradeToAndCall ( nextImpl , call ) : proxy . upgradeTo ( nextImpl ) ;
55
+ } ;
51
56
} else {
52
57
// Admin contract: redirect upgrade call through it
53
58
const manifest = await Manifest . forNetwork ( provider ) ;
@@ -59,8 +64,9 @@ async function getUpgrader(
59
64
throw new Error ( 'Proxy admin is not the one registered in the network manifest' ) ;
60
65
}
61
66
62
- return ( nextImpl , call ) =>
63
- call ? admin . upgradeAndCall ( proxyAddress , nextImpl , call ) : admin . upgrade ( proxyAddress , nextImpl ) ;
67
+ return ( nextImpl , call ) => {
68
+ return call ? admin . upgradeAndCall ( proxyAddress , nextImpl , call ) : admin . upgrade ( proxyAddress , nextImpl ) ;
69
+ } ;
64
70
}
65
71
}
66
72
0 commit comments