Deploying Reactive Smart Contracts with Remix
Overview
This guide will walk you through deploying Reactive Smart Contracts using the Remix Development Environment. We will use the Basic Demo that involves three smart contracts: the Origin chain contract BasicDemoL1Contract.sol, the Destination chain contract BasicDemoL1Callback.sol, and the Reactive contract BasicDemoReactiveContract.sol.
Prerequisites
Acquire Testnet Funds
You will need SepETH for Ethereum Sepolia and REACT tokens for Kopli Testnet. To receive REACT tokens, send SepETH to the Reactive faucet on Ethereum Sepolia (0x9b9BB25f1A81078C544C829c5EB7822d747Cf434
). An equivalent amount of REACT will be sent to your address. To connect your MetaMask account to Kopli Testnet, use the button below:
Origin Chain Contract
-
Open BasicDemoL1Contract.sol in Remix.
-
Compile the contract.
- Deploy the Origin chain contract to Ethereum Sepolia.
-
Open MetaMask and select Ethereum Sepolia.
-
In Remix, in the Deploy & Run Transactions tab, select "Injected Provider — MetaMask" as your environment.
-
Click the Deploy button. MetaMask will prompt you to confirm the transaction. Check the transaction details to ensure you are deploying the contract to Ethereum Sepolia.
-
After you confirm the transaction, the contract address will appear in the Deployed Contracts list. Copy this contract address.
- Check the transaction details using the contract address on Sepolia Testnet Explorer.
Destination Chain Contract
-
Open BasicDemoL1Callback.sol in Remix. Properly import abstract contracts and interfaces: AbstractCallback, AbstractPayer, IPayable, and IPayer.
-
Compile the contract.
- Deploy the Destination chain contract to Ethereum Sepolia the same way we do with the Origin chain contract.
4.Copy the contract address that will appear in the Deployed Contracts list.
Reactive Smart Contract
-
Open BasicDemoReactiveContract.sol in Remix. Properly import abstract contracts and interfaces: AbstractReactive, IReactive, ISystemContract, IPayer, IPayable, ISubscriptionService,
-
Compile the contract.
- Deploy the reactive contract to Kopli Testnet.
-
Open MetaMask and select Kopli Testnet.
-
In Remix, in the Deploy & Run Transactions tab, select "Injected Provider — MetaMask" as your Environment.
-
In the Deploy section, fill out the following fields:
service address
: Reactive callback proxy address0x0000000000000000000000000000000000FFFFFF
._contract
: Origin chain contract address.topic_0
: TheReceived
event on the origin chain contract0x8cabf31d2b1b11ba52dbb302817a3c9c83e4b2a5194d35121ab1354d69f6a4cb
.callback
: Destination chain contract address. -
Click the transact button. MetaMask will prompt you to confirm the transaction. Check the transaction details to ensure you are deploying the contract to the Kopli Testnet.
-
After you confirm the transaction, the contract address will appear in the Deployed Contracts list. Copy this contract address.
- Once the reactive сontract is successfully deployed, check the transaction details using the contract address on Reactive Scan.
To receive a callback on the destination chain contract, you should send 0.1 SepETH to your Origin contract address via Metamask. Check the contract's events for a callback.