Skip to content

Commit 4e3bf87

Browse files
authored
[AUTOMATION] deploy autowrap with burned owner keys, switch to hardhat-verify (#2104)
1 parent 0a841a1 commit 4e3bf87

File tree

24 files changed

+375
-259
lines changed

24 files changed

+375
-259
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"version": "0.0.0",
55
"devDependencies": {
66
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
7-
"@nomicfoundation/hardhat-ethers": "^3.0.7",
8-
"@nomiclabs/hardhat-etherscan": "^3.1.7",
9-
"@nomiclabs/hardhat-web3": "^2.0.0",
7+
"@nomicfoundation/hardhat-ethers": "^3.1.0",
8+
"@nomicfoundation/hardhat-verify": "^2.1.1",
9+
"@nomiclabs/hardhat-web3": "^2.1.0",
1010
"@openzeppelin/test-helpers": "^0.5.16",
1111
"@truffle/hdwallet-provider": "^2.1.15",
1212
"@typechain/ethers-v5": "^11.1.2",
@@ -23,8 +23,8 @@
2323
"eslint-plugin-eslint-comments": "^3.2.0",
2424
"eslint-plugin-import": "^2.29.1",
2525
"eslint-plugin-prettier": "^5.2.1",
26-
"hardhat": "^2.22.9",
27-
"hardhat-deploy": "^0.12.4",
26+
"hardhat": "^2.26.1",
27+
"hardhat-deploy": "^1.0.4",
2828
"husky": "^9.1.5",
2929
"lerna": "^8.1.8",
3030
"node-jq": "^6.0.1",

packages/automation-contracts/autowrap/.env.example

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
PRIVATE_KEY=
44

5-
MUMBAI_URL=
65
POLYGON_URL=
76
BSC_URL=
87
OPSEPOLIA_URL=
98
BASE_URL=https://mainnet.base.org
109

11-
ETHERSCAN_API_KEY=
10+
ETHERSCAN_API_V2_KEY=

packages/automation-contracts/autowrap/README.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ When your Super Token balance reaches a certain lower threshold, Auto Wrap steps
1010

1111
- Auto Wrap uses [Foundry](https://github.com/gakonst/foundry#installation) as the development framework.
1212
- [Yarn](https://github.com/yarnpkg/yarn) is used as the package manager.
13+
- [Hardhat v2](https://v2.hardhat.org/) is used for deployment
1314

1415
### Environment Variables
1516

@@ -23,7 +24,7 @@ PRIVATE_KEY=
2324
POLYGON_PRIVATE_KEY=
2425
BSC_PRIVATE_KEY=
2526

26-
ETHERSCAN_API_KEY=
27+
ETHERSCAN_API_V2_KEY=
2728
```
2829

2930
#### Run tests
@@ -43,26 +44,8 @@ Deploy script also calls `addStrategy` task to add the strategy to the Scheduler
4344
npx hardhat deploy --network <network>
4445
```
4546

46-
#### Task - Add Approved Strategies to Manager contract
47-
48-
If you need to add strategies to the Scheduler, you can use the `addStrategy` task.
49-
50-
```bash
51-
npx hardhat addStrategy --manager <manager_address> --strategy <strategy_address> --network <network>
52-
```
53-
47+
The deploy script effectively burns the owner keys by calling `renounceOwnership()` on both contracts after deployment.
5448

5549
#### Deployed Contracts
5650

57-
#### Testnets
58-
| | Manager | WrapStrategy |
59-
|----------|--------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
60-
| OP Sepolia | [0xe567b32C10B0dB72d9490eB1B9A409C5ADed192C](https://sepolia-optimism.etherscan.io/address/0xe567b32C10B0dB72d9490eB1B9A409C5ADed192C) | [0xf232f1fd34CE12e24F4391865c2D6E374D2C34d9](https://sepolia-optimism.etherscan.io/address/0xf232f1fd34CE12e24F4391865c2D6E374D2C34d9) |
61-
62-
#### Mainnets
63-
64-
| | Manager | WrapStrategy |
65-
|---------|--------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
66-
| Polygon | [0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32](https://polygonscan.com/address/0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32#code) | [0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b](https://polygonscan.com/address/0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b#code) |
67-
| BSC | [0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325](https://bscscan.com/address/0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325#code) | [0x9e308cb079ae130790F604b1030cDf386670f199](https://bscscan.com/address/0x9e308cb079ae130790F604b1030cDf386670f199#code) |
68-
51+
See [metadata/networks.json](../../metadata/networks.json)

packages/automation-contracts/autowrap/deploy/deploy.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,35 @@ module.exports = async function ({ deployments, getNamedAccounts }) {
4545
skipIfAlreadyDeployed: false,
4646
});
4747

48-
// approve strategy on manager contract
49-
await hre.run("addStrategy", {
50-
manager: Manager.address,
51-
strategy:WrapStrategy.address,
52-
});
48+
// Check if this is a fresh deployment or reusing existing contracts
49+
const isFreshDeployment = Manager.newlyDeployed && WrapStrategy.newlyDeployed;
50+
51+
if (isFreshDeployment) {
52+
console.log("Fresh deployment detected - executing additional setup steps...");
53+
54+
// approve strategy on manager contract directly
55+
console.log("Adding strategy to manager...");
56+
const managerContract = await hre.ethers.getContractAt("Manager", Manager.address);
57+
const addStrategyTx = await managerContract.addApprovedStrategy(WrapStrategy.address);
58+
await addStrategyTx.wait();
59+
console.log(`Strategy added. Tx hash: ${addStrategyTx.hash}`);
60+
61+
// Renounce ownership on both contracts
62+
console.log("Renouncing ownership on Manager contract...");
63+
const renounceManagerTx = await managerContract.renounceOwnership();
64+
await renounceManagerTx.wait();
65+
console.log(`Manager ownership renounced. Tx hash: ${renounceManagerTx.hash}`);
66+
67+
console.log("Renouncing ownership on WrapStrategy contract...");
68+
const wrapStrategyContract = await hre.ethers.getContractAt("WrapStrategy", WrapStrategy.address);
69+
const renounceStrategyTx = await wrapStrategyContract.renounceOwnership();
70+
await renounceStrategyTx.wait();
71+
console.log(`WrapStrategy ownership renounced. Tx hash: ${renounceStrategyTx.hash}`);
72+
} else {
73+
console.log("Reusing existing contracts - skipping additional setup steps");
74+
}
5375

54-
// wait for 15 seconds to allow etherscan to indexed the contracts
76+
console.log("Giving the explorer(s) 15 seconds to index before verification...");
5577
await sleep(15000);
5678

5779
try {

packages/automation-contracts/autowrap/hardhat.config.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
require("dotenv").config();
22
require("@nomiclabs/hardhat-ethers");
3-
require("@nomiclabs/hardhat-etherscan");
3+
require("@nomicfoundation/hardhat-verify");
44
require("hardhat-deploy");
55
require("hardhat/config");
6-
require("./script/addStrategy");
76

87
// You need to export an object to set up your config
98
// Go to https://hardhat.org/config/ to learn more
@@ -47,22 +46,22 @@ module.exports = {
4746
? [process.env.PRIVATE_KEY]
4847
: [],
4948
},
50-
"base-mainnet": {
49+
base: {
5150
url: process.env.BASE_URL || "",
5251
accounts:
5352
process.env.PRIVATE_KEY !== undefined
5453
? [process.env.PRIVATE_KEY]
5554
: [],
56-
gasPrice: 1000000000,
5755
},
5856
},
5957
namedAccounts: {
6058
deployer: {
6159
default: 0,
6260
},
6361
},
62+
// see https://v2.hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify
6463
etherscan: {
65-
apiKey: process.env.ETHERSCAN_API_KEY,
64+
apiKey: process.env.ETHERSCAN_API_V2_KEY,
6665
customChains: [
6766
{
6867
network: "opsepolia",
@@ -72,14 +71,9 @@ module.exports = {
7271
browserURL: "https://sepolia-optimism.etherscan.io/",
7372
},
7473
},
75-
{
76-
network: "base-mainnet",
77-
chainId: 8453,
78-
urls: {
79-
apiURL: "https://api.basescan.org/api",
80-
browserURL: "https://basescan.org/",
81-
},
82-
},
8374
],
8475
},
76+
sourcify: {
77+
enabled: true,
78+
},
8579
};

packages/automation-contracts/autowrap/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"devDependencies": {
66
"@openzeppelin/contracts": "^4.9.6",
77
"@superfluid-finance/ethereum-contracts": "^1.13.0",
8-
"@superfluid-finance/metadata": "^1.6.0"
8+
"@superfluid-finance/metadata": "^1.6.1"
99
},
1010
"license": "MIT",
1111
"scripts": {

packages/automation-contracts/autowrap/script/addStrategy.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/automation-contracts/default.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
./autowrap/package.json
1212
./autowrap/contracts
1313
./autowrap/test
14-
./autowrap/script
1514
./autowrap/.solhint.json
1615
# scheduler
1716
./scheduler/foundry.toml

packages/automation-contracts/scheduler/.env.example

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
PRIVATE_KEY=
44

5-
MUMBAI_URL=
65
POLYGON_URL=
76
BSC_URL=
87
OPSEPOLIA_URL=
9-
BASE_URL=https://mainnet.base.org
8+
BASE_URL=
109
OPTIMISM_URL=
1110

12-
ETHERSCAN_API_KEY=
11+
ETHERSCAN_API_V2_KEY=
1312

1413
DEPLOY_FLOW_SCHEDULER=
1514
DEPLOY_VESTING_SCHEDULER=

packages/automation-contracts/scheduler/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ BSC_PRIVATE_KEY=
3030
POLYGON_URL=
3131
BSC_URL=
3232

33-
ETHERSCAN_API_KEY=
33+
ETHERSCAN_API_V2_KEY=
3434
```
3535

3636
#### Run tests
@@ -51,7 +51,7 @@ npx hardhat deploy --network <network>
5151

5252
#### Deployed Contracts
5353

54-
Contract addresses can be found in https://explorer.superfluid.finance/protocol, with the data source being `networks.json` in the metadata package.
54+
Contract addresses can be found in https://explorer.superfluid.finance/protocol, with the data source being [metadata/networks.json](../../metadata/networks.json).
5555
All current production deployments are based on the codebase found in version 1.2.0 of the scheduler package.
5656

5757
In package version 1.3.0 VestingScheduler (v1) was removed, as it's not gonna be used for new production deployments.

0 commit comments

Comments
 (0)