@keep-network/tbtc-v2 0.1.1-dev.66 → 0.1.1-dev.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/Bank.json +17 -17
- package/artifacts/Bridge.json +1293 -2768
- package/artifacts/DefaultProxyAdmin.json +259 -0
- package/artifacts/Deposit.json +10 -10
- package/artifacts/DepositSweep.json +10 -10
- package/artifacts/EcdsaDkgValidator.json +17 -16
- package/artifacts/EcdsaInactivity.json +11 -11
- package/artifacts/Fraud.json +10 -10
- package/artifacts/KeepRegistry.json +1 -1
- package/artifacts/KeepStake.json +2 -2
- package/artifacts/KeepToken.json +2 -2
- package/artifacts/KeepTokenStaking.json +1 -1
- package/artifacts/MovingFunds.json +12 -12
- package/artifacts/NuCypherStakingEscrow.json +1 -1
- package/artifacts/NuCypherToken.json +2 -2
- package/artifacts/RandomBeaconStub.json +18 -18
- package/artifacts/Redemption.json +10 -10
- package/artifacts/ReimbursementPool.json +17 -17
- package/artifacts/Relay.json +12 -12
- package/artifacts/SortitionPool.json +99 -38
- package/artifacts/T.json +2 -2
- package/artifacts/TBTC.json +19 -19
- package/artifacts/TBTCToken.json +19 -19
- package/artifacts/TokenStaking.json +1 -1
- package/artifacts/TokenholderGovernor.json +9 -9
- package/artifacts/TokenholderTimelock.json +8 -8
- package/artifacts/VendingMachine.json +24 -24
- package/artifacts/VendingMachineKeep.json +1 -1
- package/artifacts/VendingMachineNuCypher.json +1 -1
- package/artifacts/WalletRegistry.json +310 -902
- package/artifacts/WalletRegistry_Implementation.json +2824 -0
- package/artifacts/WalletRegistry_Proxy.json +259 -0
- package/artifacts/Wallets.json +10 -10
- package/artifacts/solcInputs/1635d55d57a0a2552952c0d22586ed23.json +56 -0
- package/artifacts/solcInputs/903b9dffeb736456e9c3556193b1c8f2.json +269 -0
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.json +2 -2
- package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
- package/build/contracts/bridge/Bridge.sol/Bridge.json +88 -73
- package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
- package/build/contracts/bridge/BridgeState.sol/BridgeState.json +2 -2
- package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
- package/build/contracts/bridge/Deposit.sol/Deposit.json +2 -2
- package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +1 -1
- package/build/contracts/bridge/DepositSweep.sol/DepositSweep.json +2 -2
- package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
- package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
- package/build/contracts/bridge/Fraud.sol/Fraud.json +2 -2
- package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +1 -1
- package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
- package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
- package/build/contracts/bridge/MovingFunds.sol/MovingFunds.json +2 -2
- package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/OutboundTx.json +2 -2
- package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/Redemption.json +2 -2
- package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
- package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
- package/build/contracts/bridge/Wallets.sol/Wallets.json +2 -2
- package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
- package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +1 -1
- package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
- package/contracts/bridge/BitcoinTx.sol +8 -0
- package/contracts/bridge/Bridge.sol +17 -3
- package/contracts/bridge/BridgeState.sol +8 -0
- package/contracts/bridge/Deposit.sol +5 -0
- package/contracts/bridge/DepositSweep.sol +4 -0
- package/contracts/bridge/Fraud.sol +3 -0
- package/contracts/bridge/MovingFunds.sol +5 -0
- package/contracts/bridge/Redemption.sol +7 -0
- package/contracts/bridge/Wallets.sol +3 -0
- package/contracts/hardhat-dependency-compiler/.hardhat-dependency-compiler +1 -0
- package/contracts/hardhat-dependency-compiler/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol +3 -0
- package/contracts/hardhat-dependency-compiler/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol +3 -0
- package/deploy/00_resolve_wallet_registry.ts +83 -0
- package/deploy/05_deploy_bridge.ts +23 -14
- package/deploy/09_transfer_proxy_admin_ownership.ts +23 -0
- package/deploy/10_deploy_proxy_admin_with_deputy.ts +33 -0
- package/export.json +4227 -3757
- package/package.json +6 -2
- package/artifacts/WalletRegistryGovernance.json +0 -2364
- package/artifacts/solcInputs/496e626b61d332140d7f8662b25cbc03.json +0 -227
|
@@ -169,6 +169,9 @@ library Redemption {
|
|
|
169
169
|
uint64 txMaxFee;
|
|
170
170
|
// UNIX timestamp the request was created at.
|
|
171
171
|
uint32 requestedAt;
|
|
172
|
+
// This struct doesn't contain `__gap` property as the structure is stored
|
|
173
|
+
// in a mapping, mappings store values in different slots and they are
|
|
174
|
+
// not contiguous with other values.
|
|
172
175
|
}
|
|
173
176
|
|
|
174
177
|
/// @notice Represents an outcome of the redemption Bitcoin transaction
|
|
@@ -187,6 +190,8 @@ library Redemption {
|
|
|
187
190
|
uint32 changeIndex;
|
|
188
191
|
// Value in satoshi of the change output.
|
|
189
192
|
uint64 changeValue;
|
|
193
|
+
// This struct doesn't contain `__gap` property as the structure is not
|
|
194
|
+
// stored, it is used as a function's memory argument.
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
/// @notice Represents temporary information needed during the processing of
|
|
@@ -203,6 +208,8 @@ library Redemption {
|
|
|
203
208
|
bytes32 walletP2PKHScriptKeccak;
|
|
204
209
|
// P2WPKH script for the wallet. Needed to determine the change output.
|
|
205
210
|
bytes32 walletP2WPKHScriptKeccak;
|
|
211
|
+
// This struct doesn't contain `__gap` property as the structure is not
|
|
212
|
+
// stored, it is used as a function's memory argument.
|
|
206
213
|
}
|
|
207
214
|
|
|
208
215
|
event RedemptionRequested(
|
|
@@ -86,6 +86,9 @@ library Wallets {
|
|
|
86
86
|
// is built by applying the keccak256 hash over the list of 20-byte
|
|
87
87
|
// public key hashes of the target wallets.
|
|
88
88
|
bytes32 movingFundsTargetWalletsCommitmentHash;
|
|
89
|
+
// This struct doesn't contain `__gap` property as the structure is stored
|
|
90
|
+
// in a mapping, mappings store values in different slots and they are
|
|
91
|
+
// not contiguous with other values.
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
event NewWalletRequested();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
directory approved for write access by hardhat-dependency-compiler
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { HardhatRuntimeEnvironment } from "hardhat/types"
|
|
2
|
+
|
|
3
|
+
import { DeployFunction } from "hardhat-deploy/types"
|
|
4
|
+
|
|
5
|
+
import deploySortitionPool from "@keep-network/ecdsa/export/deploy/01_deploy_sortition_pool"
|
|
6
|
+
import deployReimbursementPool from "@keep-network/ecdsa/export/deploy/02_deploy_reimbursement_pool"
|
|
7
|
+
import deployDkgValidator from "@keep-network/ecdsa/export/deploy/03_deploy_dkg_validator"
|
|
8
|
+
|
|
9
|
+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
10
|
+
const { getNamedAccounts, deployments, helpers } = hre
|
|
11
|
+
const { log } = deployments
|
|
12
|
+
const { deployer } = await getNamedAccounts()
|
|
13
|
+
|
|
14
|
+
const WalletRegistry = await deployments.getOrNull("WalletRegistry")
|
|
15
|
+
|
|
16
|
+
if (WalletRegistry && helpers.address.isValid(WalletRegistry.address)) {
|
|
17
|
+
log(`using external WalletRegistry at ${WalletRegistry.address}`)
|
|
18
|
+
} else if (hre.network.name !== "hardhat") {
|
|
19
|
+
throw new Error("deployed WalletRegistry contract not found")
|
|
20
|
+
} else {
|
|
21
|
+
// FIXME: This is a workaround deployment. We expect that the `WalletRegistry`
|
|
22
|
+
// contract deployment will be imported from `@keep-network/ecdsa` deployment
|
|
23
|
+
// scripts. But due to some bug or incompatibility of the plugins we use
|
|
24
|
+
// the deployment fails. We need to investigate it further nad get working
|
|
25
|
+
// properly.
|
|
26
|
+
// https://github.com/keep-network/tbtc-v2/issues/267
|
|
27
|
+
log("deploying WalletRegistry")
|
|
28
|
+
|
|
29
|
+
await deploySortitionPool(hre)
|
|
30
|
+
await deployReimbursementPool(hre)
|
|
31
|
+
await deployDkgValidator(hre)
|
|
32
|
+
|
|
33
|
+
const SortitionPool = await deployments.get("SortitionPool")
|
|
34
|
+
const TokenStaking = await deployments.get("TokenStaking")
|
|
35
|
+
const ReimbursementPool = await deployments.get("ReimbursementPool")
|
|
36
|
+
const EcdsaDkgValidator = await deployments.get("EcdsaDkgValidator")
|
|
37
|
+
|
|
38
|
+
// TODO: RandomBeaconStub contract should be replaced by actual implementation of
|
|
39
|
+
// RandomBeacon contract, once @keep-network/random-beacon hardhat deployments
|
|
40
|
+
// scripts are implemented.
|
|
41
|
+
log("deploying RandomBeaconStub contract instead of RandomBeacon")
|
|
42
|
+
const RandomBeacon = await deployments.deploy("RandomBeaconStub", {
|
|
43
|
+
from: deployer,
|
|
44
|
+
log: true,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const EcdsaInactivity = await deployments.deploy("EcdsaInactivity", {
|
|
48
|
+
from: deployer,
|
|
49
|
+
log: true,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
// Use `deployments.deploy` instead of `helpers.upgrades.deployProxy` as
|
|
53
|
+
// to workaround problem with a hardhat-gas-reporter problem described in
|
|
54
|
+
// https://github.com/keep-network/keep-core/pull/2970.
|
|
55
|
+
await deployments.deploy("WalletRegistry", {
|
|
56
|
+
from: deployer,
|
|
57
|
+
args: [SortitionPool.address, TokenStaking.address],
|
|
58
|
+
libraries: {
|
|
59
|
+
EcdsaInactivity: EcdsaInactivity.address,
|
|
60
|
+
},
|
|
61
|
+
proxy: {
|
|
62
|
+
proxyContract: "TransparentUpgradeableProxy",
|
|
63
|
+
viaAdminContract: "DefaultProxyAdmin",
|
|
64
|
+
owner: deployer,
|
|
65
|
+
execute: {
|
|
66
|
+
init: {
|
|
67
|
+
methodName: "initialize",
|
|
68
|
+
args: [
|
|
69
|
+
EcdsaDkgValidator.address,
|
|
70
|
+
RandomBeacon.address,
|
|
71
|
+
ReimbursementPool.address,
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
log: true,
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default func
|
|
82
|
+
|
|
83
|
+
func.tags = ["WalletRegistry"]
|
|
@@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"
|
|
|
2
2
|
import { DeployFunction } from "hardhat-deploy/types"
|
|
3
3
|
|
|
4
4
|
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
5
|
-
const { deployments, getNamedAccounts } = hre
|
|
5
|
+
const { ethers, helpers, deployments, getNamedAccounts } = hre
|
|
6
6
|
const { deploy } = deployments
|
|
7
7
|
const { deployer, treasury } = await getNamedAccounts()
|
|
8
8
|
|
|
@@ -31,32 +31,41 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
|
31
31
|
log: true,
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const bridge = await helpers.upgrades.deployProxy("Bridge", {
|
|
35
|
+
contractName:
|
|
36
36
|
deployments.getNetworkName() === "hardhat" ? "BridgeStub" : undefined,
|
|
37
|
-
|
|
38
|
-
args: [
|
|
37
|
+
initializerArgs: [
|
|
39
38
|
Bank.address,
|
|
40
39
|
Relay.address,
|
|
41
40
|
treasury,
|
|
42
41
|
WalletRegistry.address,
|
|
43
42
|
txProofDifficultyFactor,
|
|
44
43
|
],
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
factoryOpts: {
|
|
45
|
+
signer: await ethers.getSigner(deployer),
|
|
46
|
+
libraries: {
|
|
47
|
+
Deposit: Deposit.address,
|
|
48
|
+
DepositSweep: DepositSweep.address,
|
|
49
|
+
Redemption: Redemption.address,
|
|
50
|
+
Wallets: Wallets.address,
|
|
51
|
+
Fraud: Fraud.address,
|
|
52
|
+
MovingFunds: MovingFunds.address,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
proxyOpts: {
|
|
56
|
+
kind: "transparent",
|
|
57
|
+
// Allow external libraries linking. We need to ensure manually that the
|
|
58
|
+
// external libraries we link are upgrade safe, as the OpenZeppelin plugin
|
|
59
|
+
// doesn't perform such a validation yet.
|
|
60
|
+
// See: https://docs.openzeppelin.com/upgrades-plugins/1.x/faq#why-cant-i-use-external-libraries
|
|
61
|
+
unsafeAllow: ["external-library-linking"],
|
|
52
62
|
},
|
|
53
|
-
log: true,
|
|
54
63
|
})
|
|
55
64
|
|
|
56
65
|
if (hre.network.tags.tenderly) {
|
|
57
66
|
await hre.tenderly.verify({
|
|
58
67
|
name: "Bridge",
|
|
59
|
-
address:
|
|
68
|
+
address: bridge.address,
|
|
60
69
|
})
|
|
61
70
|
}
|
|
62
71
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HardhatRuntimeEnvironment } from "hardhat/types"
|
|
2
|
+
import type { DeployFunction } from "hardhat-deploy/types"
|
|
3
|
+
|
|
4
|
+
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
|
|
5
|
+
const { ethers, getNamedAccounts, upgrades, deployments } = hre
|
|
6
|
+
const { esdm } = await getNamedAccounts()
|
|
7
|
+
const { deployer } = await ethers.getNamedSigners()
|
|
8
|
+
|
|
9
|
+
// TODO: Once a DAO is established we want to switch to ProxyAdminWithDeputy and
|
|
10
|
+
// use the DAO as the proxy admin owner and ESDM as the deputy. Until then we
|
|
11
|
+
// use governance as the owner of ProxyAdmin contract.
|
|
12
|
+
const newProxyAdminOwner = esdm
|
|
13
|
+
|
|
14
|
+
deployments.log(`transferring ProxyAdmin ownership to ${newProxyAdminOwner}`)
|
|
15
|
+
|
|
16
|
+
const proxyAdmin = await upgrades.admin.getInstance()
|
|
17
|
+
await proxyAdmin.connect(deployer).transferOwnership(newProxyAdminOwner)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default func
|
|
21
|
+
|
|
22
|
+
func.tags = ["TransferProxyAdminOwnership"]
|
|
23
|
+
func.dependencies = ["Bridge"]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HardhatRuntimeEnvironment } from "hardhat/types"
|
|
2
|
+
import type { DeployFunction } from "hardhat-deploy/types"
|
|
3
|
+
|
|
4
|
+
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
|
|
5
|
+
const { ethers, getNamedAccounts, upgrades, deployments } = hre
|
|
6
|
+
const { deployer, dao, esdm } = await getNamedAccounts()
|
|
7
|
+
|
|
8
|
+
const BridgeProxyAdminWithDeputy = await deployments.deploy(
|
|
9
|
+
"BridgeProxyAdminWithDeputy",
|
|
10
|
+
{
|
|
11
|
+
contract: "ProxyAdminWithDeputy",
|
|
12
|
+
from: deployer,
|
|
13
|
+
args: [dao, esdm],
|
|
14
|
+
log: true,
|
|
15
|
+
}
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const Bridge = await deployments.get("Bridge")
|
|
19
|
+
|
|
20
|
+
const proxyAdmin = await upgrades.admin.getInstance()
|
|
21
|
+
|
|
22
|
+
await proxyAdmin
|
|
23
|
+
.connect(await ethers.getSigner(esdm))
|
|
24
|
+
.changeProxyAdmin(Bridge.address, BridgeProxyAdminWithDeputy.address)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default func
|
|
28
|
+
|
|
29
|
+
func.tags = ["BridgeProxyAdminWithDeputy"]
|
|
30
|
+
func.dependencies = ["Bridge"]
|
|
31
|
+
|
|
32
|
+
// TODO: For now we skip this script as DAO is not yet established.
|
|
33
|
+
func.skip = async () => true
|