Skip to content

Commit c62e667

Browse files
authored
Merge pull request #226 from keep-network/batched-phased-escrow-deploy
BatchedPhasedEscrow: final deployment script updates Closes #220 During the work on this PR I updated the deployment scenario in #200 and inspected all deployment scripts. The deployment script code should now reflect the scenario from #200 1:1. The following changes to the deployment scripts were applied: - `BatchedPhasedEscrow` is deployed - `CoveragePoolBeneficiary` is approved as a beneficiary in `BatchedPhasedEscrow` - `CoveragePoolBeneficiary`'s ownership is transferred to `BatchedPhasedEscrow` - `BatchedPhasedEscrow`'s drawee role is transferred to Threshold Council - `BatchedPhasedEscrow`'s ownership is transferred to Threshold Council Also, Hardhat network config for `mainnet` was added and the Treasury Guild address was set. Accidentally, I noticed the change from #225 broke the `README` structure. I fixed it in 8707a5b. **Testing** This PR was tested by commenting out all `func.skip` occurrences in the deployment scripts, and running `FORKING_URL="..." yarn deploy --network hardhat`. To make it work, you also need to uncomment this line: https://github.com/keep-network/coverage-pools/blob/0eab64d27020633620ed0a36e89bd92553ab5368/hardhat.config.ts#L87
2 parents d14e7a2 + 28d56aa commit c62e667

File tree

6 files changed

+73
-14
lines changed

6 files changed

+73
-14
lines changed

README.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ As a workaround, we advise changing Git configuration to use `https://` protocol
102102
instead of `git://` by executing:
103103
```
104104
git config --global url."https://".insteadOf git://
105+
```
105106

106107
=== Test contracts
107108

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { HardhatRuntimeEnvironment } from "hardhat/types"
2+
import { DeployFunction } from "hardhat-deploy/types"
3+
4+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5+
const { getNamedAccounts, deployments } = hre
6+
const { deployer } = await getNamedAccounts()
7+
8+
const T = await deployments.get("T")
9+
10+
const BatchedPhasedEscrow = await deployments.deploy("BatchedPhasedEscrow", {
11+
contract: "BatchedPhasedEscrow",
12+
from: deployer,
13+
args: [T.address],
14+
log: true,
15+
})
16+
17+
if (hre.network.tags.tenderly) {
18+
await hre.tenderly.verify({
19+
name: "BatchedPhasedEscrow",
20+
address: BatchedPhasedEscrow.address,
21+
})
22+
}
23+
}
24+
25+
export default func
26+
27+
func.tags = ["BatchedPhasedEscrow"]
28+
func.dependencies = ["T"]
29+
func.skip = async function (hre: HardhatRuntimeEnvironment): Promise<boolean> {
30+
return hre.network.name !== "mainnet"
31+
}

deploy/04_deploy_coverage_pool_beneficiary.ts renamed to deploy/05_deploy_coverage_pool_beneficiary.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { DeployFunction } from "hardhat-deploy/types"
33

44
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
55
const { getNamedAccounts, deployments, helpers } = hre
6-
const { read } = deployments
6+
const { execute, read } = deployments
77
const { deployer, rewardManager } = await getNamedAccounts()
88

99
const T = await deployments.get("T")
10-
// const BatchedPhasedEscrow = await deployments.get("BatchedPhasedEscrow")
10+
const BatchedPhasedEscrow = await deployments.get("BatchedPhasedEscrow")
1111

1212
const RewardsPoolAddress = await read("AssetPool", "rewardsPool")
1313

@@ -28,13 +28,18 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2828
})
2929
}
3030

31-
// TODO: depends on https://github.com/keep-network/coverage-pools/issues/220
32-
// and transfer the ownership
33-
// await helpers.ownable.transferOwnership(
34-
// "CoveragePoolBeneficiary",
35-
// BatchedPhasedEscrow.address,
36-
// deployer
37-
// )
31+
await execute(
32+
"BatchedPhasedEscrow",
33+
{ from: deployer, log: true },
34+
"approveBeneficiary",
35+
CoveragePoolBeneficiary.address
36+
)
37+
38+
await helpers.ownable.transferOwnership(
39+
"CoveragePoolBeneficiary",
40+
BatchedPhasedEscrow.address,
41+
deployer
42+
)
3843

3944
await helpers.ownable.transferOwnership(
4045
"RewardsPool",
@@ -46,7 +51,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
4651
export default func
4752

4853
func.tags = ["CoveragePoolBeneficiary"]
49-
func.dependencies = ["T", "AssetPool"]
54+
func.dependencies = ["T", "BatchedPhasedEscrow", "AssetPool"]
5055
func.skip = async function (hre: HardhatRuntimeEnvironment): Promise<boolean> {
5156
return hre.network.name !== "mainnet"
5257
}

deploy/06_transfer_ownership_to_t_council.ts renamed to deploy/07_transfer_ownership_to_t_council.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,22 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"
22
import { DeployFunction } from "hardhat-deploy/types"
33

44
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5-
const { getNamedAccounts, helpers } = hre
5+
const { getNamedAccounts, deployments, helpers } = hre
66
const { deployer, thresholdCouncil } = await getNamedAccounts()
7+
const { execute } = deployments
8+
9+
await execute(
10+
"BatchedPhasedEscrow",
11+
{ from: deployer, log: true },
12+
"setDrawee",
13+
thresholdCouncil
14+
)
15+
16+
await helpers.ownable.transferOwnership(
17+
"BatchedPhasedEscrow",
18+
thresholdCouncil,
19+
deployer
20+
)
721

822
await helpers.ownable.transferOwnership(
923
"CoveragePool",
@@ -15,7 +29,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1529
export default func
1630

1731
func.tags = ["TransferOwnership"]
18-
func.dependencies = ["CoveragePool"]
32+
func.dependencies = ["BatchedPhasedEscrow", "CoveragePool"]
1933
func.runAtTheEnd = true
2034
func.skip = async function (hre: HardhatRuntimeEnvironment): Promise<boolean> {
2135
return hre.network.name !== "mainnet"

hardhat.config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ const config: HardhatUserConfig = {
5151
: undefined,
5252
tags: ["tenderly"],
5353
},
54+
mainnet: {
55+
url: process.env.CHAIN_API_URL || "",
56+
chainId: 1,
57+
accounts: process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
58+
? [process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY]
59+
: undefined,
60+
tags: ["etherscan", "tenderly"],
61+
},
5462
},
5563
tenderly: {
5664
username: "thesis",
@@ -73,7 +81,7 @@ const config: HardhatUserConfig = {
7381
deployments: {
7482
// For hardhat environment we can fork the mainnet, so we need to point it
7583
// to the contract artifacts.
76-
// hardhat: ["./external/mainnet"],
84+
// hardhat: ["./external/mainnet-v2"],
7785
// For development environment we expect the local dependencies to be linked
7886
// with `yarn link` command.
7987
development: [
@@ -103,7 +111,7 @@ const config: HardhatUserConfig = {
103111
},
104112
treasuryGuild: {
105113
default: 3,
106-
mainnet: "0x0", // tbd
114+
mainnet: "0x71E47a4429d35827e0312AA13162197C23287546",
107115
},
108116
},
109117
mocha: {

0 commit comments

Comments
 (0)