Skip to content

Reactive-Network/react-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reactive Bridge

Testing Setup Instructions

Step 1 — Set Up the WREACT Token

Deploy the WREACT token from the wreact-erc20-token repository to Ethereum Sepolia:

forge create --rpc-url $SEPOLIA_RPC --private-key $SEPOLIA_PRIVATE_KEY src/WrappedReact.sol:WrappedReact

Deployed address:

export WREACT_ADDR=...

Step 2 — Initialize the Non-Reactive Bridge

Deploy the non-reactive bridge component to Ethereum Sepolia:

forge create --rpc-url $SEPOLIA_RPC --private-key $SEPOLIA_PRIVATE_KEY src/Bridge.sol:Bridge --value 0.1ether --constructor-args $SEPOLIA_CALLBACK_PROXY_ADDR 2 false 10 $WREACT_ADDR true false 0.05ether 250 100000

Deployed address:

export BRIDGE_ADDR=... // to be announced later

If the token is mintable, authorize the bridge to mint WREACT tokens:

cast send --rpc-url $SEPOLIA_RPC --private-key $SEPOLIA_PRIVATE_KEY $WREACT_ADDR "authorizeMinter(address)" $BRIDGE_ADDR

Otherwise, provide liquidity to the bridge directly:

cast send --rpc-url $SEPOLIA_RPC --private-key $SEPOLIA_PRIVATE_KEY $WREACT_ADDR "transfer(address,uint256)" $BRIDGE_ADDR 1ether

Step 3 — Deploy the Reactive Bridge

Ensure the deployment keys match before proceeding with the Reactive Bridge setup:

forge create --legacy --rpc-url $REACTIVE_RPC --private-key $SEPOLIA_PRIVATE_KEY src/ReactiveBridge.sol:ReactiveBridge --value 1ether --constructor-args 5318008 11155111 $BRIDGE_ADDR 2 false 10 0.05ether 250 true

Deployed address:

export RBRIDGE_ADDR=... // to be announced later

Step 4 — Bridge Tokens to Ethereum Sepolia

Initiate the bridging of REACT tokens to Ethereum Sepolia:

cast send --legacy --rpc-url $REACTIVE_RPC --private-key $SEPOLIA_PRIVATE_KEY $RBRIDGE_ADDR "bridge(uint256,address)" 0x123467 $RECIPIENT_ADDR --value 1ether

This command triggers four reactive transactions on the bridge contract:

  1. Initial Reaction: Processes the SendMessage event from the Reactive Network and sends the initial callback to Ethereum Sepolia.
  2. First Confirmation: Responds to the ConfirmationRequest event from Ethereum Sepolia and sends the first confirmation callback.
  3. Final Confirmation: Handles another ConfirmationRequest event, sending the final callback and minting WREACT tokens on Ethereum Sepolia.
  4. Delivery Confirmation: Processes the DeliveryConfirmation event from the other side, completing the bridging sequence with no further callbacks.

Step 5 — Send WREACT Back to the Reactive Network

To unwrap some WREACT and send it back to the Reactive Network, first authorize the bridge on Ethereum Sepolia:

cast send --rpc-url $SEPOLIA_RPC --private-key $SEPOLIA_PRIVATE_KEY $WREACT_ADDR "approve(address,uint256)" $BRIDGE_ADDR 0.75ether

Then initiate the bridging sequence:

cast send --rpc-url $SEPOLIA_RPC --private-key $SEPOLIA_PRIVATE_KEY $BRIDGE_ADDR "bridge(uint256,address,uint256)" 0x987643 $RECIPIENT_ADDR 0.75ether --value 0.2ether

This triggers four additional reactive transactions with similar semantics:

  1. Initial Message: The Ethereum Sepolia bridge sends an InitialMessage to the Reactive Network.
  2. First Confirmation: The Reactive Network responds with a FirstConfirmation.
  3. Final Confirmation: The final confirmation triggers the actual transfer of funds back to the Reactive Network.
  4. Delivery Confirmation: A DeliveryConfirmation is sent to Ethereum Sepolia, marking the successful completion of the process.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •