2020-09-02 17:43:48 +03:00
![tokenbridge ](https://github.com/poanetwork/tokenbridge/workflows/tokenbridge/badge.svg?branch=master )
2019-05-07 17:52:44 +03:00
[![Gitter ](https://badges.gitter.im/poanetwork/poa-bridge.svg )](https://gitter.im/poanetwork/poa-bridge?utm_source=badge& utm_medium=badge& utm_campaign=pr-badge& utm_content=badge)
[![License: LGPL v3.0 ](https://img.shields.io/badge/License-LGPL%20v3-blue.svg )](https://www.gnu.org/licenses/lgpl-3.0)
# Tokenbridge
2019-07-19 10:18:51 +03:00
Welcome to the **POA TokenBridge** monorepository!
2019-05-10 14:40:56 +03:00
Please note that this repository as a **work in progress** .
## Overview
2019-07-19 10:18:51 +03:00
The POA TokenBridge allows users to transfer assets between two chains in the Ethereum ecosystem. It is composed of several elements which are contained within this monorepository.
2019-05-10 14:40:56 +03:00
2019-07-19 10:18:51 +03:00
For a complete picture of the POA TokenBridge functionality, it is useful to explore each subrepository.
2019-05-07 17:52:44 +03:00
## Structure
Sub-repositories maintained within this monorepo are listed below.
| Sub-repository | Description |
| --- | --- |
2019-05-10 14:40:56 +03:00
| [Oracle ](oracle/README.md ) | Oracle responsible for listening to bridge related events and authorizing asset transfers. |
2019-05-14 10:23:52 +03:00
| [Monitor ](monitor/README.md ) | Tool for checking balances and unprocessed events in bridged networks. |
| [Deployment ](deployment/README.md ) | Ansible playbooks for deploying cross-chain bridges. |
2019-05-31 15:54:32 +03:00
| [Oracle-E2E ](oracle-e2e/README.md ) | End to end tests for the Oracle |
2019-06-27 10:57:45 +03:00
| [Monitor-E2E ](monitor-e2e/README.md ) | End to end tests for the Monitor |
2019-08-29 11:30:34 +03:00
| [Deployment-E2E ](deployment-e2e/README.md ) | End to end tests for the Deployment |
2019-07-11 16:46:52 +03:00
| [Commons ](commons/README.md ) | Interfaces, constants and utilities shared between the sub-repositories |
2019-06-04 11:28:12 +03:00
| [E2E-Commons ](e2e-commons/README.md ) | Common utilities and configuration used in end to end tests |
2020-06-04 19:15:39 +03:00
| [ALM ](alm/README.md ) | DApp interface tool for AMB Live Monitoring |
| [Burner-wallet-plugin ](burner-wallet-plugin/README.md ) | TokenBridge Burner Wallet 2 Plugin |
2019-05-10 14:40:56 +03:00
2019-11-05 15:53:47 +03:00
Additionally there are [Smart Contracts ](https://github.com/poanetwork/tokenbridge-contracts ) used to manage bridge validators, collect signatures, and confirm asset relay and disposal.
2019-05-10 14:40:56 +03:00
2019-07-03 23:12:51 +03:00
## Available deployments
| **Launched by POA** | **Launched by 3rd parties** |
| ---------- | ---------- |
2019-07-19 10:18:51 +03:00
| [POA20 Bridge ](https://bridge.poa.net/ ) | [Ocean TokenBridge ](https://bridge.oceanprotocol.com/ ) |
2019-07-03 23:12:51 +03:00
| [xDai Bridge ](https://dai-bridge.poa.network/ ) | [Thunder bridge ](https://ui.stormdapps.com/ ) |
2019-07-19 10:18:51 +03:00
| [WETC Bridge ](https://wetc.app/ ) | [Volta TokenBridge ](https://vt.volta.bridge.eth.events/ ) & [DAI bridge to Volta Chain ](https://dai.volta.bridge.eth.events/ ) |
2019-07-03 23:12:51 +03:00
| | [Artis Brige ](https://bridge.artis.network/ ) |
| | [Tenda bridge ](https://bridge-mainnet.tenda.network ) & [xDai-to-Tenda bridge ](https://bridge-xdai.tenda.network/ ) |
2019-05-10 14:40:56 +03:00
## Network Definitions
Bridging occurs between two networks.
* **Home** - or **Native** - is a network with fast and inexpensive operations. All bridge operations to collect validator confirmations are performed on this side of the bridge.
* **Foreign** can be any chain; generally it refers to the Ethereum mainnet.
## Operational Modes
2019-09-18 22:45:13 +03:00
The POA TokenBridge provides four operational modes:
2019-05-10 14:40:56 +03:00
- [x] `ERC20-to-Native` : Pre-existing **tokens** in the Foreign network are locked and **coins** are minted in the `Home` network. In this mode, the Home network consensus engine invokes [Parity's Block Reward contract ](https://wiki.parity.io/Block-Reward-Contract.html ) to mint coins per the bridge contract request. **More Information: [xDai Chain](https://medium.com/poa-network/poa-network-partners-with-makerdao-on-xdai-chain-the-first-ever-usd-stable-blockchain-65a078c41e6a)**
2019-09-18 22:45:13 +03:00
- [x] `Arbitrary-Message` : Transfer arbitrary data between two networks as so the data could be interpreted as an arbitrary contract method invocation.
2019-05-07 17:52:44 +03:00
2019-05-31 15:54:32 +03:00
## Initializing the monorepository
2019-05-07 17:52:44 +03:00
2019-06-13 17:17:24 +03:00
Clone the repository:
2019-05-31 15:54:32 +03:00
```bash
2019-06-13 17:17:24 +03:00
git clone https://github.com/poanetwork/tokenbridge
2019-05-31 15:54:32 +03:00
```
2019-05-15 14:49:58 +03:00
2021-04-16 12:31:12 +03:00
If there is no need to build docker images for the TokenBridge components (oracle, monitor), initialize submodules, install dependencies, compile the Smart Contracts:
2019-05-31 15:54:32 +03:00
```
2019-06-13 17:17:24 +03:00
yarn initialize
2019-05-31 15:54:32 +03:00
```
2020-02-21 16:58:05 +03:00
Then refer to the corresponding README files to get information about particular TokenBridge component.
2019-05-31 15:54:32 +03:00
## Linting
2019-05-15 15:23:29 +03:00
2019-05-10 15:04:20 +03:00
Running linter for all JS projects:
2019-05-07 17:52:44 +03:00
2019-05-31 15:54:32 +03:00
```
yarn lint
```
2019-05-07 17:52:44 +03:00
2019-05-31 15:54:32 +03:00
## Tests
2019-05-10 15:04:20 +03:00
2019-05-10 14:40:56 +03:00
Running tests for all projects:
2019-05-07 17:52:44 +03:00
2019-05-31 15:54:32 +03:00
```
yarn test
```
2021-04-16 12:31:12 +03:00
Additionally there are end-to-end tests for [Oracle ](oracle-e2e/README.md ) and [Monitor ](monitor-e2e/README.md ).
2019-05-07 17:52:44 +03:00
For details on building, running and developing please refer to respective READMEs in sub-repositories.
2019-06-13 17:17:24 +03:00
## Building, running and deploying
Please refer to the instructions in sub-directories.
2019-09-13 10:11:38 +03:00
Configuration details are available [here ](./CONFIGURATION.md ).
2019-06-13 17:17:24 +03:00
2019-05-07 17:52:44 +03:00
## Contributing
See the [CONTRIBUTING ](CONTRIBUTING.md ) document for contribution, testing and pull request protocol.
## License
This project is licensed under the GNU Lesser General Public License v3.0. See the [LICENSE ](LICENSE ) file for details.
## References
2019-05-06 16:30:44 +03:00
2020-09-01 22:56:54 +03:00
* [TokenBridge Documentation ](https://docs.tokenbridge.net/ )