From ae783fc6d2e52907b9d9e95ba943b3403ec69dee Mon Sep 17 00:00:00 2001 From: Alexander Kolotov Date: Sat, 22 Sep 2018 00:32:17 +0300 Subject: [PATCH] fixed documentation issues --- README.md | 33 ++++++----- deploy/.env.example.swp | Bin 0 -> 12288 bytes deploy/README.md | 125 ++++++++++++++++++++++++++-------------- 3 files changed, 100 insertions(+), 58 deletions(-) create mode 100644 deploy/.env.example.swp diff --git a/README.md b/README.md index d76acb6a9..d38f15c04 100644 --- a/README.md +++ b/README.md @@ -21,21 +21,23 @@ Responsibilities and roles of the bridge: - sends POA coins to Home bridge in order to receive ERC20 token on Foreign Bridge - sends ERC20 POA20 token on Foreign Bridge in order to receive POA coins on Home Bridge +## Compilation and automated deployment -# Dependencies -```bash -npm install -``` +1. Dependant packages installation + ```bash + npm install + ``` +2. Contract compilation + ```bash + npm run compile + ``` +3. In order to deploy contracts by Check the README.md in `deploy` folder. -# To Deploy -Check `truffle.js` for networks and their ports -```bash -NETWORK=sokol npm run deploy -``` +## Manual Deployment steps -# Manual Deployment steps +It is assumed that contracts were compiled. See first two steps in the _Compilation and automated deployment_ section. -## Home Deployment(Sokol) +### Home Deployment(Sokol) 1. Deploy [EternalStorageProxy contract](https://github.com/poanetwork/poa-parity-bridge-contracts/blob/upgradable/flats/EternalStorageProxy_flat.sol#L218) (Example address: '0x01') that will be used as Home Bridge Validators Proxy contract @@ -57,9 +59,8 @@ that will be used as Home Bridge Proxy contract. Example address: `0x04` - Daily Limit in wei: Example `1000000000000000000` == 1 ether - Maximum Per Transaction Limit in wei: Example `100000000000000000` == 0.1 ether. Should be less than Daily Limit - Minimum Per Transaction Limit in wei: Example `10000000000000000` == 0.01 ether. Should be less than Daily Limit and less than MaxPerTx -===== -## Foreign Deployment on Kovan -===== + +### Foreign Deployment on Kovan 9. Deploy [POA20 contract](https://github.com/poanetwork/poa-parity-bridge-contracts/blob/upgradable/flats/POA20_flat.sol#L448) Example(`0x05`) 10. Deploy [EternalStorageProxy contract](https://github.com/poanetwork/poa-parity-bridge-contracts/blob/upgradable/flats/EternalStorageProxy_flat.sol#L218) @@ -86,8 +87,10 @@ that will be used as Foreign Bridge Proxy contract. Example `0x08` 18. Call `transferOwnership` of POA20 contract(0x05) with 1 parameter: - address of Foreign Bridge Proxy (`0x08`) from step#14 +## To Flatten + +Only `HomeBridge` and `ForeignBridge` contracts will be flattened. -# To Flatten ```bash npm run flatten ``` diff --git a/deploy/.env.example.swp b/deploy/.env.example.swp new file mode 100644 index 0000000000000000000000000000000000000000..35fb64f131cde4021d7f1f7776b7a4371e82976a GIT binary patch literal 12288 zcmeI2J#W)M7{{*+NC*lDrY^|1ups5FEwn;1l4D=PDSioOJ2YZArHv_7(wvnTS{UF1 z@CiU{3?MP`Jz(HvC^HfRUjSHmY^Q0O(9#w3Soz7x-QVZCpYH}Mw_2<-TUpF65ID{f zQvLPvPV@K$@^yxgwrqBi;=dh9F4t*Bv5XFlK2Cy#^^G{!3nSSt)Of!T$!2b~x6xV; zb8E62_nK>Qzt9S!j(k|ihusJHaJ#t~b;3g%#!57R29980n#|9Yib-%*y{Mc&7aZXl zjGzHDfCkV28bAYR01co4H1NL|h@&a;1O{_#FrdqW^VHaR@DopH01co4G=K)s02)98 zXaEhM0W^RH(7-=vpxGki(n&%-0?GgXyYK(s&Jgkrcnv%S`TzrN0yDtR(}a8hc7V6Q z3t$VV16P0_(}cVS-T=>mXMh9(AP1ZPc1{uU3U~x~zzskJrh!wycj(h+;M1UgACf-e zfd#JyGM#pc?Eh+$|j5 zu57tRRT!?b%($)l%ym3%X&AE^+{|_Z#}_r|l)s`~Esh_1VSQyRyf~RouO41v>da~g zi`mTAN(Y3Cd%X^76|S39FIyBGB%LdBW>%zhYDa#zmXxh9zq4PjPS<|C3 z=f|JY@OPG-w6te3z58Tfzs58)=`bxmg23!<>4VIsv`GzS>lUnu(vnIhs=bC?b}dcy zsptQp+R<&QsSSC*r#Ru3QcgFmw-jHt!>&q5h5CY1gR+`0nB!9pV}UQiW|qY~3bWtz zv_u&(Y0YvQHiZelZ{3WQXESyolRA2lZW!5W;jFIvR8(n0ySA9mmlg(N61Hnn&4HCx Tr?8p@ENe2G4L7TTg5C1pyt8K3 literal 0 HcmV?d00001 diff --git a/deploy/README.md b/deploy/README.md index 10b7c308a..b3462022a 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -1,47 +1,86 @@ -# How to use -0. compile source contracts: -``` -poa-parity - -1. create .env file -```bash -DEPLOYMENT_ACCOUNT_ADDRESS=0xb8988b690910913c97a090c3a6f80fad8b3a4683 -DEPLOYMENT_ACCOUNT_PRIVATE_KEY=67..14 -DEPLOYMENT_GAS_LIMIT=4000000 -DEPLOYMENT_GAS_PRICE=10 -GET_RECEIPT_INTERVAL_IN_MILLISECONDS=3000 - -HOME_RPC_URL=https://sokol.poa.network -HOME_OWNER_MULTISIG=0x -HOME_UPGRADEABLE_ADMIN_VALIDATORS=0x -HOME_UPGRADEABLE_ADMIN_BRIDGE=0x -HOME_DAILY_LIMIT=30000000000000000000000000 -HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000 -HOME_MIN_AMOUNT_PER_TX=500000000000000000 -HOME_REQUIRED_BLOCK_CONFIRMATIONS=1 -HOME_GAS_PRICE=1 - -FOREIGN_RPC_URL=https://sokol.poa.network -FOREIGN_OWNER_MULTISIG=0x -FOREIGN_UPGRADEABLE_ADMIN_VALIDATORS=0x -FOREIGN_UPGRADEABLE_ADMIN_BRIDGE=0x -FOREIGN_DAILY_LIMIT=15000000000000000000000000 -FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000 -FOREIGN_MIN_AMOUNT_PER_TX=500000000000000000 -FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=8 -FOREIGN_GAS_PRICE=10 - -REQUIRED_NUMBER_OF_VALIDATORS=1 -VALIDATORS="0x 0x 0x" - - - -``` -2. Run `node deploy.js` -OR -2. Compile sources: `npm run compile` -3. run `./build/deploy-macos` +# How to deploy POA bridge contracts +It is assumed that steps listed below are executed in `deploy` folder. +1. Install packages needed for deployment + ```bash + npm install + ``` +2. create `.env` file by + ```bash + 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. + +4. adjust parameters in the .env file + + ```bash + DEPLOYMENT_ACCOUNT_ADDRESS=0xb8988b690910913c97a090c3a6f80fad8b3a4683 + DEPLOYMENT_ACCOUNT_PRIVATE_KEY=67..14 + DEPLOYMENT_GAS_LIMIT=4000000 + DEPLOYMENT_GAS_PRICE=10 + GET_RECEIPT_INTERVAL_IN_MILLISECONDS=3000 + + HOME_RPC_URL=https://sokol.poa.network + HOME_OWNER_MULTISIG=0x + HOME_UPGRADEABLE_ADMIN_VALIDATORS=0x + HOME_UPGRADEABLE_ADMIN_BRIDGE=0x + HOME_DAILY_LIMIT=30000000000000000000000000 + HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000 + HOME_MIN_AMOUNT_PER_TX=500000000000000000 + HOME_REQUIRED_BLOCK_CONFIRMATIONS=1 + HOME_GAS_PRICE=1 + + FOREIGN_RPC_URL=https://sokol.poa.network + FOREIGN_OWNER_MULTISIG=0x + FOREIGN_UPGRADEABLE_ADMIN_VALIDATORS=0x + FOREIGN_UPGRADEABLE_ADMIN_BRIDGE=0x + FOREIGN_DAILY_LIMIT=15000000000000000000000000 + FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000 + FOREIGN_MIN_AMOUNT_PER_TX=500000000000000000 + FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=8 + FOREIGN_GAS_PRICE=10 + + REQUIRED_NUMBER_OF_VALIDATORS=1 + VALIDATORS="0x 0x 0x" + ``` + +5. fill the balance of the deployment account in Home and Foreign networks + +6. run the deployment script + ```bash + node deploy.js + ``` + +## Explanation of parameters in `.env` file + +Name | Description +--------- | ------- +DEPLOYMENT_ACCOUNT_ADDRESS | Temporary account from which all contracts will be deployed. Make sure that the deployment account owns some ether on both kovan & sokol network. +DEPLOYMENT_ACCOUNT_PRIVATE_KEY | private key from temp account +DEPLOYMENT_GAS_LIMIT | Gas Limit to use for transactions during bridge contract provisioning +DEPLOYMENT_GAS_PRICE | Gas Price to use for transactions during bridge contract provisioning on both networks in gwei +GET_RECEIPT_INTERVAL_IN_MILLISECONDS | Interval that is used to wait for tx to be mined( 3 sec in example) +HOME_RPC_URL | Public RPC Node URL for Home Network +HOME_OWNER_MULTISIG | Address of Administrator role on Home network to change parameters of the bridge and validator's contract +HOME_UPGRADEABLE_ADMIN_VALIDATORS | Address from which Validator's contract could be upgraded +HOME_UPGRADEABLE_ADMIN_BRIDGE | Address from which HomeBridge's contract could be upgraded +HOME_DAILY_LIMIT | Daily Limit in Wei. Example above is `1 eth` +HOME_MAX_AMOUNT_PER_TX | Max limit per 1 tx in Wei. Example above is `0.1 eth` +HOME_MIN_AMOUNT_PER_TX | Minimum amount per 1 tx in Wei. Example above is `0.01 eth` +HOME_REQUIRED_BLOCK_CONFIRMATIONS | Number of blocks issued after the block with the corresponding deposit transaction to make sure that the transaction will not be rolled back +HOME_GAS_PRICE | Gas Price to use for transactions to relay withdraws to Home Network +FOREIGN_RPC_URL | Public RPC Node URL for Foreign Network +FOREIGN_OWNER_MULTISIG | Address of Administrator role on FOREIGN network to change parameters of the bridge and validator's contract +FOREIGN_UPGRADEABLE_ADMIN_VALIDATORS | Address from which Validator's contract could be upgraded +FOREIGN_UPGRADEABLE_ADMIN_BRIDGE | Address from which HomeBridge's contract could be upgraded +FOREIGN_DAILY_LIMIT | Daily Limit in Wei. Example above is `1 eth` +FOREIGN_MAX_AMOUNT_PER_TX | Max limit per 1 tx in Wei. Example above is `0.1 eth` +FOREIGN_MIN_AMOUNT_PER_TX | Minimum amount per 1 tx in Wei. Example above is `0.01 eth` +FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS | Number of blocks issued after the block with the corresponding withdraw transaction to make sure that the transaction will not be rolled back +FOREIGN_GAS_PRICE | Gas Price to use for transactions to deposit and confirm withdraws to Foreign Network +VALIDATORS | array of validators on Home and Foreign network. Space separated. +REQUIRED_NUMBER_OF_VALIDATORS | Minimum Number of validators in order to Withdraw Funds on POA network Sokol