Skip to content

Commit

Permalink
address comment review
Browse files Browse the repository at this point in the history
  • Loading branch information
cwsnt committed Dec 27, 2024
1 parent 6cf1274 commit 2f382bd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 28 deletions.
14 changes: 10 additions & 4 deletions hardhat/tasks/sips/args/sipArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1180,23 +1180,29 @@ const getArgsSip0084Part2 = async (hre) => {
return { args, governor: "GovernorOwner" };
};

const getArgsSIP0085 = async (hre) => {
const getArgsSip0086 = async (hre) => {
const {
ethers,
deployments: { get, log },
} = hre;

const abiCoder = new ethers.utils.AbiCoder();

const newBorrowerOperationsImplementation = await get("BorrowerOperations_Implementation");
const borrowerOperationsProxy = await get("BorrowerOperations_Proxy");
const borrowerOperationsProxy = await ethers.getContract("BorrowerOperations_Proxy");

/** SOV3564 Mynt */
const myntAdminProxy = await get("MyntAdminProxy");
const myntAdminProxy = await ethers.getContract("MyntAdminProxy");

const basketManagerProxy = await get("BasketManagerV3_Proxy");
const newBasketManagerImpl = await get("BasketManagerV3_Implementation");

const borrowerOperationsProxyOwner = await borrowerOperationsProxy.getOwner();
const myntAdminProxyOwner = await myntAdminProxy.owner();

const args = {
targets: [borrowerOperationsProxy.address, myntAdminProxy.address],
targetOwnerValidationAddresses: [borrowerOperationsProxyOwner, myntAdminProxyOwner],
values: [0, 0],
signatures: ["setImplementation(address)", "upgrade(address,address)"],
data: [
Expand Down Expand Up @@ -1235,5 +1241,5 @@ module.exports = {
getArgsSip0079,
getArgsSip0084Part1,
getArgsSip0084Part2,
getArgsSIP0085,
getArgsSip0086,
};
48 changes: 24 additions & 24 deletions tests-onchain/sip0085.test.js → tests-onchain/sip0086.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// first run a local forked mainnet node in a separate terminal window:
// npx hardhat node --fork https://mainnet-dev.sovryn.app/rpc --no-deploy
// now run the test:
// npx hardhat test tests-onchain/sip0085.test.js --network rskForkedMainnet
// npx hardhat test tests-onchain/sip0086.test.js --network rskForkedMainnet

const {
impersonateAccount,
Expand All @@ -26,7 +26,7 @@ const getImpersonatedSigner = async (addressToImpersonate) => {
return await ethers.getSigner(addressToImpersonate);
};

describe("SIP-0085 test onchain", () => {
describe("SIP-0086 test onchain", () => {
const getImpersonatedSignerFromJsonRpcProvider = async (addressToImpersonate) => {
const provider = new ethers.providers.JsonRpcProvider("http://localhost:8545");
await provider.send("hardhat_impersonateAccount", [addressToImpersonate]);
Expand All @@ -48,16 +48,16 @@ describe("SIP-0085 test onchain", () => {
const staking = await ethers.getContract("Staking", deployerSigner);
const sovrynProtocol = await ethers.getContract("SovrynProtocol", deployerSigner);

const god = await deployments.get("GovernorAdmin");
const governorAdmin = await ethers.getContractAt(
const god = await deployments.get("GovernorOwner");
const governorOwner = await ethers.getContractAt(
"GovernorAlpha",
god.address,
deployerSigner
);
const governorAdminSigner = await getImpersonatedSigner(god.address);
const governorOwnerSigner = await getImpersonatedSigner(god.address);

await setBalance(governorAdminSigner.address, ONE_RBTC);
const timelockOwner = await ethers.getContract("TimelockOwner", governorAdminSigner);
await setBalance(governorOwnerSigner.address, ONE_RBTC);
const timelockOwner = await ethers.getContract("TimelockOwner", governorOwnerSigner);

const timelockOwnerSigner = await getImpersonatedSignerFromJsonRpcProvider(
timelockOwner.address
Expand All @@ -70,17 +70,17 @@ describe("SIP-0085 test onchain", () => {
deployerSigner,
staking,
sovrynProtocol,
governorAdmin,
governorAdminSigner,
governorOwner,
governorOwnerSigner,
timelockOwner,
timelockOwnerSigner,
multisigAddress,
multisigSigner,
};
});

describe("SIP-0085 Test creation and execution", () => {
it("SIP-0085 is executable and valid", async () => {
describe("SIP-0086 Test creation and execution", () => {
it("SIP-0086 is executable and valid", async () => {
if (!hre.network.tags["forked"]) {
console.error("ERROR: Must run on a forked net");
return;
Expand All @@ -91,7 +91,7 @@ describe("SIP-0085 test onchain", () => {
{
forking: {
jsonRpcUrl: "https://mainnet-dev.sovryn.app/rpc",
blockNumber: 6926710,
blockNumber: 7057100,
},
},
],
Expand All @@ -101,7 +101,7 @@ describe("SIP-0085 test onchain", () => {
deployer,
deployerSigner,
staking,
governorAdmin,
governorOwner,
timelockOwnerSigner,
multisigAddress,
multisigSigner,
Expand All @@ -125,9 +125,9 @@ describe("SIP-0085 test onchain", () => {
await mine();

// CREATE PROPOSAL AND VERIFY
const proposalIdBeforeSIP = await governorAdmin.latestProposalIds(deployer);
await hre.run("sips:create", { argsFunc: "getArgsSip0085" });
const proposalId = await governorAdmin.latestProposalIds(deployer);
const proposalIdBeforeSIP = await governorOwner.latestProposalIds(deployer);
await hre.run("sips:create", { argsFunc: "getArgsSip0086" });
const proposalId = await governorOwner.latestProposalIds(deployer);
expect(
proposalId,
"Proposal was not created. Check the SIP creation is not commented out."
Expand All @@ -136,12 +136,12 @@ describe("SIP-0085 test onchain", () => {
// VOTE FOR PROPOSAL

await mine();
await governorAdmin.connect(deployerSigner).castVote(proposalId, true);
await governorOwner.connect(deployerSigner).castVote(proposalId, true);

// QUEUE PROPOSAL
let proposal = await governorAdmin.proposals(proposalId);
let proposal = await governorOwner.proposals(proposalId);
await mine(proposal.endBlock);
await governorAdmin.queue(proposalId);
await governorOwner.queue(proposalId);

const wrbtc = await ethers.getContract("WRBTC");
const priceFeeds = await ethers.getContract("PriceFeeds");
Expand All @@ -150,14 +150,14 @@ describe("SIP-0085 test onchain", () => {
console.log(`previous WRBTC priceFeeds: ${previousWrbtcPriceFeeds}`);

// EXECUTE PROPOSAL
proposal = await governorAdmin.proposals(proposalId);
proposal = await governorOwner.proposals(proposalId);
await time.increaseTo(proposal.eta);
await expect(governorAdmin.execute(proposalId))
.to.emit(governorAdmin, "ProposalExecuted")
await expect(governorOwner.execute(proposalId))
.to.emit(governorOwner, "ProposalExecuted")
.withArgs(proposalId);

// VERIFY execution
expect((await governorAdmin.proposals(proposalId)).executed).to.be.true;
expect((await governorOwner.proposals(proposalId)).executed).to.be.true;

// Validate zero contracts upgrade
const borrowerOperationsProxy = await ethers.getContract("BorrowerOperations_Proxy");
Expand All @@ -174,7 +174,7 @@ describe("SIP-0085 test onchain", () => {

expect(
await myntAdminProxy.getProxyImplementation(basketManagerProxy.address)
).to.equal(basketManagerImpl.implementation);
).to.equal(basketManagerImpl.address);
});
});
});

0 comments on commit 2f382bd

Please sign in to comment.