-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from poanetwork/141-UserRequestForAffirmation…
…-erc677-erc677 Add support for UserRequestForAffirmation event on erc-to-erc mode
- Loading branch information
Showing
9 changed files
with
1,361 additions
and
6 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM parity/parity:v2.2.11 | ||
FROM parity/parity:v2.3.3 | ||
|
||
WORKDIR /stuff | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const path = require('path') | ||
require('dotenv').config({ | ||
path: path.join(__dirname, '../.env') | ||
}) | ||
const Web3 = require('web3') | ||
const ERC677BridgeTokenABI = require('../abis/ERC677BridgeToken.abi') | ||
const { ERC_TYPES } = require('../src/utils/constants') | ||
|
||
async function initialChecks() { | ||
const { ERC20_TOKEN_ADDRESS, BRIDGE_MODE, FOREIGN_RPC_URL, FOREIGN_BRIDGE_ADDRESS } = process.env | ||
const result = {} | ||
|
||
if (BRIDGE_MODE === 'ERC_TO_ERC') { | ||
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(FOREIGN_RPC_URL)) | ||
const tokenContract = new foreignWeb3.eth.Contract(ERC677BridgeTokenABI, ERC20_TOKEN_ADDRESS) | ||
try { | ||
const bridgeContract = await tokenContract.methods.bridgeContract().call() | ||
if (bridgeContract === FOREIGN_BRIDGE_ADDRESS) { | ||
result.foreignERC = ERC_TYPES.ERC677 | ||
} else { | ||
result.foreignERC = ERC_TYPES.ERC20 | ||
} | ||
} catch (e) { | ||
result.foreignERC = ERC_TYPES.ERC20 | ||
} | ||
} | ||
console.log(JSON.stringify(result)) | ||
return result | ||
} | ||
|
||
initialChecks() | ||
|
||
module.exports = initialChecks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters