Skip to content

Commit

Permalink
updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aalavandhan committed Nov 7, 2024
1 parent 3a7eec8 commit 5689d1e
Show file tree
Hide file tree
Showing 12 changed files with 1,201 additions and 1,790 deletions.
2 changes: 1 addition & 1 deletion spot-vaults/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"ethers": "^6.6.0",
"ethers-v5": "npm:ethers@^5.7.0",
"ganache-cli": "latest",
"hardhat": "^2.22.8",
"hardhat": "^2.22.10",
"hardhat-gas-reporter": "latest",
"lodash": "^4.17.21",
"prettier": "^2.7.1",
Expand Down
53 changes: 46 additions & 7 deletions spot-vaults/tasks/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ import { TaskArguments } from "hardhat/types";
import { sleep } from "./tools";

task("validate_upgrade")
.addPositionalParam("factory", "the name of the factory", undefined, types.string, false)
.addPositionalParam("address", "the address of the deployed proxy contract", undefined, types.string, false)
.addPositionalParam(
"factory",
"the name of the factory",
undefined,
types.string,
false,
)
.addPositionalParam(
"address",
"the address of the deployed proxy contract",
undefined,
types.string,
false,
)
.setAction(async function (args: TaskArguments, hre) {
const { factory, address } = args;
const Factory = await hre.ethers.getContractFactory(factory);
Expand All @@ -23,8 +35,20 @@ task("validate_upgrade")
});

task("prepare_upgrade")
.addPositionalParam("factory", "the name of the factory", undefined, types.string, false)
.addPositionalParam("address", "the address of the deployed proxy contract", undefined, types.string, false)
.addPositionalParam(
"factory",
"the name of the factory",
undefined,
types.string,
false,
)
.addPositionalParam(
"address",
"the address of the deployed proxy contract",
undefined,
types.string,
false,
)
.addParam("fromIdx", "the index of sender", 0, types.int)
.setAction(async function (args: TaskArguments, hre) {
const { factory, address } = args;
Expand Down Expand Up @@ -52,8 +76,20 @@ task("prepare_upgrade")
});

task("upgrade:testnet")
.addPositionalParam("factory", "the name of the factory", undefined, types.string, false)
.addPositionalParam("address", "the address of the deployed proxy contract", undefined, types.string, false)
.addPositionalParam(
"factory",
"the name of the factory",
undefined,
types.string,
false,
)
.addPositionalParam(
"address",
"the address of the deployed proxy contract",
undefined,
types.string,
false,
)
.addParam("fromIdx", "the index of sender", 0, types.int)
.setAction(async function (args: TaskArguments, hre) {
const signer = (await hre.ethers.getSigners())[args.fromIdx];
Expand All @@ -64,7 +100,10 @@ task("upgrade:testnet")
const Factory = await hre.ethers.getContractFactory(factory);

console.log("Proxy", address);
console.log("Current implementation", await getImplementationAddress(hre.ethers.provider, address));
console.log(
"Current implementation",
await getImplementationAddress(hre.ethers.provider, address),
);

const impl = await hre.upgrades.upgradeProxy(address, Factory, {
unsafeAllowRenames: true,
Expand Down
Loading

0 comments on commit 5689d1e

Please sign in to comment.