Skip to content

Commit

Permalink
Update readmes for ethers v6
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau committed Jul 5, 2023
1 parent 51d655d commit bed84e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

```
npm install --save-dev @openzeppelin/hardhat-upgrades
npm install --save-dev '@nomiclabs/hardhat-ethers@^2.0.0' 'ethers@^5.0.0' # peer dependencies
npm install --save-dev @nomicfoundation/hardhat-ethers ethers # peer dependencies
```

```js
Expand Down Expand Up @@ -46,11 +46,11 @@ async function main() {
// Deploying
const Box = await ethers.getContractFactory("Box");
const instance = await upgrades.deployProxy(Box, [42]);
await instance.deployed();
await instance.waitForDeployment();

// Upgrading
const BoxV2 = await ethers.getContractFactory("BoxV2");
const upgraded = await upgrades.upgradeProxy(instance.address, BoxV2);
const upgraded = await upgrades.upgradeProxy(await instance.getAddress(), BoxV2);
}

main();
Expand All @@ -77,7 +77,7 @@ it('works before and after upgrading', async function () {
const instance = await upgrades.deployProxy(Box, [42]);
assert.strictEqual(await instance.retrieve(), 42);

await upgrades.upgradeProxy(instance.address, BoxV2);
await upgrades.upgradeProxy(instance, BoxV2);
assert.strictEqual(await instance.retrieve(), 42);
});
```
Expand Down
18 changes: 9 additions & 9 deletions packages/plugin-hardhat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

```
npm install --save-dev @openzeppelin/hardhat-upgrades
npm install --save-dev @nomiclabs/hardhat-ethers ethers # peer dependencies
npm install --save-dev @nomicfoundation/hardhat-ethers ethers # peer dependencies
```

And register the plugin in your [`hardhat.config.js`](https://hardhat.org/config/):
Expand All @@ -35,8 +35,8 @@ const { ethers, upgrades } = require("hardhat");
async function main() {
const Box = await ethers.getContractFactory("Box");
const box = await upgrades.deployProxy(Box, [42]);
await box.deployed();
console.log("Box deployed to:", box.address);
await box.waitForDeployment();
console.log("Box deployed to:", await box.getAddress());
}

main();
Expand Down Expand Up @@ -75,12 +75,12 @@ async function main() {
const Box = await ethers.getContractFactory("Box");

const beacon = await upgrades.deployBeacon(Box);
await beacon.deployed();
console.log("Beacon deployed to:", beacon.address);
await beacon.waitForDeployment();
console.log("Beacon deployed to:", await beacon.getAddress());

const box = await upgrades.deployBeaconProxy(beacon, Box, [42]);
await box.deployed();
console.log("Box deployed to:", box.address);
await box.waitForDeployment();
console.log("Box deployed to:", await box.getAddress());
}

main();
Expand Down Expand Up @@ -119,7 +119,7 @@ describe("Box", function() {
const BoxV2 = await ethers.getContractFactory("BoxV2");

const instance = await upgrades.deployProxy(Box, [42]);
const upgraded = await upgrades.upgradeProxy(instance.address, BoxV2);
const upgraded = await upgrades.upgradeProxy(await instance.getAddress(), BoxV2);

const value = await upgraded.value();
expect(value.toString()).to.equal('42');
Expand All @@ -141,7 +141,7 @@ describe("Box", function() {
const instance = await upgrades.deployBeaconProxy(beacon, Box, [42]);

await upgrades.upgradeBeacon(beacon, BoxV2);
const upgraded = BoxV2.attach(instance.address);
const upgraded = BoxV2.attach(await instance.getAddress());

const value = await upgraded.value();
expect(value.toString()).to.equal('42');
Expand Down

0 comments on commit bed84e0

Please sign in to comment.