Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
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
21 changes: 12 additions & 9 deletions solidity/deploy/00_resolve_relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { log } = deployments
const { deployer } = await getNamedAccounts()

const Relay = await deployments.getOrNull("Relay")
const BitcoinRelay = await deployments.getOrNull("BitcoinRelay")

if (Relay && helpers.address.isValid(Relay.address)) {
log(`using external Relay at ${Relay.address}`)
if (BitcoinRelay && helpers.address.isValid(BitcoinRelay.address)) {
log(`using external BitcoinRelay at ${BitcoinRelay.address}`)
} else if (
!hre.network.tags.allowStubs ||
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled
// TODO: Temporarily deploy a stub for Goerli network.
hre.network.name !== "goerli" &&
(!hre.network.tags.allowStubs ||
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled)
) {
throw new Error("deployed Relay contract not found")
throw new Error("deployed BitcoinRelay contract not found")
} else {
log("deploying Relay stub")
log("deploying BitcoinRelay stub")

await deployments.deploy("Relay", {
await deployments.deploy("BitcoinRelay", {
contract: "TestRelay",
from: deployer,
log: true,
waitConfirmations: 1,
})
}
}

export default func

func.tags = ["Relay"]
func.tags = ["BitcoinRelay"]
1 change: 1 addition & 0 deletions solidity/deploy/02_deploy_vending_machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
from: deployer,
args: [TBTCToken.address, TBTC.address, unmintFee],
log: true,
waitConfirmations: 1,
})

await helpers.ownable.transferOwnership(
Expand Down
4 changes: 2 additions & 2 deletions solidity/deploy/03_transfer_vending_machine_roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await execute(
"VendingMachine",
{ from: deployer },
{ from: deployer, log: true, waitConfirmations: 1 },
"transferVendingMachineUpgradeInitiatorRole",
keepTechnicalWalletTeam
)
Expand All @@ -24,7 +24,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await execute(
"VendingMachine",
{ from: deployer },
{ from: deployer, log: true, waitConfirmations: 1 },
"transferUnmintFeeUpdateInitiatorRole",
keepTechnicalWalletTeam
)
Expand Down
1 change: 1 addition & 0 deletions solidity/deploy/04_deploy_bank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
from: deployer,
args: [],
log: true,
waitConfirmations: 1,
})

if (hre.network.tags.tenderly) {
Expand Down
29 changes: 14 additions & 15 deletions solidity/deploy/05_deploy_bridge.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { HardhatRuntimeEnvironment } from "hardhat/types"
import { DeployFunction } from "hardhat-deploy/types"
import { DeployFunction, DeployOptions } from "hardhat-deploy/types"

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { ethers, helpers, deployments, getNamedAccounts } = hre
const { deploy } = deployments
const { deployer, treasury } = await getNamedAccounts()

const Bank = await deployments.get("Bank")
const Relay = await deployments.get("Relay")
const BitcoinRelay = await deployments.get("BitcoinRelay")

// TODO: Test for mainnet deployment that when `WalletRegistry` is provided
// in `external/mainnet/` directory it gets resolved correctly, and the deployment
Expand All @@ -21,29 +21,28 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
? 1
: 6

const Deposit = await deploy("Deposit", { from: deployer, log: true })
const DepositSweep = await deploy("DepositSweep", {
const deployOptions: DeployOptions = {
from: deployer,
log: true,
})
const Redemption = await deploy("Redemption", { from: deployer, log: true })
waitConfirmations: 1,
}

const Deposit = await deploy("Deposit", deployOptions)
const DepositSweep = await deploy("DepositSweep", deployOptions)
const Redemption = await deploy("Redemption", deployOptions)
const Wallets = await deploy("Wallets", {
contract: "contracts/bridge/Wallets.sol:Wallets",
from: deployer,
log: true,
})
const Fraud = await deploy("Fraud", { from: deployer, log: true })
const MovingFunds = await deploy("MovingFunds", {
from: deployer,
log: true,
...deployOptions,
})
const Fraud = await deploy("Fraud", deployOptions)
const MovingFunds = await deploy("MovingFunds", deployOptions)

const bridge = await helpers.upgrades.deployProxy("Bridge", {
contractName:
process.env.TEST_USE_STUBS_TBTC === "true" ? "BridgeStub" : undefined,
initializerArgs: [
Bank.address,
Relay.address,
BitcoinRelay.address,
treasury,
WalletRegistry.address,
txProofDifficultyFactor,
Expand Down Expand Up @@ -80,4 +79,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
export default func

func.tags = ["Bridge"]
func.dependencies = ["Bank", "Relay", "Treasury", "WalletRegistry"]
func.dependencies = ["Bank", "BitcoinRelay", "Treasury", "WalletRegistry"]
1 change: 1 addition & 0 deletions solidity/deploy/06_deploy_tbtc_vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
from: deployer,
args: [Bank.address, TBTC.address],
log: true,
waitConfirmations: 1,
})

if (hre.network.tags.tenderly) {
Expand Down
2 changes: 2 additions & 0 deletions solidity/deploy/07_deploy_bridge_governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
{
from: deployer,
log: true,
waitConfirmations: 1,
}
)

Expand All @@ -25,6 +26,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
libraries: {
BridgeGovernanceParameters: BridgeGovernanceParameters.address,
},
waitConfirmations: 1,
})

if (hre.network.tags.tenderly) {
Expand Down
1 change: 1 addition & 0 deletions solidity/deploy/08_deploy_maintainer_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
from: deployer,
args: [Bridge.address, ReimbursementPool.address],
log: true,
waitConfirmations: 1,
})

if (hre.network.tags.tenderly) {
Expand Down
11 changes: 7 additions & 4 deletions solidity/deploy/09_bank_update_bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import { DeployFunction } from "hardhat-deploy/types"

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { getNamedAccounts, deployments } = hre
const { execute, log } = deployments
const { execute } = deployments
const { deployer } = await getNamedAccounts()

const Bridge = await deployments.get("Bridge")

log("updating Bridge in Bank")

await execute("Bank", { from: deployer }, "updateBridge", Bridge.address)
await execute(
"Bank",
{ from: deployer, log: true, waitConfirmations: 1 },
"updateBridge",
Bridge.address
)
}

export default func
Expand Down
2 changes: 1 addition & 1 deletion solidity/deploy/10_authorize_spv_maintainer_in_bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await execute(
"Bridge",
{ from: deployer },
{ from: deployer, log: true, waitConfirmations: 1 },
"setSpvMaintainerStatus",
spvMaintainer,
true
Expand Down
2 changes: 1 addition & 1 deletion solidity/deploy/12_transfer_bridge_governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await deployments.execute(
"Bridge",
{ from: deployer },
{ from: deployer, log: true, waitConfirmations: 1 },
"transferGovernance",
BridgeGovernance.address
)
Expand Down
2 changes: 2 additions & 0 deletions solidity/deploy/16_initialize_wallet_owner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import initializeWalletOwner from "@keep-network/ecdsa/export/tasks/initialize-w
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const Bridge = await hre.deployments.get("Bridge")

hre.deployments.log("initializing Bridge as ECDSA wallet owner")

await initializeWalletOwner(hre, Bridge.address)
}

Expand Down
4 changes: 2 additions & 2 deletions solidity/deploy/18_authorize_maintainer_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await execute(
"ReimbursementPool",
{ from: deployer },
{ from: deployer, log: true, waitConfirmations: 1 },
"authorize",
MaintainerProxy.address
)

await execute(
"Bridge",
{ from: deployer },
{ from: deployer, log: true, waitConfirmations: 1 },
"setSpvMaintainerStatus",
MaintainerProxy.address,
true
Expand Down
1 change: 1 addition & 0 deletions solidity/deploy/20_deploy_proxy_admin_with_deputy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
from: deployer,
args: [dao, esdm],
log: true,
waitConfirmations: 1,
}
)

Expand Down
15 changes: 12 additions & 3 deletions solidity/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ const config: HardhatUserConfig = {
chainId: 1101,
tags: ["allowStubs"],
},
ropsten: {
goerli: {
url: process.env.CHAIN_API_URL || "",
chainId: 3,
chainId: 5,
accounts: process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
? [process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY]
: undefined,
Expand Down Expand Up @@ -153,14 +153,19 @@ const config: HardhatUserConfig = {
"node_modules/@keep-network/random-beacon/deployments/development",
"node_modules/@keep-network/ecdsa/deployments/development",
],
ropsten: ["node_modules/@keep-network/tbtc/artifacts"],
goerli: [
"node_modules/@keep-network/tbtc/artifacts",
"node_modules/@keep-network/random-beacon/artifacts",
"node_modules/@keep-network/ecdsa/artifacts",
],
mainnet: ["./external/mainnet"],
},
},

namedAccounts: {
deployer: {
default: 1,
goerli: 0,
},
// TODO: Governance should be the Threshold Council.
// Inspect usages and rename.
Expand All @@ -173,17 +178,21 @@ const config: HardhatUserConfig = {
},
keepTechnicalWalletTeam: {
default: 4,
goerli: 0,
mainnet: "0xB3726E69Da808A689F2607939a2D9E958724FC2A",
},
keepCommunityMultiSig: {
default: 5,
goerli: 0,
mainnet: "0x19FcB32347ff4656E4E6746b4584192D185d640d",
},
treasury: {
default: 6,
Comment thread
michalinacienciala marked this conversation as resolved.
goerli: 0,
},
spvMaintainer: {
default: 7,
goerli: 0,
},
},
dependencyCompiler: {
Expand Down
2 changes: 1 addition & 1 deletion solidity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"export.json"
],
"scripts": {
"clean": "hardhat clean",
"clean": "hardhat clean && rm -rf cache/ export/ external/npm export.json",
"build": "hardhat compile",
"deploy": "hardhat deploy --export export.json",
"deploy:test": "USE_EXTERNAL_DEPLOY=true TEST_USE_STUBS_TBTC=true npm run deploy",
Expand Down