Skip to content

Commit 597983c

Browse files
committed
feat: Multisig migration tenderly test | GBI-2702
1 parent 0b55744 commit 597983c

File tree

4 files changed

+115
-2
lines changed

4 files changed

+115
-2
lines changed

addresses.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,32 @@
4646
"deployed": false
4747
}
4848
},
49+
"tenderly": {
50+
"SignatureValidator": {
51+
"address": "0xb107cc96A5CfC4Be502e9BBB1208dE4792044ba7",
52+
"deployed": true
53+
},
54+
"Quotes": {
55+
"address": "0xecfF1feFa8814c980330ca1000B067BBC9D2ee25",
56+
"deployed": true
57+
},
58+
"BtcUtils": {
59+
"address": "0x48841b09CD720355F8EE5164DEeFbB30535d825a",
60+
"deployed": true
61+
},
62+
"LiquidityBridgeContract": {
63+
"address": "0xAA9cAf1e3967600578727F975F283446A3Da6612",
64+
"deployed": true
65+
},
66+
"Migrations": {
67+
"address": "0x22183DB087d1Fed621435d00aa9cac4B5CdC9aE1",
68+
"deployed": true
69+
},
70+
"QuotesV2": {
71+
"address": "0x0123eF8Ae46F9FCBF67c706f73d46bCCE3df44F7",
72+
"deployed": true
73+
}
74+
},
4975
"rskMainnet": {
5076
"SignatureValidator": {
5177
"address": "0xb107cc96A5CfC4Be502e9BBB1208dE4792044ba7",

e2e/multisig-migration.test.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
LiquidityBridgeContractV2,
1212
} from "../typechain-types";
1313
import { deployUpgradeLibraries } from "../scripts/deployment-utils/upgrade-proxy";
14+
import hre from "hardhat";
1415

1516
type 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

112180
async function checkForkedNetwork() {

hardhat.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ const config: HardhatUserConfig = {
5454
chainId: 30,
5555
accounts: getAccounts("mainnet"),
5656
},
57+
tenderly: {
58+
url: process.env.FORK_NETWORK_URL ?? "https://public-node.testnet.rsk.co",
59+
chainId: 30,
60+
timeout: rpcDefaultTimeout,
61+
},
5762
hardhat: {
5863
...(forkEnabled
5964
? {

multisig-owners.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,22 @@
2020
]
2121
},
2222
"rskMainnet": {
23-
"address": "",
24-
"owners": []
23+
"address": "0x633d1233ed6251108b61a8365ceed271bf3e3c9b",
24+
"owners": [
25+
"0xd50c4c5577229c81b19fe1c7d413c2d79ccf7901",
26+
"0x15105d3e5f7752f0f7ea0e7b1f3b113701080355",
27+
"0xa420af120ec6515870b65e811fa7ce147d491402",
28+
"0xa3fd0eedca5ba7504e19b7e0660f21d25fefe77f"
29+
]
30+
},
31+
"tenderly": {
32+
"address": "0x633d1233ed6251108b61a8365ceed271bf3e3c9b",
33+
"owners": [
34+
"0xd50c4c5577229c81b19fe1c7d413c2d79ccf7901",
35+
"0x15105d3e5f7752f0f7ea0e7b1f3b113701080355",
36+
"0xa420af120ec6515870b65e811fa7ce147d491402",
37+
"0xa3fd0eedca5ba7504e19b7e0660f21d25fefe77f"
38+
]
2539
},
2640
"hardhat": {
2741
"address": "",

0 commit comments

Comments
 (0)