-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy path15_set_wallet_parameters.ts
42 lines (34 loc) · 1.52 KB
/
15_set_wallet_parameters.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import type { HardhatRuntimeEnvironment } from "hardhat/types"
import type { DeployFunction } from "hardhat-deploy/types"
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, ethers, getNamedAccounts } = hre
const { execute, read } = deployments
const { deployer } = await getNamedAccounts()
deployments.log("setting initial wallet parameters")
// We set the wallet creation period to two weeks and the min BTC balance to
// zero. It will allow creating new wallets every two weeks even though they
// are not sweeping so from the Bridge's perspective their balance is zero.
//
// 14 * 24 * 60 * 60 = 1209600 seconds
const walletCreationPeriod = ethers.BigNumber.from("1209600")
const walletCreationMinBtcBalance = ethers.BigNumber.from("0")
// Fetch the current values of other wallet parameters to keep them unchanged.
const walletParameters = await read("Bridge", "walletParameters")
await execute(
"Bridge",
{ from: deployer, log: true, waitConfirmations: 1 },
"updateWalletParameters",
walletCreationPeriod,
walletCreationMinBtcBalance,
walletParameters.walletCreationMaxBtcBalance,
walletParameters.walletClosureMinBtcBalance,
walletParameters.walletMaxAge,
walletParameters.walletMaxBtcTransfer,
walletParameters.walletClosingPeriod
)
}
export default func
func.tags = ["SetWalletParameters"]
func.dependencies = ["Bridge"]
func.skip = async (hre: HardhatRuntimeEnvironment): Promise<boolean> =>
hre.network.name !== "mainnet"