Consistent variable naming (#198)

* Add console.table

* First steps in validate script

* env rename

* Added parameter names

* Descriptions

* Print and configuration

* Added more parameters

* Rename gas oracle to gas supplier

* More changes

* Removed env examples for now

* RPC rename

* Bridge address rename

* More changes

* jobs

* Renames

* Typo

* jobs

* Changes

* jobs

* Changes

* Monitor changes

* jovs

* Typo

* Changes

* REACT_APP_ env prefix

* Typo

* Rollback changes

* Oracle deployment

* Defaults

* Monitor

* Naming

* Typo

* Typo

* Envs

* ui deployment

* ALl jobs

* Vars in ultimate

* Lint

* Lint

* Lint

* Another way to add REACT_APP prefixing

* Unnecessary mapping

* No output timeout

* No output timeout

* Got rid of ERC20_TOKEN_ADDRESS

* Configuration readme

* Configuration

* Prefixes

* timeout

* Docs

* Docs

* docs

* docs

* docs

* Roll back ERC20_TOKEN_ADDRESS for erc-to-erc

* Typo

* lint

* Rollback

* ROllback validator

* Rollback yarn.lock

* dai and wetc update

* Rollback ERC20_TOKEN_ADDRESS

* erc to native

* examples

* all jobs

* roll back

* roll back ERC20_TOKEN_ADDRESS: "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B"

* ui env example

* typo

* Allow rpc for ultimate

* Test

* ERC20_TOKEN_ADDRESS rollback

* Specify port

* React port

* All jobs

* cosmetics

* Values

* Restore erc20 token

* Rearrange example for easier comparision

* Rearrange ultimate for easier comparision

* Rearrange for easier comparision

* Refactor

* Conditional app styles

* Loading environment variables in react app

* Add missing vars for UI in wetc and dai

* Bring back test parameters readme

* Readme for monitor vars

* Reading environment variables in e2e-commons (#207)
This commit is contained in:
Przemyslaw Rzad 2019-09-13 09:11:38 +02:00 committed by GitHub
parent d593577ace
commit 8b010f887d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
100 changed files with 933 additions and 867 deletions

72
CONFIGURATION.md Normal file

@ -0,0 +1,72 @@
# Configuration
## Common configuration
name | description | value
--- | --- | ---
COMMON_HOME_RPC_URL | The HTTPS URL(s) used to communicate to the RPC nodes in the Home network. Several URLs can be specified, delimited by spaces. If the connection to one of these nodes is lost the next URL is used for connection. | URL(s)
COMMON_FOREIGN_RPC_URL | The HTTPS URL(s) used to communicate to the RPC nodes in the Foreign network. Several URLs can be specified, delimited by spaces. If the connection to one of these nodes is lost the next URL is used for connection. | URL(s)
COMMON_HOME_BRIDGE_ADDRESS | The address of the bridge contract address in the Home network. It is used to listen to events from and send validators' transactions to the Home network. | hexidecimal beginning with "0x"
COMMON_FOREIGN_BRIDGE_ADDRESS | The address of the bridge contract address in the Foreign network. It is used to listen to events from and send validators' transactions to the Foreign network. | hexidecimal beginning with "0x"
COMMON_HOME_GAS_PRICE_SUPPLIER_URL | The URL used to get a JSON response from the gas price prediction oracle for the Home network. The gas price provided by the oracle is used to send the validator's transactions to the RPC node. Since it is assumed that the Home network has a predefined gas price (e.g. the gas price in the Core of POA.Network is `1 GWei`), the gas price oracle parameter can be omitted for such networks. | URL
COMMON_HOME_GAS_PRICE_SPEED_TYPE | Assuming the gas price oracle responds with the following JSON structure: `{"fast": 20.0, "block_time": 12.834, "health": true, "standard": 6.0, "block_number": 6470469, "instant": 71.0, "slow": 1.889}`, this parameter specifies the desirable transaction speed. The speed type can be omitted when `COMMON_HOME_GAS_PRICE_SUPPLIER_URL` is not used. | `instant` / `fast` / `standard` / `slow`
COMMON_HOME_GAS_PRICE_FALLBACK | The gas price (in Wei) that is used if both the oracle and the fall back gas price specified in the Home Bridge contract are not available. | integer
COMMON_HOME_GAS_PRICE_FACTOR | A value that will multiply the gas price of the oracle to convert it to gwei. If the oracle API returns gas prices in gwei then this can be set to `1`. Also, it could be used to intentionally pay more gas than suggested by the oracle to guarantee the transaction verification. E.g. `1.25` or `1.5`. | integer
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL | The URL used to get a JSON response from the gas price prediction oracle for the Foreign network. The provided gas price is used to send the validator's transactions to the RPC node. If the Foreign network is Ethereum Foundation mainnet, the oracle URL can be: https://gasprice.poa.network. Otherwise this parameter can be omitted. | URL
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE | Assuming the gas price oracle responds with the following JSON structure: `{"fast": 20.0, "block_time": 12.834, "health": true, "standard": 6.0, "block_number": 6470469, "instant": 71.0, "slow": 1.889}`, this parameter specifies the desirable transaction speed. The speed type can be omitted when `COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL`is not used. | `instant` / `fast` / `standard` / `slow`
COMMON_FOREIGN_GAS_PRICE_FALLBACK | The gas price (in Wei) used if both the oracle and fall back gas price specified in the Foreign Bridge contract are not available. | integer
COMMON_FOREIGN_GAS_PRICE_FACTOR | A value that will multiply the gas price of the oracle to convert it to gwei. If the oracle API returns gas prices in gwei then this can be set to `1`. Also, it could be used to intentionally pay more gas than suggested by the oracle to guarantee the transaction verification. E.g. `1.25` or `1.5`. | integer
## Oracle configuration
name | description | value
--- | --- | ---"
ORACLE_BRIDGE_MODE | The bridge mode. The bridge starts listening to a different set of events based on this parameter. | NATIVE_TO_ERC / ERC_TO_ERC / ERC_TO_NATIVE
ORACLE_ALLOW_HTTP_FOR_RPC | **Only use in test environments - must be omitted in production environments.**. If this parameter is specified and set to `yes`, RPC URLs can be specified in form of HTTP links. A warning that the connection is insecure will be written to the logs. | `yes` / `no`
ORACLE_HOME_RPC_POLLING_INTERVAL | The interval in milliseconds used to request the RPC node in the Home network for new blocks. The interval should match the average production time for a new block. | integer
ORACLE_FOREIGN_RPC_POLLING_INTERVAL | The interval in milliseconds used to request the RPC node in the Foreign network for new blocks. The interval should match the average production time for a new block. | integer
ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL | An interval in milliseconds used to get the updated gas price value either from the oracle or from the Home Bridge contract. | integer
ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL | The interval in milliseconds used to get the updated gas price value either from the oracle or from the Foreign Bridge contract. | integer
ORACLE_QUEUE_URL | RabbitMQ URL used by watchers and senders to communicate to the message queue. Typically set to: `amqp://127.0.0.1`. | local URL
ORACLE_REDIS_URL | Redis DB URL used by watchers and senders to communicate to the database. Typically set to: `redis://127.0.0.1:6379`. | local URL
ORACLE_HOME_START_BLOCK | The block number in the Home network used to start watching for events when the bridge instance is run for the first time. Usually this is the same block where the Home Bridge contract is deployed. If a new validator instance is being deployed for an existing set of validators, the block number could be the latest block in the chain. | integer
ORACLE_FOREIGN_START_BLOCK | The block number in the Foreign network used to start watching for events when the bridge instance runs for the first time. Usually this is the same block where the Foreign Bridge contract was deployed to. If a new validator instance is being deployed for an existing set of validators, the block number could be the latest block in the chain. | integer
ORACLE_LOG_LEVEL | Set the level of details in the logs. | `trace` / `debug` / `info` / `warn` / `error` / `fatal`
ORACLE_MAX_PROCESSING_TIME | The workers processes will be killed if this amount of time (in milliseconds) is elapsed before they finish processing. It is recommended to set this value to 4 times the value of the longest polling time (set with the `HOME_POLLING_INTERVAL` and `FOREIGN_POLLING_INTERVAL` variables). To disable this, set the time to 0. | integer
ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY | The private key of the bridge validator used to sign confirmations before sending transactions to the bridge contracts. The validator account is calculated automatically from the private key. Every bridge instance (set of watchers and senders) must have its own unique private key. The specified private key is used to sign transactions on both sides of the bridge. | hexidecimal without "0x"
ORACLE_VALIDATOR_ADDRESS | The public address of the bridge validator | hexidecimal with "0x"
ERC20_TOKEN_ADDRESS | address of token for ERC-TO-ERC type of bridge | hexidecimal with "0x"
## UI configuration
name | description | value
--- | --- | ---
UI_TITLE | The title for the bridge UI page. `%c` will be replaced by the name of the network. | string
UI_DESCRIPTION | The meta description for the deployed bridge page. | string
UI_NATIVE_TOKEN_DISPLAY_NAME | name of the home native coin | string
UI_HOME_NETWORK_DISPLAY_NAME | name to be displayed for home network | string
UI_FOREIGN_NETWORK_DISPLAY_NAME | name to be displayed for foreign network | string
UI_HOME_WITHOUT_EVENTS | `true` if home network doesn't support events | true/false
UI_FOREIGN_WITHOUT_EVENTS | `true` if foreign network doesn't support events | true/false
UI_HOME_EXPLORER_TX_TEMPLATE | template link to transaction on home explorer. `%s` will be replaced by transaction hash | URL template
UI_FOREIGN_EXPLORER_TX_TEMPLATE | template link to transaction on foreign explorer. `%s` will be replaced by transaction hash | URL template
UI_HOME_EXPLORER_ADDRESS_TEMPLATE | template link to address on home explorer. `%s` will be replaced by address | URL template
UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE | template link to address on foreign explorer. `%s` will be replaced by address | URL template
UI_HOME_GAS_PRICE_UPDATE_INTERVAL | An interval in milliseconds used to get the updated gas price value either from the oracle or from the Home Bridge contract. | integer
UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL | An interval in milliseconds used to get the updated gas price value either from the oracle or from the Foreign Bridge contract. | integer
UI_PORT | The port for the UI app. | integer
UI_STYLES | The set of styles to render the bridge UI page. Currently only `classic` is implemented | classic
## Monitor configuration
name | description | value
--- | --- | ---
MONITOR_HOME_START_BLOCK | The app will monitor transactions starting from this block. | integer
MONITOR_FOREIGN_START_BLOCK | The app will monitor transactions starting from this block. | integer
MONITOR_VALIDATOR_HOME_TX_LIMIT | Average gas usage of a transaction sent by a validator, it is used to estimate the number of transaction that can be paid by the validator. | integer
MONITOR_VALIDATOR_FOREIGN_TX_LIMIT | Average gas usage of a transaction sent by a validator, it is used to estimate the number of transaction that can be paid by the validator. | integer
MONITOR_TX_NUMBER_THRESHOLD | If estimated number of transaction is equal to or below this value, the monitor will report that the validator has less funds than it is required. | integer
MONITOR_PORT | The port for the Monitor. | integer

@ -93,6 +93,7 @@ For details on building, running and developing please refer to respective READM
## Building, running and deploying ## Building, running and deploying
Please refer to the instructions in sub-directories. Please refer to the instructions in sub-directories.
Configuration details are available [here](./CONFIGURATION.md).
## Contributing ## Contributing

@ -33,7 +33,7 @@ provisioner:
inventory: inventory:
host_vars: host_vars:
oracle-host: oracle-host:
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
syslog_server_port: "udp://127.0.0.1:514" syslog_server_port: "udp://127.0.0.1:514"
verifier: verifier:
name: testinfra name: testinfra

@ -32,13 +32,13 @@ provisioner:
inventory: inventory:
host_vars: host_vars:
oracle-erc-to-erc-host: oracle-erc-to-erc-host:
HOME_RPC_URL: "http://parity1:8545" COMMON_HOME_RPC_URL: "http://parity1:8545"
FOREIGN_RPC_URL: "http://parity2:8545" COMMON_FOREIGN_RPC_URL: "http://parity2:8545"
VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" ORACLE_VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
ui-erc-to-erc-host: ui-erc-to-erc-host:
HOME_RPC_URL: "http://localhost:8541" COMMON_HOME_RPC_URL: "http://localhost:8541"
FOREIGN_RPC_URL: "http://localhost:8542" COMMON_FOREIGN_RPC_URL: "http://localhost:8542"
verifier: verifier:
name: testinfra name: testinfra
lint: lint:

@ -32,13 +32,13 @@ provisioner:
inventory: inventory:
host_vars: host_vars:
oracle-erc-to-native-host: oracle-erc-to-native-host:
HOME_RPC_URL: "http://parity1:8545" COMMON_HOME_RPC_URL: "http://parity1:8545"
FOREIGN_RPC_URL: "http://parity2:8545" COMMON_FOREIGN_RPC_URL: "http://parity2:8545"
VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" ORACLE_VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
ui-erc-to-native-host: ui-erc-to-native-host:
HOME_RPC_URL: "http://localhost:8541" COMMON_HOME_RPC_URL: "http://localhost:8541"
FOREIGN_RPC_URL: "http://localhost:8542" COMMON_FOREIGN_RPC_URL: "http://localhost:8542"
verifier: verifier:
name: testinfra name: testinfra
lint: lint:

@ -32,13 +32,13 @@ provisioner:
inventory: inventory:
host_vars: host_vars:
oracle-native-to-erc-host: oracle-native-to-erc-host:
HOME_RPC_URL: "http://parity1:8545" COMMON_HOME_RPC_URL: "http://parity1:8545"
FOREIGN_RPC_URL: "http://parity2:8545" COMMON_FOREIGN_RPC_URL: "http://parity2:8545"
VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" ORACLE_VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
ui-native-to-erc-host: ui-native-to-erc-host:
HOME_RPC_URL: "http://localhost:8541" COMMON_HOME_RPC_URL: "http://localhost:8541"
FOREIGN_RPC_URL: "http://localhost:8542" COMMON_FOREIGN_RPC_URL: "http://localhost:8542"
verifier: verifier:
name: testinfra name: testinfra
lint: lint:

@ -1,6 +1,6 @@
# POA TokenBridge / Deployment Configuration # POA TokenBridge / Deployment Configuration
Please see the [Oracle](../oracle/README.md) for additional configuration and execution details. Please see the [Configuration](../CONFIGURATION.md) for additional configuration and execution details.
## Prerequisites ## Prerequisites
@ -30,7 +30,7 @@ cp hosts.yml.example hosts.yml
hosts: hosts:
<host_ip_A>: <host_ip_A>:
ansible_user: <user> ansible_user: <user>
VALIDATOR_ADDRESS_PRIVATE_KEY: "<private_key>" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "<private_key>"
#syslog_server_port: "<protocol>://<ip>:<port>" # When this parameter is set all bridge logs will be redirected to <ip>:<port> address. #syslog_server_port: "<protocol>://<ip>:<port>" # When this parameter is set all bridge logs will be redirected to <ip>:<port> address.
<host_ip_B>: <host_ip_B>:
# (...) # (...)
@ -69,7 +69,7 @@ Example config for installing only UI:
| `<bridge_name>` | The bridge name which tells Ansible which file to use. This is located in `group_vars/<bridge_name>.yml`. | | `<bridge_name>` | The bridge name which tells Ansible which file to use. This is located in `group_vars/<bridge_name>.yml`. |
| `<host_ip>` | Remote server IP address. | | `<host_ip>` | Remote server IP address. |
| ansible_user: `<user>` | User that will ssh into the node. This is typically `ubuntu` or `root`. | | ansible_user: `<user>` | User that will ssh into the node. This is typically `ubuntu` or `root`. |
| VALIDATOR_ADDRESS_PRIVATE_KEY: `"<private_key>"` | The private key for the specified validator address. | | ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: `"<private_key>"` | The private key for the specified validator address. |
| syslog_server_port: `"<protocol>://<ip>:<port>"` | Optional port specification for bridge logs. This value will be provided by an administrator if required. | | syslog_server_port: `"<protocol>://<ip>:<port>"` | Optional port specification for bridge logs. This value will be provided by an administrator if required. |
`hosts.yml` can contain multiple bridge configurations at once. `hosts.yml` can contain multiple bridge configurations at once.

@ -1,35 +1,35 @@
--- ---
## General settings ## General settings
BRIDGE_MODE: "ERC_TO_NATIVE" ORACLE_BRIDGE_MODE: "ERC_TO_NATIVE"
HOME_NATIVE_NAME: "xDai" UI_NATIVE_TOKEN_DISPLAY_NAME: "xDai"
## Home contract ## Home contract
HOME_RPC_URL: "https://dai.poa.network" COMMON_HOME_RPC_URL: "https://dai.poa.network"
HOME_NAME: "xDai chain" UI_HOME_NETWORK_DISPLAY_NAME: "xDai chain"
HOME_WITHOUT_EVENTS: false UI_HOME_WITHOUT_EVENTS: false
HOME_BRIDGE_ADDRESS: "0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6" COMMON_HOME_BRIDGE_ADDRESS: "0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6"
HOME_POLLING_INTERVAL: 5000 ORACLE_HOME_RPC_POLLING_INTERVAL: 5000
## Foreign contract ## Foreign contract
FOREIGN_RPC_URL: "https://mainnet.infura.io" COMMON_FOREIGN_RPC_URL: "https://mainnet.infura.io"
FOREIGN_NAME: "Ethereum Mainnet" UI_FOREIGN_NETWORK_DISPLAY_NAME: "Ethereum Mainnet"
FOREIGN_WITHOUT_EVENTS: false UI_FOREIGN_WITHOUT_EVENTS: false
FOREIGN_BRIDGE_ADDRESS: "0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016" COMMON_FOREIGN_BRIDGE_ADDRESS: "0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016"
ERC20_TOKEN_ADDRESS: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359" ERC20_TOKEN_ADDRESS: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"
FOREIGN_POLLING_INTERVAL: 5000 ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 5000
## Home Gasprice ## Home Gasprice
# HOME_GAS_PRICE_ORACLE_URL: "https://localhost:8888/" # COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "https://localhost:8888/"
HOME_GAS_PRICE_SPEED_TYPE: "standard" COMMON_HOME_GAS_PRICE_SPEED_TYPE: "standard"
HOME_GAS_PRICE_FALLBACK: 0 COMMON_HOME_GAS_PRICE_FALLBACK: 0
HOME_GAS_PRICE_UPDATE_INTERVAL: 600000 COMMON_HOME_GAS_PRICE_FACTOR: 600000
## Foreign Gasprice ## Foreign Gasprice
FOREIGN_GAS_PRICE_ORACLE_URL: "https://gasprice.poa.network/" COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL: "https://gasprice.poa.network/"
FOREIGN_GAS_PRICE_SPEED_TYPE: "standard" COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE: "standard"
FOREIGN_GAS_PRICE_FALLBACK: 10000000000 COMMON_FOREIGN_GAS_PRICE_FALLBACK: 10000000000
FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000 ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000
FOREIGN_GAS_PRICE_FACTOR: 1 COMMON_FOREIGN_GAS_PRICE_FACTOR: 1
## UI ## UI
UI_TITLE: "TokenBridge UI app - %c" UI_TITLE: "TokenBridge UI app - %c"
@ -39,15 +39,13 @@ UI_HOME_EXPLORER_TX_TEMPLATE: https://blockscout.com/poa/dai/tx/%s
UI_FOREIGN_EXPLORER_TX_TEMPLATE: https://blockscout.com/eth/mainnet/tx/%s UI_FOREIGN_EXPLORER_TX_TEMPLATE: https://blockscout.com/eth/mainnet/tx/%s
UI_HOME_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/poa/dai/address/%s UI_HOME_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/poa/dai/address/%s
UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/eth/mainnet/address/%s UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/eth/mainnet/address/%s
UI_HOME_GAS_PRICE_FALLBACK: 1000000000 UI_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000
UI_FOREIGN_GAS_PRICE_FALLBACK: 10000000000 UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000
## Monitor ## Monitor
MONITOR_PORT: 3003 MONITOR_PORT: 3003
MONITOR_HOME_DEPLOYMENT_BLOCK: 759 MONITOR_HOME_START_BLOCK: 759
MONITOR_FOREIGN_DEPLOYMENT_BLOCK: 6478417 MONITOR_FOREIGN_START_BLOCK: 6478417
MONITOR_HOME_GAS_LIMIT: 300000 MONITOR_VALIDATOR_HOME_TX_LIMIT: 300000
MONITOR_FOREIGN_GAS_LIMIT: 300000 MONITOR_VALIDATOR_FOREIGN_TX_LIMIT: 300000
MONITOR_HOME_GAS_PRICE_FALLBACK: 0 MONITOR_TX_NUMBER_THRESHOLD: 100
MONITOR_FOREIGN_GAS_PRICE_FALLBACK: 10000000000
MONITOR_LEFT_TX_THRESHOLD: 100

@ -1,7 +1,7 @@
--- ---
BRIDGE_MODE: "ERC_TO_ERC" ORACLE_BRIDGE_MODE: "ERC_TO_ERC"
HOME_BRIDGE_ADDRESS: "0x1feB40aD9420b186F019A717c37f5546165d411E" COMMON_HOME_BRIDGE_ADDRESS: "0x1feB40aD9420b186F019A717c37f5546165d411E"
FOREIGN_BRIDGE_ADDRESS: "0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127" COMMON_FOREIGN_BRIDGE_ADDRESS: "0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127"
ERC20_TOKEN_ADDRESS: "0x3C665A31199694Bf723fD08844AD290207B5797f" ERC20_TOKEN_ADDRESS: "0x3C665A31199694Bf723fD08844AD290207B5797f"
UI_PORT: 3001 UI_PORT: 3001
MONITOR_PORT: 3011 MONITOR_PORT: 3011

@ -1,7 +1,7 @@
--- ---
BRIDGE_MODE: "ERC_TO_NATIVE" ORACLE_BRIDGE_MODE: "ERC_TO_NATIVE"
HOME_BRIDGE_ADDRESS: "0x488Af810997eD1730cB3a3918cD83b3216E6eAda" COMMON_HOME_BRIDGE_ADDRESS: "0x488Af810997eD1730cB3a3918cD83b3216E6eAda"
FOREIGN_BRIDGE_ADDRESS: "0x488Af810997eD1730cB3a3918cD83b3216E6eAda" COMMON_FOREIGN_BRIDGE_ADDRESS: "0x488Af810997eD1730cB3a3918cD83b3216E6eAda"
ERC20_TOKEN_ADDRESS: "0x3C665A31199694Bf723fD08844AD290207B5797f" ERC20_TOKEN_ADDRESS: "0x3C665A31199694Bf723fD08844AD290207B5797f"
UI_PORT: 3002 UI_PORT: 3002
MONITOR_PORT: 3012 MONITOR_PORT: 3012

@ -1,36 +1,37 @@
--- ---
## General settings ## General settings
BRIDGE_MODE: "NATIVE_TO_ERC" ORACLE_BRIDGE_MODE: "NATIVE_TO_ERC"
HOME_NATIVE_NAME: "POA" ORACLE_LOG_LEVEL: debug
UI_NATIVE_TOKEN_DISPLAY_NAME: "POA"
## Home contract ## Home contract
HOME_RPC_URL: "https://sokol.poa.network" COMMON_HOME_RPC_URL: "https://sokol.poa.network"
HOME_NAME: "POA Sokol" UI_HOME_NETWORK_DISPLAY_NAME: "POA Sokol"
HOME_WITHOUT_EVENTS: false UI_HOME_WITHOUT_EVENTS: false
HOME_BRIDGE_ADDRESS: "0x98aFdE294f1C46aA0a27Cc4049ED337F879d8976" COMMON_HOME_BRIDGE_ADDRESS: "0x98aFdE294f1C46aA0a27Cc4049ED337F879d8976"
HOME_POLLING_INTERVAL: 5000 ORACLE_HOME_RPC_POLLING_INTERVAL: 5000
## Foreign contract ## Foreign contract
FOREIGN_RPC_URL: "https://sokol.poa.network" COMMON_FOREIGN_RPC_URL: "https://sokol.poa.network"
FOREIGN_NAME: "Kovan" UI_FOREIGN_NETWORK_DISPLAY_NAME: "Kovan"
FOREIGN_WITHOUT_EVENTS: false UI_FOREIGN_WITHOUT_EVENTS: false
FOREIGN_BRIDGE_ADDRESS: "0x5a584f4C30B36f282848dAc9a2b20E7BEF481981" COMMON_FOREIGN_BRIDGE_ADDRESS: "0x5a584f4C30B36f282848dAc9a2b20E7BEF481981"
ERC20_TOKEN_ADDRESS: "0x6ef22442D600E1865AD8A8c254d6befCe7f4e6e4" ERC20_TOKEN_ADDRESS: "0x6ef22442D600E1865AD8A8c254d6befCe7f4e6e4"
FOREIGN_POLLING_INTERVAL: 1000 ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 1000
## Home Gasprice ## Home Gasprice
HOME_GAS_PRICE_ORACLE_URL: "https://gasprice.poa.network/" COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "https://gasprice.poa.network/"
HOME_GAS_PRICE_SPEED_TYPE: "standard" COMMON_HOME_GAS_PRICE_SPEED_TYPE: "standard"
HOME_GAS_PRICE_FALLBACK: 1000000000 # in wei COMMON_HOME_GAS_PRICE_FALLBACK: 1000000000 # in wei
HOME_GAS_PRICE_UPDATE_INTERVAL: 600000 COMMON_HOME_GAS_PRICE_FACTOR: 1
HOME_GAS_PRICE_FACTOR: 1 ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000
## Foreign Gasprice ## Foreign Gasprice
FOREIGN_GAS_PRICE_ORACLE_URL: "https://gasprice.poa.network/" COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL: "https://gasprice.poa.network/"
FOREIGN_GAS_PRICE_SPEED_TYPE: "standard" COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE: "standard"
FOREIGN_GAS_PRICE_FALLBACK: 1000000000 # in wei COMMON_FOREIGN_GAS_PRICE_FALLBACK: 1000000000 # in wei
FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000 COMMON_FOREIGN_GAS_PRICE_FACTOR: 1
FOREIGN_GAS_PRICE_FACTOR: 1 ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000
## UI ## UI
UI_TITLE: "TokenBridge UI app - %c" UI_TITLE: "TokenBridge UI app - %c"
@ -40,15 +41,13 @@ UI_HOME_EXPLORER_TX_TEMPLATE: https://blockscout.com/poa/sokol/tx/%s
UI_FOREIGN_EXPLORER_TX_TEMPLATE: https://blockscout.com/eth/kovan/tx/%s UI_FOREIGN_EXPLORER_TX_TEMPLATE: https://blockscout.com/eth/kovan/tx/%s
UI_HOME_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/poa/sokol/address/%s UI_HOME_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/poa/sokol/address/%s
UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/eth/kovan/address/%s UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/eth/kovan/address/%s
UI_HOME_GAS_PRICE_FALLBACK: 1000000000 UI_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000
UI_FOREIGN_GAS_PRICE_FALLBACK: 1000000000 UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000
## Monitor ## Monitor
MONITOR_PORT: 3003 MONITOR_PORT: 3003
MONITOR_HOME_DEPLOYMENT_BLOCK: 0 MONITOR_HOME_START_BLOCK: 0
MONITOR_FOREIGN_DEPLOYMENT_BLOCK: 0 MONITOR_FOREIGN_START_BLOCK: 0
MONITOR_HOME_GAS_LIMIT: 300000 MONITOR_VALIDATOR_HOME_TX_LIMIT: 300000
MONITOR_FOREIGN_GAS_LIMIT: 300000 MONITOR_VALIDATOR_FOREIGN_TX_LIMIT: 300000
MONITOR_HOME_GAS_PRICE_FALLBACK: 1000000000
MONITOR_FOREIGN_GAS_PRICE_FALLBACK: 1000000000
MONITOR_LEFT_TX_THRESHOLD: 100 MONITOR_LEFT_TX_THRESHOLD: 100

@ -1,7 +1,7 @@
--- ---
BRIDGE_MODE: "NATIVE_TO_ERC" ORACLE_BRIDGE_MODE: "NATIVE_TO_ERC"
HOME_BRIDGE_ADDRESS: "0x32198D570fffC7033641F8A9094FFDCaAEF42624" COMMON_HOME_BRIDGE_ADDRESS: "0x32198D570fffC7033641F8A9094FFDCaAEF42624"
FOREIGN_BRIDGE_ADDRESS: "0x2B6871b9B02F73fa24F4864322CdC78604207769" COMMON_FOREIGN_BRIDGE_ADDRESS: "0x2B6871b9B02F73fa24F4864322CdC78604207769"
ERC20_TOKEN_ADDRESS: "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B" ERC20_TOKEN_ADDRESS: "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B"
UI_PORT: 3000 UI_PORT: 3000
MONITOR_PORT: 3010 MONITOR_PORT: 3010

@ -1,56 +1,49 @@
--- ---
## General settings ## General settings
# BRIDGE_MODE: "" UI_NATIVE_TOKEN_DISPLAY_NAME: "POA"
HOME_NATIVE_NAME: "POA" ORACLE_ALLOW_HTTP_FOR_RPC: yes
ALLOW_HTTP: yes ORACLE_LOG_LEVEL: debug
LOG_LEVEL: debug
## Home contract ## Home contract
HOME_RPC_URL: "https://sokol.poa.network" COMMON_HOME_RPC_URL: "https://sokol.poa.network"
HOME_NAME: "POA Sokol" UI_HOME_NETWORK_DISPLAY_NAME: "POA Sokol"
HOME_WITHOUT_EVENTS: false UI_HOME_WITHOUT_EVENTS: false
# HOME_BRIDGE_ADDRESS: "0x32198D570fffC7033641F8A9094FFDCaAEF42624" ORACLE_HOME_RPC_POLLING_INTERVAL: 5000
HOME_POLLING_INTERVAL: 5000
## Foreign contract ## Foreign contract
FOREIGN_RPC_URL: "https://sokol.poa.network" COMMON_FOREIGN_RPC_URL: "https://sokol.poa.network"
FOREIGN_NAME: "Kovan" UI_FOREIGN_NETWORK_DISPLAY_NAME: "Kovan"
FOREIGN_WITHOUT_EVENTS: false UI_FOREIGN_WITHOUT_EVENTS: false
# FOREIGN_BRIDGE_ADDRESS: "0x2B6871b9B02F73fa24F4864322CdC78604207769" ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 1000
# ERC20_TOKEN_ADDRESS: "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B"
FOREIGN_POLLING_INTERVAL: 1000
## Home Gasprice ## Home Gasprice
HOME_GAS_PRICE_ORACLE_URL: "https://gasprice.poa.network/" COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "https://gasprice.poa.network/"
HOME_GAS_PRICE_SPEED_TYPE: "standard" COMMON_HOME_GAS_PRICE_SPEED_TYPE: "standard"
HOME_GAS_PRICE_FALLBACK: 1000000000 # in wei COMMON_HOME_GAS_PRICE_FALLBACK: 1000000000 # in wei
HOME_GAS_PRICE_UPDATE_INTERVAL: 600000 COMMON_HOME_GAS_PRICE_FACTOR: 1
HOME_GAS_PRICE_FACTOR: 1 ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000
## Foreign Gasprice ## Foreign Gasprice
FOREIGN_GAS_PRICE_ORACLE_URL: "https://gasprice.poa.network/" COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL: "https://gasprice.poa.network/"
FOREIGN_GAS_PRICE_SPEED_TYPE: "standard" COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE: "standard"
FOREIGN_GAS_PRICE_FALLBACK: 1000000000 # in wei COMMON_FOREIGN_GAS_PRICE_FALLBACK: 1000000000 # in wei
FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000 COMMON_FOREIGN_GAS_PRICE_FACTOR: 1
FOREIGN_GAS_PRICE_FACTOR: 1 ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000
## UI
#ui
UI_TITLE: "TokenBridge UI app - %c" UI_TITLE: "TokenBridge UI app - %c"
UI_DESCRIPTION: "The POA cross-chain bridge serves as a method of transferring POA native tokens from the POA Network to the Ethereum network in a quick and cost-efficient manner." UI_DESCRIPTION: "The POA cross-chain bridge serves as a method of transferring POA native tokens from the POA Network to the Ethereum network in a quick and cost-efficient manner."
# UI_PORT: 3000
UI_HOME_EXPLORER_TX_TEMPLATE: https://blockscout.com/poa/sokol/tx/%s UI_HOME_EXPLORER_TX_TEMPLATE: https://blockscout.com/poa/sokol/tx/%s
UI_FOREIGN_EXPLORER_TX_TEMPLATE: https://blockscout.com/eth/kovan/tx/%s UI_FOREIGN_EXPLORER_TX_TEMPLATE: https://blockscout.com/eth/kovan/tx/%s
UI_HOME_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/poa/sokol/address/%s UI_HOME_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/poa/sokol/address/%s
UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/eth/kovan/address/%s UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/eth/kovan/address/%s
UI_HOME_GAS_PRICE_FALLBACK: 1000000000 UI_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000
UI_FOREIGN_GAS_PRICE_FALLBACK: 1000000000 UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000
## Monitor #montior
# MONITOR_PORT: 3003 MONITOR_HOME_START_BLOCK: 0
MONITOR_HOME_DEPLOYMENT_BLOCK: 0 MONITOR_FOREIGN_START_BLOCK: 0
MONITOR_FOREIGN_DEPLOYMENT_BLOCK: 0 MONITOR_VALIDATOR_HOME_TX_LIMIT: 300000
MONITOR_HOME_GAS_LIMIT: 300000 MONITOR_VALIDATOR_FOREIGN_TX_LIMIT: 300000
MONITOR_FOREIGN_GAS_LIMIT: 300000
MONITOR_HOME_GAS_PRICE_FALLBACK: 1000000000
MONITOR_FOREIGN_GAS_PRICE_FALLBACK: 1000000000
MONITOR_LEFT_TX_THRESHOLD: 100 MONITOR_LEFT_TX_THRESHOLD: 100

@ -1,36 +1,36 @@
--- ---
## General settings ## General settings
BRIDGE_MODE: "NATIVE_TO_ERC" ORACLE_BRIDGE_MODE: "NATIVE_TO_ERC"
HOME_NATIVE_NAME: "ETC" UI_NATIVE_TOKEN_DISPLAY_NAME: "ETC"
## Home contract ## Home contract
HOME_RPC_URL: "https://ethereumclassic.network" COMMON_HOME_RPC_URL: "https://ethereumclassic.network"
HOME_NAME: "Ethereum Classic" UI_HOME_NETWORK_DISPLAY_NAME: "Ethereum Classic"
HOME_WITHOUT_EVENTS: false UI_HOME_WITHOUT_EVENTS: false
HOME_BRIDGE_ADDRESS: "0x073081832B4Ecdce79d4D6753565c85Ba4b3BeA9" COMMON_HOME_BRIDGE_ADDRESS: "0x073081832B4Ecdce79d4D6753565c85Ba4b3BeA9"
HOME_POLLING_INTERVAL: 7000 ORACLE_HOME_RPC_POLLING_INTERVAL: 7000
## Foreign contract ## Foreign contract
FOREIGN_RPC_URL: "https://mainnet.infura.io/" COMMON_FOREIGN_RPC_URL: "https://mainnet.infura.io/"
FOREIGN_NAME: "Ethereum Mainnet" UI_FOREIGN_NETWORK_DISPLAY_NAME: "Ethereum Mainnet"
FOREIGN_WITHOUT_EVENTS: false UI_FOREIGN_WITHOUT_EVENTS: false
FOREIGN_BRIDGE_ADDRESS: "0x0cB781EE62F815bdD9CD4c2210aE8600d43e7040" COMMON_FOREIGN_BRIDGE_ADDRESS: "0x0cB781EE62F815bdD9CD4c2210aE8600d43e7040"
ERC20_TOKEN_ADDRESS: "0x86aaBCc646f290b9Fc9Bd05CE17C3858d1511Da1" ERC20_TOKEN_ADDRESS: "0x86aaBCc646f290b9Fc9Bd05CE17C3858d1511Da1"
FOREIGN_POLLING_INTERVAL: 7000 ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 7000
## Home Gasprice ## Home Gasprice
HOME_GAS_PRICE_ORACLE_URL: "https://gasprice-etc.poa.network/" COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "https://gasprice-etc.poa.network/"
HOME_GAS_PRICE_SPEED_TYPE: "standard" COMMON_HOME_GAS_PRICE_SPEED_TYPE: "standard"
HOME_GAS_PRICE_FALLBACK: 15000000000 # in wei COMMON_HOME_GAS_PRICE_FALLBACK: 15000000000 # in wei
HOME_GAS_PRICE_UPDATE_INTERVAL: 600000 ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000
HOME_GAS_PRICE_FACTOR: 1 COMMON_HOME_GAS_PRICE_FACTOR: 1
## Foreign Gasprice ## Foreign Gasprice
FOREIGN_GAS_PRICE_ORACLE_URL: "https://gasprice.poa.network/" COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL: "https://gasprice.poa.network/"
FOREIGN_GAS_PRICE_SPEED_TYPE: "standard" COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE: "standard"
FOREIGN_GAS_PRICE_FALLBACK: 10000000000 # in wei COMMON_FOREIGN_GAS_PRICE_FALLBACK: 10000000000 # in wei
FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000 ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000
FOREIGN_GAS_PRICE_FACTOR: 1 COMMON_FOREIGN_GAS_PRICE_FACTOR: 1
## UI ## UI
UI_TITLE: "TokenBridge UI app - %c" UI_TITLE: "TokenBridge UI app - %c"
@ -40,15 +40,13 @@ UI_HOME_EXPLORER_TX_TEMPLATE: https://blockscout.com/etc/mainnet/tx/%s
UI_FOREIGN_EXPLORER_TX_TEMPLATE: https://blockscout.com/eth/mainnet/tx/%s UI_FOREIGN_EXPLORER_TX_TEMPLATE: https://blockscout.com/eth/mainnet/tx/%s
UI_HOME_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/etc/mainnet/address/%s UI_HOME_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/etc/mainnet/address/%s
UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/eth/mainnet/address/%s UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE: https://blockscout.com/eth/mainnet/address/%s
UI_HOME_GAS_PRICE_FALLBACK: 15000000000 UI_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000
UI_FOREIGN_GAS_PRICE_FALLBACK: 10000000000 UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000
## Monitor ## Monitor
MONITOR_PORT: 3003 MONITOR_PORT: 3003
MONITOR_HOME_DEPLOYMENT_BLOCK: 7703292 MONITOR_HOME_START_BLOCK: 7703292
MONITOR_FOREIGN_DEPLOYMENT_BLOCK: 7412459 MONITOR_FOREIGN_START_BLOCK: 7412459
MONITOR_HOME_GAS_LIMIT: 300000 MONITOR_VALIDATOR_HOME_TX_LIMIT: 300000
MONITOR_FOREIGN_GAS_LIMIT: 300000 MONITOR_VALIDATOR_FOREIGN_TX_LIMIT: 300000
MONITOR_HOME_GAS_PRICE_FALLBACK: 15000000000 MONITOR_TX_NUMBER_THRESHOLD: 100
MONITOR_FOREIGN_GAS_PRICE_FALLBACK: 10000000000
MONITOR_LEFT_TX_THRESHOLD: 100

@ -5,7 +5,7 @@ sokol-kovan:
hosts: hosts:
127.0.0.1: 127.0.0.1:
ansible_user: ubuntu ansible_user: ubuntu
VALIDATOR_ADDRESS_PRIVATE_KEY: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
#syslog_server_port: "udp://127.0.0.1:514" #syslog_server_port: "udp://127.0.0.1:514"
ui: ui:
hosts: hosts:

@ -1,24 +1,24 @@
HOME_RPC_URL={{ HOME_RPC_URL }} COMMON_HOME_RPC_URL={{ COMMON_HOME_RPC_URL }}
FOREIGN_RPC_URL={{ FOREIGN_RPC_URL }} COMMON_FOREIGN_RPC_URL={{ COMMON_FOREIGN_RPC_URL }}
HOME_BRIDGE_ADDRESS={{ HOME_BRIDGE_ADDRESS }} COMMON_HOME_BRIDGE_ADDRESS={{ COMMON_HOME_BRIDGE_ADDRESS }}
FOREIGN_BRIDGE_ADDRESS={{ FOREIGN_BRIDGE_ADDRESS }} COMMON_FOREIGN_BRIDGE_ADDRESS={{ COMMON_FOREIGN_BRIDGE_ADDRESS }}
HOME_DEPLOYMENT_BLOCK={{ MONITOR_HOME_DEPLOYMENT_BLOCK }} MONITOR_HOME_START_BLOCK={{ MONITOR_HOME_START_BLOCK }}
FOREIGN_DEPLOYMENT_BLOCK={{ MONITOR_FOREIGN_DEPLOYMENT_BLOCK }} MONITOR_FOREIGN_START_BLOCK={{ MONITOR_FOREIGN_START_BLOCK }}
HOME_GAS_LIMIT={{ MONITOR_HOME_GAS_LIMIT }} MONITOR_VALIDATOR_HOME_TX_LIMIT={{ MONITOR_VALIDATOR_HOME_TX_LIMIT }}
{% if HOME_GAS_PRICE_ORACLE_URL | default('') != '' %} {% if COMMON_HOME_GAS_PRICE_SUPPLIER_URL | default('') != '' %}
HOME_GAS_PRICE_ORACLE_URL={{ HOME_GAS_PRICE_ORACLE_URL }} COMMON_HOME_GAS_PRICE_SUPPLIER_URL={{ COMMON_HOME_GAS_PRICE_SUPPLIER_URL }}
{% endif %} {% endif %}
{% if HOME_GAS_PRICE_SPEED_TYPE | default('') != '' %} {% if COMMON_HOME_GAS_PRICE_SPEED_TYPE | default('') != '' %}
HOME_GAS_PRICE_SPEED_TYPE={{ HOME_GAS_PRICE_SPEED_TYPE }} COMMON_HOME_GAS_PRICE_SPEED_TYPE={{ COMMON_HOME_GAS_PRICE_SPEED_TYPE }}
{% endif %} {% endif %}
HOME_GAS_PRICE_FALLBACK={{ MONITOR_HOME_GAS_PRICE_FALLBACK }} COMMON_HOME_GAS_PRICE_FALLBACK={{ COMMON_HOME_GAS_PRICE_FALLBACK }}
{% if HOME_GAS_PRICE_FACTOR | default('') != '' %} {% if COMMON_HOME_GAS_PRICE_FACTOR | default('') != '' %}
HOME_GAS_PRICE_FACTOR={{ HOME_GAS_PRICE_FACTOR }} COMMON_HOME_GAS_PRICE_FACTOR={{ COMMON_HOME_GAS_PRICE_FACTOR }}
{% endif %} {% endif %}
FOREIGN_GAS_LIMIT={{ MONITOR_FOREIGN_GAS_LIMIT }} MONITOR_VALIDATOR_FOREIGN_TX_LIMIT={{ MONITOR_VALIDATOR_FOREIGN_TX_LIMIT }}
FOREIGN_GAS_PRICE_ORACLE_URL={{ FOREIGN_GAS_PRICE_ORACLE_URL }} COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL={{ COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL }}
FOREIGN_GAS_PRICE_SPEED_TYPE={{ FOREIGN_GAS_PRICE_SPEED_TYPE }} COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE={{ COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE }}
FOREIGN_GAS_PRICE_FALLBACK={{ MONITOR_FOREIGN_GAS_PRICE_FALLBACK }} COMMON_FOREIGN_GAS_PRICE_FALLBACK={{ COMMON_FOREIGN_GAS_PRICE_FALLBACK }}
FOREIGN_GAS_PRICE_FACTOR={{ FOREIGN_GAS_PRICE_FACTOR }} COMMON_FOREIGN_GAS_PRICE_FACTOR={{ COMMON_FOREIGN_GAS_PRICE_FACTOR }}
LEFT_TX_THRESHOLD={{ MONITOR_LEFT_TX_THRESHOLD }} MONITOR_LEFT_TX_THRESHOLD={{ MONITOR_LEFT_TX_THRESHOLD }}
PORT={{ MONITOR_PORT }} MONITOR_PORT={{ MONITOR_PORT }}

@ -1,6 +1,6 @@
--- ---
bridge_path: "/home/{{ compose_service_user }}/bridge" bridge_path: "/home/{{ compose_service_user }}/bridge"
ALLOW_HTTP: no ORACLE_ALLOW_HTTP_FOR_RPC: no
QUEUE_URL: amqp://rabbit ORACLE_QUEUE_URL: amqp://rabbit
REDIS_URL: redis://redis ORACLE_REDIS_URL: redis://redis
keyfile_path: "/root/.key" keyfile_path: "/root/.key"

@ -40,5 +40,5 @@
path: /etc/rsyslog.conf path: /etc/rsyslog.conf
insertbefore: "# Where to place spool and state files" insertbefore: "# Where to place spool and state files"
marker: "#{mark} add string to discarding unwanted messages" marker: "#{mark} add string to discarding unwanted messages"
content: ':msg, contains, "VALIDATOR_ADDRESS_PRIVATE_KEY" ~' content: ':msg, contains, "ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY" ~'
notify: restart rsyslog notify: restart rsyslog

@ -16,14 +16,14 @@
- name: Get validator address - name: Get validator address
become_user: "{{ compose_service_user }}" become_user: "{{ compose_service_user }}"
shell: docker-compose run -e VALIDATOR_ADDRESS_PRIVATE_KEY="{{ VALIDATOR_ADDRESS_PRIVATE_KEY }}" --entrypoint "node scripts/privateKeyToAddress.js" bridge_affirmation shell: docker-compose run -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY="{{ ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY }}" --entrypoint "node scripts/privateKeyToAddress.js" bridge_affirmation
args: args:
chdir: "{{ bridge_path }}/oracle" chdir: "{{ bridge_path }}/oracle"
register: VADDRESS register: VADDRESS
- name: Set VALIDATOR_ADDRESS variable - name: Set ORACLE_VALIDATOR_ADDRESS variable
set_fact: set_fact:
VALIDATOR_ADDRESS: "{{ VADDRESS.stdout }}" ORACLE_VALIDATOR_ADDRESS: "{{ VADDRESS.stdout }}"
- name: Install .key config - name: Install .key config
template: template:

@ -1,47 +1,48 @@
## General settings ## General settings
BRIDGE_MODE={{ BRIDGE_MODE }} ORACLE_BRIDGE_MODE={{ ORACLE_BRIDGE_MODE }}
ORACLE_LOG_LEVEL={{ ORACLE_LOG_LEVEL }}
## Home contract ## Home contract
HOME_RPC_URL={{ HOME_RPC_URL }} COMMON_HOME_RPC_URL={{ COMMON_HOME_RPC_URL }}
HOME_BRIDGE_ADDRESS={{ HOME_BRIDGE_ADDRESS }} COMMON_HOME_BRIDGE_ADDRESS={{ COMMON_HOME_BRIDGE_ADDRESS }}
HOME_POLLING_INTERVAL={{ HOME_POLLING_INTERVAL }} ORACLE_HOME_RPC_POLLING_INTERVAL={{ ORACLE_HOME_RPC_POLLING_INTERVAL }}
## Foreign contract ## Foreign contract
FOREIGN_RPC_URL={{ FOREIGN_RPC_URL }} COMMON_FOREIGN_RPC_URL={{ COMMON_FOREIGN_RPC_URL }}
FOREIGN_BRIDGE_ADDRESS={{ FOREIGN_BRIDGE_ADDRESS }} COMMON_FOREIGN_BRIDGE_ADDRESS={{ COMMON_FOREIGN_BRIDGE_ADDRESS }}
ERC20_TOKEN_ADDRESS={{ ERC20_TOKEN_ADDRESS }} ERC20_TOKEN_ADDRESS={{ ERC20_TOKEN_ADDRESS }}
FOREIGN_POLLING_INTERVAL={{ FOREIGN_POLLING_INTERVAL }} ORACLE_FOREIGN_RPC_POLLING_INTERVAL={{ ORACLE_FOREIGN_RPC_POLLING_INTERVAL }}
## Gasprice ## Gasprice
{% if HOME_GAS_PRICE_ORACLE_URL | default('') != '' %} {% if COMMON_HOME_GAS_PRICE_SUPPLIER_URL | default('') != '' %}
HOME_GAS_PRICE_ORACLE_URL={{ HOME_GAS_PRICE_ORACLE_URL }} COMMON_HOME_GAS_PRICE_SUPPLIER_URL={{ COMMON_HOME_GAS_PRICE_SUPPLIER_URL }}
{% endif %} {% endif %}
{% if HOME_GAS_PRICE_SPEED_TYPE | default('') != '' %} {% if COMMON_HOME_GAS_PRICE_SPEED_TYPE | default('') != '' %}
HOME_GAS_PRICE_SPEED_TYPE={{ HOME_GAS_PRICE_SPEED_TYPE }} COMMON_HOME_GAS_PRICE_SPEED_TYPE={{ COMMON_HOME_GAS_PRICE_SPEED_TYPE }}
{% endif %} {% endif %}
HOME_GAS_PRICE_FALLBACK={{ HOME_GAS_PRICE_FALLBACK }} COMMON_HOME_GAS_PRICE_FALLBACK={{ COMMON_HOME_GAS_PRICE_FALLBACK }}
{% if HOME_GAS_PRICE_UPDATE_INTERVAL | default('') != '' %} {% if ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL | default('') != '' %}
HOME_GAS_PRICE_UPDATE_INTERVAL={{ HOME_GAS_PRICE_UPDATE_INTERVAL }} ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL={{ ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL }}
{% endif %} {% endif %}
{% if HOME_GAS_PRICE_FACTOR | default('') != '' %} {% if COMMON_HOME_GAS_PRICE_FACTOR | default('') != '' %}
HOME_GAS_PRICE_FACTOR={{ HOME_GAS_PRICE_FACTOR }} COMMON_HOME_GAS_PRICE_FACTOR={{ COMMON_HOME_GAS_PRICE_FACTOR }}
{% endif %} {% endif %}
{% if FOREIGN_GAS_PRICE_ORACLE_URL | default('') != '' %} {% if COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL | default('') != '' %}
FOREIGN_GAS_PRICE_ORACLE_URL={{ FOREIGN_GAS_PRICE_ORACLE_URL }} COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL={{ COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL }}
{% endif %} {% endif %}
{% if FOREIGN_GAS_PRICE_SPEED_TYPE | default('') != '' %} {% if COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE | default('') != '' %}
FOREIGN_GAS_PRICE_SPEED_TYPE={{ FOREIGN_GAS_PRICE_SPEED_TYPE }} COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE={{ COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE }}
{% endif %} {% endif %}
FOREIGN_GAS_PRICE_FALLBACK={{ FOREIGN_GAS_PRICE_FALLBACK }} COMMON_FOREIGN_GAS_PRICE_FALLBACK={{ COMMON_FOREIGN_GAS_PRICE_FALLBACK }}
{% if FOREIGN_GAS_PRICE_UPDATE_INTERVAL | default('') != '' %} {% if ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL | default('') != '' %}
FOREIGN_GAS_PRICE_UPDATE_INTERVAL={{ FOREIGN_GAS_PRICE_UPDATE_INTERVAL }} ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL={{ ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL }}
{% endif %} {% endif %}
{% if FOREIGN_GAS_PRICE_FACTOR | default('') != '' %} {% if COMMON_FOREIGN_GAS_PRICE_FACTOR | default('') != '' %}
FOREIGN_GAS_PRICE_FACTOR={{ FOREIGN_GAS_PRICE_FACTOR }} COMMON_FOREIGN_GAS_PRICE_FACTOR={{ COMMON_FOREIGN_GAS_PRICE_FACTOR }}
{% endif %} {% endif %}
## Transport configuration ## Transport configuration
ALLOW_HTTP={{ "yes" if ALLOW_HTTP else "no" }} ORACLE_ALLOW_HTTP_FOR_RPC={{ "yes" if ORACLE_ALLOW_HTTP_FOR_RPC else "no" }}
QUEUE_URL={{ QUEUE_URL }} ORACLE_QUEUE_URL={{ ORACLE_QUEUE_URL }}
REDIS_URL={{ REDIS_URL }} ORACLE_REDIS_URL={{ ORACLE_REDIS_URL }}

@ -1,3 +1,3 @@
## Validator-specific options ## Validator-specific options
VALIDATOR_ADDRESS={{ VALIDATOR_ADDRESS }} ORACLE_VALIDATOR_ADDRESS={{ ORACLE_VALIDATOR_ADDRESS }}
VALIDATOR_ADDRESS_PRIVATE_KEY={{ VALIDATOR_ADDRESS_PRIVATE_KEY }} ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY={{ ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY }}

@ -14,8 +14,8 @@ WORKDIR="{{ '/home/' + compose_service_user | default('poadocker') + '/' + bridg
#Getting path to private key file and variable name for parsing key file #Getting path to private key file and variable name for parsing key file
keyfile="{{ keyfile_path }}" keyfile="{{ keyfile_path }}"
vaddr="VALIDATOR_ADDRESS=" vaddr="ORACLE_VALIDATOR_ADDRESS="
vkey="VALIDATOR_ADDRESS_PRIVATE_KEY=" vkey="ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY="
#Parsing file content and add key to variable #Parsing file content and add key to variable
while read -r line while read -r line
@ -35,7 +35,7 @@ start(){
cd $WORKDIR cd $WORKDIR
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose down -v sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose down -v
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose rm -fv sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose rm -fv
sudo -u "{{ compose_service_user }}" VALIDATOR_ADDRESS=$vaddr VALIDATOR_ADDRESS_PRIVATE_KEY=$vkey /usr/local/bin/docker-compose up --detach sudo -u "{{ compose_service_user }}" ORACLE_VALIDATOR_ADDRESS=$vaddr ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=$vkey /usr/local/bin/docker-compose up --detach
} }
stop(){ stop(){
@ -56,7 +56,7 @@ rebuild(){
cd $WORKDIR cd $WORKDIR
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose down -v sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose down -v
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose rm -fv sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose rm -fv
sudo -u "{{ compose_service_user }}" VALIDATOR_ADDRESS=$vaddr VALIDATOR_ADDRESS_PRIVATE_KEY=$vkey /usr/local/bin/docker-compose up --detach --force-recreate --no-deps --build sudo -u "{{ compose_service_user }}" ORACLE_VALIDATOR_ADDRESS=$vaddr ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=$vkey /usr/local/bin/docker-compose up --detach --force-recreate --no-deps --build
} }

@ -1,38 +1,42 @@
REACT_APP_HOME_BRIDGE_ADDRESS={{ HOME_BRIDGE_ADDRESS }} COMMON_HOME_BRIDGE_ADDRESS={{ COMMON_HOME_BRIDGE_ADDRESS }}
REACT_APP_FOREIGN_BRIDGE_ADDRESS={{ FOREIGN_BRIDGE_ADDRESS }} COMMON_FOREIGN_BRIDGE_ADDRESS={{ COMMON_FOREIGN_BRIDGE_ADDRESS }}
REACT_APP_FOREIGN_HTTP_PARITY_URL={{ FOREIGN_RPC_URL }} COMMON_FOREIGN_RPC_URL={{ COMMON_FOREIGN_RPC_URL }}
REACT_APP_HOME_HTTP_PARITY_URL={{ HOME_RPC_URL }} COMMON_HOME_RPC_URL={{ COMMON_HOME_RPC_URL }}
REACT_APP_HOME_NATIVE_NAME={{ HOME_NATIVE_NAME }} UI_NATIVE_TOKEN_DISPLAY_NAME={{ UI_NATIVE_TOKEN_DISPLAY_NAME }}
REACT_APP_HOME_NETWORK_NAME={{ HOME_NAME }} UI_HOME_NETWORK_DISPLAY_NAME={{ UI_HOME_NETWORK_DISPLAY_NAME }}
REACT_APP_FOREIGN_NETWORK_NAME={{ FOREIGN_NAME }} UI_FOREIGN_NETWORK_DISPLAY_NAME={{ UI_FOREIGN_NETWORK_DISPLAY_NAME }}
REACT_APP_HOME_WITHOUT_EVENTS={{ HOME_WITHOUT_EVENTS }} UI_HOME_WITHOUT_EVENTS={{ UI_HOME_WITHOUT_EVENTS }}
REACT_APP_FOREIGN_WITHOUT_EVENTS={{ FOREIGN_WITHOUT_EVENTS }} UI_FOREIGN_WITHOUT_EVENTS={{ UI_FOREIGN_WITHOUT_EVENTS }}
REACT_APP_HOME_EXPLORER_TX_TEMPLATE={{ UI_HOME_EXPLORER_TX_TEMPLATE }} UI_HOME_EXPLORER_TX_TEMPLATE={{ UI_HOME_EXPLORER_TX_TEMPLATE }}
REACT_APP_FOREIGN_EXPLORER_TX_TEMPLATE={{ UI_FOREIGN_EXPLORER_TX_TEMPLATE }} UI_FOREIGN_EXPLORER_TX_TEMPLATE={{ UI_FOREIGN_EXPLORER_TX_TEMPLATE }}
REACT_APP_HOME_EXPLORER_ADDRESS_TEMPLATE={{ UI_HOME_EXPLORER_ADDRESS_TEMPLATE }} UI_HOME_EXPLORER_ADDRESS_TEMPLATE={{ UI_HOME_EXPLORER_ADDRESS_TEMPLATE }}
REACT_APP_FOREIGN_EXPLORER_ADDRESS_TEMPLATE={{ UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE }} UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE={{ UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE }}
{% if HOME_GAS_PRICE_ORACLE_URL | default('') != '' %} {% if COMMON_HOME_GAS_PRICE_SUPPLIER_URL | default('') != '' %}
REACT_APP_HOME_GAS_PRICE_ORACLE_URL={{ HOME_GAS_PRICE_ORACLE_URL }} COMMON_HOME_GAS_PRICE_SUPPLIER_URL={{ COMMON_HOME_GAS_PRICE_SUPPLIER_URL }}
REACT_APP_HOME_GAS_PRICE_SPEED_TYPE={{ HOME_GAS_PRICE_SPEED_TYPE }} COMMON_HOME_GAS_PRICE_SPEED_TYPE={{ COMMON_HOME_GAS_PRICE_SPEED_TYPE }}
{% endif %} {% endif %}
REACT_APP_HOME_GAS_PRICE_FALLBACK={{ UI_HOME_GAS_PRICE_FALLBACK }} COMMON_HOME_GAS_PRICE_FALLBACK={{ COMMON_HOME_GAS_PRICE_FALLBACK }}
REACT_APP_HOME_GAS_PRICE_UPDATE_INTERVAL={{ HOME_GAS_PRICE_UPDATE_INTERVAL }} UI_HOME_GAS_PRICE_UPDATE_INTERVAL={{ UI_HOME_GAS_PRICE_UPDATE_INTERVAL }}
{% if HOME_GAS_PRICE_FACTOR | default('') != '' %} {% if COMMON_HOME_GAS_PRICE_FACTOR | default('') != '' %}
REACT_APP_HOME_GAS_PRICE_FACTOR={{ HOME_GAS_PRICE_FACTOR }} COMMON_HOME_GAS_PRICE_FACTOR={{ COMMON_HOME_GAS_PRICE_FACTOR }}
{% endif %} {% endif %}
REACT_APP_FOREIGN_GAS_PRICE_ORACLE_URL={{ FOREIGN_GAS_PRICE_ORACLE_URL }} COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL={{ COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL }}
REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE={{ FOREIGN_GAS_PRICE_SPEED_TYPE }} COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE={{ COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE }}
REACT_APP_FOREIGN_GAS_PRICE_FALLBACK={{ UI_FOREIGN_GAS_PRICE_FALLBACK }} COMMON_FOREIGN_GAS_PRICE_FALLBACK={{ COMMON_FOREIGN_GAS_PRICE_FALLBACK }}
REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL={{ FOREIGN_GAS_PRICE_UPDATE_INTERVAL }} UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL={{ UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL }}
REACT_APP_FOREIGN_GAS_PRICE_FACTOR={{ FOREIGN_GAS_PRICE_FACTOR }} COMMON_FOREIGN_GAS_PRICE_FACTOR={{ COMMON_FOREIGN_GAS_PRICE_FACTOR }}
# Default # Default
REACT_APP_TITLE={{ UI_TITLE }} UI_TITLE={{ UI_TITLE }}
REACT_APP_DESCRIPTION={{ UI_DESCRIPTION }} UI_DESCRIPTION={{ UI_DESCRIPTION }}
PORT={{ UI_PORT }} UI_PORT={{ UI_PORT }}
{% if UI_STYLES | default('') != '' %}
UI_STYLES={{ UI_STYLES }}
{% endif %}

@ -0,0 +1,18 @@
COMMON_HOME_RPC_URL=http://parity1:8545
COMMON_FOREIGN_RPC_URL=http://parity2:8545
COMMON_HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
COMMON_FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
MONITOR_HOME_START_BLOCK=0
MONITOR_FOREIGN_START_BLOCK=0
MONITOR_VALIDATOR_HOME_TX_LIMIT=300000
COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
COMMON_HOME_GAS_PRICE_FALLBACK=1000000000
COMMON_HOME_GAS_PRICE_FACTOR=1
MONITOR_VALIDATOR_FOREIGN_TX_LIMIT=300000
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
COMMON_FOREIGN_GAS_PRICE_FALLBACK=1000000000
COMMON_FOREIGN_GAS_PRICE_FACTOR=1
MONITOR_TX_NUMBER_THRESHOLD=100
MONITOR_PORT=3012

@ -0,0 +1,18 @@
COMMON_HOME_RPC_URL=http://parity1:8545
COMMON_FOREIGN_RPC_URL=http://parity2:8545
COMMON_HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E
COMMON_FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127
MONITOR_HOME_START_BLOCK=0
MONITOR_FOREIGN_START_BLOCK=0
MONITOR_VALIDATOR_HOME_TX_LIMIT=300000
COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
COMMON_HOME_GAS_PRICE_FALLBACK=1000000000
COMMON_HOME_GAS_PRICE_FACTOR=1
MONITOR_VALIDATOR_FOREIGN_TX_LIMIT=300000
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
COMMON_FOREIGN_GAS_PRICE_FALLBACK=1000000000
COMMON_FOREIGN_GAS_PRICE_FACTOR=1
MONITOR_TX_NUMBER_THRESHOLD=100
MONITOR_PORT=3011

@ -0,0 +1,18 @@
COMMON_HOME_RPC_URL=http://parity1:8545
COMMON_FOREIGN_RPC_URL=http://parity2:8545
COMMON_HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624
COMMON_FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769
MONITOR_HOME_START_BLOCK=0
MONITOR_FOREIGN_START_BLOCK=0
MONITOR_VALIDATOR_HOME_TX_LIMIT=300000
COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
COMMON_HOME_GAS_PRICE_FALLBACK=1000000000
COMMON_HOME_GAS_PRICE_FACTOR=1
MONITOR_VALIDATOR_FOREIGN_TX_LIMIT=300000
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
COMMON_FOREIGN_GAS_PRICE_FALLBACK=1000000000
COMMON_FOREIGN_GAS_PRICE_FACTOR=1
MONITOR_TX_NUMBER_THRESHOLD=100
MONITOR_PORT=3010

@ -0,0 +1,25 @@
ORACLE_BRIDGE_MODE=ERC_TO_NATIVE
ORACLE_QUEUE_URL=amqp://rabbit
ORACLE_REDIS_URL=redis://redis
COMMON_HOME_RPC_URL=http://parity1:8545
COMMON_FOREIGN_RPC_URL=http://parity2:8545
COMMON_HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
COMMON_FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
BRIDGEABLE_TOKEN_ADDRESS=0x792455a6bCb62Ed4C4362D323E0590654CA4765c
ORACLE_VALIDATOR_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
COMMON_HOME_GAS_PRICE_FALLBACK=1
ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL=600000
COMMON_HOME_GAS_PRICE_FACTOR=1
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
COMMON_FOREIGN_GAS_PRICE_FALLBACK=1
ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000
COMMON_FOREIGN_GAS_PRICE_FACTOR=0.1
ORACLE_HOME_RPC_POLLING_INTERVAL=500
ORACLE_FOREIGN_RPC_POLLING_INTERVAL=500
ORACLE_ALLOW_HTTP_FOR_RPC=yes

@ -0,0 +1,24 @@
ORACLE_BRIDGE_MODE=ERC_TO_ERC
ORACLE_QUEUE_URL=amqp://rabbit
ORACLE_REDIS_URL=redis://redis
COMMON_HOME_RPC_URL=http://parity1:8545
COMMON_FOREIGN_RPC_URL=http://parity2:8545
COMMON_HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E
COMMON_FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127
ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
ORACLE_VALIDATOR_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
COMMON_HOME_GAS_PRICE_FALLBACK=1
ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL=600000
COMMON_HOME_GAS_PRICE_FACTOR=1
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
COMMON_FOREIGN_GAS_PRICE_FALLBACK=1
ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000
COMMON_FOREIGN_GAS_PRICE_FACTOR=0.1
ORACLE_HOME_RPC_POLLING_INTERVAL=500
ORACLE_FOREIGN_RPC_POLLING_INTERVAL=500
ORACLE_ALLOW_HTTP_FOR_RPC=yes

@ -0,0 +1,23 @@
ORACLE_BRIDGE_MODE=NATIVE_TO_ERC
ORACLE_QUEUE_URL=amqp://rabbit
ORACLE_REDIS_URL=redis://redis
COMMON_HOME_RPC_URL=http://parity1:8545
COMMON_FOREIGN_RPC_URL=http://parity2:8545
COMMON_HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624
COMMON_FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769
ORACLE_VALIDATOR_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
COMMON_HOME_GAS_PRICE_FALLBACK=1
ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL=600000
COMMON_HOME_GAS_PRICE_FACTOR=1
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
COMMON_FOREIGN_GAS_PRICE_FALLBACK=1
ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000
COMMON_FOREIGN_GAS_PRICE_FACTOR=0.1
ORACLE_HOME_RPC_POLLING_INTERVAL=500
ORACLE_FOREIGN_RPC_POLLING_INTERVAL=500
ORACLE_ALLOW_HTTP_FOR_RPC=yes

@ -0,0 +1,22 @@
COMMON_HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
COMMON_FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
COMMON_FOREIGN_RPC_URL=http://localhost:8542
COMMON_HOME_RPC_URL=http://localhost:8541
UI_NATIVE_TOKEN_DISPLAY_NAME=POA
UI_HOME_NETWORK_DISPLAY_NAME=Sokol
UI_FOREIGN_NETWORK_DISPLAY_NAME=Kovan
UI_HOME_EXPLORER_TX_TEMPLATE=https://blockscout.com/poa/sokol/tx//%s
UI_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s
UI_HOME_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/poa/sokol/address/%s
UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/eth/kovan/address/%s
COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
COMMON_HOME_GAS_PRICE_FALLBACK=5000000000
UI_HOME_GAS_PRICE_UPDATE_INTERVAL=15000
COMMON_HOME_GAS_PRICE_FACTOR=1
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
COMMON_FOREIGN_GAS_PRICE_FALLBACK=5000000000
UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
COMMON_FOREIGN_GAS_PRICE_FACTOR=1
UI_PORT=3000

@ -0,0 +1,22 @@
COMMON_HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E
COMMON_FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127
COMMON_FOREIGN_RPC_URL=http://localhost:8542
COMMON_HOME_RPC_URL=http://localhost:8541
UI_NATIVE_TOKEN_DISPLAY_NAME=POA
UI_HOME_NETWORK_DISPLAY_NAME=Sokol
UI_FOREIGN_NETWORK_DISPLAY_NAME=Kovan
UI_HOME_EXPLORER_TX_TEMPLATE=https://blockscout.com/poa/sokol/tx//%s
UI_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s
UI_HOME_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/poa/sokol/address/%s
UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/eth/kovan/address/%s
COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
COMMON_HOME_GAS_PRICE_FALLBACK=5000000000
UI_HOME_GAS_PRICE_UPDATE_INTERVAL=15000
COMMON_HOME_GAS_PRICE_FACTOR=1
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
COMMON_FOREIGN_GAS_PRICE_FALLBACK=5000000000
UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
COMMON_FOREIGN_GAS_PRICE_FACTOR=1
UI_PORT=3000

@ -0,0 +1,22 @@
COMMON_HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624
COMMON_FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769
COMMON_FOREIGN_RPC_URL=http://localhost:8542
COMMON_HOME_RPC_URL=http://localhost:8541
UI_NATIVE_TOKEN_DISPLAY_NAME=POA
UI_HOME_NETWORK_DISPLAY_NAME=Sokol
UI_FOREIGN_NETWORK_DISPLAY_NAME=Kovan
UI_HOME_EXPLORER_TX_TEMPLATE=https://blockscout.com/poa/sokol/tx//%s
UI_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s
UI_HOME_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/poa/sokol/address/%s
UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/eth/kovan/address/%s
COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
COMMON_HOME_GAS_PRICE_FALLBACK=5000000000
UI_HOME_GAS_PRICE_UPDATE_INTERVAL=15000
COMMON_HOME_GAS_PRICE_FACTOR=1
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
COMMON_FOREIGN_GAS_PRICE_FALLBACK=5000000000
UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
COMMON_FOREIGN_GAS_PRICE_FACTOR=1
UI_PORT=3000

@ -32,31 +32,10 @@ services:
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
args:
DOT_ENV_PATH: e2e-commons/components-envs/oracle.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- BRIDGE_MODE=NATIVE_TO_ERC
- QUEUE_URL=amqp://rabbit
- REDIS_URL=redis://redis
- HOME_RPC_URL=http://parity1:8545
- FOREIGN_RPC_URL=http://parity2:8545
- HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624
- FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769
- ERC20_TOKEN_ADDRESS=0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B
- VALIDATOR_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
- VALIDATOR_ADDRESS_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
- HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- HOME_GAS_PRICE_SPEED_TYPE=standard
- HOME_GAS_PRICE_FALLBACK=1
- HOME_GAS_PRICE_UPDATE_INTERVAL=600000
- HOME_GAS_PRICE_FACTOR=1
- FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- FOREIGN_GAS_PRICE_FALLBACK=1
- FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000
- FOREIGN_GAS_PRICE_FACTOR=0.1
- HOME_POLLING_INTERVAL=500
- FOREIGN_POLLING_INTERVAL=500
- ALLOW_HTTP=yes
command: "true" command: "true"
networks: networks:
- ultimate - ultimate
@ -64,32 +43,10 @@ services:
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
args:
DOT_ENV_PATH: e2e-commons/components-envs/oracle-erc20.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- BRIDGE_MODE=ERC_TO_ERC
- QUEUE_URL=amqp://rabbit
- REDIS_URL=redis://redis
- HOME_RPC_URL=http://parity1:8545
- FOREIGN_RPC_URL=http://parity2:8545
- HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E
- FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127
- ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
- BRIDGEABLE_TOKEN_ADDRESS=0x792455a6bCb62Ed4C4362D323E0590654CA4765c
- VALIDATOR_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
- VALIDATOR_ADDRESS_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
- HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- HOME_GAS_PRICE_SPEED_TYPE=standard
- HOME_GAS_PRICE_FALLBACK=1
- HOME_GAS_PRICE_UPDATE_INTERVAL=600000
- HOME_GAS_PRICE_FACTOR=1
- FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- FOREIGN_GAS_PRICE_FALLBACK=1
- FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000
- FOREIGN_GAS_PRICE_FACTOR=0.1
- HOME_POLLING_INTERVAL=500
- FOREIGN_POLLING_INTERVAL=500
- ALLOW_HTTP=yes
command: "true" command: "true"
networks: networks:
- ultimate - ultimate
@ -97,32 +54,10 @@ services:
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
args:
DOT_ENV_PATH: e2e-commons/components-envs/oracle-erc20-native.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- BRIDGE_MODE=ERC_TO_NATIVE
- QUEUE_URL=amqp://rabbit
- REDIS_URL=redis://redis
- HOME_RPC_URL=http://parity1:8545
- FOREIGN_RPC_URL=http://parity2:8545
- HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
- BRIDGEABLE_TOKEN_ADDRESS=0x792455a6bCb62Ed4C4362D323E0590654CA4765c
- VALIDATOR_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
- VALIDATOR_ADDRESS_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
- HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- HOME_GAS_PRICE_SPEED_TYPE=standard
- HOME_GAS_PRICE_FALLBACK=1
- HOME_GAS_PRICE_UPDATE_INTERVAL=600000
- HOME_GAS_PRICE_FACTOR=1
- FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- FOREIGN_GAS_PRICE_FALLBACK=1
- FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000
- FOREIGN_GAS_PRICE_FACTOR=0.1
- HOME_POLLING_INTERVAL=500
- FOREIGN_POLLING_INTERVAL=500
- ALLOW_HTTP=yes
command: "true" command: "true"
networks: networks:
- ultimate - ultimate
@ -130,29 +65,8 @@ services:
build: build:
context: .. context: ..
dockerfile: ui/Dockerfile dockerfile: ui/Dockerfile
environment: args:
- REACT_APP_HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624 DOT_ENV_PATH: e2e-commons/components-envs/ui.env
- REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769
- REACT_APP_FOREIGN_HTTP_PARITY_URL=http://localhost:8542
- REACT_APP_HOME_HTTP_PARITY_URL=http://localhost:8541
- REACT_APP_HOME_NATIVE_NAME=POA
- REACT_APP_HOME_NETWORK_NAME=Sokol
- REACT_APP_FOREIGN_NETWORK_NAME=Kovan
- REACT_APP_HOME_EXPLORER_TX_TEMPLATE=https://blockscout.com/poa/sokol/tx//%s
- REACT_APP_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s
- REACT_APP_HOME_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/poa/sokol/address/%s
- REACT_APP_FOREIGN_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/eth/kovan/address/%s
- REACT_APP_HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- REACT_APP_HOME_GAS_PRICE_SPEED_TYPE=standard
- REACT_APP_HOME_GAS_PRICE_FALLBACK=5000000000
- REACT_APP_HOME_GAS_PRICE_UPDATE_INTERVAL=15000
- REACT_APP_HOME_GAS_PRICE_FACTOR=1
- REACT_APP_FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- REACT_APP_FOREIGN_GAS_PRICE_FALLBACK=5000000000
- REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
- REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1
- PORT=3000
command: "true" command: "true"
networks: networks:
- ultimate - ultimate
@ -160,29 +74,8 @@ services:
build: build:
context: .. context: ..
dockerfile: ui/Dockerfile dockerfile: ui/Dockerfile
environment: args:
- REACT_APP_HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E DOT_ENV_PATH: e2e-commons/components-envs/ui-erc20.env
- REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127
- REACT_APP_FOREIGN_HTTP_PARITY_URL=http://localhost:8542
- REACT_APP_HOME_HTTP_PARITY_URL=http://localhost:8541
- REACT_APP_HOME_NATIVE_NAME=POA
- REACT_APP_HOME_NETWORK_NAME=Sokol
- REACT_APP_FOREIGN_NETWORK_NAME=Kovan
- REACT_APP_HOME_EXPLORER_TX_TEMPLATE=https://blockscout.com/poa/sokol/tx//%s
- REACT_APP_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s
- REACT_APP_HOME_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/poa/sokol/address/%s
- REACT_APP_FOREIGN_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/eth/kovan/address/%s
- REACT_APP_HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- REACT_APP_HOME_GAS_PRICE_SPEED_TYPE=standard
- REACT_APP_HOME_GAS_PRICE_FALLBACK=5000000000
- REACT_APP_HOME_GAS_PRICE_UPDATE_INTERVAL=15000
- REACT_APP_HOME_GAS_PRICE_FACTOR=1
- REACT_APP_FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- REACT_APP_FOREIGN_GAS_PRICE_FALLBACK=5000000000
- REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
- REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1
- PORT=3000
command: "true" command: "true"
networks: networks:
- ultimate - ultimate
@ -190,29 +83,8 @@ services:
build: build:
context: .. context: ..
dockerfile: ui/Dockerfile dockerfile: ui/Dockerfile
environment: args:
- REACT_APP_HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda DOT_ENV_PATH: e2e-commons/components-envs/ui-erc20-native.env
- REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- REACT_APP_FOREIGN_HTTP_PARITY_URL=http://localhost:8542
- REACT_APP_HOME_HTTP_PARITY_URL=http://localhost:8541
- REACT_APP_HOME_NATIVE_NAME=POA
- REACT_APP_HOME_NETWORK_NAME=Sokol
- REACT_APP_FOREIGN_NETWORK_NAME=Kovan
- REACT_APP_HOME_EXPLORER_TX_TEMPLATE=https://blockscout.com/poa/sokol/tx//%s
- REACT_APP_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s
- REACT_APP_HOME_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/poa/sokol/address/%s
- REACT_APP_FOREIGN_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/eth/kovan/address/%s
- REACT_APP_HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- REACT_APP_HOME_GAS_PRICE_SPEED_TYPE=standard
- REACT_APP_HOME_GAS_PRICE_FALLBACK=5000000000
- REACT_APP_HOME_GAS_PRICE_UPDATE_INTERVAL=15000
- REACT_APP_HOME_GAS_PRICE_FACTOR=1
- REACT_APP_FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- REACT_APP_FOREIGN_GAS_PRICE_FALLBACK=5000000000
- REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
- REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1
- PORT=3000
command: "true" command: "true"
networks: networks:
- ultimate - ultimate
@ -220,25 +92,8 @@ services:
build: build:
context: .. context: ..
dockerfile: monitor/Dockerfile dockerfile: monitor/Dockerfile
environment: args:
- HOME_RPC_URL=http://parity1:8545 DOT_ENV_PATH: e2e-commons/components-envs/monitor.env
- FOREIGN_RPC_URL=http://parity2:8545
- HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624
- FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769
- HOME_DEPLOYMENT_BLOCK=0
- FOREIGN_DEPLOYMENT_BLOCK=0
- HOME_GAS_LIMIT=300000
- HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- HOME_GAS_PRICE_SPEED_TYPE=standard
- HOME_GAS_PRICE_FALLBACK=1000000000
- HOME_GAS_PRICE_FACTOR=1
- FOREIGN_GAS_LIMIT=300000
- FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- FOREIGN_GAS_PRICE_FALLBACK=1000000000
- FOREIGN_GAS_PRICE_FACTOR=1
- LEFT_TX_THRESHOLD=100
- PORT=3010
entrypoint: yarn check-and-start entrypoint: yarn check-and-start
ports: ports:
- "3010:3010" - "3010:3010"
@ -248,25 +103,8 @@ services:
build: build:
context: .. context: ..
dockerfile: monitor/Dockerfile dockerfile: monitor/Dockerfile
environment: args:
- HOME_RPC_URL=http://parity1:8545 DOT_ENV_PATH: e2e-commons/components-envs/monitor-erc20.env
- FOREIGN_RPC_URL=http://parity2:8545
- HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E
- FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127
- HOME_DEPLOYMENT_BLOCK=0
- FOREIGN_DEPLOYMENT_BLOCK=0
- HOME_GAS_LIMIT=300000
- HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- HOME_GAS_PRICE_SPEED_TYPE=standard
- HOME_GAS_PRICE_FALLBACK=1000000000
- HOME_GAS_PRICE_FACTOR=1
- FOREIGN_GAS_LIMIT=300000
- FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- FOREIGN_GAS_PRICE_FALLBACK=1000000000
- FOREIGN_GAS_PRICE_FACTOR=1
- LEFT_TX_THRESHOLD=100
- PORT=3011
entrypoint: yarn check-and-start entrypoint: yarn check-and-start
ports: ports:
- "3011:3011" - "3011:3011"
@ -276,25 +114,8 @@ services:
build: build:
context: .. context: ..
dockerfile: monitor/Dockerfile dockerfile: monitor/Dockerfile
environment: args:
- HOME_RPC_URL=http://parity1:8545 DOT_ENV_PATH: e2e-commons/components-envs/monitor-erc20-native.env
- FOREIGN_RPC_URL=http://parity2:8545
- HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- HOME_DEPLOYMENT_BLOCK=0
- FOREIGN_DEPLOYMENT_BLOCK=0
- HOME_GAS_LIMIT=300000
- HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- HOME_GAS_PRICE_SPEED_TYPE=standard
- HOME_GAS_PRICE_FALLBACK=1000000000
- HOME_GAS_PRICE_FACTOR=1
- FOREIGN_GAS_LIMIT=300000
- FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/
- FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- FOREIGN_GAS_PRICE_FALLBACK=1000000000
- FOREIGN_GAS_PRICE_FACTOR=1
- LEFT_TX_THRESHOLD=100
- PORT=3012
entrypoint: yarn check-and-start entrypoint: yarn check-and-start
ports: ports:
- "3012:3012" - "3012:3012"

@ -4,7 +4,7 @@ set -e # exit when any command fails
CONTRACTS_PATH="../../contracts" CONTRACTS_PATH="../../contracts"
DEPLOY_PATH="$CONTRACTS_PATH/deploy" DEPLOY_PATH="$CONTRACTS_PATH/deploy"
ENVS_PATH="../envs" ENVS_PATH="../contracts-envs"
echo -e "\n\n############ Deploying native-to-erc ############\n" echo -e "\n\n############ Deploying native-to-erc ############\n"
cp "$ENVS_PATH/native-to-erc.env" "$DEPLOY_PATH/.env" cp "$ENVS_PATH/native-to-erc.env" "$DEPLOY_PATH/.env"

@ -1,21 +1,21 @@
HOME_RPC_URL=https://sokol.poa.network COMMON_HOME_RPC_URL=https://sokol.poa.network
FOREIGN_RPC_URL=https://kovan.infura.io/mew COMMON_FOREIGN_RPC_URL=https://kovan.infura.io/mew
HOME_BRIDGE_ADDRESS=0xABb4C1399DcC28FBa3Beb76CAE2b50Be3e087353 COMMON_HOME_BRIDGE_ADDRESS=0xABb4C1399DcC28FBa3Beb76CAE2b50Be3e087353
FOREIGN_BRIDGE_ADDRESS=0xE405F6872cE38a7a4Ff63DcF946236D458c2ca3a COMMON_FOREIGN_BRIDGE_ADDRESS=0xE405F6872cE38a7a4Ff63DcF946236D458c2ca3a
HOME_DEPLOYMENT_BLOCK=0 MONITOR_HOME_START_BLOCK=0
FOREIGN_DEPLOYMENT_BLOCK=0 MONITOR_FOREIGN_START_BLOCK=0
HOME_GAS_LIMIT=300000 MONITOR_VALIDATOR_HOME_TX_LIMIT=300000
HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
HOME_GAS_PRICE_SPEED_TYPE=standard COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
HOME_GAS_PRICE_FALLBACK=1000000000 COMMON_HOME_GAS_PRICE_FALLBACK=1000000000
HOME_GAS_PRICE_FACTOR=1 COMMON_HOME_GAS_PRICE_FACTOR=1
FOREIGN_GAS_LIMIT=300000 MONITOR_VALIDATOR_FOREIGN_TX_LIMIT=300000
FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
FOREIGN_GAS_PRICE_SPEED_TYPE=standard COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
FOREIGN_GAS_PRICE_FALLBACK=1000000000 COMMON_FOREIGN_GAS_PRICE_FALLBACK=1000000000
FOREIGN_GAS_PRICE_FACTOR=1 COMMON_FOREIGN_GAS_PRICE_FACTOR=1
LEFT_TX_THRESHOLD=100 MONITOR_TX_NUMBER_THRESHOLD=100
PORT=3003 MONITOR_PORT=3003

@ -15,6 +15,9 @@ RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./b
COPY ./commons ./commons COPY ./commons ./commons
COPY ./monitor ./monitor COPY ./monitor ./monitor
ARG DOT_ENV_PATH=./monitor/.env
COPY ${DOT_ENV_PATH} ./monitor/.env
WORKDIR /mono/monitor WORKDIR /mono/monitor
CMD echo "To start the monitor run:" \ CMD echo "To start the monitor run:" \
"yarn check-and-start" "yarn check-and-start"

@ -110,6 +110,8 @@ cd monitor
cp .env.example .env cp .env.example .env
``` ```
Please refer to [Configuration](../CONFIGURATION.md) for details on configuration parameters.
## Run web interface ## Run web interface
Using Yarn: Using Yarn:

@ -4,12 +4,12 @@ const logger = require('./logger')('alerts')
const eventsInfo = require('./utils/events') const eventsInfo = require('./utils/events')
const { getBlockNumber } = require('./utils/contract') const { getBlockNumber } = require('./utils/contract')
const { HOME_RPC_URL, FOREIGN_RPC_URL } = process.env const { COMMON_HOME_RPC_URL, COMMON_FOREIGN_RPC_URL } = process.env
const homeProvider = new Web3.providers.HttpProvider(HOME_RPC_URL) const homeProvider = new Web3.providers.HttpProvider(COMMON_HOME_RPC_URL)
const web3Home = new Web3(homeProvider) const web3Home = new Web3(homeProvider)
const foreignProvider = new Web3.providers.HttpProvider(FOREIGN_RPC_URL) const foreignProvider = new Web3.providers.HttpProvider(COMMON_FOREIGN_RPC_URL)
const web3Foreign = new Web3(foreignProvider) const web3Foreign = new Web3(foreignProvider)
async function main() { async function main() {

@ -7,15 +7,15 @@ const getBalances = require('./getBalances')
const getShortEventStats = require('./getShortEventStats') const getShortEventStats = require('./getShortEventStats')
const validators = require('./validators') const validators = require('./validators')
const { HOME_BRIDGE_ADDRESS, HOME_RPC_URL } = process.env const { COMMON_HOME_BRIDGE_ADDRESS, COMMON_HOME_RPC_URL } = process.env
const homeProvider = new Web3.providers.HttpProvider(HOME_RPC_URL) const homeProvider = new Web3.providers.HttpProvider(COMMON_HOME_RPC_URL)
const web3Home = new Web3(homeProvider) const web3Home = new Web3(homeProvider)
const { HOME_ERC_TO_ERC_ABI } = require('../commons') const { HOME_ERC_TO_ERC_ABI } = require('../commons')
async function checkWorker() { async function checkWorker() {
try { try {
const homeBridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, HOME_BRIDGE_ADDRESS) const homeBridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, COMMON_HOME_BRIDGE_ADDRESS)
const bridgeMode = await getBridgeMode(homeBridge) const bridgeMode = await getBridgeMode(homeBridge)
logger.debug('Bridge mode:', bridgeMode) logger.debug('Bridge mode:', bridgeMode)
logger.debug('calling getBalances()') logger.debug('calling getBalances()')

@ -6,7 +6,7 @@ services:
context: .. context: ..
dockerfile: monitor/Dockerfile dockerfile: monitor/Dockerfile
ports: ports:
- "${PORT}:${PORT}" - "${MONITOR_PORT}:${MONITOR_PORT}"
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production

@ -6,12 +6,17 @@ const { BRIDGE_MODES } = require('../commons')
const Web3Utils = Web3.utils const Web3Utils = Web3.utils
const { HOME_RPC_URL, FOREIGN_RPC_URL, HOME_BRIDGE_ADDRESS, FOREIGN_BRIDGE_ADDRESS } = process.env const {
COMMON_HOME_RPC_URL,
COMMON_FOREIGN_RPC_URL,
COMMON_HOME_BRIDGE_ADDRESS,
COMMON_FOREIGN_BRIDGE_ADDRESS
} = process.env
const homeProvider = new Web3.providers.HttpProvider(HOME_RPC_URL) const homeProvider = new Web3.providers.HttpProvider(COMMON_HOME_RPC_URL)
const web3Home = new Web3(homeProvider) const web3Home = new Web3(homeProvider)
const foreignProvider = new Web3.providers.HttpProvider(FOREIGN_RPC_URL) const foreignProvider = new Web3.providers.HttpProvider(COMMON_FOREIGN_RPC_URL)
const web3Foreign = new Web3(foreignProvider) const web3Foreign = new Web3(foreignProvider)
const { const {
@ -27,12 +32,12 @@ const {
async function main(bridgeMode) { async function main(bridgeMode) {
if (bridgeMode === BRIDGE_MODES.ERC_TO_ERC) { if (bridgeMode === BRIDGE_MODES.ERC_TO_ERC) {
const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_ERC_TO_ERC_ABI, FOREIGN_BRIDGE_ADDRESS) const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_ERC_TO_ERC_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
const erc20Address = await foreignBridge.methods.erc20token().call() const erc20Address = await foreignBridge.methods.erc20token().call()
const erc20Contract = new web3Foreign.eth.Contract(ERC20_ABI, erc20Address) const erc20Contract = new web3Foreign.eth.Contract(ERC20_ABI, erc20Address)
logger.debug('calling erc20Contract.methods.balanceOf') logger.debug('calling erc20Contract.methods.balanceOf')
const foreignErc20Balance = await erc20Contract.methods.balanceOf(FOREIGN_BRIDGE_ADDRESS).call() const foreignErc20Balance = await erc20Contract.methods.balanceOf(COMMON_FOREIGN_BRIDGE_ADDRESS).call()
const homeBridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, HOME_BRIDGE_ADDRESS) const homeBridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, COMMON_HOME_BRIDGE_ADDRESS)
logger.debug('calling homeBridge.methods.erc677token') logger.debug('calling homeBridge.methods.erc677token')
const tokenAddress = await homeBridge.methods.erc677token().call() const tokenAddress = await homeBridge.methods.erc677token().call()
const tokenContract = new web3Home.eth.Contract(ERC677_ABI, tokenAddress) const tokenContract = new web3Home.eth.Contract(ERC677_ABI, tokenAddress)
@ -54,9 +59,9 @@ async function main(bridgeMode) {
} }
} else if (bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC || bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC_V1) { } else if (bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC || bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC_V1) {
logger.debug('calling web3Home.eth.getBalance') logger.debug('calling web3Home.eth.getBalance')
const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_NATIVE_TO_ERC_ABI, FOREIGN_BRIDGE_ADDRESS) const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_NATIVE_TO_ERC_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
const erc20Address = await foreignBridge.methods.erc677token().call() const erc20Address = await foreignBridge.methods.erc677token().call()
const homeBalance = await web3Home.eth.getBalance(HOME_BRIDGE_ADDRESS) const homeBalance = await web3Home.eth.getBalance(COMMON_HOME_BRIDGE_ADDRESS)
const tokenContract = new web3Foreign.eth.Contract(ERC20_ABI, erc20Address) const tokenContract = new web3Foreign.eth.Contract(ERC20_ABI, erc20Address)
logger.debug('calling tokenContract.methods.totalSupply()') logger.debug('calling tokenContract.methods.totalSupply()')
const totalSupply = await tokenContract.methods.totalSupply().call() const totalSupply = await tokenContract.methods.totalSupply().call()
@ -75,13 +80,13 @@ async function main(bridgeMode) {
lastChecked: Math.floor(Date.now() / 1000) lastChecked: Math.floor(Date.now() / 1000)
} }
} else if (bridgeMode === BRIDGE_MODES.ERC_TO_NATIVE) { } else if (bridgeMode === BRIDGE_MODES.ERC_TO_NATIVE) {
const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_ERC_TO_NATIVE_ABI, FOREIGN_BRIDGE_ADDRESS) const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_ERC_TO_NATIVE_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
const erc20Address = await foreignBridge.methods.erc20token().call() const erc20Address = await foreignBridge.methods.erc20token().call()
const erc20Contract = new web3Foreign.eth.Contract(ERC20_ABI, erc20Address) const erc20Contract = new web3Foreign.eth.Contract(ERC20_ABI, erc20Address)
logger.debug('calling erc20Contract.methods.balanceOf') logger.debug('calling erc20Contract.methods.balanceOf')
const foreignErc20Balance = await erc20Contract.methods.balanceOf(FOREIGN_BRIDGE_ADDRESS).call() const foreignErc20Balance = await erc20Contract.methods.balanceOf(COMMON_FOREIGN_BRIDGE_ADDRESS).call()
const homeBridge = new web3Home.eth.Contract(HOME_ERC_TO_NATIVE_ABI, HOME_BRIDGE_ADDRESS) const homeBridge = new web3Home.eth.Contract(HOME_ERC_TO_NATIVE_ABI, COMMON_HOME_BRIDGE_ADDRESS)
logger.debug('calling homeBridge.methods.blockRewardContract') logger.debug('calling homeBridge.methods.blockRewardContract')
const blockRewardAddress = await homeBridge.methods.blockRewardContract().call() const blockRewardAddress = await homeBridge.methods.blockRewardContract().call()
const blockRewardContract = new web3Home.eth.Contract(BLOCK_REWARD_ABI, blockRewardAddress) const blockRewardContract = new web3Home.eth.Contract(BLOCK_REWARD_ABI, blockRewardAddress)

@ -5,8 +5,8 @@ const { isV1Bridge } = require('./utils/serverUtils')
const app = express() const app = express()
const LEFT_TX_THRESHOLD = Number(process.env.LEFT_TX_THRESHOLD) || 100 const MONITOR_TX_NUMBER_THRESHOLD = Number(process.env.MONITOR_TX_NUMBER_THRESHOLD) || 100
console.log('LEFT_TX_THRESHOLD = ' + LEFT_TX_THRESHOLD) console.log('MONITOR_TX_NUMBER_THRESHOLD = ' + MONITOR_TX_NUMBER_THRESHOLD)
async function readFile(path) { async function readFile(path) {
try { try {
@ -53,13 +53,13 @@ app.get('/validators', async (req, res, next) => {
results.homeOk = true results.homeOk = true
results.foreignOk = true results.foreignOk = true
for (const hv in results.home.validators) { for (const hv in results.home.validators) {
if (results.home.validators[hv].leftTx < LEFT_TX_THRESHOLD) { if (results.home.validators[hv].leftTx < MONITOR_TX_NUMBER_THRESHOLD) {
results.homeOk = false results.homeOk = false
break break
} }
} }
for (const hv in results.foreign.validators) { for (const hv in results.foreign.validators) {
if (results.foreign.validators[hv].leftTx < LEFT_TX_THRESHOLD) { if (results.foreign.validators[hv].leftTx < MONITOR_TX_NUMBER_THRESHOLD) {
results.foreignOk = false results.foreignOk = false
break break
} }
@ -100,6 +100,6 @@ app.get('/alerts', async (req, res, next) => {
initV1routes(app) initV1routes(app)
const port = process.env.PORT || 3003 const port = process.env.MONITOR_PORT || 3003
app.set('port', port) app.set('port', port)
app.listen(port, () => console.log(`Monitoring app listening on port ${port}!`)) app.listen(port, () => console.log(`Monitoring app listening on port ${port}!`))

@ -3,10 +3,10 @@ const Web3 = require('web3')
const logger = require('./logger')('stuckTransfers.js') const logger = require('./logger')('stuckTransfers.js')
const { FOREIGN_V1_ABI } = require('../commons/abis') const { FOREIGN_V1_ABI } = require('../commons/abis')
const { FOREIGN_RPC_URL, FOREIGN_BRIDGE_ADDRESS } = process.env const { COMMON_FOREIGN_RPC_URL, COMMON_FOREIGN_BRIDGE_ADDRESS } = process.env
const FOREIGN_DEPLOYMENT_BLOCK = Number(process.env.FOREIGN_DEPLOYMENT_BLOCK) || 0 const MONITOR_FOREIGN_START_BLOCK = Number(process.env.MONITOR_FOREIGN_START_BLOCK) || 0
const foreignProvider = new Web3.providers.HttpProvider(FOREIGN_RPC_URL) const foreignProvider = new Web3.providers.HttpProvider(COMMON_FOREIGN_RPC_URL)
const web3Foreign = new Web3(foreignProvider) const web3Foreign = new Web3(foreignProvider)
const ABITransferWithoutData = [ const ABITransferWithoutData = [
@ -75,24 +75,24 @@ function compareTransfers(transfersNormal) {
} }
async function main() { async function main() {
const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_V1_ABI, FOREIGN_BRIDGE_ADDRESS) const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_V1_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
const erc20Address = await foreignBridge.methods.erc677token().call() const erc20Address = await foreignBridge.methods.erc677token().call()
const tokenContract = new web3Foreign.eth.Contract(ABITransferWithoutData, erc20Address) const tokenContract = new web3Foreign.eth.Contract(ABITransferWithoutData, erc20Address)
const tokenContractWithData = new web3Foreign.eth.Contract(ABIWithData, erc20Address) const tokenContractWithData = new web3Foreign.eth.Contract(ABIWithData, erc20Address)
logger.debug('calling tokenContract.getPastEvents Transfer') logger.debug('calling tokenContract.getPastEvents Transfer')
const transfersNormal = await tokenContract.getPastEvents('Transfer', { const transfersNormal = await tokenContract.getPastEvents('Transfer', {
filter: { filter: {
to: FOREIGN_BRIDGE_ADDRESS to: COMMON_FOREIGN_BRIDGE_ADDRESS
}, },
fromBlock: FOREIGN_DEPLOYMENT_BLOCK, fromBlock: MONITOR_FOREIGN_START_BLOCK,
toBlock: 'latest' toBlock: 'latest'
}) })
logger.debug('calling tokenContractWithData.getPastEvents Transfer') logger.debug('calling tokenContractWithData.getPastEvents Transfer')
const transfersWithData = await tokenContractWithData.getPastEvents('Transfer', { const transfersWithData = await tokenContractWithData.getPastEvents('Transfer', {
filter: { filter: {
to: FOREIGN_BRIDGE_ADDRESS to: COMMON_FOREIGN_BRIDGE_ADDRESS
}, },
fromBlock: FOREIGN_DEPLOYMENT_BLOCK, fromBlock: MONITOR_FOREIGN_START_BLOCK,
toBlock: 'latest' toBlock: 'latest'
}) })
const stuckTransfers = transfersNormal.filter(compareTransfers(transfersWithData)) const stuckTransfers = transfersNormal.filter(compareTransfers(transfersWithData))

@ -9,5 +9,5 @@ app.all('/', (req, res) => {
}, 2000) }, 2000)
}) })
const PORT = process.env.PORT || 4000 const MONITOR_PORT = process.env.MONITOR_PORT || 4000
app.listen(PORT, () => console.log('Listening on port ' + PORT)) app.listen(MONITOR_PORT, () => console.log('Listening on port ' + MONITOR_PORT))

@ -14,30 +14,35 @@ const {
getPastEvents getPastEvents
} = require('../../commons') } = require('../../commons')
const { HOME_RPC_URL, FOREIGN_RPC_URL, HOME_BRIDGE_ADDRESS, FOREIGN_BRIDGE_ADDRESS } = process.env const {
const HOME_DEPLOYMENT_BLOCK = toBN(Number(process.env.HOME_DEPLOYMENT_BLOCK) || 0) COMMON_HOME_RPC_URL,
const FOREIGN_DEPLOYMENT_BLOCK = toBN(Number(process.env.FOREIGN_DEPLOYMENT_BLOCK) || 0) COMMON_FOREIGN_RPC_URL,
COMMON_HOME_BRIDGE_ADDRESS,
COMMON_FOREIGN_BRIDGE_ADDRESS
} = process.env
const MONITOR_HOME_START_BLOCK = toBN(Number(process.env.MONITOR_HOME_START_BLOCK) || 0)
const MONITOR_FOREIGN_START_BLOCK = toBN(Number(process.env.MONITOR_FOREIGN_START_BLOCK) || 0)
const homeProvider = new Web3.providers.HttpProvider(HOME_RPC_URL) const homeProvider = new Web3.providers.HttpProvider(COMMON_HOME_RPC_URL)
const web3Home = new Web3(homeProvider) const web3Home = new Web3(homeProvider)
const foreignProvider = new Web3.providers.HttpProvider(FOREIGN_RPC_URL) const foreignProvider = new Web3.providers.HttpProvider(COMMON_FOREIGN_RPC_URL)
const web3Foreign = new Web3(foreignProvider) const web3Foreign = new Web3(foreignProvider)
const { getBlockNumber } = require('./contract') const { getBlockNumber } = require('./contract')
async function main(mode) { async function main(mode) {
const homeErcBridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, HOME_BRIDGE_ADDRESS) const homeErcBridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, COMMON_HOME_BRIDGE_ADDRESS)
const bridgeMode = mode || (await getBridgeMode(homeErcBridge)) const bridgeMode = mode || (await getBridgeMode(homeErcBridge))
const { HOME_ABI, FOREIGN_ABI } = getBridgeABIs(bridgeMode) const { HOME_ABI, FOREIGN_ABI } = getBridgeABIs(bridgeMode)
const homeBridge = new web3Home.eth.Contract(HOME_ABI, HOME_BRIDGE_ADDRESS) const homeBridge = new web3Home.eth.Contract(HOME_ABI, COMMON_HOME_BRIDGE_ADDRESS)
const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_ABI, FOREIGN_BRIDGE_ADDRESS) const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
const v1Bridge = bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC_V1 const v1Bridge = bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC_V1
const erc20MethodName = bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC || v1Bridge ? 'erc677token' : 'erc20token' const erc20MethodName = bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC || v1Bridge ? 'erc677token' : 'erc20token'
const erc20Address = await foreignBridge.methods[erc20MethodName]().call() const erc20Address = await foreignBridge.methods[erc20MethodName]().call()
const tokenType = await getTokenType( const tokenType = await getTokenType(
new web3Foreign.eth.Contract(ERC677_BRIDGE_TOKEN_ABI, erc20Address), new web3Foreign.eth.Contract(ERC677_BRIDGE_TOKEN_ABI, erc20Address),
FOREIGN_BRIDGE_ADDRESS COMMON_FOREIGN_BRIDGE_ADDRESS
) )
const isExternalErc20 = tokenType === ERC_TYPES.ERC20 const isExternalErc20 = tokenType === ERC_TYPES.ERC20
const erc20Contract = new web3Foreign.eth.Contract(ERC20_ABI, erc20Address) const erc20Contract = new web3Foreign.eth.Contract(ERC20_ABI, erc20Address)
@ -48,21 +53,21 @@ async function main(mode) {
logger.debug("calling homeBridge.getPastEvents('UserRequestForSignature')") logger.debug("calling homeBridge.getPastEvents('UserRequestForSignature')")
const homeDeposits = await getPastEvents(homeBridge, { const homeDeposits = await getPastEvents(homeBridge, {
event: v1Bridge ? 'Deposit' : 'UserRequestForSignature', event: v1Bridge ? 'Deposit' : 'UserRequestForSignature',
fromBlock: HOME_DEPLOYMENT_BLOCK, fromBlock: MONITOR_HOME_START_BLOCK,
toBlock: homeBlockNumber toBlock: homeBlockNumber
}) })
logger.debug("calling foreignBridge.getPastEvents('RelayedMessage')") logger.debug("calling foreignBridge.getPastEvents('RelayedMessage')")
const foreignDeposits = await getPastEvents(foreignBridge, { const foreignDeposits = await getPastEvents(foreignBridge, {
event: v1Bridge ? 'Deposit' : 'RelayedMessage', event: v1Bridge ? 'Deposit' : 'RelayedMessage',
fromBlock: FOREIGN_DEPLOYMENT_BLOCK, fromBlock: MONITOR_FOREIGN_START_BLOCK,
toBlock: foreignBlockNumber toBlock: foreignBlockNumber
}) })
logger.debug("calling homeBridge.getPastEvents('AffirmationCompleted')") logger.debug("calling homeBridge.getPastEvents('AffirmationCompleted')")
const homeWithdrawals = await getPastEvents(homeBridge, { const homeWithdrawals = await getPastEvents(homeBridge, {
event: v1Bridge ? 'Withdraw' : 'AffirmationCompleted', event: v1Bridge ? 'Withdraw' : 'AffirmationCompleted',
fromBlock: HOME_DEPLOYMENT_BLOCK, fromBlock: MONITOR_HOME_START_BLOCK,
toBlock: homeBlockNumber toBlock: homeBlockNumber
}) })
@ -70,15 +75,15 @@ async function main(mode) {
const foreignWithdrawals = isExternalErc20 const foreignWithdrawals = isExternalErc20
? await getPastEvents(erc20Contract, { ? await getPastEvents(erc20Contract, {
event: 'Transfer', event: 'Transfer',
fromBlock: FOREIGN_DEPLOYMENT_BLOCK, fromBlock: MONITOR_FOREIGN_START_BLOCK,
toBlock: foreignBlockNumber, toBlock: foreignBlockNumber,
options: { options: {
filter: { to: FOREIGN_BRIDGE_ADDRESS } filter: { to: COMMON_FOREIGN_BRIDGE_ADDRESS }
} }
}) })
: await getPastEvents(foreignBridge, { : await getPastEvents(foreignBridge, {
event: v1Bridge ? 'Withdraw' : 'UserRequestForAffirmation', event: v1Bridge ? 'Withdraw' : 'UserRequestForAffirmation',
fromBlock: FOREIGN_DEPLOYMENT_BLOCK, fromBlock: MONITOR_FOREIGN_START_BLOCK,
toBlock: foreignBlockNumber toBlock: foreignBlockNumber
}) })
logger.debug('Done') logger.debug('Done')

@ -1,12 +1,12 @@
const Web3 = require('web3') const Web3 = require('web3')
const { BRIDGE_MODES, getBridgeMode, HOME_ERC_TO_ERC_ABI } = require('../../commons') const { BRIDGE_MODES, getBridgeMode, HOME_ERC_TO_ERC_ABI } = require('../../commons')
const { HOME_BRIDGE_ADDRESS, HOME_RPC_URL } = process.env const { COMMON_HOME_BRIDGE_ADDRESS, COMMON_HOME_RPC_URL } = process.env
const homeProvider = new Web3.providers.HttpProvider(HOME_RPC_URL) const homeProvider = new Web3.providers.HttpProvider(COMMON_HOME_RPC_URL)
const web3Home = new Web3(homeProvider) const web3Home = new Web3(homeProvider)
async function isV1Bridge() { async function isV1Bridge() {
const homeBridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, HOME_BRIDGE_ADDRESS) const homeBridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, COMMON_HOME_BRIDGE_ADDRESS)
const bridgeMode = await getBridgeMode(homeBridge) const bridgeMode = await getBridgeMode(homeBridge)
return bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC_V1 return bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC_V1
} }

@ -6,41 +6,41 @@ const { getBridgeABIs, BRIDGE_VALIDATORS_ABI, getValidatorList, gasPriceFromOrac
const { getBlockNumber } = require('./utils/contract') const { getBlockNumber } = require('./utils/contract')
const { const {
HOME_RPC_URL, COMMON_HOME_RPC_URL,
FOREIGN_RPC_URL, COMMON_FOREIGN_RPC_URL,
HOME_BRIDGE_ADDRESS, COMMON_HOME_BRIDGE_ADDRESS,
FOREIGN_BRIDGE_ADDRESS, COMMON_FOREIGN_BRIDGE_ADDRESS,
HOME_GAS_LIMIT, MONITOR_VALIDATOR_HOME_TX_LIMIT,
HOME_GAS_PRICE_ORACLE_URL, COMMON_HOME_GAS_PRICE_SUPPLIER_URL,
HOME_GAS_PRICE_SPEED_TYPE, COMMON_HOME_GAS_PRICE_SPEED_TYPE,
HOME_GAS_PRICE_FALLBACK, COMMON_HOME_GAS_PRICE_FALLBACK,
HOME_GAS_PRICE_FACTOR, COMMON_HOME_GAS_PRICE_FACTOR,
FOREIGN_GAS_LIMIT, MONITOR_VALIDATOR_FOREIGN_TX_LIMIT,
FOREIGN_GAS_PRICE_ORACLE_URL, COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL,
FOREIGN_GAS_PRICE_SPEED_TYPE, COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE,
FOREIGN_GAS_PRICE_FALLBACK, COMMON_FOREIGN_GAS_PRICE_FALLBACK,
FOREIGN_GAS_PRICE_FACTOR COMMON_FOREIGN_GAS_PRICE_FACTOR
} = process.env } = process.env
const HOME_DEPLOYMENT_BLOCK = Number(process.env.HOME_DEPLOYMENT_BLOCK) || 0 const MONITOR_HOME_START_BLOCK = Number(process.env.MONITOR_HOME_START_BLOCK) || 0
const FOREIGN_DEPLOYMENT_BLOCK = Number(process.env.FOREIGN_DEPLOYMENT_BLOCK) || 0 const MONITOR_FOREIGN_START_BLOCK = Number(process.env.MONITOR_FOREIGN_START_BLOCK) || 0
const Web3Utils = Web3.utils const Web3Utils = Web3.utils
const homeProvider = new Web3.providers.HttpProvider(HOME_RPC_URL) const homeProvider = new Web3.providers.HttpProvider(COMMON_HOME_RPC_URL)
const web3Home = new Web3(homeProvider) const web3Home = new Web3(homeProvider)
const foreignProvider = new Web3.providers.HttpProvider(FOREIGN_RPC_URL) const foreignProvider = new Web3.providers.HttpProvider(COMMON_FOREIGN_RPC_URL)
const web3Foreign = new Web3(foreignProvider) const web3Foreign = new Web3(foreignProvider)
const homeGasOracleOpts = { const homeGasOracleOpts = {
speedType: HOME_GAS_PRICE_SPEED_TYPE, speedType: COMMON_HOME_GAS_PRICE_SPEED_TYPE,
factor: HOME_GAS_PRICE_FACTOR, factor: COMMON_HOME_GAS_PRICE_FACTOR,
logger logger
} }
const foreignGasOracleOpts = { const foreignGasOracleOpts = {
speedType: FOREIGN_GAS_PRICE_SPEED_TYPE, speedType: COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE,
factor: FOREIGN_GAS_PRICE_FACTOR, factor: COMMON_FOREIGN_GAS_PRICE_FACTOR,
logger logger
} }
@ -52,8 +52,8 @@ const asyncForEach = async (array, callback) => {
async function main(bridgeMode) { async function main(bridgeMode) {
const { HOME_ABI, FOREIGN_ABI } = getBridgeABIs(bridgeMode) const { HOME_ABI, FOREIGN_ABI } = getBridgeABIs(bridgeMode)
const homeBridge = new web3Home.eth.Contract(HOME_ABI, HOME_BRIDGE_ADDRESS) const homeBridge = new web3Home.eth.Contract(HOME_ABI, COMMON_HOME_BRIDGE_ADDRESS)
const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_ABI, FOREIGN_BRIDGE_ADDRESS) const foreignBridge = new web3Foreign.eth.Contract(FOREIGN_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
const homeValidatorsAddress = await homeBridge.methods.validatorContract().call() const homeValidatorsAddress = await homeBridge.methods.validatorContract().call()
const homeBridgeValidators = new web3Home.eth.Contract(BRIDGE_VALIDATORS_ABI, homeValidatorsAddress) const homeBridgeValidators = new web3Home.eth.Contract(BRIDGE_VALIDATORS_ABI, homeValidatorsAddress)
@ -66,14 +66,14 @@ async function main(bridgeMode) {
logger.debug('calling foreignBridgeValidators getValidatorList()') logger.debug('calling foreignBridgeValidators getValidatorList()')
const foreignValidators = await getValidatorList(foreignValidatorsAddress, web3Foreign.eth, { const foreignValidators = await getValidatorList(foreignValidatorsAddress, web3Foreign.eth, {
from: FOREIGN_DEPLOYMENT_BLOCK, from: MONITOR_FOREIGN_START_BLOCK,
to: foreignBlockNumber, to: foreignBlockNumber,
logger logger
}) })
logger.debug('calling homeBridgeValidators getValidatorList()') logger.debug('calling homeBridgeValidators getValidatorList()')
const homeValidators = await getValidatorList(homeValidatorsAddress, web3Home.eth, { const homeValidators = await getValidatorList(homeValidatorsAddress, web3Home.eth, {
from: HOME_DEPLOYMENT_BLOCK, from: MONITOR_HOME_START_BLOCK,
to: homeBlockNumber, to: homeBlockNumber,
logger logger
}) })
@ -88,17 +88,17 @@ async function main(bridgeMode) {
logger.debug('calling home getGasPrices') logger.debug('calling home getGasPrices')
const homeGasPrice = const homeGasPrice =
(await gasPriceFromOracle(() => fetch(HOME_GAS_PRICE_ORACLE_URL), homeGasOracleOpts)) || (await gasPriceFromOracle(() => fetch(COMMON_HOME_GAS_PRICE_SUPPLIER_URL), homeGasOracleOpts)) ||
Web3Utils.toBN(HOME_GAS_PRICE_FALLBACK) Web3Utils.toBN(COMMON_HOME_GAS_PRICE_FALLBACK)
const homeGasPriceGwei = Web3Utils.fromWei(homeGasPrice.toString(), 'gwei') const homeGasPriceGwei = Web3Utils.fromWei(homeGasPrice.toString(), 'gwei')
const homeTxCost = homeGasPrice.mul(Web3Utils.toBN(HOME_GAS_LIMIT)) const homeTxCost = homeGasPrice.mul(Web3Utils.toBN(MONITOR_VALIDATOR_HOME_TX_LIMIT))
logger.debug('calling foreign getGasPrices') logger.debug('calling foreign getGasPrices')
const foreignGasPrice = const foreignGasPrice =
(await gasPriceFromOracle(() => fetch(FOREIGN_GAS_PRICE_ORACLE_URL), foreignGasOracleOpts)) || (await gasPriceFromOracle(() => fetch(COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL), foreignGasOracleOpts)) ||
Web3Utils.toBN(FOREIGN_GAS_PRICE_FALLBACK) Web3Utils.toBN(COMMON_FOREIGN_GAS_PRICE_FALLBACK)
const foreignGasPriceGwei = Web3Utils.fromWei(foreignGasPrice.toString(), 'gwei') const foreignGasPriceGwei = Web3Utils.fromWei(foreignGasPrice.toString(), 'gwei')
const foreignTxCost = foreignGasPrice.mul(Web3Utils.toBN(FOREIGN_GAS_LIMIT)) const foreignTxCost = foreignGasPrice.mul(Web3Utils.toBN(MONITOR_VALIDATOR_FOREIGN_TX_LIMIT))
let validatorsMatch = true let validatorsMatch = true
logger.debug('calling asyncForEach foreignValidators foreignVBalances') logger.debug('calling asyncForEach foreignValidators foreignVBalances')

@ -8,8 +8,8 @@ const { generateNewBlock } = require('../../e2e-commons/utils')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL)) const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL)) const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL))
const HOME_BRIDGE_ADDRESS = ercToErcBridge.home const COMMON_HOME_BRIDGE_ADDRESS = ercToErcBridge.home
const FOREIGN_BRIDGE_ADDRESS = ercToErcBridge.foreign const COMMON_FOREIGN_BRIDGE_ADDRESS = ercToErcBridge.foreign
const { toBN } = foreignWeb3.utils const { toBN } = foreignWeb3.utils
@ -26,7 +26,7 @@ describe('erc to erc', () => {
// send tokens to foreign bridge // send tokens to foreign bridge
await erc20Token.methods await erc20Token.methods
.transfer(FOREIGN_BRIDGE_ADDRESS, homeWeb3.utils.toWei('0.01')) .transfer(COMMON_FOREIGN_BRIDGE_ADDRESS, homeWeb3.utils.toWei('0.01'))
.send({ .send({
from: user.address, from: user.address,
gas: '1000000' gas: '1000000'
@ -56,7 +56,7 @@ describe('erc to erc', () => {
// send transaction to home bridge // send transaction to home bridge
const depositTx = await erc677Token.methods const depositTx = await erc677Token.methods
.transferAndCall(HOME_BRIDGE_ADDRESS, homeWeb3.utils.toWei('0.01'), '0x') .transferAndCall(COMMON_HOME_BRIDGE_ADDRESS, homeWeb3.utils.toWei('0.01'), '0x')
.send({ .send({
from: user.address, from: user.address,
gas: '1000000' gas: '1000000'

@ -8,8 +8,8 @@ const { generateNewBlock } = require('../../e2e-commons/utils')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL)) const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL)) const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL))
const HOME_BRIDGE_ADDRESS = ercToNativeBridge.home const COMMON_HOME_BRIDGE_ADDRESS = ercToNativeBridge.home
const FOREIGN_BRIDGE_ADDRESS = ercToNativeBridge.foreign const COMMON_FOREIGN_BRIDGE_ADDRESS = ercToNativeBridge.foreign
const { toBN } = foreignWeb3.utils const { toBN } = foreignWeb3.utils
@ -26,7 +26,7 @@ describe('erc to native', () => {
// send tokens to foreign bridge // send tokens to foreign bridge
await erc20Token.methods await erc20Token.methods
.transfer(FOREIGN_BRIDGE_ADDRESS, homeWeb3.utils.toWei('0.01')) .transfer(COMMON_FOREIGN_BRIDGE_ADDRESS, homeWeb3.utils.toWei('0.01'))
.send({ .send({
from: user.address, from: user.address,
gas: '1000000' gas: '1000000'
@ -57,7 +57,7 @@ describe('erc to native', () => {
// send transaction to home bridge // send transaction to home bridge
const depositTx = await homeWeb3.eth.sendTransaction({ const depositTx = await homeWeb3.eth.sendTransaction({
from: user.address, from: user.address,
to: HOME_BRIDGE_ADDRESS, to: COMMON_HOME_BRIDGE_ADDRESS,
gasPrice: '1', gasPrice: '1',
gas: '1000000', gas: '1000000',
value: homeWeb3.utils.toWei('0.01') value: homeWeb3.utils.toWei('0.01')

@ -16,8 +16,8 @@ const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL)) const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL))
const { toBN } = foreignWeb3.utils const { toBN } = foreignWeb3.utils
const HOME_BRIDGE_ADDRESS = nativeToErcBridge.home const COMMON_HOME_BRIDGE_ADDRESS = nativeToErcBridge.home
const FOREIGN_BRIDGE_ADDRESS = nativeToErcBridge.foreign const COMMON_FOREIGN_BRIDGE_ADDRESS = nativeToErcBridge.foreign
homeWeb3.eth.accounts.wallet.add(user.privateKey) homeWeb3.eth.accounts.wallet.add(user.privateKey)
homeWeb3.eth.accounts.wallet.add(validator.privateKey) homeWeb3.eth.accounts.wallet.add(validator.privateKey)
@ -39,7 +39,7 @@ describe('native to erc', () => {
// send transaction to home chain // send transaction to home chain
const depositTx = await homeWeb3.eth.sendTransaction({ const depositTx = await homeWeb3.eth.sendTransaction({
from: user.address, from: user.address,
to: HOME_BRIDGE_ADDRESS, to: COMMON_HOME_BRIDGE_ADDRESS,
gasPrice: '1', gasPrice: '1',
gas: '50000', gas: '50000',
value: '1000000000000000000' value: '1000000000000000000'
@ -81,7 +81,7 @@ describe('native to erc', () => {
// send tokens to foreign bridge // send tokens to foreign bridge
await token.methods await token.methods
.transferAndCall(FOREIGN_BRIDGE_ADDRESS, homeWeb3.utils.toWei('0.01'), '0x') .transferAndCall(COMMON_FOREIGN_BRIDGE_ADDRESS, homeWeb3.utils.toWei('0.01'), '0x')
.send({ .send({
from: user.address, from: user.address,
gas: '1000000' gas: '1000000'
@ -113,7 +113,7 @@ describe('native to erc', () => {
// send transaction to home chain // send transaction to home chain
const depositTx = await homeWeb3.eth.sendTransaction({ const depositTx = await homeWeb3.eth.sendTransaction({
from: user.address, from: user.address,
to: HOME_BRIDGE_ADDRESS, to: COMMON_HOME_BRIDGE_ADDRESS,
gasPrice: '1', gasPrice: '1',
gas: '50000', gas: '50000',
value: '1000000000000000000' value: '1000000000000000000'
@ -170,7 +170,7 @@ describe('native to erc', () => {
// send transaction to home chain // send transaction to home chain
await homeWeb3.eth.sendTransaction({ await homeWeb3.eth.sendTransaction({
from: user.address, from: user.address,
to: HOME_BRIDGE_ADDRESS, to: COMMON_HOME_BRIDGE_ADDRESS,
gasPrice: '1', gasPrice: '1',
gas: '50000', gas: '50000',
value: '1000000000000000000' value: '1000000000000000000'

@ -1,35 +1,35 @@
#BRIDGE_MODE=ERC_TO_ERC #ORACLE_BRIDGE_MODE=ERC_TO_ERC
HOME_POLLING_INTERVAL=5000 ORACLE_HOME_RPC_POLLING_INTERVAL=5000
FOREIGN_POLLING_INTERVAL=1000 ORACLE_FOREIGN_RPC_POLLING_INTERVAL=1000
ALLOW_HTTP=no ORACLE_ALLOW_HTTP_FOR_RPC=no
HOME_RPC_URL=https://kovan.infura.io/mew COMMON_HOME_RPC_URL=https://kovan.infura.io/mew
FOREIGN_RPC_URL=https://kovan.infura.io/mew COMMON_FOREIGN_RPC_URL=https://kovan.infura.io/mew
HOME_BRIDGE_ADDRESS=0x86b621b839Ff86Bb59fA57015b02318f9a870d80 COMMON_HOME_BRIDGE_ADDRESS=0x86b621b839Ff86Bb59fA57015b02318f9a870d80
FOREIGN_BRIDGE_ADDRESS=0x8dDCa2eB86D22FcB93342753515986e258A90169 COMMON_FOREIGN_BRIDGE_ADDRESS=0x8dDCa2eB86D22FcB93342753515986e258A90169
ERC20_TOKEN_ADDRESS=0x7AA0A62497B5f4120fbe5D26c95bC612c2b96C14 ERC20_TOKEN_ADDRESS=0x7AA0A62497B5f4120fbe5D26c95bC612c2b96C14
VALIDATOR_ADDRESS_PRIVATE_KEY= ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=
HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
HOME_GAS_PRICE_SPEED_TYPE=standard COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
HOME_GAS_PRICE_FALLBACK=1000000000 COMMON_HOME_GAS_PRICE_FALLBACK=1000000000
HOME_GAS_PRICE_UPDATE_INTERVAL=600000 ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL=600000
HOME_GAS_PRICE_FACTOR=1 COMMON_HOME_GAS_PRICE_FACTOR=1
FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
FOREIGN_GAS_PRICE_SPEED_TYPE=standard COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
FOREIGN_GAS_PRICE_FALLBACK=1000000000 COMMON_FOREIGN_GAS_PRICE_FALLBACK=1000000000
FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000 ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000
FOREIGN_GAS_PRICE_FACTOR=1 COMMON_FOREIGN_GAS_PRICE_FACTOR=1
QUEUE_URL=amqp://rabbit ORACLE_QUEUE_URL=amqp://rabbit
REDIS_URL=redis://redis ORACLE_REDIS_URL=redis://redis
HOME_START_BLOCK= ORACLE_HOME_START_BLOCK=
FOREIGN_START_BLOCK= ORACLE_FOREIGN_START_BLOCK=
LOG_LEVEL=debug ORACLE_LOG_LEVEL=debug
MAX_PROCESSING_TIME=20000 ORACLE_MAX_PROCESSING_TIME=20000
#Uncomment these lines only if you are going to send transaction by testing scripts #Uncomment these lines only if you are going to send transaction by testing scripts
#USER_ADDRESS=0x59c4474184579b9c31b5e51445b6eef91cebf370 #USER_ADDRESS=0x59c4474184579b9c31b5e51445b6eef91cebf370

@ -22,6 +22,9 @@ RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./b
COPY ./commons ./commons COPY ./commons ./commons
COPY ./oracle ./oracle COPY ./oracle ./oracle
ARG DOT_ENV_PATH=./oracle/.env
COPY ${DOT_ENV_PATH} ./oracle/.env
WORKDIR /mono/oracle WORKDIR /mono/oracle
CMD echo "To start a bridge process run:" \ CMD echo "To start a bridge process run:" \
"VALIDATOR_ADDRESS=<validator address> VALIDATOR_ADDRESS_PRIVATE_KEY=<validator address private key> docker-compose up -d --build" "ORACLE_VALIDATOR_ADDRESS=<validator address> ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=<validator address private key> docker-compose up -d --build"

@ -107,7 +107,7 @@ cd oracle
cp .env.example .env cp .env.example .env
``` ```
2. Fill in the required information using the JSON output data. Check the tables with the [set of parameters](#configuration-parameters) below to see their explanation. 2. Fill in the required information using the JSON output data. Check [Configuration](../CONFIGURATION.md) to see their explanation.
## Run the Processes ## Run the Processes
@ -117,8 +117,8 @@ There are two options to run the TokenBridge processes:
### Docker ### Docker
- While running the bridge containers for the first time use `VALIDATOR_ADDRESS=<validator address> VALIDATOR_ADDRESS_PRIVATE_KEY=<validator address private key> docker-compose up -d --build` - While running the bridge containers for the first time use `ORACLE_VALIDATOR_ADDRESS=<validator address> ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=<validator address private key> docker-compose up -d --build`
- For further launches use `VALIDATOR_ADDRESS=<validator address> VALIDATOR_ADDRESS_PRIVATE_KEY=<validator address private key> docker-compose up --detach` - For further launches use `ORACLE_VALIDATOR_ADDRESS=<validator address> ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=<validator address private key> docker-compose up --detach`
All [watcher](#watcher) & [sender](#sender) services launch when `docker-compose` is called. All [watcher](#watcher) & [sender](#sender) services launch when `docker-compose` is called.
@ -166,34 +166,7 @@ where the _watcher_ could be one of:
## Configuration parameters ## Configuration parameters
| Variable | Description | Values | Please refer to [Configuration](../CONFIGURATION.md).
|-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| `BRIDGE_MODE` | The bridge mode. The bridge starts listening to a different set of events based on this parameter. | `NATIVE_TO_ERC` / `ERC_TO_ERC` / `ERC_TO_NATIVE` |
| `HOME_RPC_URL` | The HTTPS URL(s) used to communicate to the RPC nodes in the Home network. Several URLs can be specified, delimited by spaces. If the connection to one of these nodes is lost the next URL is used for connection. | URL(s) |
| `HOME_BRIDGE_ADDRESS` | The address of the bridge contract address in the Home network. It is used to listen to events from and send validators' transactions to the Home network. | hexidecimal beginning with "0x" |
| `HOME_POLLING_INTERVAL` | The interval in milliseconds used to request the RPC node in the Home network for new blocks. The interval should match the average production time for a new block. | integer |
| `FOREIGN_RPC_URL` | The HTTPS URL(s) used to communicate to the RPC nodes in the Foreign network. Several URLs can be specified, delimited by spaces. If the connection to one of these nodes is lost the next URL is used for connection. | URL(s) |
| `FOREIGN_BRIDGE_ADDRESS` | The address of the bridge contract address in the Foreign network. It is used to listen to events from and send validators' transactions to the Foreign network. | hexidecimal beginning with "0x" |
| `ERC20_TOKEN_ADDRESS` | Used with the `ERC_TO_ERC` bridge mode, this parameter specifies the ERC20-compatible token contract address. The token contract address is used to identify transactions that transfer tokens to the Foreign Bridge account address. Omit this parameter with other bridge modes. | hexidecimal beginning with "0x" |
| `FOREIGN_POLLING_INTERVAL` | The interval in milliseconds used to request the RPC node in the Foreign network for new blocks. The interval should match the average production time for a new block. | integer |
| `HOME_GAS_PRICE_ORACLE_URL` | The URL used to get a JSON response from the gas price prediction oracle for the Home network. The gas price provided by the oracle is used to send the validator's transactions to the RPC node. Since it is assumed that the Home network has a predefined gas price (e.g. the gas price in the Core of POA.Network is `1 GWei`), the gas price oracle parameter can be omitted for such networks. | URL |
| `HOME_GAS_PRICE_SPEED_TYPE` | Assuming the gas price oracle responds with the following JSON structure: `{"fast": 20.0, "block_time": 12.834, "health": true, "standard": 6.0, "block_number": 6470469, "instant": 71.0, "slow": 1.889}`, this parameter specifies the desirable transaction speed. The speed type can be omitted when `HOME_GAS_PRICE_ORACLE_URL` is not used. | `instant` / `fast` / `standard` / `slow` |
| `HOME_GAS_PRICE_FALLBACK` | The gas price (in Wei) that is used if both the oracle and the fall back gas price specified in the Home Bridge contract are not available. | integer |
| `HOME_GAS_PRICE_UPDATE_INTERVAL` | An interval in milliseconds used to get the updated gas price value either from the oracle or from the Home Bridge contract. | integer |
| `HOME_GAS_PRICE_FACTOR` | A value that will multiply the gas price of the oracle to convert it to gwei. If the oracle API returns gas prices in gwei then this can be set to `1`. Also, it could be used to intentionally pay more gas than suggested by the oracle to guarantee the transaction verification. E.g. `1.25` or `1.5`. | integer |
| `FOREIGN_GAS_PRICE_ORACLE_URL` | The URL used to get a JSON response from the gas price prediction oracle for the Foreign network. The provided gas price is used to send the validator's transactions to the RPC node. If the Foreign network is Ethereum Foundation mainnet, the oracle URL can be: https://gasprice.poa.network. Otherwise this parameter can be omitted. | URL |
| `FOREIGN_GAS_PRICE_SPEED_TYPE` | Assuming the gas price oracle responds with the following JSON structure: `{"fast": 20.0, "block_time": 12.834, "health": true, "standard": 6.0, "block_number": 6470469, "instant": 71.0, "slow": 1.889}`, this parameter specifies the desirable transaction speed. The speed type can be omitted when `FOREIGN_GAS_PRICE_ORACLE_URL`is not used. | `instant` / `fast` / `standard` / `slow` |
| `FOREIGN_GAS_PRICE_FALLBACK` | The gas price (in Wei) used if both the oracle and fall back gas price specified in the Foreign Bridge contract are not available. | integer |
| `FOREIGN_GAS_PRICE_UPDATE_INTERVAL` | The interval in milliseconds used to get the updated gas price value either from the oracle or from the Foreign Bridge contract. | integer |
| `FOREIGN_GAS_PRICE_FACTOR` | A value that will multiply the gas price of the oracle to convert it to gwei. If the oracle API returns gas prices in gwei then this can be set to `1`. Also, it could be used to intentionally pay more gas than suggested by the oracle to guarantee the transaction verification. E.g. `1.25` or `1.5`. | integer |
| `VALIDATOR_ADDRESS_PRIVATE_KEY` | The private key of the bridge validator used to sign confirmations before sending transactions to the bridge contracts. The validator account is calculated automatically from the private key. Every bridge instance (set of watchers and senders) must have its own unique private key. The specified private key is used to sign transactions on both sides of the bridge. | hexidecimal without "0x" |
| `HOME_START_BLOCK` | The block number in the Home network used to start watching for events when the bridge instance is run for the first time. Usually this is the same block where the Home Bridge contract is deployed. If a new validator instance is being deployed for an existing set of validators, the block number could be the latest block in the chain. | integer |
| `FOREIGN_START_BLOCK` | The block number in the Foreign network used to start watching for events when the bridge instance runs for the first time. Usually this is the same block where the Foreign Bridge contract was deployed to. If a new validator instance is being deployed for an existing set of validators, the block number could be the latest block in the chain. | integer |
| `QUEUE_URL` | RabbitMQ URL used by watchers and senders to communicate to the message queue. Typically set to: `amqp://127.0.0.1`. | local URL |
| `REDIS_URL` | Redis DB URL used by watchers and senders to communicate to the database. Typically set to: `redis://127.0.0.1:6379`. | local URL |
| `ALLOW_HTTP` | **Only use in test environments - must be omitted in production environments.**. If this parameter is specified and set to `yes`, RPC URLs can be specified in form of HTTP links. A warning that the connection is insecure will be written to the logs. | `yes` / `no` |
| `LOG_LEVEL` | Set the level of details in the logs. | `trace` / `debug` / `info` / `warn` / `error` / `fatal` |
| `MAX_PROCESSING_TIME` | The workers processes will be killed if this amount of time (in milliseconds) is ellapsed before they finish processing. It is recommended to set this value to 4 times the value of the longest polling time (set with the `HOME_POLLING_INTERVAL` and `FOREIGN_POLLING_INTERVAL` variables). To disable this, set the time to 0. | integer |
## Useful Commands for Development ## Useful Commands for Development
@ -254,14 +227,14 @@ When running the processes, the following commands can be used to test functiona
| Variable | Description | | Variable | Description |
|-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `HOME_RPC_URL` | The HTTPS URL(s) used to communicate to the RPC nodes in the Home network. | | `COMMON_HOME_RPC_URL` | The HTTPS URL(s) used to communicate to the RPC nodes in the Home network. |
| `FOREIGN_RPC_URL` | The HTTPS URL(s) used to communicate to the RPC nodes in the Foreign network. | | `COMMON_FOREIGN_RPC_URL` | The HTTPS URL(s) used to communicate to the RPC nodes in the Foreign network. |
| `USER_ADDRESS` | An account - the current owner of coins/tokens. | | `USER_ADDRESS` | An account - the current owner of coins/tokens. |
| `USER_ADDRESS_PRIVATE_KEY` | A private key belonging to the account. | | `USER_ADDRESS_PRIVATE_KEY` | A private key belonging to the account. |
| `HOME_BRIDGE_ADDRESS` | Address of the bridge in the Home network to send transactions. | | `COMMON_HOME_BRIDGE_ADDRESS` | Address of the bridge in the Home network to send transactions. |
| `HOME_MIN_AMOUNT_PER_TX` | Value (in _eth_ or tokens) to be sent in one transaction for the Home network. This should be greater than or equal to the value specified in the `poa-bridge-contracts/deploy/.env` file. The default value in that file is 500000000000000000, which is equivalent to 0.5. | | `HOME_MIN_AMOUNT_PER_TX` | Value (in _eth_ or tokens) to be sent in one transaction for the Home network. This should be greater than or equal to the value specified in the `poa-bridge-contracts/deploy/.env` file. The default value in that file is 500000000000000000, which is equivalent to 0.5. |
| `HOME_TEST_TX_GAS_PRICE` | The gas price (in Wei) that is used to send transactions in the Home network . | | `HOME_TEST_TX_GAS_PRICE` | The gas price (in Wei) that is used to send transactions in the Home network . |
| `FOREIGN_BRIDGE_ADDRESS` | Address of the bridge in the Foreign network to send transactions. | | `COMMON_FOREIGN_BRIDGE_ADDRESS` | Address of the bridge in the Foreign network to send transactions. |
| `FOREIGN_MIN_AMOUNT_PER_TX` | Value (in _eth_ or tokens) to be sent in one transaction for the Foreign network. This should be greater than or equal to the value specified in the `poa-bridge-contracts/deploy/.env` file. The default value in that file is 500000000000000000, which is equivalent to 0.5. | | `FOREIGN_MIN_AMOUNT_PER_TX` | Value (in _eth_ or tokens) to be sent in one transaction for the Foreign network. This should be greater than or equal to the value specified in the `poa-bridge-contracts/deploy/.env` file. The default value in that file is 500000000000000000, which is equivalent to 0.5. |
| `FOREIGN_TEST_TX_GAS_PRICE` | The gas price (in Wei) that is used to send transactions in the Foreign network . | | `FOREIGN_TEST_TX_GAS_PRICE` | The gas price (in Wei) that is used to send transactions in the Foreign network . |

@ -28,7 +28,7 @@ module.exports =
event: 'Transfer', event: 'Transfer',
eventContractAddress: process.env.ERC20_TOKEN_ADDRESS, eventContractAddress: process.env.ERC20_TOKEN_ADDRESS,
eventAbi: ERC20_ABI, eventAbi: ERC20_ABI,
eventFilter: { to: process.env.FOREIGN_BRIDGE_ADDRESS }, eventFilter: { to: process.env.COMMON_FOREIGN_BRIDGE_ADDRESS },
queue: 'home', queue: 'home',
name: `watcher-${id}`, name: `watcher-${id}`,
id id

@ -13,13 +13,13 @@ const {
const { web3Home, web3Foreign } = require('../src/services/web3') const { web3Home, web3Foreign } = require('../src/services/web3')
const { privateKeyToAddress } = require('../src/utils/utils') const { privateKeyToAddress } = require('../src/utils/utils')
const { VALIDATOR_ADDRESS, VALIDATOR_ADDRESS_PRIVATE_KEY } = process.env const { ORACLE_VALIDATOR_ADDRESS, ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY } = process.env
let homeAbi let homeAbi
let foreignAbi let foreignAbi
let id let id
switch (process.env.BRIDGE_MODE) { switch (process.env.ORACLE_BRIDGE_MODE) {
case BRIDGE_MODES.NATIVE_TO_ERC: case BRIDGE_MODES.NATIVE_TO_ERC:
homeAbi = HOME_NATIVE_TO_ERC_ABI homeAbi = HOME_NATIVE_TO_ERC_ABI
foreignAbi = FOREIGN_NATIVE_TO_ERC_ABI foreignAbi = FOREIGN_NATIVE_TO_ERC_ABI
@ -37,7 +37,7 @@ switch (process.env.BRIDGE_MODE) {
break break
default: default:
if (process.env.NODE_ENV !== 'test') { if (process.env.NODE_ENV !== 'test') {
throw new Error(`Bridge Mode: ${process.env.BRIDGE_MODE} not supported.`) throw new Error(`Bridge Mode: ${process.env.ORACLE_BRIDGE_MODE} not supported.`)
} else { } else {
homeAbi = HOME_ERC_TO_NATIVE_ABI homeAbi = HOME_ERC_TO_NATIVE_ABI
foreignAbi = FOREIGN_ERC_TO_NATIVE_ABI foreignAbi = FOREIGN_ERC_TO_NATIVE_ABI
@ -46,41 +46,42 @@ switch (process.env.BRIDGE_MODE) {
} }
let maxProcessingTime = null let maxProcessingTime = null
if (String(process.env.MAX_PROCESSING_TIME) === '0') { if (String(process.env.ORACLE_MAX_PROCESSING_TIME) === '0') {
maxProcessingTime = 0 maxProcessingTime = 0
} else if (!process.env.MAX_PROCESSING_TIME) { } else if (!process.env.ORACLE_MAX_PROCESSING_TIME) {
maxProcessingTime = 4 * Math.max(process.env.HOME_POLLING_INTERVAL, process.env.FOREIGN_POLLING_INTERVAL) maxProcessingTime =
4 * Math.max(process.env.ORACLE_HOME_RPC_POLLING_INTERVAL, process.env.ORACLE_FOREIGN_RPC_POLLING_INTERVAL)
} else { } else {
maxProcessingTime = Number(process.env.MAX_PROCESSING_TIME) maxProcessingTime = Number(process.env.ORACLE_MAX_PROCESSING_TIME)
} }
const bridgeConfig = { const bridgeConfig = {
homeBridgeAddress: process.env.HOME_BRIDGE_ADDRESS, homeBridgeAddress: process.env.COMMON_HOME_BRIDGE_ADDRESS,
homeBridgeAbi: homeAbi, homeBridgeAbi: homeAbi,
foreignBridgeAddress: process.env.FOREIGN_BRIDGE_ADDRESS, foreignBridgeAddress: process.env.COMMON_FOREIGN_BRIDGE_ADDRESS,
foreignBridgeAbi: foreignAbi, foreignBridgeAbi: foreignAbi,
eventFilter: {}, eventFilter: {},
validatorAddress: VALIDATOR_ADDRESS || privateKeyToAddress(VALIDATOR_ADDRESS_PRIVATE_KEY), validatorAddress: ORACLE_VALIDATOR_ADDRESS || privateKeyToAddress(ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY),
maxProcessingTime maxProcessingTime
} }
const homeConfig = { const homeConfig = {
eventContractAddress: process.env.HOME_BRIDGE_ADDRESS, eventContractAddress: process.env.COMMON_HOME_BRIDGE_ADDRESS,
eventAbi: homeAbi, eventAbi: homeAbi,
bridgeContractAddress: process.env.HOME_BRIDGE_ADDRESS, bridgeContractAddress: process.env.COMMON_HOME_BRIDGE_ADDRESS,
bridgeAbi: homeAbi, bridgeAbi: homeAbi,
pollingInterval: process.env.HOME_POLLING_INTERVAL, pollingInterval: process.env.ORACLE_HOME_RPC_POLLING_INTERVAL,
startBlock: toBN(process.env.HOME_START_BLOCK || 0), startBlock: toBN(process.env.ORACLE_HOME_START_BLOCK || 0),
web3: web3Home web3: web3Home
} }
const foreignConfig = { const foreignConfig = {
eventContractAddress: process.env.FOREIGN_BRIDGE_ADDRESS, eventContractAddress: process.env.COMMON_FOREIGN_BRIDGE_ADDRESS,
eventAbi: foreignAbi, eventAbi: foreignAbi,
bridgeContractAddress: process.env.FOREIGN_BRIDGE_ADDRESS, bridgeContractAddress: process.env.COMMON_FOREIGN_BRIDGE_ADDRESS,
bridgeAbi: foreignAbi, bridgeAbi: foreignAbi,
pollingInterval: process.env.FOREIGN_POLLING_INTERVAL, pollingInterval: process.env.ORACLE_FOREIGN_RPC_POLLING_INTERVAL,
startBlock: toBN(process.env.FOREIGN_START_BLOCK || 0), startBlock: toBN(process.env.ORACLE_FOREIGN_START_BLOCK || 0),
web3: web3Foreign web3: web3Foreign
} }

@ -38,7 +38,7 @@ services:
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- VALIDATOR_ADDRESS_PRIVATE_KEY=${VALIDATOR_ADDRESS_PRIVATE_KEY} - ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=${ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY}
restart: unless-stopped restart: unless-stopped
entrypoint: yarn watcher:signature-request entrypoint: yarn watcher:signature-request
networks: networks:
@ -53,7 +53,7 @@ services:
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- VALIDATOR_ADDRESS=${VALIDATOR_ADDRESS} - ORACLE_VALIDATOR_ADDRESS=${ORACLE_VALIDATOR_ADDRESS}
restart: unless-stopped restart: unless-stopped
entrypoint: yarn watcher:collected-signatures entrypoint: yarn watcher:collected-signatures
networks: networks:
@ -68,7 +68,7 @@ services:
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- VALIDATOR_ADDRESS=${VALIDATOR_ADDRESS} - ORACLE_VALIDATOR_ADDRESS=${ORACLE_VALIDATOR_ADDRESS}
restart: unless-stopped restart: unless-stopped
entrypoint: yarn watcher:affirmation-request entrypoint: yarn watcher:affirmation-request
networks: networks:
@ -83,7 +83,7 @@ services:
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- VALIDATOR_ADDRESS_PRIVATE_KEY=${VALIDATOR_ADDRESS_PRIVATE_KEY} - ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=${ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY}
restart: unless-stopped restart: unless-stopped
entrypoint: yarn sender:home entrypoint: yarn sender:home
networks: networks:
@ -98,7 +98,7 @@ services:
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- VALIDATOR_ADDRESS_PRIVATE_KEY=${VALIDATOR_ADDRESS_PRIVATE_KEY} - ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=${ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY}
restart: unless-stopped restart: unless-stopped
entrypoint: yarn sender:foreign entrypoint: yarn sender:foreign
networks: networks:

@ -8,7 +8,7 @@ const { ERC20_ABI } = require('../../../commons')
const { const {
USER_ADDRESS, USER_ADDRESS,
USER_ADDRESS_PRIVATE_KEY, USER_ADDRESS_PRIVATE_KEY,
FOREIGN_BRIDGE_ADDRESS, COMMON_FOREIGN_BRIDGE_ADDRESS,
FOREIGN_MIN_AMOUNT_PER_TX, FOREIGN_MIN_AMOUNT_PER_TX,
FOREIGN_TEST_TX_GAS_PRICE FOREIGN_TEST_TX_GAS_PRICE
} = process.env } = process.env
@ -22,7 +22,7 @@ const foreignProvider = new Web3.providers.HttpProvider(foreignRpcUrl)
const web3Foreign = new Web3(foreignProvider) const web3Foreign = new Web3(foreignProvider)
async function main() { async function main() {
const bridge = new web3Foreign.eth.Contract(FOREIGN_ERC_TO_ERC_ABI, FOREIGN_BRIDGE_ADDRESS) const bridge = new web3Foreign.eth.Contract(FOREIGN_ERC_TO_ERC_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
const ERC20_TOKEN_ADDRESS = await bridge.methods.erc20token().call() const ERC20_TOKEN_ADDRESS = await bridge.methods.erc20token().call()
const poa20 = new web3Foreign.eth.Contract(ERC20_ABI, ERC20_TOKEN_ADDRESS) const poa20 = new web3Foreign.eth.Contract(ERC20_ABI, ERC20_TOKEN_ADDRESS)
@ -41,10 +41,10 @@ async function main() {
let actualSent = 0 let actualSent = 0
for (let i = 0; i < Number(NUMBER_OF_DEPOSITS_TO_SEND); i++) { for (let i = 0; i < Number(NUMBER_OF_DEPOSITS_TO_SEND); i++) {
const gasLimit = await poa20.methods const gasLimit = await poa20.methods
.transfer(FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX)) .transfer(COMMON_FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX))
.estimateGas({ from: USER_ADDRESS }) .estimateGas({ from: USER_ADDRESS })
const data = await poa20.methods const data = await poa20.methods
.transfer(FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX)) .transfer(COMMON_FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX))
.encodeABI({ from: USER_ADDRESS }) .encodeABI({ from: USER_ADDRESS })
const txHash = await sendTx({ const txHash = await sendTx({
chain: 'foreign', chain: 'foreign',

@ -9,7 +9,7 @@ const { HOME_ERC_TO_ERC_ABI } = require('../../../commons')
const { const {
USER_ADDRESS, USER_ADDRESS,
USER_ADDRESS_PRIVATE_KEY, USER_ADDRESS_PRIVATE_KEY,
HOME_BRIDGE_ADDRESS, COMMON_HOME_BRIDGE_ADDRESS,
HOME_MIN_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX,
HOME_TEST_TX_GAS_PRICE HOME_TEST_TX_GAS_PRICE
} = process.env } = process.env
@ -51,7 +51,7 @@ const homeProvider = new Web3.providers.HttpProvider(homeRpcUrl)
const web3Home = new Web3(homeProvider) const web3Home = new Web3(homeProvider)
async function main() { async function main() {
const bridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, HOME_BRIDGE_ADDRESS) const bridge = new web3Home.eth.Contract(HOME_ERC_TO_ERC_ABI, COMMON_HOME_BRIDGE_ADDRESS)
const BRIDGEABLE_TOKEN_ADDRESS = await bridge.methods.erc677token().call() const BRIDGEABLE_TOKEN_ADDRESS = await bridge.methods.erc677token().call()
const erc677 = new web3Home.eth.Contract(BRIDGEABLE_TOKEN_ABI, BRIDGEABLE_TOKEN_ADDRESS) const erc677 = new web3Home.eth.Contract(BRIDGEABLE_TOKEN_ABI, BRIDGEABLE_TOKEN_ADDRESS)
@ -72,10 +72,10 @@ async function main() {
let actualSent = 0 let actualSent = 0
for (let i = 0; i < Number(NUMBER_OF_WITHDRAWALS_TO_SEND); i++) { for (let i = 0; i < Number(NUMBER_OF_WITHDRAWALS_TO_SEND); i++) {
const gasLimit = await erc677.methods const gasLimit = await erc677.methods
.transferAndCall(HOME_BRIDGE_ADDRESS, Web3Utils.toWei(HOME_MIN_AMOUNT_PER_TX), '0x') .transferAndCall(COMMON_HOME_BRIDGE_ADDRESS, Web3Utils.toWei(HOME_MIN_AMOUNT_PER_TX), '0x')
.estimateGas({ from: USER_ADDRESS }) .estimateGas({ from: USER_ADDRESS })
const data = await erc677.methods const data = await erc677.methods
.transferAndCall(HOME_BRIDGE_ADDRESS, Web3Utils.toWei(HOME_MIN_AMOUNT_PER_TX), '0x') .transferAndCall(COMMON_HOME_BRIDGE_ADDRESS, Web3Utils.toWei(HOME_MIN_AMOUNT_PER_TX), '0x')
.encodeABI({ from: USER_ADDRESS }) .encodeABI({ from: USER_ADDRESS })
const txHash = await sendTx({ const txHash = await sendTx({
chain: 'home', chain: 'home',

@ -7,7 +7,7 @@ const { sendTx, sendRawTx } = require('../../src/tx/sendTx')
const { const {
USER_ADDRESS, USER_ADDRESS,
USER_ADDRESS_PRIVATE_KEY, USER_ADDRESS_PRIVATE_KEY,
FOREIGN_BRIDGE_ADDRESS, COMMON_FOREIGN_BRIDGE_ADDRESS,
FOREIGN_MIN_AMOUNT_PER_TX, FOREIGN_MIN_AMOUNT_PER_TX,
FOREIGN_TEST_TX_GAS_PRICE FOREIGN_TEST_TX_GAS_PRICE
} = process.env } = process.env
@ -21,7 +21,7 @@ const foreignProvider = new Web3.providers.HttpProvider(foreignRpcUrl)
const web3Foreign = new Web3(foreignProvider) const web3Foreign = new Web3(foreignProvider)
async function main() { async function main() {
const bridge = new web3Foreign.eth.Contract(FOREIGN_ERC_TO_NATIVE_ABI, FOREIGN_BRIDGE_ADDRESS) const bridge = new web3Foreign.eth.Contract(FOREIGN_ERC_TO_NATIVE_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
const ERC20_TOKEN_ADDRESS = await bridge.methods.erc20token().call() const ERC20_TOKEN_ADDRESS = await bridge.methods.erc20token().call()
const poa20 = new web3Foreign.eth.Contract(ERC20_ABI, ERC20_TOKEN_ADDRESS) const poa20 = new web3Foreign.eth.Contract(ERC20_ABI, ERC20_TOKEN_ADDRESS)
@ -40,10 +40,10 @@ async function main() {
let actualSent = 0 let actualSent = 0
for (let i = 0; i < Number(NUMBER_OF_DEPOSITS_TO_SEND); i++) { for (let i = 0; i < Number(NUMBER_OF_DEPOSITS_TO_SEND); i++) {
const gasLimit = await poa20.methods const gasLimit = await poa20.methods
.transfer(FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX)) .transfer(COMMON_FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX))
.estimateGas({ from: USER_ADDRESS }) .estimateGas({ from: USER_ADDRESS })
const data = await poa20.methods const data = await poa20.methods
.transfer(FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX)) .transfer(COMMON_FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX))
.encodeABI({ from: USER_ADDRESS }) .encodeABI({ from: USER_ADDRESS })
const txHash = await sendTx({ const txHash = await sendTx({
chain: 'foreign', chain: 'foreign',

@ -8,7 +8,7 @@ const { HOME_ERC_TO_NATIVE_ABI } = require('../../../commons')
const { const {
USER_ADDRESS, USER_ADDRESS,
USER_ADDRESS_PRIVATE_KEY, USER_ADDRESS_PRIVATE_KEY,
HOME_BRIDGE_ADDRESS, COMMON_HOME_BRIDGE_ADDRESS,
HOME_MIN_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX,
HOME_TEST_TX_GAS_PRICE HOME_TEST_TX_GAS_PRICE
} = process.env } = process.env
@ -16,7 +16,7 @@ const {
const NUMBER_OF_DEPOSITS_TO_SEND = process.argv[2] || 1 const NUMBER_OF_DEPOSITS_TO_SEND = process.argv[2] || 1
async function main() { async function main() {
const bridge = new web3Home.eth.Contract(HOME_ERC_TO_NATIVE_ABI, HOME_BRIDGE_ADDRESS) const bridge = new web3Home.eth.Contract(HOME_ERC_TO_NATIVE_ABI, COMMON_HOME_BRIDGE_ADDRESS)
try { try {
await isValidAmount(HOME_MIN_AMOUNT_PER_TX, bridge) await isValidAmount(HOME_MIN_AMOUNT_PER_TX, bridge)
@ -42,7 +42,7 @@ async function main() {
gasPrice: HOME_TEST_TX_GAS_PRICE, gasPrice: HOME_TEST_TX_GAS_PRICE,
amount: HOME_MIN_AMOUNT_PER_TX, amount: HOME_MIN_AMOUNT_PER_TX,
gasLimit: 100000, gasLimit: 100000,
to: HOME_BRIDGE_ADDRESS, to: COMMON_HOME_BRIDGE_ADDRESS,
web3: web3Home, web3: web3Home,
chainId: homeChainId chainId: homeChainId
}) })

@ -23,7 +23,7 @@ async function getStartBlock(rpcUrl, bridgeAddress, bridgeAbi) {
const validatorAddedEvents = await validatorContract.getPastEvents('ValidatorAdded', { const validatorAddedEvents = await validatorContract.getPastEvents('ValidatorAdded', {
fromBlock: validatorDeployedAtBlock, fromBlock: validatorDeployedAtBlock,
filter: { validator: process.env.VALIDATOR_ADDRESS } filter: { validator: process.env.ORACLE_VALIDATOR_ADDRESS }
}) })
return validatorAddedEvents.length ? validatorAddedEvents[0].blockNumber : deployedAtBlock return validatorAddedEvents.length ? validatorAddedEvents[0].blockNumber : deployedAtBlock
@ -33,12 +33,12 @@ async function getStartBlock(rpcUrl, bridgeAddress, bridgeAbi) {
} }
async function main() { async function main() {
const { HOME_BRIDGE_ADDRESS, FOREIGN_BRIDGE_ADDRESS } = process.env const { COMMON_HOME_BRIDGE_ADDRESS, COMMON_FOREIGN_BRIDGE_ADDRESS } = process.env
const homeRpcUrl = rpcUrlsManager.homeUrls[0] const homeRpcUrl = rpcUrlsManager.homeUrls[0]
const foreignRpcUrl = rpcUrlsManager.foreignUrls[0] const foreignRpcUrl = rpcUrlsManager.foreignUrls[0]
const homeStartBlock = await getStartBlock(homeRpcUrl, HOME_BRIDGE_ADDRESS, homeABI) const homeStartBlock = await getStartBlock(homeRpcUrl, COMMON_HOME_BRIDGE_ADDRESS, homeABI)
const foreignStartBlock = await getStartBlock(foreignRpcUrl, FOREIGN_BRIDGE_ADDRESS, foreignABI) const foreignStartBlock = await getStartBlock(foreignRpcUrl, COMMON_FOREIGN_BRIDGE_ADDRESS, foreignABI)
const result = { const result = {
homeStartBlock, homeStartBlock,
foreignStartBlock foreignStartBlock

@ -3,14 +3,14 @@ const Web3 = require('web3')
const { ERC677_BRIDGE_TOKEN_ABI, getTokenType } = require('../../commons') const { ERC677_BRIDGE_TOKEN_ABI, getTokenType } = require('../../commons')
async function initialChecks() { async function initialChecks() {
const { ERC20_TOKEN_ADDRESS, BRIDGE_MODE, FOREIGN_RPC_URL, FOREIGN_BRIDGE_ADDRESS } = process.env const { ERC20_TOKEN_ADDRESS, ORACLE_BRIDGE_MODE, COMMON_FOREIGN_RPC_URL, COMMON_FOREIGN_BRIDGE_ADDRESS } = process.env
const result = {} const result = {}
if (BRIDGE_MODE === 'ERC_TO_ERC') { if (ORACLE_BRIDGE_MODE === 'ERC_TO_ERC') {
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(FOREIGN_RPC_URL)) const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(COMMON_FOREIGN_RPC_URL))
const bridgeTokenContract = new foreignWeb3.eth.Contract(ERC677_BRIDGE_TOKEN_ABI, ERC20_TOKEN_ADDRESS) const bridgeTokenContract = new foreignWeb3.eth.Contract(ERC677_BRIDGE_TOKEN_ABI, ERC20_TOKEN_ADDRESS)
result.foreignERC = await getTokenType(bridgeTokenContract, FOREIGN_BRIDGE_ADDRESS) result.foreignERC = await getTokenType(bridgeTokenContract, COMMON_FOREIGN_BRIDGE_ADDRESS)
} }
console.log(JSON.stringify(result)) console.log(JSON.stringify(result))
return result return result

@ -8,7 +8,7 @@ const { FOREIGN_NATIVE_TO_ERC_ABI } = require('../../../commons')
const { const {
USER_ADDRESS, USER_ADDRESS,
USER_ADDRESS_PRIVATE_KEY, USER_ADDRESS_PRIVATE_KEY,
FOREIGN_BRIDGE_ADDRESS, COMMON_FOREIGN_BRIDGE_ADDRESS,
FOREIGN_MIN_AMOUNT_PER_TX, FOREIGN_MIN_AMOUNT_PER_TX,
FOREIGN_TEST_TX_GAS_PRICE FOREIGN_TEST_TX_GAS_PRICE
} = process.env } = process.env
@ -46,7 +46,7 @@ const ERC677_ABI = [
] ]
async function main() { async function main() {
const bridge = new web3Foreign.eth.Contract(FOREIGN_NATIVE_TO_ERC_ABI, FOREIGN_BRIDGE_ADDRESS) const bridge = new web3Foreign.eth.Contract(FOREIGN_NATIVE_TO_ERC_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
const ERC20_TOKEN_ADDRESS = await bridge.methods.erc677token().call() const ERC20_TOKEN_ADDRESS = await bridge.methods.erc677token().call()
const poa20 = new web3Foreign.eth.Contract(ERC677_ABI, ERC20_TOKEN_ADDRESS) const poa20 = new web3Foreign.eth.Contract(ERC677_ABI, ERC20_TOKEN_ADDRESS)
@ -67,10 +67,10 @@ async function main() {
let actualSent = 0 let actualSent = 0
for (let i = 0; i < Number(NUMBER_OF_WITHDRAWALS_TO_SEND); i++) { for (let i = 0; i < Number(NUMBER_OF_WITHDRAWALS_TO_SEND); i++) {
const gasLimit = await poa20.methods const gasLimit = await poa20.methods
.transferAndCall(FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX), '0x') .transferAndCall(COMMON_FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX), '0x')
.estimateGas({ from: USER_ADDRESS }) .estimateGas({ from: USER_ADDRESS })
const data = await poa20.methods const data = await poa20.methods
.transferAndCall(FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX), '0x') .transferAndCall(COMMON_FOREIGN_BRIDGE_ADDRESS, Web3Utils.toWei(FOREIGN_MIN_AMOUNT_PER_TX), '0x')
.encodeABI({ from: USER_ADDRESS }) .encodeABI({ from: USER_ADDRESS })
const txHash = await sendTx({ const txHash = await sendTx({
chain: 'foreign', chain: 'foreign',

@ -8,7 +8,7 @@ const { HOME_NATIVE_TO_ERC_ABI } = require('../../../commons')
const { const {
USER_ADDRESS, USER_ADDRESS,
USER_ADDRESS_PRIVATE_KEY, USER_ADDRESS_PRIVATE_KEY,
HOME_BRIDGE_ADDRESS, COMMON_HOME_BRIDGE_ADDRESS,
HOME_MIN_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX,
HOME_TEST_TX_GAS_PRICE HOME_TEST_TX_GAS_PRICE
} = process.env } = process.env
@ -16,7 +16,7 @@ const {
const NUMBER_OF_DEPOSITS_TO_SEND = process.argv[2] || 1 const NUMBER_OF_DEPOSITS_TO_SEND = process.argv[2] || 1
async function main() { async function main() {
const bridge = new web3Home.eth.Contract(HOME_NATIVE_TO_ERC_ABI, HOME_BRIDGE_ADDRESS) const bridge = new web3Home.eth.Contract(HOME_NATIVE_TO_ERC_ABI, COMMON_HOME_BRIDGE_ADDRESS)
try { try {
await isValidAmount(HOME_MIN_AMOUNT_PER_TX, bridge) await isValidAmount(HOME_MIN_AMOUNT_PER_TX, bridge)
@ -42,7 +42,7 @@ async function main() {
gasPrice: HOME_TEST_TX_GAS_PRICE, gasPrice: HOME_TEST_TX_GAS_PRICE,
amount: HOME_MIN_AMOUNT_PER_TX, amount: HOME_MIN_AMOUNT_PER_TX,
gasLimit: 100000, gasLimit: 100000,
to: HOME_BRIDGE_ADDRESS, to: COMMON_HOME_BRIDGE_ADDRESS,
web3: web3Home, web3: web3Home,
chainId: homeChainId chainId: homeChainId
}) })

@ -2,10 +2,10 @@ require('../env')
const { privateKeyToAddress } = require('../src/utils/utils') const { privateKeyToAddress } = require('../src/utils/utils')
const { EXIT_CODES } = require('../src/utils/constants') const { EXIT_CODES } = require('../src/utils/constants')
const privateKey = process.env.VALIDATOR_ADDRESS_PRIVATE_KEY const privateKey = process.env.ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY
if (!privateKey) { if (!privateKey) {
console.error('Environment variable VALIDATOR_ADDRESS_PRIVATE_KEY is not set') console.error('Environment variable ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY is not set')
process.exit(EXIT_CODES.GENERAL_ERROR) process.exit(EXIT_CODES.GENERAL_ERROR)
} }

@ -3,7 +3,7 @@ const Redis = require('ioredis')
const { id } = require('../config/base.config') const { id } = require('../config/base.config')
const { EXIT_CODES } = require('../src/utils/constants') const { EXIT_CODES } = require('../src/utils/constants')
const redis = new Redis(process.env.REDIS_URL) const redis = new Redis(process.env.ORACLE_REDIS_URL)
redis.on('error', () => { redis.on('error', () => {
logError('Error: Cannot connect to redis') logError('Error: Cannot connect to redis')

@ -9,7 +9,7 @@ const estimateGas = require('./estimateGas')
const { AlreadyProcessedError, AlreadySignedError, InvalidValidatorError } = require('../../utils/errors') const { AlreadyProcessedError, AlreadySignedError, InvalidValidatorError } = require('../../utils/errors')
const { EXIT_CODES, MAX_CONCURRENT_EVENTS } = require('../../utils/constants') const { EXIT_CODES, MAX_CONCURRENT_EVENTS } = require('../../utils/constants')
const { VALIDATOR_ADDRESS_PRIVATE_KEY } = process.env const { ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY } = process.env
const limit = promiseLimit(MAX_CONCURRENT_EVENTS) const limit = promiseLimit(MAX_CONCURRENT_EVENTS)
@ -53,7 +53,7 @@ function processSignatureRequestsBuilder(config) {
expectedMessageLength expectedMessageLength
}) })
const signature = web3Home.eth.accounts.sign(message, `0x${VALIDATOR_ADDRESS_PRIVATE_KEY}`) const signature = web3Home.eth.accounts.sign(message, `0x${ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY}`)
let gasEstimate let gasEstimate
try { try {

@ -18,9 +18,9 @@ const {
} = require('./utils/utils') } = require('./utils/utils')
const { EXIT_CODES, EXTRA_GAS_PERCENTAGE } = require('./utils/constants') const { EXIT_CODES, EXTRA_GAS_PERCENTAGE } = require('./utils/constants')
const { VALIDATOR_ADDRESS_PRIVATE_KEY } = process.env const { ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY } = process.env
const VALIDATOR_ADDRESS = privateKeyToAddress(VALIDATOR_ADDRESS_PRIVATE_KEY) const ORACLE_VALIDATOR_ADDRESS = privateKeyToAddress(ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY)
if (process.argv.length < 3) { if (process.argv.length < 3) {
logger.error('Please check the number of arguments, config file was not provided') logger.error('Please check the number of arguments, config file was not provided')
@ -35,7 +35,7 @@ let chainId = 0
async function initialize() { async function initialize() {
try { try {
const checkHttps = checkHTTPS(process.env.ALLOW_HTTP, logger) const checkHttps = checkHTTPS(process.env.ORACLE_ALLOW_HTTP_FOR_RPC, logger)
rpcUrlsManager.homeUrls.forEach(checkHttps('home')) rpcUrlsManager.homeUrls.forEach(checkHttps('home'))
rpcUrlsManager.foreignUrls.forEach(checkHttps('foreign')) rpcUrlsManager.foreignUrls.forEach(checkHttps('foreign'))
@ -71,7 +71,7 @@ async function readNonce(forceUpdate) {
logger.debug('Reading nonce') logger.debug('Reading nonce')
if (forceUpdate) { if (forceUpdate) {
logger.debug('Forcing update of nonce') logger.debug('Forcing update of nonce')
return getNonce(web3Instance, VALIDATOR_ADDRESS) return getNonce(web3Instance, ORACLE_VALIDATOR_ADDRESS)
} }
const nonce = await redis.get(nonceKey) const nonce = await redis.get(nonceKey)
@ -80,7 +80,7 @@ async function readNonce(forceUpdate) {
return Number(nonce) return Number(nonce)
} else { } else {
logger.debug("Nonce wasn't found in the DB") logger.debug("Nonce wasn't found in the DB")
return getNonce(web3Instance, VALIDATOR_ADDRESS) return getNonce(web3Instance, ORACLE_VALIDATOR_ADDRESS)
} }
} }
@ -117,7 +117,7 @@ async function main({ msg, ackMsg, nackMsg, channel, scheduleForRetry }) {
gasPrice: gasPrice.toString(10), gasPrice: gasPrice.toString(10),
amount: '0', amount: '0',
gasLimit, gasLimit,
privateKey: VALIDATOR_ADDRESS_PRIVATE_KEY, privateKey: ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY,
to: job.to, to: job.to,
chainId, chainId,
web3: web3Instance web3: web3Instance
@ -140,7 +140,7 @@ async function main({ msg, ackMsg, nackMsg, channel, scheduleForRetry }) {
if (e.message.includes('Insufficient funds')) { if (e.message.includes('Insufficient funds')) {
insufficientFunds = true insufficientFunds = true
const currentBalance = await web3Instance.eth.getBalance(VALIDATOR_ADDRESS) const currentBalance = await web3Instance.eth.getBalance(ORACLE_VALIDATOR_ADDRESS)
minimumBalance = gasLimit.multipliedBy(gasPrice) minimumBalance = gasLimit.multipliedBy(gasPrice)
logger.error( logger.error(
`Insufficient funds: ${currentBalance}. Stop processing messages until the balance is at least ${minimumBalance}.` `Insufficient funds: ${currentBalance}. Stop processing messages until the balance is at least ${minimumBalance}.`
@ -164,7 +164,7 @@ async function main({ msg, ackMsg, nackMsg, channel, scheduleForRetry }) {
if (insufficientFunds) { if (insufficientFunds) {
logger.warn('Insufficient funds. Stop sending transactions until the account has the minimum balance') logger.warn('Insufficient funds. Stop sending transactions until the account has the minimum balance')
channel.close() channel.close()
waitForFunds(web3Instance, VALIDATOR_ADDRESS, minimumBalance, resume, logger) waitForFunds(web3Instance, ORACLE_VALIDATOR_ADDRESS, minimumBalance, resume, logger)
} }
} catch (e) { } catch (e) {
logger.error(e) logger.error(e)

@ -1,5 +1,5 @@
require('../../env') require('../../env')
const connection = require('amqp-connection-manager').connect(process.env.QUEUE_URL) const connection = require('amqp-connection-manager').connect(process.env.ORACLE_QUEUE_URL)
const logger = require('./logger') const logger = require('./logger')
const { getRetrySequence } = require('../utils/utils') const { getRetrySequence } = require('../utils/utils')

@ -13,23 +13,23 @@ const HomeABI = bridgeConfig.homeBridgeAbi
const ForeignABI = bridgeConfig.foreignBridgeAbi const ForeignABI = bridgeConfig.foreignBridgeAbi
const { const {
FOREIGN_BRIDGE_ADDRESS, COMMON_FOREIGN_BRIDGE_ADDRESS,
FOREIGN_GAS_PRICE_FALLBACK, COMMON_FOREIGN_GAS_PRICE_FALLBACK,
FOREIGN_GAS_PRICE_ORACLE_URL, COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL,
FOREIGN_GAS_PRICE_SPEED_TYPE, COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE,
FOREIGN_GAS_PRICE_UPDATE_INTERVAL, ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL,
FOREIGN_GAS_PRICE_FACTOR, COMMON_FOREIGN_GAS_PRICE_FACTOR,
HOME_BRIDGE_ADDRESS, COMMON_HOME_BRIDGE_ADDRESS,
HOME_GAS_PRICE_FALLBACK, COMMON_HOME_GAS_PRICE_FALLBACK,
HOME_GAS_PRICE_ORACLE_URL, COMMON_HOME_GAS_PRICE_SUPPLIER_URL,
HOME_GAS_PRICE_SPEED_TYPE, COMMON_HOME_GAS_PRICE_SPEED_TYPE,
HOME_GAS_PRICE_UPDATE_INTERVAL, ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL,
HOME_GAS_PRICE_FACTOR COMMON_HOME_GAS_PRICE_FACTOR
} = process.env } = process.env
const homeBridge = new web3Home.eth.Contract(HomeABI, HOME_BRIDGE_ADDRESS) const homeBridge = new web3Home.eth.Contract(HomeABI, COMMON_HOME_BRIDGE_ADDRESS)
const foreignBridge = new web3Foreign.eth.Contract(ForeignABI, FOREIGN_BRIDGE_ADDRESS) const foreignBridge = new web3Foreign.eth.Contract(ForeignABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
let cachedGasPrice = null let cachedGasPrice = null
@ -55,20 +55,20 @@ async function start(chainId) {
let factor = null let factor = null
if (chainId === 'home') { if (chainId === 'home') {
bridgeContract = homeBridge bridgeContract = homeBridge
oracleUrl = HOME_GAS_PRICE_ORACLE_URL oracleUrl = COMMON_HOME_GAS_PRICE_SUPPLIER_URL
speedType = HOME_GAS_PRICE_SPEED_TYPE speedType = COMMON_HOME_GAS_PRICE_SPEED_TYPE
updateInterval = HOME_GAS_PRICE_UPDATE_INTERVAL || DEFAULT_UPDATE_INTERVAL updateInterval = ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL || DEFAULT_UPDATE_INTERVAL
factor = Number(HOME_GAS_PRICE_FACTOR) || DEFAULT_GAS_PRICE_FACTOR factor = Number(COMMON_HOME_GAS_PRICE_FACTOR) || DEFAULT_GAS_PRICE_FACTOR
cachedGasPrice = HOME_GAS_PRICE_FALLBACK cachedGasPrice = COMMON_HOME_GAS_PRICE_FALLBACK
} else if (chainId === 'foreign') { } else if (chainId === 'foreign') {
bridgeContract = foreignBridge bridgeContract = foreignBridge
oracleUrl = FOREIGN_GAS_PRICE_ORACLE_URL oracleUrl = COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL
speedType = FOREIGN_GAS_PRICE_SPEED_TYPE speedType = COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE
updateInterval = FOREIGN_GAS_PRICE_UPDATE_INTERVAL || DEFAULT_UPDATE_INTERVAL updateInterval = ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL || DEFAULT_UPDATE_INTERVAL
factor = Number(FOREIGN_GAS_PRICE_FACTOR) || DEFAULT_GAS_PRICE_FACTOR factor = Number(COMMON_FOREIGN_GAS_PRICE_FACTOR) || DEFAULT_GAS_PRICE_FACTOR
cachedGasPrice = FOREIGN_GAS_PRICE_FALLBACK cachedGasPrice = COMMON_FOREIGN_GAS_PRICE_FALLBACK
} else { } else {
throw new Error(`Unrecognized chainId '${chainId}'`) throw new Error(`Unrecognized chainId '${chainId}'`)
} }

@ -1,3 +1,3 @@
const RpcUrlsManager = require('./RpcUrlsManager') const RpcUrlsManager = require('./RpcUrlsManager')
module.exports = new RpcUrlsManager(process.env.HOME_RPC_URL, process.env.FOREIGN_RPC_URL) module.exports = new RpcUrlsManager(process.env.COMMON_HOME_RPC_URL, process.env.COMMON_FOREIGN_RPC_URL)

@ -6,11 +6,11 @@ const config = process.env.NODE_ENV !== 'test' ? require(path.join('../../config
const logger = pino({ const logger = pino({
enabled: process.env.NODE_ENV !== 'test', enabled: process.env.NODE_ENV !== 'test',
name: config.name, name: config.name,
level: process.env.LOG_LEVEL || 'debug', level: process.env.ORACLE_LOG_LEVEL || 'debug',
base: base:
process.env.NODE_ENV === 'production' process.env.NODE_ENV === 'production'
? { ? {
validator: process.env.VALIDATOR_ADDRESS validator: process.env.ORACLE_VALIDATOR_ADDRESS
} }
: {} : {}
}) })

@ -1,7 +1,7 @@
const Redis = require('ioredis') const Redis = require('ioredis')
const logger = require('./logger') const logger = require('./logger')
const redis = new Redis(process.env.REDIS_URL) const redis = new Redis(process.env.ORACLE_REDIS_URL)
redis.on('connect', () => { redis.on('connect', () => {
logger.info('Connected to redis') logger.info('Connected to redis')

@ -14,11 +14,11 @@ async function syncForEach(array, callback) {
} }
} }
function checkHTTPS(ALLOW_HTTP, logger) { function checkHTTPS(ORACLE_ALLOW_HTTP_FOR_RPC, logger) {
return function(network) { return function(network) {
return function(url) { return function(url) {
if (!/^https.*/.test(url)) { if (!/^https.*/.test(url)) {
if (ALLOW_HTTP !== 'yes') { if (ORACLE_ALLOW_HTTP_FOR_RPC !== 'yes') {
throw new Error(`http is not allowed: ${url}`) throw new Error(`http is not allowed: ${url}`)
} else { } else {
logger.warn(`You are using http (${url}) on ${network} network. In production https must be used instead.`) logger.warn(`You are using http (${url}) on ${network} network. In production https must be used instead.`)

@ -33,7 +33,7 @@ let lastProcessedBlock = BN.max(config.startBlock.sub(ONE), ZERO)
async function initialize() { async function initialize() {
try { try {
const checkHttps = checkHTTPS(process.env.ALLOW_HTTP, logger) const checkHttps = checkHTTPS(process.env.ORACLE_ALLOW_HTTP_FOR_RPC, logger)
rpcUrlsManager.homeUrls.forEach(checkHttps('home')) rpcUrlsManager.homeUrls.forEach(checkHttps('home'))
rpcUrlsManager.foreignUrls.forEach(checkHttps('foreign')) rpcUrlsManager.foreignUrls.forEach(checkHttps('foreign'))

@ -9,54 +9,56 @@ describe('gasPrice', () => {
beforeEach(() => { beforeEach(() => {
utils.setIntervalAndRun.resetHistory() utils.setIntervalAndRun.resetHistory()
}) })
it('should call setIntervalAndRun with HOME_GAS_PRICE_UPDATE_INTERVAL interval value on Home', async () => { it('should call setIntervalAndRun with ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL interval value on Home', async () => {
// given // given
process.env.HOME_GAS_PRICE_UPDATE_INTERVAL = 15000 process.env.ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL = 15000
const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils }) const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils })
// when // when
await gasPrice.start('home') await gasPrice.start('home')
// then // then
expect(process.env.HOME_GAS_PRICE_UPDATE_INTERVAL).to.equal('15000') expect(process.env.ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL).to.equal('15000')
expect(process.env.HOME_GAS_PRICE_UPDATE_INTERVAL).to.not.equal(DEFAULT_UPDATE_INTERVAL.toString()) expect(process.env.ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL).to.not.equal(DEFAULT_UPDATE_INTERVAL.toString())
expect(utils.setIntervalAndRun.args[0][1]).to.equal(process.env.HOME_GAS_PRICE_UPDATE_INTERVAL.toString()) expect(utils.setIntervalAndRun.args[0][1]).to.equal(process.env.ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL.toString())
}) })
it('should call setIntervalAndRun with FOREIGN_GAS_PRICE_UPDATE_INTERVAL interval value on Foreign', async () => { it('should call setIntervalAndRun with ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL interval value on Foreign', async () => {
// given // given
process.env.FOREIGN_GAS_PRICE_UPDATE_INTERVAL = 15000 process.env.ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL = 15000
const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils }) const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils })
// when // when
await gasPrice.start('foreign') await gasPrice.start('foreign')
// then // then
expect(process.env.FOREIGN_GAS_PRICE_UPDATE_INTERVAL).to.equal('15000') expect(process.env.ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL).to.equal('15000')
expect(process.env.HOME_GAS_PRICE_UPDATE_INTERVAL).to.not.equal(DEFAULT_UPDATE_INTERVAL.toString()) expect(process.env.ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL).to.not.equal(DEFAULT_UPDATE_INTERVAL.toString())
expect(utils.setIntervalAndRun.args[0][1]).to.equal(process.env.FOREIGN_GAS_PRICE_UPDATE_INTERVAL.toString()) expect(utils.setIntervalAndRun.args[0][1]).to.equal(
process.env.ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL.toString()
)
}) })
it('should call setIntervalAndRun with default interval value on Home', async () => { it('should call setIntervalAndRun with default interval value on Home', async () => {
// given // given
delete process.env.HOME_GAS_PRICE_UPDATE_INTERVAL delete process.env.ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL
const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils }) const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils })
// when // when
await gasPrice.start('home') await gasPrice.start('home')
// then // then
expect(process.env.HOME_GAS_PRICE_UPDATE_INTERVAL).to.equal(undefined) expect(process.env.ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL).to.equal(undefined)
expect(utils.setIntervalAndRun.args[0][1]).to.equal(DEFAULT_UPDATE_INTERVAL) expect(utils.setIntervalAndRun.args[0][1]).to.equal(DEFAULT_UPDATE_INTERVAL)
}) })
it('should call setIntervalAndRun with default interval value on Foreign', async () => { it('should call setIntervalAndRun with default interval value on Foreign', async () => {
// given // given
delete process.env.FOREIGN_GAS_PRICE_UPDATE_INTERVAL delete process.env.ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL
const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils }) const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils })
// when // when
await gasPrice.start('foreign') await gasPrice.start('foreign')
// then // then
expect(process.env.FOREIGN_GAS_PRICE_UPDATE_INTERVAL).to.equal(undefined) expect(process.env.ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL).to.equal(undefined)
expect(utils.setIntervalAndRun.args[0][1]).to.equal(DEFAULT_UPDATE_INTERVAL) expect(utils.setIntervalAndRun.args[0][1]).to.equal(DEFAULT_UPDATE_INTERVAL)
}) })
}) })
@ -66,7 +68,7 @@ describe('gasPrice', () => {
it('should fall back to default if contract and oracle/supplier are not working', async () => { it('should fall back to default if contract and oracle/supplier are not working', async () => {
// given // given
process.env.HOME_GAS_PRICE_FALLBACK = '101000000000' process.env.COMMON_HOME_GAS_PRICE_FALLBACK = '101000000000'
const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils }) const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils })
await gasPrice.start('home') await gasPrice.start('home')
@ -79,7 +81,7 @@ describe('gasPrice', () => {
it('should fetch gas from oracle/supplier', async () => { it('should fetch gas from oracle/supplier', async () => {
// given // given
process.env.HOME_GAS_PRICE_FALLBACK = '101000000000' process.env.COMMON_HOME_GAS_PRICE_FALLBACK = '101000000000'
const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils }) const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils })
await gasPrice.start('home') await gasPrice.start('home')
@ -98,7 +100,7 @@ describe('gasPrice', () => {
it('should fetch gas from contract', async () => { it('should fetch gas from contract', async () => {
// given // given
process.env.HOME_GAS_PRICE_FALLBACK = '101000000000' process.env.COMMON_HOME_GAS_PRICE_FALLBACK = '101000000000'
const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils }) const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils })
await gasPrice.start('home') await gasPrice.start('home')
@ -119,7 +121,7 @@ describe('gasPrice', () => {
it('should fetch the gas price from the oracle first', async () => { it('should fetch the gas price from the oracle first', async () => {
// given // given
process.env.HOME_GAS_PRICE_FALLBACK = '101000000000' process.env.COMMON_HOME_GAS_PRICE_FALLBACK = '101000000000'
const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils }) const gasPrice = proxyquire('../src/services/gasPrice', { '../utils/utils': utils })
await gasPrice.start('home') await gasPrice.start('home')

@ -1,3 +1,3 @@
HOME_RPC_URL=http://example.com COMMON_HOME_RPC_URL=http://example.com
FOREIGN_RPC_URL=http://example.com COMMON_FOREIGN_RPC_URL=http://example.com
QUEUE_URL=http://example.com ORACLE_QUEUE_URL=http://example.com

@ -1,42 +1,42 @@
REACT_APP_HOME_BRIDGE_ADDRESS=0xABb4C1399DcC28FBa3Beb76CAE2b50Be3e087353 COMMON_HOME_BRIDGE_ADDRESS=0xABb4C1399DcC28FBa3Beb76CAE2b50Be3e087353
REACT_APP_FOREIGN_BRIDGE_ADDRESS=0xE405F6872cE38a7a4Ff63DcF946236D458c2ca3a COMMON_FOREIGN_BRIDGE_ADDRESS=0xE405F6872cE38a7a4Ff63DcF946236D458c2ca3a
REACT_APP_HOME_HTTP_PARITY_URL=https://sokol.poa.network COMMON_HOME_RPC_URL=https://sokol.poa.network
REACT_APP_FOREIGN_HTTP_PARITY_URL=https://kovan.infura.io/mew COMMON_FOREIGN_RPC_URL=https://kovan.infura.io/mew
REACT_APP_HOME_NATIVE_NAME=POA UI_NATIVE_TOKEN_DISPLAY_NAME=POA
REACT_APP_HOME_NETWORK_NAME=POA Sokol UI_HOME_NETWORK_DISPLAY_NAME=POA Sokol
REACT_APP_FOREIGN_NETWORK_NAME=Kovan UI_FOREIGN_NETWORK_DISPLAY_NAME=Kovan
# Set to true if network doesn't support events # Set to true if network doesn't support events
REACT_APP_HOME_WITHOUT_EVENTS=false UI_HOME_WITHOUT_EVENTS=false
REACT_APP_FOREIGN_WITHOUT_EVENTS=false UI_FOREIGN_WITHOUT_EVENTS=false
REACT_APP_HOME_EXPLORER_TX_TEMPLATE=https://blockscout.com/poa/sokol/tx/%s UI_HOME_EXPLORER_TX_TEMPLATE=https://blockscout.com/poa/sokol/tx/%s
REACT_APP_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s UI_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s
REACT_APP_HOME_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/poa/sokol/address/%s UI_HOME_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/poa/sokol/address/%s
REACT_APP_FOREIGN_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/eth/kovan/address/%s UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE=https://blockscout.com/eth/kovan/address/%s
REACT_APP_HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ COMMON_HOME_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
REACT_APP_HOME_GAS_PRICE_SPEED_TYPE=standard COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
REACT_APP_HOME_GAS_PRICE_FALLBACK=5000000000 COMMON_HOME_GAS_PRICE_FALLBACK=5000000000
REACT_APP_HOME_GAS_PRICE_UPDATE_INTERVAL=15000 UI_HOME_GAS_PRICE_UPDATE_INTERVAL=15000
REACT_APP_HOME_GAS_PRICE_FACTOR=1 COMMON_HOME_GAS_PRICE_FACTOR=1
REACT_APP_FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE=standard COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
REACT_APP_FOREIGN_GAS_PRICE_FALLBACK=5000000000 COMMON_FOREIGN_GAS_PRICE_FALLBACK=5000000000
REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000 UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
REACT_APP_FOREIGN_GAS_PRICE_FACTOR=1 COMMON_FOREIGN_GAS_PRICE_FACTOR=1
# Default # Default
REACT_APP_TITLE=TokenBridge UI app - %c UI_TITLE=TokenBridge UI app - %c
REACT_APP_DESCRIPTION=The POA cross-chain bridge serves as a method of transferring POA native tokens from the POA Network to the Ethereum network in a quick and cost-efficient manner. UI_DESCRIPTION=The POA cross-chain bridge serves as a method of transferring POA native tokens from the POA Network to the Ethereum network in a quick and cost-efficient manner.
PORT=3000 UI_PORT=3000
# RSK # RSK
#REACT_APP_DESCRIPTION=The TokenBridge serves as a method of transferring Bancor Network tokens between the Ethereum network and the Rootstock network in a quick and cost-efficient manner. #UI_DESCRIPTION=The TokenBridge serves as a method of transferring Bancor Network tokens between the Ethereum network and the Rootstock network in a quick and cost-efficient manner.
# To use Ethereum-classic styles # To use Ethereum-classic styles
#APP_STYLES=classic #UI_STYLES=classic

@ -16,6 +16,9 @@ RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./b
COPY ./commons ./commons COPY ./commons ./commons
COPY ./ui ./ui COPY ./ui ./ui
ARG DOT_ENV_PATH=./ui/.env
COPY ${DOT_ENV_PATH} ./ui/.env
WORKDIR /mono/ui WORKDIR /mono/ui
CMD echo "To start a UI application run:" \ CMD echo "To start a UI application run:" \
"yarn start" "yarn start"

@ -130,13 +130,13 @@ cat ../poa-bridge-contracts/deploy/bridgeDeploymentResults.json
```bash ```bash
# HomeBridge address in bridgeDeploymentResults.json # HomeBridge address in bridgeDeploymentResults.json
REACT_APP_HOME_BRIDGE_ADDRESS=0x.. COMMON_HOME_BRIDGE_ADDRESS=0x..
# ForeignBridge address in bridgeDeploymentResults.json # ForeignBridge address in bridgeDeploymentResults.json
REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x.. COMMON_FOREIGN_BRIDGE_ADDRESS=0x..
# https public RPC node for Foreign network # https public RPC node for Foreign network
REACT_APP_FOREIGN_HTTP_PARITY_URL=https://kovan.infura.io/mew COMMON_FOREIGN_RPC_URL=https://kovan.infura.io/mew
# public RPC node for Home network # public RPC node for Home network
REACT_APP_HOME_HTTP_PARITY_URL=https://sokol.poa.network COMMON_HOME_RPC_URL=https://sokol.poa.network
``` ```
* Run the dApp * Run the dApp
@ -158,35 +158,7 @@ The application will run on `http://localhost:PORT`, where `PORT` is specified i
### Env Parameter Details ### Env Parameter Details
Name | Description Please refer to [Configuration](../CONFIGURATION.md).
--------- | -------
REACT_APP_HOME_BRIDGE_ADDRESS | address that you have deployed at step#3. Should also be recorded at `sokol-kovan-bridge/poa-bridge-contracts/deploy/bridgeDeploymentResults.json`
REACT_APP_FOREIGN_BRIDGE_ADDRESS | address that you have deployed at step#3.
REACT_APP_FOREIGN_HTTP_PARITY_URL | http public rpc node for Foreign Network
REACT_APP_HOME_HTTP_PARITY_URL | http public rpc node for Foreign Network
REACT_APP_HOME_NATIVE_NAME | name of the home native coin
REACT_APP_HOME_NETWORK_NAME | name to be displayed for home network
REACT_APP_FOREIGN_NETWORK_NAME | name to be displayed for foreign network
REACT_APP_HOME_WITHOUT_EVENTS | `true` if home network doesn't support events
REACT_APP_FOREIGN_WITHOUT_EVENTS | `true` if foreign network doesn't support events
REACT_APP_HOME_EXPLORER_TX_TEMPLATE | template link to transaction on home explorer. `%s` will be replaced by transaction hash
REACT_APP_FOREIGN_EXPLORER_TX_TEMPLATE | template link to transaction on foreign explorer. `%s` will be replaced by transaction hash
REACT_APP_HOME_EXPLORER_ADDRESS_TEMPLATE | template link to address on home explorer. `%s` will be replaced by address
REACT_APP_FOREIGN_EXPLORER_ADDRESS_TEMPLATE | template link to address on foreign explorer. `%s` will be replaced by address
REACT_APP_HOME_GAS_PRICE_ORACLE_URL | The URL used to get a JSON response from the gas price prediction oracle for Home network.
REACT_APP_HOME_GAS_PRICE_SPEED_TYPE | Gas Price speed (slow, standard, fast, instant)
REACT_APP_HOME_GAS_PRICE_FALLBACK | The gas price (in Wei) that is used if both the oracle and the fall back gas price specified in the Home Bridge contract are not available.
REACT_APP_HOME_GAS_PRICE_UPDATE_INTERVAL | An interval in milliseconds used to get the updated gas price value either from the oracle or from the Home Bridge contract.
REACT_APP_HOME_GAS_PRICE_FACTOR | A value that will multiply the gas price of the oracle to convert it to gwei. If the oracle API returns gas prices in gwei then this can be set to `1`. Also, it could be used to intentionally pay more gas than suggested by the oracle to guarantee the transaction verification. E.g. `1.25` or `1.5`.
REACT_APP_FOREIGN_GAS_PRICE_ORACLE_URL | The URL used to get a JSON response from the gas price prediction oracle for Foreign network.
REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE | Gas Price speed (slow, standard, fast, instant)
REACT_APP_FOREIGN_GAS_PRICE_FALLBACK | The gas price (in Wei) that is used if both the oracle and the fall back gas price specified in the Foreign Bridge contract are not available.
REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL | An interval in milliseconds used to get the updated gas price value either from the oracle or from the Foreign Bridge contract.
REACT_APP_FOREIGN_GAS_PRICE_FACTOR | A value that will multiply the gas price of the oracle to convert it to gwei. If the oracle API returns gas prices in gwei then this can be set to `1`. Also, it could be used to intentionally pay more gas than suggested by the oracle to guarantee the transaction verification. E.g. `1.25` or `1.5`.
REACT_APP_TITLE | The title for the bridge UI page. `%c` will be replaced by the name of the network.
REACT_APP_DESCRIPTION | The meta description for the deployed bridge page.
APP_STYLES | The set of styles to render the bridge UI page. Currently only `classic` is implemented
## Testing ## Testing

@ -6,7 +6,7 @@ services:
context: .. context: ..
dockerfile: ui/Dockerfile dockerfile: ui/Dockerfile
ports: ports:
- "${PORT}:${PORT}" - "${UI_PORT}:${UI_PORT}"
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production

16
ui/load-env.sh Executable file

@ -0,0 +1,16 @@
#!/bin/bash
while read line; do
if [ "$line" = "" ]; then
: # Skip empty lines
elif [[ "$line" =~ \#.* ]]; then
: # Skip comment lines
elif [[ "$line" =~ "UI_PORT"* ]]; then
eval $line
export PORT="$UI_PORT"
else
export "REACT_APP_$line"
fi
done < '.env'
$*

@ -31,8 +31,8 @@
"select-css-theme": "node scripts/selectTheme.js", "select-css-theme": "node scripts/selectTheme.js",
"build-css": "node-sass-chokidar src/assets/stylesheets -o src/assets/stylesheets --output-style=compressed -m application*.css", "build-css": "node-sass-chokidar src/assets/stylesheets -o src/assets/stylesheets --output-style=compressed -m application*.css",
"watch-css": "nodemon -e scss -x \"yarn build-css\"", "watch-css": "nodemon -e scss -x \"yarn build-css\"",
"start": "yarn build-css && yarn select-css-theme && react-app-rewired start", "start": "yarn build-css && yarn select-css-theme && ./load-env.sh react-app-rewired start",
"build": "yarn build-css && yarn select-css-theme && react-app-rewired build", "build": "yarn build-css && yarn select-css-theme && ./load-env.sh react-app-rewired build",
"test": "react-app-rewired test --env=jsdom --no-watch", "test": "react-app-rewired test --env=jsdom --no-watch",
"test:watch": "react-app-rewired test --env=jsdom", "test:watch": "react-app-rewired test --env=jsdom",
"coverage": "react-app-rewired test --env=jsdom --coverage", "coverage": "react-app-rewired test --env=jsdom --coverage",

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000"> <meta name="theme-color" content="#000000">
<meta property="og:title" content="POA Bridge UI" /> <meta property="og:title" content="POA Bridge UI" />
<meta property="og:description" content="%REACT_APP_DESCRIPTION%" /> <meta property="og:description" content="%REACT_APP_UI_DESCRIPTION%" />
<meta property="og:url" content="https://poanetwork.github.io/bridge-ui" /> <meta property="og:url" content="https://poanetwork.github.io/bridge-ui" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:image" content="/images/bridgeogimage.jpg"> <meta property="og:image" content="/images/bridgeogimage.jpg">

@ -8,7 +8,7 @@ const stylePath = path.resolve(__dirname, '..', 'src', 'assets', 'stylesheets')
const destinationFilename = 'application.css' const destinationFilename = 'application.css'
let filename let filename
if (process.env.APP_STYLES === 'classic') { if (process.env.UI_STYLES === 'classic') {
filename = 'application.classic.css' filename = 'application.classic.css'
} else { } else {
filename = 'application.core.css' filename = 'application.core.css'

@ -100,7 +100,7 @@ export class Bridge extends React.Component {
alertStore.setLoading(true) alertStore.setLoading(true)
if (isErcToErcMode) { if (isErcToErcMode) {
return txStore.erc677transferAndCall({ return txStore.erc677transferAndCall({
to: homeStore.HOME_BRIDGE_ADDRESS, to: homeStore.COMMON_HOME_BRIDGE_ADDRESS,
from: web3Store.defaultAccount.address, from: web3Store.defaultAccount.address,
value: toDecimals(amount, homeStore.tokenDecimals), value: toDecimals(amount, homeStore.tokenDecimals),
contract: homeStore.tokenContract, contract: homeStore.tokenContract,
@ -109,7 +109,7 @@ export class Bridge extends React.Component {
} else { } else {
const value = toHex(toDecimals(amount, homeStore.tokenDecimals)) const value = toHex(toDecimals(amount, homeStore.tokenDecimals))
return txStore.doSend({ return txStore.doSend({
to: homeStore.HOME_BRIDGE_ADDRESS, to: homeStore.COMMON_HOME_BRIDGE_ADDRESS,
from: web3Store.defaultAccount.address, from: web3Store.defaultAccount.address,
value, value,
data: '0x', data: '0x',
@ -161,13 +161,13 @@ export class Bridge extends React.Component {
alertStore.setLoading(true) alertStore.setLoading(true)
if (isExternalErc20) { if (isExternalErc20) {
return await txStore.erc20transfer({ return await txStore.erc20transfer({
to: foreignStore.FOREIGN_BRIDGE_ADDRESS, to: foreignStore.COMMON_FOREIGN_BRIDGE_ADDRESS,
from: web3Store.defaultAccount.address, from: web3Store.defaultAccount.address,
value: toDecimals(amount, foreignStore.tokenDecimals) value: toDecimals(amount, foreignStore.tokenDecimals)
}) })
} else { } else {
return await txStore.erc677transferAndCall({ return await txStore.erc677transferAndCall({
to: foreignStore.FOREIGN_BRIDGE_ADDRESS, to: foreignStore.COMMON_FOREIGN_BRIDGE_ADDRESS,
from: web3Store.defaultAccount.address, from: web3Store.defaultAccount.address,
value: toHex(toDecimals(amount, foreignStore.tokenDecimals)), value: toHex(toDecimals(amount, foreignStore.tokenDecimals)),
contract: foreignStore.tokenContract, contract: foreignStore.tokenContract,
@ -265,9 +265,9 @@ export class Bridge extends React.Component {
const modalData = { const modalData = {
isHome: true, isHome: true,
networkData: web3Store.homeNet, networkData: web3Store.homeNet,
url: web3Store.HOME_HTTP_PARITY_URL, url: web3Store.COMMON_HOME_RPC_URL,
logo: homeLogoPurple, logo: homeLogoPurple,
address: homeStore.HOME_BRIDGE_ADDRESS, address: homeStore.COMMON_HOME_BRIDGE_ADDRESS,
currency: homeStore.symbol, currency: homeStore.symbol,
maxCurrentLimit: homeStore.maxCurrentDeposit, maxCurrentLimit: homeStore.maxCurrentDeposit,
maxPerTx: homeStore.maxPerTx, maxPerTx: homeStore.maxPerTx,
@ -288,7 +288,7 @@ export class Bridge extends React.Component {
loadForeignDetails = () => { loadForeignDetails = () => {
const { web3Store, foreignStore } = this.props.RootStore const { web3Store, foreignStore } = this.props.RootStore
const isExternalErc20 = foreignStore.tokenType === ERC_TYPES.ERC20 const isExternalErc20 = foreignStore.tokenType === ERC_TYPES.ERC20
const foreignURL = new URL(web3Store.FOREIGN_HTTP_PARITY_URL) const foreignURL = new URL(web3Store.COMMON_FOREIGN_RPC_URL)
const foreignDisplayUrl = `${foreignURL.protocol}//${foreignURL.hostname}` const foreignDisplayUrl = `${foreignURL.protocol}//${foreignURL.hostname}`
const modalData = { const modalData = {
@ -296,7 +296,7 @@ export class Bridge extends React.Component {
networkData: web3Store.foreignNet, networkData: web3Store.foreignNet,
url: foreignDisplayUrl, url: foreignDisplayUrl,
logo: foreignLogoPurple, logo: foreignLogoPurple,
address: foreignStore.FOREIGN_BRIDGE_ADDRESS, address: foreignStore.COMMON_FOREIGN_BRIDGE_ADDRESS,
currency: foreignStore.symbol, currency: foreignStore.symbol,
maxCurrentLimit: foreignStore.maxCurrentDeposit, maxCurrentLimit: foreignStore.maxCurrentDeposit,
maxPerTx: foreignStore.maxPerTx, maxPerTx: foreignStore.maxPerTx,

@ -16,7 +16,7 @@ export class Header extends React.Component {
onMenuToggle, onMenuToggle,
RootStore: { alertStore, web3Store } RootStore: { alertStore, web3Store }
} = this.props } = this.props
const { REACT_APP_HOME_WITHOUT_EVENTS: HOME, REACT_APP_FOREIGN_WITHOUT_EVENTS: FOREIGN } = process.env const { REACT_APP_UI_HOME_WITHOUT_EVENTS: HOME, REACT_APP_UI_FOREIGN_WITHOUT_EVENTS: FOREIGN } = process.env
const withoutEvents = web3Store.metamaskNet.id === web3Store.homeNet.id.toString() ? yn(HOME) : yn(FOREIGN) const withoutEvents = web3Store.metamaskNet.id === web3Store.homeNet.id.toString() ? yn(HOME) : yn(FOREIGN)
return ( return (

@ -139,7 +139,7 @@ export class RelayEvents extends React.Component {
const { selectedList } = this.state const { selectedList } = this.state
const home = this.getHomeEvents(homeStore, foreignStore) const home = this.getHomeEvents(homeStore, foreignStore)
const foreign = this.getForeignEvents(foreignStore, homeStore) const foreign = this.getForeignEvents(foreignStore, homeStore)
const { REACT_APP_HOME_WITHOUT_EVENTS: HOME, REACT_APP_FOREIGN_WITHOUT_EVENTS: FOREIGN } = process.env const { REACT_APP_UI_HOME_WITHOUT_EVENTS: HOME, REACT_APP_UI_FOREIGN_WITHOUT_EVENTS: FOREIGN } = process.env
const withoutEvents = web3Store.metamaskNet.id === web3Store.homeNet.id.toString() ? yn(HOME) : yn(FOREIGN) const withoutEvents = web3Store.metamaskNet.id === web3Store.homeNet.id.toString() ? yn(HOME) : yn(FOREIGN)
return withoutEvents ? ( return withoutEvents ? (

@ -15,7 +15,7 @@ export class StatisticsPage extends React.Component {
const isNativeToErc = bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC const isNativeToErc = bridgeMode === BRIDGE_MODES.NATIVE_TO_ERC
const leftTitle = isNativeToErc ? 'Deposits' : 'Withdraws' const leftTitle = isNativeToErc ? 'Deposits' : 'Withdraws'
const rightTitle = isNativeToErc ? 'Withdraws' : 'Deposits' const rightTitle = isNativeToErc ? 'Withdraws' : 'Deposits'
const { REACT_APP_HOME_WITHOUT_EVENTS: HOME, REACT_APP_FOREIGN_WITHOUT_EVENTS: FOREIGN } = process.env const { REACT_APP_UI_HOME_WITHOUT_EVENTS: HOME, REACT_APP_UI_FOREIGN_WITHOUT_EVENTS: FOREIGN } = process.env
const withoutEvents = web3Store.metamaskNet.id === web3Store.homeNet.id.toString() ? yn(HOME) : yn(FOREIGN) const withoutEvents = web3Store.metamaskNet.id === web3Store.homeNet.id.toString() ? yn(HOME) : yn(FOREIGN)
return withoutEvents ? ( return withoutEvents ? (

@ -16,7 +16,7 @@ export class StatusPage extends React.Component {
const maxSingleDeposit = isHome ? homeStore.maxPerTx : foreignStore.maxPerTx const maxSingleDeposit = isHome ? homeStore.maxPerTx : foreignStore.maxPerTx
const maxTotalBalance = isHome ? homeStore.maxCurrentDeposit : foreignStore.maxCurrentDeposit const maxTotalBalance = isHome ? homeStore.maxCurrentDeposit : foreignStore.maxCurrentDeposit
const validatorsList = isHome ? homeStore.validators : foreignStore.validators const validatorsList = isHome ? homeStore.validators : foreignStore.validators
const { REACT_APP_HOME_WITHOUT_EVENTS: HOME, REACT_APP_FOREIGN_WITHOUT_EVENTS: FOREIGN } = process.env const { REACT_APP_UI_HOME_WITHOUT_EVENTS: HOME, REACT_APP_UI_FOREIGN_WITHOUT_EVENTS: FOREIGN } = process.env
const withoutEvents = web3Store.metamaskNet.id === web3Store.homeNet.id.toString() ? yn(HOME) : yn(FOREIGN) const withoutEvents = web3Store.metamaskNet.id === web3Store.homeNet.id.toString() ? yn(HOME) : yn(FOREIGN)
return ( return (

@ -107,14 +107,14 @@ class ForeignStore {
totalFeeDistributedFromSignatures: BN(0), totalFeeDistributedFromSignatures: BN(0),
totalFeeDistributedFromAffirmation: BN(0) totalFeeDistributedFromAffirmation: BN(0)
} }
networkName = process.env.REACT_APP_FOREIGN_NETWORK_NAME || 'Unknown' networkName = process.env.REACT_APP_UI_FOREIGN_NETWORK_DISPLAY_NAME || 'Unknown'
filteredBlockNumber = 0 filteredBlockNumber = 0
foreignBridge = {} foreignBridge = {}
tokenContract = {} tokenContract = {}
tokenDecimals = 18 tokenDecimals = 18
FOREIGN_BRIDGE_ADDRESS = process.env.REACT_APP_FOREIGN_BRIDGE_ADDRESS COMMON_FOREIGN_BRIDGE_ADDRESS = process.env.REACT_APP_COMMON_FOREIGN_BRIDGE_ADDRESS
explorerTxTemplate = process.env.REACT_APP_FOREIGN_EXPLORER_TX_TEMPLATE || '' explorerTxTemplate = process.env.REACT_APP_UI_FOREIGN_EXPLORER_TX_TEMPLATE || ''
explorerAddressTemplate = process.env.REACT_APP_FOREIGN_EXPLORER_ADDRESS_TEMPLATE || '' explorerAddressTemplate = process.env.REACT_APP_UI_FOREIGN_EXPLORER_ADDRESS_TEMPLATE || ''
constructor(rootStore) { constructor(rootStore) {
this.web3Store = rootStore.web3Store this.web3Store = rootStore.web3Store
@ -132,7 +132,7 @@ class ForeignStore {
return return
} }
const { FOREIGN_ABI } = getBridgeABIs(this.rootStore.bridgeMode) const { FOREIGN_ABI } = getBridgeABIs(this.rootStore.bridgeMode)
this.foreignBridge = new this.foreignWeb3.eth.Contract(FOREIGN_ABI, this.FOREIGN_BRIDGE_ADDRESS) this.foreignBridge = new this.foreignWeb3.eth.Contract(FOREIGN_ABI, this.COMMON_FOREIGN_BRIDGE_ADDRESS)
await this.getBlockNumber() await this.getBlockNumber()
await this.getTokenInfo() await this.getTokenInfo()
this.getMinPerTxLimit() this.getMinPerTxLimit()
@ -187,7 +187,7 @@ class ForeignStore {
? await getErc20TokenAddress(this.foreignBridge) ? await getErc20TokenAddress(this.foreignBridge)
: await getErc677TokenAddress(this.foreignBridge) : await getErc677TokenAddress(this.foreignBridge)
this.tokenContract = new this.foreignWeb3.eth.Contract(ERC677_BRIDGE_TOKEN_ABI, this.tokenAddress) this.tokenContract = new this.foreignWeb3.eth.Contract(ERC677_BRIDGE_TOKEN_ABI, this.tokenAddress)
this.tokenType = await getTokenType(this.tokenContract, this.FOREIGN_BRIDGE_ADDRESS) this.tokenType = await getTokenType(this.tokenContract, this.COMMON_FOREIGN_BRIDGE_ADDRESS)
const alternativeContract = new this.foreignWeb3.eth.Contract(ERC20_BYTES32_ABI, this.tokenAddress) const alternativeContract = new this.foreignWeb3.eth.Contract(ERC20_BYTES32_ABI, this.tokenAddress)
try { try {
this.symbol = await getSymbol(this.tokenContract) this.symbol = await getSymbol(this.tokenContract)

@ -2,16 +2,18 @@ import { observable, computed } from 'mobx'
import { toHex } from 'web3-utils' import { toHex } from 'web3-utils'
import { gasPriceFromOracle } from '../../../commons' import { gasPriceFromOracle } from '../../../commons'
const HOME_GAS_PRICE_FALLBACK = process.env.REACT_APP_HOME_GAS_PRICE_FALLBACK const {
const HOME_GAS_PRICE_ORACLE_URL = process.env.REACT_APP_HOME_GAS_PRICE_ORACLE_URL REACT_APP_COMMON_HOME_GAS_PRICE_FALLBACK,
const HOME_GAS_PRICE_SPEED_TYPE = process.env.REACT_APP_HOME_GAS_PRICE_SPEED_TYPE REACT_APP_COMMON_HOME_GAS_PRICE_SUPPLIER_URL,
const HOME_GAS_PRICE_UPDATE_INTERVAL = process.env.REACT_APP_HOME_GAS_PRICE_UPDATE_INTERVAL REACT_APP_COMMON_HOME_GAS_PRICE_SPEED_TYPE,
const HOME_GAS_PRICE_FACTOR = process.env.REACT_APP_HOME_GAS_PRICE_FACTOR REACT_APP_UI_HOME_GAS_PRICE_UPDATE_INTERVAL,
const FOREIGN_GAS_PRICE_FALLBACK = process.env.REACT_APP_FOREIGN_GAS_PRICE_FALLBACK REACT_APP_COMMON_HOME_GAS_PRICE_FACTOR,
const FOREIGN_GAS_PRICE_ORACLE_URL = process.env.REACT_APP_FOREIGN_GAS_PRICE_ORACLE_URL REACT_APP_COMMON_FOREIGN_GAS_PRICE_FALLBACK,
const FOREIGN_GAS_PRICE_SPEED_TYPE = process.env.REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE REACT_APP_COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL,
const FOREIGN_GAS_PRICE_UPDATE_INTERVAL = process.env.REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL REACT_APP_COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE,
const FOREIGN_GAS_PRICE_FACTOR = process.env.REACT_APP_FOREIGN_GAS_PRICE_FACTOR REACT_APP_UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL,
REACT_APP_COMMON_FOREIGN_GAS_PRICE_FACTOR
} = process.env
const DEFAULT_GAS_PRICE_FACTOR = 1 const DEFAULT_GAS_PRICE_FACTOR = 1
const DEFAULT_GAS_PRICE_UPDATE_INTERVAL = 900000 const DEFAULT_GAS_PRICE_UPDATE_INTERVAL = 900000
@ -37,17 +39,17 @@ class GasPriceStore {
await this.web3Store.setHomeWeb3Promise await this.web3Store.setHomeWeb3Promise
if (await this.web3Store.onHomeSide()) { if (await this.web3Store.onHomeSide()) {
this.gasPrice = HOME_GAS_PRICE_FALLBACK this.gasPrice = REACT_APP_COMMON_HOME_GAS_PRICE_FALLBACK
this.oracleUrl = HOME_GAS_PRICE_ORACLE_URL this.oracleUrl = REACT_APP_COMMON_HOME_GAS_PRICE_SUPPLIER_URL
this.speedType = HOME_GAS_PRICE_SPEED_TYPE this.speedType = REACT_APP_COMMON_HOME_GAS_PRICE_SPEED_TYPE
this.updateInterval = HOME_GAS_PRICE_UPDATE_INTERVAL || DEFAULT_GAS_PRICE_UPDATE_INTERVAL this.updateInterval = REACT_APP_UI_HOME_GAS_PRICE_UPDATE_INTERVAL || DEFAULT_GAS_PRICE_UPDATE_INTERVAL
this.factor = Number(HOME_GAS_PRICE_FACTOR) || DEFAULT_GAS_PRICE_FACTOR this.factor = Number(REACT_APP_COMMON_HOME_GAS_PRICE_FACTOR) || DEFAULT_GAS_PRICE_FACTOR
} else { } else {
this.gasPrice = FOREIGN_GAS_PRICE_FALLBACK this.gasPrice = REACT_APP_COMMON_FOREIGN_GAS_PRICE_FALLBACK
this.oracleUrl = FOREIGN_GAS_PRICE_ORACLE_URL this.oracleUrl = REACT_APP_COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL
this.speedType = FOREIGN_GAS_PRICE_SPEED_TYPE this.speedType = REACT_APP_COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE
this.updateInterval = FOREIGN_GAS_PRICE_UPDATE_INTERVAL || DEFAULT_GAS_PRICE_UPDATE_INTERVAL this.updateInterval = REACT_APP_UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL || DEFAULT_GAS_PRICE_UPDATE_INTERVAL
this.factor = Number(FOREIGN_GAS_PRICE_FACTOR) || DEFAULT_GAS_PRICE_FACTOR this.factor = Number(REACT_APP_COMMON_FOREIGN_GAS_PRICE_FACTOR) || DEFAULT_GAS_PRICE_FACTOR
} }
const oracleOptions = { speedType: this.speedType, factor: this.factor, logger: console } const oracleOptions = { speedType: this.speedType, factor: this.factor, logger: console }

@ -101,7 +101,7 @@ class HomeStore {
tokenAddress = '' tokenAddress = ''
@observable @observable
symbol = process.env.REACT_APP_HOME_NATIVE_NAME || 'NONAME' symbol = process.env.REACT_APP_UI_NATIVE_TOKEN_DISPLAY_NAME || 'NONAME'
@observable @observable
tokenName = '' tokenName = ''
@ -140,12 +140,12 @@ class HomeStore {
totalFeeDistributedFromSignatures: BN(0), totalFeeDistributedFromSignatures: BN(0),
totalFeeDistributedFromAffirmation: BN(0) totalFeeDistributedFromAffirmation: BN(0)
} }
networkName = process.env.REACT_APP_HOME_NETWORK_NAME || 'Unknown' networkName = process.env.REACT_APP_UI_HOME_NETWORK_DISPLAY_NAME || 'Unknown'
filteredBlockNumber = 0 filteredBlockNumber = 0
homeBridge = {} homeBridge = {}
HOME_BRIDGE_ADDRESS = process.env.REACT_APP_HOME_BRIDGE_ADDRESS COMMON_HOME_BRIDGE_ADDRESS = process.env.REACT_APP_COMMON_HOME_BRIDGE_ADDRESS
explorerTxTemplate = process.env.REACT_APP_HOME_EXPLORER_TX_TEMPLATE || '' explorerTxTemplate = process.env.REACT_APP_UI_HOME_EXPLORER_TX_TEMPLATE || ''
explorerAddressTemplate = process.env.REACT_APP_HOME_EXPLORER_ADDRESS_TEMPLATE || '' explorerAddressTemplate = process.env.REACT_APP_UI_HOME_EXPLORER_ADDRESS_TEMPLATE || ''
tokenContract = {} tokenContract = {}
tokenDecimals = 18 tokenDecimals = 18
blockRewardContract = {} blockRewardContract = {}
@ -165,7 +165,7 @@ class HomeStore {
return return
} }
const { HOME_ABI } = getBridgeABIs(this.rootStore.bridgeMode) const { HOME_ABI } = getBridgeABIs(this.rootStore.bridgeMode)
this.homeBridge = new this.homeWeb3.eth.Contract(HOME_ABI, this.HOME_BRIDGE_ADDRESS) this.homeBridge = new this.homeWeb3.eth.Contract(HOME_ABI, this.COMMON_HOME_BRIDGE_ADDRESS)
if (this.rootStore.bridgeMode === BRIDGE_MODES.ERC_TO_ERC) { if (this.rootStore.bridgeMode === BRIDGE_MODES.ERC_TO_ERC) {
await this.getTokenInfo() await this.getTokenInfo()
} else if (this.rootStore.bridgeMode === BRIDGE_MODES.ERC_TO_NATIVE) { } else if (this.rootStore.bridgeMode === BRIDGE_MODES.ERC_TO_NATIVE) {
@ -250,11 +250,11 @@ class HomeStore {
balanceLoaded() balanceLoaded()
}) })
} else if (this.rootStore.bridgeMode === BRIDGE_MODES.ERC_TO_NATIVE) { } else if (this.rootStore.bridgeMode === BRIDGE_MODES.ERC_TO_NATIVE) {
const mintedCoins = await mintedTotallyByBridge(this.blockRewardContract, this.HOME_BRIDGE_ADDRESS) const mintedCoins = await mintedTotallyByBridge(this.blockRewardContract, this.COMMON_HOME_BRIDGE_ADDRESS)
const burntCoins = await totalBurntCoins(this.homeBridge) const burntCoins = await totalBurntCoins(this.homeBridge)
this.balance = fromDecimals(mintedCoins.minus(burntCoins).toString(10), this.tokenDecimals) this.balance = fromDecimals(mintedCoins.minus(burntCoins).toString(10), this.tokenDecimals)
} else { } else {
this.balance = await getBalance(this.homeWeb3, this.HOME_BRIDGE_ADDRESS) this.balance = await getBalance(this.homeWeb3, this.COMMON_HOME_BRIDGE_ADDRESS)
} }
} catch (e) { } catch (e) {
console.error(e) console.error(e)
@ -426,7 +426,7 @@ class HomeStore {
const deployedAtBlock = await getDeployedAtBlock(this.homeBridge) const deployedAtBlock = await getDeployedAtBlock(this.homeBridge)
const { HOME_ABI } = getBridgeABIs(this.rootStore.bridgeMode) const { HOME_ABI } = getBridgeABIs(this.rootStore.bridgeMode)
const abi = [...HOME_V1_ABI, ...HOME_ABI] const abi = [...HOME_V1_ABI, ...HOME_ABI]
const contract = new this.homeWeb3.eth.Contract(abi, this.HOME_BRIDGE_ADDRESS) const contract = new this.homeWeb3.eth.Contract(abi, this.COMMON_HOME_BRIDGE_ADDRESS)
const events = await getPastEvents(contract, deployedAtBlock, 'latest') const events = await getPastEvents(contract, deployedAtBlock, 'latest')
processLargeArrayAsync(events, this.processEvent, () => { processLargeArrayAsync(events, this.processEvent, () => {
this.statistics.finished = true this.statistics.finished = true

@ -22,8 +22,8 @@ class RootStore {
@action @action
async setBridgeMode() { async setBridgeMode() {
const homeWeb3 = getWeb3Instance(process.env.REACT_APP_HOME_HTTP_PARITY_URL) const homeWeb3 = getWeb3Instance(process.env.REACT_APP_COMMON_HOME_RPC_URL)
const homeBridge = new homeWeb3.eth.Contract(HOME_ERC_TO_ERC_ABI, process.env.REACT_APP_HOME_BRIDGE_ADDRESS) const homeBridge = new homeWeb3.eth.Contract(HOME_ERC_TO_ERC_ABI, process.env.REACT_APP_COMMON_HOME_BRIDGE_ADDRESS)
const bridgeModeHash = await homeBridge.methods.getBridgeMode().call() const bridgeModeHash = await homeBridge.methods.getBridgeMode().call()
this.bridgeMode = decodeBridgeMode(bridgeModeHash) this.bridgeMode = decodeBridgeMode(bridgeModeHash)
this.bridgeModeInitialized = true this.bridgeModeInitialized = true

@ -124,7 +124,7 @@ class TxStore {
this.alertStore.setBlockConfirmations(8) this.alertStore.setBlockConfirmations(8)
this.alertStore.setLoadingStepIndex(2) this.alertStore.setLoadingStepIndex(2)
if (yn(process.env.REACT_APP_FOREIGN_WITHOUT_EVENTS)) { if (yn(process.env.REACT_APP_UI_FOREIGN_WITHOUT_EVENTS)) {
this.foreignStore.waitUntilProcessed(hash).then(() => { this.foreignStore.waitUntilProcessed(hash).then(() => {
this.alertStore.setLoadingStepIndex(3) this.alertStore.setLoadingStepIndex(3)
const unitReceived = getUnit(this.rootStore.bridgeMode).unitForeign const unitReceived = getUnit(this.rootStore.bridgeMode).unitForeign
@ -151,7 +151,7 @@ class TxStore {
this.alertStore.setBlockConfirmations(8) this.alertStore.setBlockConfirmations(8)
this.alertStore.setLoadingStepIndex(2) this.alertStore.setLoadingStepIndex(2)
if (yn(process.env.REACT_APP_HOME_WITHOUT_EVENTS)) { if (yn(process.env.REACT_APP_UI_HOME_WITHOUT_EVENTS)) {
this.homeStore.waitUntilProcessed(hash, this.txsValues[hash]).then(() => { this.homeStore.waitUntilProcessed(hash, this.txsValues[hash]).then(() => {
this.alertStore.setLoadingStepIndex(3) this.alertStore.setLoadingStepIndex(3)
const unitReceived = getUnit(this.rootStore.bridgeMode).unitHome const unitReceived = getUnit(this.rootStore.bridgeMode).unitHome

@ -36,8 +36,8 @@ class Web3Store {
@observable @observable
walletInstalled = true walletInstalled = true
HOME_HTTP_PARITY_URL = process.env.REACT_APP_HOME_HTTP_PARITY_URL COMMON_HOME_RPC_URL = process.env.REACT_APP_COMMON_HOME_RPC_URL
FOREIGN_HTTP_PARITY_URL = process.env.REACT_APP_FOREIGN_HTTP_PARITY_URL COMMON_FOREIGN_RPC_URL = process.env.REACT_APP_COMMON_FOREIGN_RPC_URL
constructor(rootStore) { constructor(rootStore) {
this.alertStore = rootStore.alertStore this.alertStore = rootStore.alertStore
@ -81,7 +81,7 @@ class Web3Store {
@action @action
async setWeb3Home() { async setWeb3Home() {
this.homeWeb3 = getWeb3Instance(this.HOME_HTTP_PARITY_URL) this.homeWeb3 = getWeb3Instance(this.COMMON_HOME_RPC_URL)
this.setHomeWeb3Promise = getNetwork(this.homeWeb3).then(homeNet => { this.setHomeWeb3Promise = getNetwork(this.homeWeb3).then(homeNet => {
this.homeNet = homeNet this.homeNet = homeNet
}) })
@ -89,7 +89,7 @@ class Web3Store {
@action @action
async setWeb3Foreign() { async setWeb3Foreign() {
this.foreignWeb3 = getWeb3Instance(this.FOREIGN_HTTP_PARITY_URL) this.foreignWeb3 = getWeb3Instance(this.COMMON_FOREIGN_RPC_URL)
this.foreignNet = await getNetwork(this.foreignWeb3) this.foreignNet = await getNetwork(this.foreignWeb3)
} }

@ -3,11 +3,11 @@ import { fromWei, toHex } from 'web3-utils'
const updateTitle = (networkName = 'No chain specified') => { const updateTitle = (networkName = 'No chain specified') => {
const defaultTitle = 'TokenBridge UI app' const defaultTitle = 'TokenBridge UI app'
if (!process.env.REACT_APP_TITLE) { if (!process.env.REACT_APP_UI_TITLE) {
document.title = defaultTitle document.title = defaultTitle
} else { } else {
const titleReplaceString = '%c' const titleReplaceString = '%c'
let appTitle = process.env.REACT_APP_TITLE || defaultTitle let appTitle = process.env.REACT_APP_UI_TITLE || defaultTitle
if (appTitle.indexOf(titleReplaceString) !== -1) { if (appTitle.indexOf(titleReplaceString) !== -1) {
document.title = appTitle.replace(titleReplaceString, networkName) document.title = appTitle.replace(titleReplaceString, networkName)