Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"version": "0.0.0",
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-ethers": "^3.0.7",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.1.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardhat-ethers v3 requires hardhat v2 and ethers v6.
There's also hardhat-ethers v4, but it requires hardhat v3.
ethereum-contracts package still uses ethers v5, thus has an overriding import of hardhat-ethers v2 which depends on ethers v5.

"@nomicfoundation/hardhat-verify": "^2.1.1",
"@nomiclabs/hardhat-web3": "^2.1.0",
"@openzeppelin/test-helpers": "^0.5.16",
"@truffle/hdwallet-provider": "^2.1.15",
"@typechain/ethers-v5": "^11.1.2",
Expand All @@ -23,8 +23,8 @@
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.2.1",
"hardhat": "^2.22.9",
"hardhat-deploy": "^0.12.4",
"hardhat": "^2.26.1",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this implies dropped node18 support. But with ethereum-contracts already having dropped that, should be ok.

"hardhat-deploy": "^1.0.4",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The switch from v0 to v1 did not come with API breakage according to the changelog

"husky": "^9.1.5",
"lerna": "^8.1.8",
"node-jq": "^6.0.1",
Expand Down
3 changes: 1 addition & 2 deletions packages/automation-contracts/autowrap/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

PRIVATE_KEY=

MUMBAI_URL=
POLYGON_URL=
BSC_URL=
OPSEPOLIA_URL=
BASE_URL=https://mainnet.base.org

ETHERSCAN_API_KEY=
ETHERSCAN_API_V2_KEY=
25 changes: 4 additions & 21 deletions packages/automation-contracts/autowrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ When your Super Token balance reaches a certain lower threshold, Auto Wrap steps

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

### Environment Variables

Expand All @@ -23,7 +24,7 @@ PRIVATE_KEY=
POLYGON_PRIVATE_KEY=
BSC_PRIVATE_KEY=

ETHERSCAN_API_KEY=
ETHERSCAN_API_V2_KEY=
```

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

#### Task - Add Approved Strategies to Manager contract

If you need to add strategies to the Scheduler, you can use the `addStrategy` task.

```bash
npx hardhat addStrategy --manager <manager_address> --strategy <strategy_address> --network <network>
```

The deploy script effectively burns the owner keys by calling `renounceOwnership()` on both contracts after deployment.

#### Deployed Contracts

#### Testnets
| | Manager | WrapStrategy |
|----------|--------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
| OP Sepolia | [0xe567b32C10B0dB72d9490eB1B9A409C5ADed192C](https://sepolia-optimism.etherscan.io/address/0xe567b32C10B0dB72d9490eB1B9A409C5ADed192C) | [0xf232f1fd34CE12e24F4391865c2D6E374D2C34d9](https://sepolia-optimism.etherscan.io/address/0xf232f1fd34CE12e24F4391865c2D6E374D2C34d9) |

#### Mainnets

| | Manager | WrapStrategy |
|---------|--------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| Polygon | [0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32](https://polygonscan.com/address/0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32#code) | [0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b](https://polygonscan.com/address/0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b#code) |
| BSC | [0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325](https://bscscan.com/address/0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325#code) | [0x9e308cb079ae130790F604b1030cDf386670f199](https://bscscan.com/address/0x9e308cb079ae130790F604b1030cDf386670f199#code) |

See [metadata/networks.json](../../metadata/networks.json)
34 changes: 28 additions & 6 deletions packages/automation-contracts/autowrap/deploy/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,35 @@ module.exports = async function ({ deployments, getNamedAccounts }) {
skipIfAlreadyDeployed: false,
});

// approve strategy on manager contract
await hre.run("addStrategy", {
manager: Manager.address,
strategy:WrapStrategy.address,
});
// Check if this is a fresh deployment or reusing existing contracts
const isFreshDeployment = Manager.newlyDeployed && WrapStrategy.newlyDeployed;

if (isFreshDeployment) {
console.log("Fresh deployment detected - executing additional setup steps...");

// approve strategy on manager contract directly
console.log("Adding strategy to manager...");
const managerContract = await hre.ethers.getContractAt("Manager", Manager.address);
const addStrategyTx = await managerContract.addApprovedStrategy(WrapStrategy.address);
await addStrategyTx.wait();
console.log(`Strategy added. Tx hash: ${addStrategyTx.hash}`);

// Renounce ownership on both contracts
console.log("Renouncing ownership on Manager contract...");
const renounceManagerTx = await managerContract.renounceOwnership();
await renounceManagerTx.wait();
console.log(`Manager ownership renounced. Tx hash: ${renounceManagerTx.hash}`);

console.log("Renouncing ownership on WrapStrategy contract...");
const wrapStrategyContract = await hre.ethers.getContractAt("WrapStrategy", WrapStrategy.address);
const renounceStrategyTx = await wrapStrategyContract.renounceOwnership();
await renounceStrategyTx.wait();
console.log(`WrapStrategy ownership renounced. Tx hash: ${renounceStrategyTx.hash}`);
} else {
console.log("Reusing existing contracts - skipping additional setup steps");
}

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

try {
Expand Down
20 changes: 7 additions & 13 deletions packages/automation-contracts/autowrap/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
require("dotenv").config();
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-etherscan");
require("@nomicfoundation/hardhat-verify");
require("hardhat-deploy");
require("hardhat/config");
require("./script/addStrategy");

// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
Expand Down Expand Up @@ -47,22 +46,22 @@ module.exports = {
? [process.env.PRIVATE_KEY]
: [],
},
"base-mainnet": {
base: {
url: process.env.BASE_URL || "",
accounts:
process.env.PRIVATE_KEY !== undefined
? [process.env.PRIVATE_KEY]
: [],
gasPrice: 1000000000,
},
},
namedAccounts: {
deployer: {
default: 0,
},
},
// see https://v2.hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
apiKey: process.env.ETHERSCAN_API_V2_KEY,
customChains: [
{
network: "opsepolia",
Expand All @@ -72,14 +71,9 @@ module.exports = {
browserURL: "https://sepolia-optimism.etherscan.io/",
},
},
{
network: "base-mainnet",
chainId: 8453,
urls: {
apiURL: "https://api.basescan.org/api",
browserURL: "https://basescan.org/",
},
},
],
},
sourcify: {
enabled: true,
},
};
18 changes: 0 additions & 18 deletions packages/automation-contracts/autowrap/script/addStrategy.js
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was simplified (inlined into the deploy script) because if burning the owner keys, there's no future path for adding more strategies.

This file was deleted.

5 changes: 2 additions & 3 deletions packages/automation-contracts/scheduler/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

PRIVATE_KEY=

MUMBAI_URL=
POLYGON_URL=
BSC_URL=
OPSEPOLIA_URL=
BASE_URL=https://mainnet.base.org
BASE_URL=
OPTIMISM_URL=

ETHERSCAN_API_KEY=
ETHERSCAN_API_V2_KEY=

DEPLOY_FLOW_SCHEDULER=
DEPLOY_VESTING_SCHEDULER=
Expand Down
4 changes: 2 additions & 2 deletions packages/automation-contracts/scheduler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BSC_PRIVATE_KEY=
POLYGON_URL=
BSC_URL=

ETHERSCAN_API_KEY=
ETHERSCAN_API_V2_KEY=
```

#### Run tests
Expand All @@ -51,7 +51,7 @@ npx hardhat deploy --network <network>

#### Deployed Contracts

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

In package version 1.3.0 VestingScheduler (v1) was removed, as it's not gonna be used for new production deployments.
Expand Down
19 changes: 7 additions & 12 deletions packages/automation-contracts/scheduler/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require("dotenv").config();
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-etherscan");
require("@nomicfoundation/hardhat-verify");
require("hardhat-deploy");
require("hardhat/config");

Expand Down Expand Up @@ -82,21 +82,21 @@ module.exports = {
: [],
},
base: {
url: process.env.BASE_URL || "",
url: process.env.BASE_URL || "https://mainnet.base.org",
accounts:
process.env.PRIVATE_KEY !== undefined
? [process.env.PRIVATE_KEY]
: [],
gasPrice: 1000000000,
},
},
namedAccounts: {
deployer: {
default: 0,
},
},
// see https://v2.hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
apiKey: process.env.ETHERSCAN_API_V2_KEY,
customChains: [
{
network: "opsepolia",
Expand All @@ -106,14 +106,9 @@ module.exports = {
browserURL: "https://sepolia-optimism.etherscan.io/",
},
},
{
network: "base-mainnet",
chainId: 8453,
urls: {
apiURL: "https://api.basescan.org/api",
browserURL: "https://basescan.org/",
},
},
],
},
sourcify: {
enabled: true,
},
};
4 changes: 2 additions & 2 deletions packages/ethereum-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"@truffle/contract": "4.6.31",
"ethereumjs-tx": "2.1.2",
"ethereumjs-util": "7.1.5",
"hardhat": "2.22.9"
"hardhat": "2.26.1"
},
"devDependencies": {
"@d10r/truffle-plugin-verify": "^0.6.11",
"@nomiclabs/hardhat-truffle5": "^2.0.7",
"@nomiclabs/hardhat-truffle5": "^2.1.0",
"@safe-global/safe-core-sdk": "^3.3.5",
"@safe-global/safe-service-client": "^2.0.3",
"@safe-global/safe-web3-lib": "^1.9.4",
Expand Down
Loading
Loading