-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include tBTC reference in the Acre contract deployment scripts (#58)
Depends on #52 Acre contract requires tBTC address as argument. We add `00_resolve_tbtc.ts` script that will ensure tBTC deployment artifact reference is available based on the network. For networks marked with `allowStubs` tag (hardhat local network for running tests) a stub ERC20 contract will be deployed. Added a script `./scripts/fetch_external_artifacts.sh` that downloads TBTC token deployment artifact from NPM packages for sepolia and mainnet network and places them under `./external` directory where they will be used for contracts deployment.
- Loading branch information
Showing
14 changed files
with
1,718 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ pnpm-debug.log* | |
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
|
||
# Temporary directory | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ cache/ | |
deployments/ | ||
export.json | ||
export/ | ||
external/ | ||
typechain/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ cache/ | |
deployments/ | ||
export.json | ||
export/ | ||
external/ | ||
typechain/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { HardhatRuntimeEnvironment } from "hardhat/types" | ||
import type { DeployFunction } from "hardhat-deploy/types" | ||
import { isNonZeroAddress } from "../helpers/address" | ||
|
||
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { | ||
const { getNamedAccounts, deployments } = hre | ||
const { log } = deployments | ||
const { deployer } = await getNamedAccounts() | ||
|
||
const tbtc = await deployments.getOrNull("TBTC") | ||
|
||
if (tbtc && isNonZeroAddress(tbtc.address)) { | ||
log(`using TBTC contract at ${tbtc.address}`) | ||
} else if (!hre.network.tags.allowStubs) { | ||
throw new Error("deployed TBTC contract not found") | ||
} else { | ||
log("deploying TBTC contract stub") | ||
|
||
await deployments.deploy("TBTC", { | ||
contract: "TestERC20", | ||
from: deployer, | ||
log: true, | ||
waitConfirmations: 1, | ||
}) | ||
} | ||
} | ||
|
||
export default func | ||
|
||
func.tags = ["TBTC"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
import type { HardhatRuntimeEnvironment } from "hardhat/types" | ||
import type { DeployFunction } from "hardhat-deploy/types" | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployments } = hre | ||
const { log } = deployments | ||
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { | ||
const { getNamedAccounts, deployments } = hre | ||
const { deployer } = await getNamedAccounts() | ||
|
||
log("Deploying Acre contract") | ||
const tbtc = await deployments.get("TBTC") | ||
|
||
await deployments.deploy("Acre", { | ||
from: deployer, | ||
args: [tbtc.address], | ||
log: true, | ||
waitConfirmations: 1, | ||
}) | ||
|
||
// TODO: Add Etherscan verification | ||
// TODO: Add Tenderly verification | ||
} | ||
|
||
export default func | ||
|
||
func.tags = ["Acre"] | ||
func.dependencies = ["TBTC"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { HardhatRuntimeEnvironment } from "hardhat/types" | ||
import type { DeployFunction } from "hardhat-deploy/types" | ||
|
||
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { | ||
const { getNamedAccounts, deployments } = hre | ||
const { deployer, governance } = await getNamedAccounts() | ||
const { log } = deployments | ||
|
||
log(`transferring ownership of Acre contract to ${governance}`) | ||
|
||
await deployments.execute( | ||
"Acre", | ||
{ from: deployer, log: true, waitConfirmations: 1 }, | ||
"transferOwnership", | ||
governance, | ||
) | ||
} | ||
|
||
export default func | ||
|
||
func.tags = ["TransferOwnershipAcre"] | ||
// TODO: Enable once Acre extends Ownable | ||
func.skip = async () => true |
Oops, something went wrong.