Mainnet -> sidechain Giveth Bridge.
npm install @giveth/bridgeGiveth specific bridge between 2 ethereum based blockchains
home chain -> foreign chain:
GivethBridge contract will be deployed on the home chain. When one donate functions are called, the sent value is locked in the bridge and an event is emitted. A node app will be watching for events and relay to the foreignChain, calling the deposit function. This will mint tokens and forward the donation to the liquidPledging contract.
foreign chain -> home chain:
ForeignGivethBridge contract will be deployed on the foreign chain. When a user wants to move tokens to the home chain they will call the withdraw function. The tokens will then be burnt and an event is emitted. A node app will be watching for events and relay to the homeChain, calling the authorizePayment function.
Once the payment is approved, the sender will be able to collect their funds from the GivethBridge contract.
The GivethBridge contract is an extension of the vault, which provides a safe and secure way to store funds. Vist the vault repo to lean more about the vault.
Currently these contracts are a temporary solution until, a more robust bridging system is ready. Both contracts are pausable which will allow use to migrate to a new bridge at a future date.
See config/default.json for example. This will be loaded and extended by additional configuration if found. You can specify the ENVIRONMENT env variable to load the file config/${ENVIRONMENT}.json if found. ENVIRONMENT defaults to local.
dataDir: directory to store bridge dbhomeNodeUrl: ethereum node connection url for homeBridgehomeBridge: address of the home bridgehomeGasPrice: price in wei to use for gas (can be set to 'ethGasStation to fetch current price)homeConfirmations: # of confirmations required before relaying tx to foreignBridgehomeBridgeDeployBlock: (optional) block to start looking for events fromforeignNodeUrl: ethereum node connection url for foreignBridgeforeignBridge: address of the foreign bridgeforeignGasPrice: price in wei to use for gas (can be set to 'ethGasStation to fetch current price)foreignConfirmations: # of confirmations required before relaying tx to homeBridgeforeignBridgeDeployBlock: (optional) block to start looking for events frompollTime: how often in miliseconds to check for txs to relayliquidPledging: address of liquidPledging contract on foreign networkpk: pk of the account to send txs from
If you would like to receive an email on any errors, the following are required:
mailApiKey: mailgun api key
mailDomain: mailgun domain
mailFrom: address to send mail from
mailTo: address sto send mail to
see Upgrade doc