:toc: macro
:icons: font

= Keep ECDSA Wallets

// TODO: Add intro

ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]

toc::[]

// TODO: Describe protocol

== Build

The contracts use https://hardhat.org/[*Hardhat*] development
environment. To build and deploy contracts, please follow the instructions
presented below.

=== Prerequisites

Please make sure you have the following prerequisites installed on your machine:

- https://nodejs.org[Node.js] >=14
- https://yarnpkg.com[Yarn] >=1.22

=== Build contracts

To build the smart contracts, install node packages first:

```sh
yarn install
```

Once packages are installed, you can build the smart contracts using:

```sh
yarn build
```

Compiled contracts will land in the `build/` directory.

==== TypeScript Typings

Typings are generated for the contracts in `typechain/` directory.

=== Test contracts

There are multiple test scenarios living in the `test` directory.
You can run them by doing:

```sh
yarn test
```

=== Deploy contracts

To deploy contract execute:

```
yarn deploy --network <NETWORK>
```

After the Bridge contract from tbtc-v2 is deployed it has to be set as the
Wallet Owner in the `WalletRegistry`:

```
npx hardhat --network <NETWORK> initialize-wallet-owner --wallet-owner-address <BRIDGE_ADDRESS>
```
