Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,32 @@
"deployed": false
}
},
"tenderly": {
"SignatureValidator": {
"address": "0xb107cc96A5CfC4Be502e9BBB1208dE4792044ba7",
"deployed": true
},
"Quotes": {
"address": "0xecfF1feFa8814c980330ca1000B067BBC9D2ee25",
"deployed": true
},
"BtcUtils": {
"address": "0x48841b09CD720355F8EE5164DEeFbB30535d825a",
"deployed": true
},
"LiquidityBridgeContract": {
"address": "0xAA9cAf1e3967600578727F975F283446A3Da6612",
"deployed": true
},
"Migrations": {
"address": "0x22183DB087d1Fed621435d00aa9cac4B5CdC9aE1",
"deployed": true
},
"QuotesV2": {
"address": "0x0123eF8Ae46F9FCBF67c706f73d46bCCE3df44F7",
"deployed": true
}
},
"rskMainnet": {
"SignatureValidator": {
"address": "0xb107cc96A5CfC4Be502e9BBB1208dE4792044ba7",
Expand Down
72 changes: 72 additions & 0 deletions e2e/multisig-migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
LiquidityBridgeContractV2,
} from "../typechain-types";
import { deployUpgradeLibraries } from "../scripts/deployment-utils/upgrade-proxy";
import hre from "hardhat";

type MultisigInfo = Record<
string,
Expand Down Expand Up @@ -50,6 +51,12 @@ describe("Should change LBC owner to the multisig.ts", function () {
await helpers.impersonateAccount(lbcOwner);
const impersonatedSigner = await ethers.getSigner(lbcOwner);

const desiredBalance = ethers.toQuantity(ethers.parseEther("100"));
await ethers.provider.send("hardhat_setBalance", [
impersonatedSigner.address,
desiredBalance,
]);

await expect(
changeMultisigOwner(safeAddress, networkName, impersonatedSigner)
).to.not.be.reverted;
Expand Down Expand Up @@ -107,6 +114,71 @@ describe("Should change LBC owner to the multisig.ts", function () {
);
await expect(newLbc.version()).to.eventually.be.equal("1.3.0");
});

it("Should change the owner using Tenderly", async () => {
await checkForkedNetwork();
const deploymentNetwork = hre.network.name;
const multisigAddress = multsigInfo[deploymentNetwork].address;
if (!multisigAddress || multisigAddress === "")
throw new Error("Multisig address not found for current network");

// Get the current owner of LiquidityBridgeContract
const deploymentData = read()[deploymentNetwork];
const proxyAddress = deploymentData.LiquidityBridgeContract.address;
if (!proxyAddress)
throw new Error(
`LiquidityBridgeContract address not found on network ${deploymentNetwork}`
);

const contract = await ethers.getContractAt(
"LiquidityBridgeContractV2",
proxyAddress
);
const currentOwner = await contract.owner();
console.info(`Current owner: ${currentOwner}`);

// Impersonate the current owner account
await helpers.impersonateAccount(currentOwner);
const impersonatedSigner = await ethers.getSigner(currentOwner);

// Set balance for the impersonated account
const desiredBalance = ethers.toQuantity(ethers.parseEther("100"));
await ethers.provider.send("hardhat_setBalance", [
impersonatedSigner.address,
desiredBalance,
]);

console.info(`Impersonated account: ${impersonatedSigner.address}`);

// Call changeMultisigOwner
await expect(
changeMultisigOwner(
multisigAddress,
deploymentNetwork,
impersonatedSigner
)
).to.not.be.reverted;

const newOwner = await contract.owner();
console.info(`New owner: ${newOwner}`);

// Verify ownership change
expect(newOwner.toLowerCase()).to.equal(multisigAddress.toLowerCase());

// Verify old owner can no longer perform owner functions
const adminAddress = await upgrades.erc1967.getAdminAddress(proxyAddress);
const adminContract = await ethers.getContractAt(
"LiquidityBridgeContractAdmin",
adminAddress
);
await expect(
adminContract.upgrade(proxyAddress, multisigAddress)
).to.revertedWith("Ownable: caller is not the owner");

console.info(
`Ownership of LiquidityBridgeContract proxy changed to multisig in ${deploymentNetwork}`
);
});
});

async function checkForkedNetwork() {
Expand Down
5 changes: 5 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ const config: HardhatUserConfig = {
chainId: 30,
accounts: getAccounts("mainnet"),
},
tenderly: {
url: process.env.FORK_NETWORK_URL ?? "https://public-node.testnet.rsk.co",
chainId: 30,
timeout: rpcDefaultTimeout,
},
hardhat: {
...(forkEnabled
? {
Expand Down
18 changes: 16 additions & 2 deletions multisig-owners.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,22 @@
]
},
"rskMainnet": {
"address": "",
"owners": []
"address": "0x633d1233ed6251108b61a8365ceed271bf3e3c9b",
"owners": [
"0xd50c4c5577229c81b19fe1c7d413c2d79ccf7901",
"0x15105d3e5f7752f0f7ea0e7b1f3b113701080355",
"0xa420af120ec6515870b65e811fa7ce147d491402",
"0xa3fd0eedca5ba7504e19b7e0660f21d25fefe77f"
]
},
"tenderly": {
"address": "0x633d1233ed6251108b61a8365ceed271bf3e3c9b",
"owners": [
"0xd50c4c5577229c81b19fe1c7d413c2d79ccf7901",
"0x15105d3e5f7752f0f7ea0e7b1f3b113701080355",
"0xa420af120ec6515870b65e811fa7ce147d491402",
"0xa3fd0eedca5ba7504e19b7e0660f21d25fefe77f"
]
},
"hardhat": {
"address": "",
Expand Down