@@ -11,6 +11,7 @@ import {
1111 LiquidityBridgeContractV2 ,
1212} from "../typechain-types" ;
1313import { deployUpgradeLibraries } from "../scripts/deployment-utils/upgrade-proxy" ;
14+ import hre from "hardhat" ;
1415
1516type MultisigInfo = Record <
1617 string ,
@@ -50,6 +51,12 @@ describe("Should change LBC owner to the multisig.ts", function () {
5051 await helpers . impersonateAccount ( lbcOwner ) ;
5152 const impersonatedSigner = await ethers . getSigner ( lbcOwner ) ;
5253
54+ const desiredBalance = ethers . toQuantity ( ethers . parseEther ( "100" ) ) ;
55+ await ethers . provider . send ( "hardhat_setBalance" , [
56+ impersonatedSigner . address ,
57+ desiredBalance ,
58+ ] ) ;
59+
5360 await expect (
5461 changeMultisigOwner ( safeAddress , networkName , impersonatedSigner )
5562 ) . to . not . be . reverted ;
@@ -107,6 +114,67 @@ describe("Should change LBC owner to the multisig.ts", function () {
107114 ) ;
108115 await expect ( newLbc . version ( ) ) . to . eventually . be . equal ( "1.3.0" ) ;
109116 } ) ;
117+
118+ it ( "Should change the owner using Tenderly" , async ( ) => {
119+ await checkForkedNetwork ( ) ;
120+ const deploymentNetwork = hre . network . name ;
121+ const multisigAddress =
122+ multsigInfo [ deploymentNetwork ] . address ;
123+ if ( ! multisigAddress || multisigAddress === "" )
124+ throw new Error ( "Multisig address not found for current network" ) ;
125+
126+ // Get the current owner of LiquidityBridgeContract
127+ const deploymentData = read ( ) [ deploymentNetwork ] ;
128+ const proxyAddress = deploymentData . LiquidityBridgeContract . address ;
129+ if ( ! proxyAddress )
130+ throw new Error (
131+ `LiquidityBridgeContract address not found on network ${ deploymentNetwork } `
132+ ) ;
133+
134+ const contract = await ethers . getContractAt (
135+ "LiquidityBridgeContractV2" ,
136+ proxyAddress
137+ ) ;
138+ const currentOwner = await contract . owner ( ) ;
139+ console . info ( `Current owner: ${ currentOwner } ` ) ;
140+
141+ // Impersonate the current owner account
142+ await helpers . impersonateAccount ( currentOwner ) ;
143+ const impersonatedSigner = await ethers . getSigner ( currentOwner ) ;
144+
145+ // Set balance for the impersonated account
146+ const desiredBalance = ethers . toQuantity ( ethers . parseEther ( "100" ) ) ;
147+ await ethers . provider . send ( "hardhat_setBalance" , [
148+ impersonatedSigner . address ,
149+ desiredBalance ,
150+ ] ) ;
151+
152+ console . info ( `Impersonated account: ${ impersonatedSigner . address } ` ) ;
153+
154+ // Call changeMultisigOwner
155+ await expect (
156+ changeMultisigOwner (
157+ multisigAddress ,
158+ deploymentNetwork ,
159+ impersonatedSigner
160+ )
161+ ) . to . not . be . reverted ;
162+
163+ const newOwner = await contract . owner ( ) ;
164+ console . info ( `New owner: ${ newOwner } ` ) ;
165+
166+ // Verify ownership change
167+ expect ( newOwner . toLowerCase ( ) ) . to . equal ( multisigAddress . toLowerCase ( ) ) ;
168+
169+ // Verify old owner can no longer perform owner functions
170+ await expect (
171+ contract . connect ( impersonatedSigner ) . setProviderStatus ( 1 , false )
172+ ) . to . be . revertedWith ( "LBC005" ) ;
173+
174+ console . info (
175+ `Ownership of LiquidityBridgeContract proxy changed to multisig in ${ deploymentNetwork } `
176+ ) ;
177+ } ) ;
110178} ) ;
111179
112180async function checkForkedNetwork ( ) {
0 commit comments