README doc updates, added CONTRIBUTING file
This commit is contained in:
parent
ed0198d13c
commit
97941bec04
|
@ -0,0 +1,73 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
education, socio-economic status, nationality, personal appearance, race,
|
||||
religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ziggy@poa.network. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
|
@ -0,0 +1,28 @@
|
|||
## Contributing
|
||||
|
||||
Thank your for contributing to this project! We welcome collaborators and expect users to follow our [code of conduct](CODE_OF_CONDUCT.md) when submitting code or comments.
|
||||
|
||||
1. Fork the repo ( https://github.com/poanetwork/poa-bridge-contracts/fork ).
|
||||
2. Create your feature branch (`git checkout -b my-new-feature`).
|
||||
3. Write tests that cover your work.
|
||||
4. Commit your changes (`git commit -am 'Add some feature'`).
|
||||
5. Push to your branch (`git push origin my-new-feature`).
|
||||
6. Create a new PR (Pull Request).
|
||||
|
||||
### General
|
||||
|
||||
* Commits should be one logical change that still allows all tests to pass. We prefer smaller commits if there could be two levels of logic grouping. The goal is to provide future contributors (including your future self) the reasoning behind your changes and allow them to cherry-pick, patch or port those changes in isolation to other branches or forks.
|
||||
* If during your PR you reveal a pre-existing bug and know how to fix it:
|
||||
1. If you can isolate the bug, fix it in a separate PR.
|
||||
2. If the fix depends on your other commits, add it in a separate commit to the same PR.
|
||||
|
||||
In either case, try to write a regression test that fails because of the bug but passes with your fix.
|
||||
|
||||
### Issues
|
||||
Creating and discussing [Issues](https://github.com/poanetwork/poa-bridge-contracts/issues) provides significant value to the project. If you find a bug you can report it in an Issue.
|
||||
|
||||
### Pull Requests
|
||||
All pull requests should include:
|
||||
* A clear, readable description of the purpose of the PR
|
||||
* A clear, readable description of changes
|
||||
* Any additional concerns or comments (optional)
|
77
README.md
77
README.md
|
@ -1,51 +1,78 @@
|
|||
[![Build Status](https://travis-ci.org/poanetwork/poa-parity-bridge-contracts.svg?branch=master)](https://travis-ci.org/poanetwork/poa-parity-bridge-contracts)
|
||||
|
||||
# POA bridge smart contracts
|
||||
These contracts are the core of POA bridge functionality. They implement the logic to relay assests between
|
||||
two EVM-based blockchain networks by collecting bridge validators signatures to approve relay operations.
|
||||
# POA Bridge Smart Contracts
|
||||
These contracts provide the core functionality for the POA bridge. They implement the logic to relay assests between two EVM-based blockchain networks. The contracts collect bridge validator's signatures to approve and facilitate relay operations.
|
||||
|
||||
Currently, the contracts supports two types of relay operations:
|
||||
* to tokenize native coins circulating in one blockchain network (Home) into an ERC20 token in another network (Foreign);
|
||||
* to swap a token presented by an existing ERC20 contract in a Foreign network to an ERC20 token in the Home network, where one pair of bridge contracts correspond to one pair of ERC20 tokens.
|
||||
The POA bridge smart contracts are intended to work with [the bridge process implemented on NodeJS](https://github.com/poanetwork/bridge-nodejs).
|
||||
Please refer to the bridge process documentation to configure and deploy the bridge.
|
||||
|
||||
This version of the contract is intended to be work with [the bridge process implemented on NodeJS](https://github.com/poanetwork/bridge-nodejs).
|
||||
Please refer to the bridge process documentation to deploy and configure it.
|
||||
## Summary
|
||||
|
||||
POA bridge contracts consist of several main parts:
|
||||
* The Home Bridge is a smart contract that should be deployed in POA.Network;
|
||||
* The Foreign Bridge is a smart contract that should be deployed in Ethereum Mainnet;
|
||||
* Depending on type of relay operations the following components are used as well:
|
||||
* in `NATIVE-TO-ERC` mode: the ERC20 token (in fact, ERC677 extension is used) should be deployed on Foreign network;
|
||||
* in `ERC-TO-ERC` mode: the ERC20 token (in fact, ERC677 extension is used) should be deployed on Home network;
|
||||
* Validators is a smart contract that should be deployed in both the POA.Network and the Ethereum Mainnet.
|
||||
### Operations
|
||||
|
||||
Currently, the contracts support two types of relay operations:
|
||||
* Tokenize the native coin in one blockchain network (Home) into an ERC20 token in another network (Foreign).
|
||||
* Swap a token presented by an existing ERC20 contract in a Foreign network into an ERC20 token in the Home network, where one pair of bridge contracts corresponds to one pair of ERC20 tokens.
|
||||
|
||||
|
||||
### Components
|
||||
|
||||
The POA bridge contracts consist of several components:
|
||||
* The **Home Bridge** smart contract. This is currently deployed in POA.Network.
|
||||
* The **Foreign Bridge** smart contract. This is deployed in the Ethereum Mainnet.
|
||||
* Depending on the type of relay operations the following components are also used:
|
||||
* in `NATIVE-TO-ERC` mode: the ERC20 token (in fact, the ERC677 extension is used) is deployed on the Foreign network;
|
||||
* in `ERC-TO-ERC` mode: the ERC20 token (in fact, the ERC677 extension is used) is deployed on the Home network;
|
||||
* The **Validators** smart contract is deployed in both the POA.Network and the Ethereum Mainnet.
|
||||
|
||||
### Bridge Roles and Responsibilities
|
||||
|
||||
Responsibilities and roles of the bridge:
|
||||
- Administrator Role (representation of a multisig contract):
|
||||
- **Administrator** role (representation of a multisig contract):
|
||||
- add/remove validators
|
||||
- set daily limits on both bridges
|
||||
- set maximum per transaction limit on both bridges
|
||||
- set minimum per transaction limit on both bridges
|
||||
- upgrade contracts in case of vulnerability
|
||||
- set minimum required signatures from validators in order to relay a user's transaction
|
||||
- Validator Role :
|
||||
- **Validator** role:
|
||||
- provide 100% uptime to relay transactions
|
||||
- listen for `UserRequestForSignature` events on Home Bridge and sign an approval to relay assets on Foreign network;
|
||||
- listen for `CollectedSignatures` events on Home Bridge as soon enough signatures are collected and transfer all collected signatures to Foreign Bridge contact;
|
||||
- listen for `UserRequestForAffirmation` or `Transfer` (depending on the bridge mode) events on Foreign Bridge and send approval to Home Bridge to relay assets from Foreign Network to Home
|
||||
- User role:
|
||||
- listen for `UserRequestForSignature` events on Home Bridge and sign an approval to relay assets on Foreign network
|
||||
- listen for `CollectedSignatures` events on Home Bridge. As soon as enough signatures are collected, transfer all collected signatures to the Foreign Bridge contract.
|
||||
- listen for `UserRequestForAffirmation` or `Transfer` (depending on the bridge mode) events on the Foreign Bridge and send approval to Home Bridge to relay assets from Foreign Network to Home
|
||||
- **User** role:
|
||||
- sends assets to Bridge contracts:
|
||||
- in `NATIVE-TO-ERC` mode: send native coins to the Home Bridge to receive ERC20 tokens from the Foreign Bridge, send ERC20 tokens to the Foreign Bridge to unlock native coins from the Home Bridge;
|
||||
- in `ERC-TO-ERC` mode: transfer ERC20 tokens to the Foreign Bridge to mint ERC20 tokens on the Home Network, transfer ERC20 tokens to the Home Bridge to unlock ERC20 tokens on Foreign networks.
|
||||
|
||||
# Dependencies
|
||||
## Usage
|
||||
|
||||
### Install Dependencies
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
### Deploy
|
||||
Please the [README.md](deploy/README.md) in the `deploy` folder for instructions and .env file configuration
|
||||
|
||||
# To Deploy
|
||||
Check the README.md in `deploy` folder
|
||||
### Test
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
# To Flatten
|
||||
### Flatten
|
||||
```bash
|
||||
npm run flatten
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
See the [CONTRIBUTING](CONTRIBUTING.md) document for contribution, testing and pull request protocol.
|
||||
|
||||
## License
|
||||
|
||||
[![License: GPL v3.0](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
|
||||
|
||||
This project is licensed under the GNU General Public License v3.0. See the [LICENSE](LICENSE) file for details.
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,28 +1,34 @@
|
|||
# How to deploy POA bridge contracts
|
||||
# How to Deploy POA Bridge Contracts
|
||||
|
||||
1. compile source contracts:
|
||||
In order to deploy bridge contracts you must run `npm install` to install all dependencies. For more information, see the [project README](../README.md).
|
||||
|
||||
1. Compile the source contracts.
|
||||
```
|
||||
cd ..
|
||||
npm run compile
|
||||
```
|
||||
|
||||
2. create `.env` file
|
||||
`cp .env.example .env`
|
||||
2. Create a `.env` file.
|
||||
```
|
||||
cd deploy
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
3. if it is necessary, deploy and configure a multi-sig wallet contract which will
|
||||
be used to manage the bridge contracts after deployment.
|
||||
3. If necessary, deploy and configure a multi-sig wallet contract to manage the bridge contracts after deployment. We have not audited any wallets for security, but have used https://github.com/gnosis/MultiSigWallet/ with success.
|
||||
|
||||
4. adjust parameters in the `.env` file depending on the desired bridge mode
|
||||
4. Adjust the parameters in the `.env` file depending on the desired bridge mode. See below for comments related to each parameter.
|
||||
|
||||
5. fill the balance of the deployment account in Home and Foreign networks
|
||||
5. Add funds to the deployment accounts in both the Home and Foreign networks.
|
||||
|
||||
6. run `node deploy.js`
|
||||
6. Run `node deploy.js`.
|
||||
|
||||
## Configuration for `NATIVE-TO-ERC` Bridge mode
|
||||
## `NATIVE-TO-ERC` Bridge Mode Configuration Example.
|
||||
|
||||
Here is an example of an `.env` file for `native-to-erc` bridge mode.
|
||||
This example of an `.env` file for the `native-to-erc` bridge mode includes comments describing each parameter.
|
||||
|
||||
```bash
|
||||
|
||||
|
||||
# The type of bridge. Defines set of contracts to be deployed.
|
||||
BRIDGE_MODE=NATIVE_TO_ERC
|
||||
|
||||
|
@ -117,9 +123,10 @@ REQUIRED_NUMBER_OF_VALIDATORS=1
|
|||
VALIDATORS="0x 0x 0x"
|
||||
```
|
||||
|
||||
## Configuration for `ERC-TO-ERC` Bridge mode
|
||||
|
||||
Here is an example of `.env` file for `erc-to-erc` bridge mode.
|
||||
## `ERC-TO-ERC` Bridge Mode Configuration Example.
|
||||
|
||||
This example of an `.env` file for the `erc-to-erc` bridge mode includes comments describing each parameter.
|
||||
|
||||
```bash
|
||||
# The type of bridge. Defines set of contracts to be deployed.
|
||||
|
|
Loading…
Reference in New Issue