Skip to content

Commit f9c877f

Browse files
committed
docs: Update README for clarity and add contract overview section
1 parent e046bcb commit f9c877f

File tree

1 file changed

+15
-64
lines changed

1 file changed

+15
-64
lines changed

README.md

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ This project implements a cross-chain token bridge for the RLC token between Eth
66

77
The system consists of two main components:
88

9-
1. **RLCAdapter (on Ethereum **Sepolia**)**: Wraps the existing RLC ERC-20 token to make it compatible with LayerZero's cross-chain messaging.
9+
1. **RLCAdapter (on Ethereum Sepolia)**: Wraps the existing RLC ERC-20 token to make it compatible with LayerZero's cross-chain messaging.
1010
2. **RLCOFT (on Arbitrum Sepolia)**: A new token that's minted when RLC tokens are locked in the adapter on Ethereum, and burned when tokens are sent back.
1111

12-
[![Architecture Diagram](https://mermaid.ink/img/pako:eNqNVNtO4zAQ_RXLvAY2F3JpQEhpLrsPRUhQXqBoZRKXRjh2ZCdouf372nHSEhrYddV2MjnHZ-ZM4leYswLDED5wVG_AMllRIJdo73ViBdNmgzluK3CFa0ZKtIIaotblIr6VX7Bkj5ju0qflWXoZ2-bpj_LsbpeOClQ3mCtGH44oF9myT3_iLW5-p8tftwv0jPkN5gyktKhZSZseg2mhg73aI35fNny6dimnKpF_E-XL7H4R0eX8v4u4Fph3VasAMAoGG-_A4eHZmwWiuubsCQvQKHHxBkaWDPQObIMYESKAkBqfcP1FB3PAguWPuw1lc_ugY2kFLQSosBDoAb_15mqgjjucC2LOhDjMN6ikI7R0YYuWcYf2QIJJ-YT5h42lhRqnHFYgH5xLu3b1dT0qTweLhmnd7Rk56EQjJ_YU5mDecrpT2APEE91P9ZN82f2UV-lE919OKQPXlPx7Tj_BkiMq1mrTkWHbAvRvTpAQCV4DPLym65KQ8CD24izzDdFwSQ4PnMQ1576RM8J4eE9Q_njyiY-GV0Xz51bqZNmWb0eBnQXf8Vs1RM3NssSOzC03y4LANL_jkpeembjqs6u6WxPMD3xlnzE4N5jwUaAb_tDd6Mb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VG_AMllRIJdo73ViBdNmgzluK3CFa0ZKtIIaotblIr6VX7Bkj5ju0qflWXoZ2-bpj_LsbpeOClQ3mCtGH44oF9myT3_iLW5-p8tftwv0jPkN5gyktKhZSZseg2mhg73aI35fNny6dimnKpF_E-XL7H4R0eX8v4u4Fph3VasAMAoGG-_A4eHZmwWiuubsCQvQKHHxBkaWDPQObIMYESKAkBqfcP1FB3PAguWPuw1lc_ugY2kFLQSosBDoAb_15mqgjjucC2LOhDjMN6ikI7R0YYuWcYf2QIJJ-YT5h42lhRqnHFYgH5xLu3b1dT0qTweLhmnd7Rk56EQjJ_YU5mDecrpT2APEE91P9ZN82f2UV-lE919OKQPXlPx7Tj_BkiMq1mrTkWHbAvRvTpAQCV4DPLym65KQ8CD24iyyDdFwSQ4PnMQ1576RM8J4eE9Q_njyiY-GV0Xz51bqZNmWb0eBnQXf8Vs1RM3NssSOzC03y4LANL_jkpeembjqs6u6WxPMD3xlnzE4N5jwUaAb_tDd6Mbgp7F9xlQTI4iestE_GuTlBBqwwrxCZSHPzFcFXUEpWuEVDGVY4DVqSaPOmXcJRW3Drp5pDkMpjg3Y1gVqcFIieUBVMFwjImS2RvSGsWoAyUsYvsI_MAysI8_yfNuZeY7tuUFgwGcYWjP3yLdN1_Jl5PiBab8b8KXbwDyaufbMOnYs27OsIPA8A3LWPmy2WrgoG8bP9ZnfHf2GPPpVN1qcy_cD85i1tJFKlj3UnHY8jXr_C5RA8AI)
1313

1414
## Prerequisites
1515

1616
- [Foundry](https://book.getfoundry.sh/getting-started/installation.html) for contract compilation and deployment
1717
- Ethereum wallet with Sepolia ETH and Arbitrum Sepolia ETH for gas
1818
- RLC tokens on Sepolia testnet for bridge testing
1919

20-
## Setup
20+
## Installation
2121

2222
1. Clone the repository
2323
```bash
@@ -35,6 +35,13 @@ The system consists of two main components:
3535
cp .env.template .env # and edit .env content
3636
```
3737

38+
## Contract Overview
39+
40+
Instead of duplicating code that may become outdated, here are links to the key contracts in the repository:
41+
42+
- [RLCAdapter.sol](https://github.com/iExecBlockchainComputing/rlc-multichain/blob/main/src/RLCAdapter.sol) - Ethereum-side adapter that wraps the existing RLC token
43+
- [RLCOFT.sol](https://github.com/iExecBlockchainComputing/rlc-multichain/blob/main/src/RLCOFT.sol) - Arbitrum-side token that implements the OFT standard
44+
3845
## Deployment
3946

4047
The deployment process involves four steps:
@@ -68,7 +75,7 @@ After deployment, update your `.env` file with the deployed contract addresses.
6875
To send RLC tokens from Ethereum Sepolia to Arbitrum Sepolia:
6976

7077
```bash
71-
make send-tokens
78+
make send-tokens-to-arbitrum-sepolia
7279
```
7380

7481
This will:
@@ -81,60 +88,14 @@ This will:
8188
To send RLC tokens from Arbitrum Sepolia back to Ethereum Sepolia:
8289

8390
```bash
84-
make send-tokens-arbitrum-sepolia
91+
make send-tokens-to-sepolia
8592
```
8693

8794
This will:
8895
1. Burn RLCOFT tokens on Arbitrum
8996
2. Send a cross-chain message to the adapter
9097
3. Release the original RLC tokens on Ethereum
9198

92-
## Contract Architecture
93-
94-
### RLCAdapter.sol
95-
96-
An adapter that wraps the existing RLC token to make it compatible with LayerZero's OFT protocol. It extends:
97-
- `OFTAdapter`: Handles the OFT cross-chain logic
98-
- `Ownable`: Provides ownership control for administrative functions
99-
100-
```solidity
101-
contract RLCAdapter is Ownable, OFTAdapter {
102-
constructor(address _token, address _lzEndpoint, address _owner)
103-
OFTAdapter(_token, _lzEndpoint, _owner)
104-
Ownable(_owner)
105-
{}
106-
}
107-
```
108-
109-
### RLCOFT.sol
110-
111-
A new token on the destination chain (Arbitrum) that's minted when RLC tokens are locked in the adapter. It extends:
112-
- `OFT`: Implements the OFT cross-chain logic
113-
- `Ownable`: Provides ownership control for administrative functions
114-
115-
```solidity
116-
contract RLCOFT is Ownable, OFT {
117-
constructor(string memory _name, string memory _symbol, address _lzEndpoint, address _delegate)
118-
OFT(_name, _symbol, _lzEndpoint, _delegate)
119-
Ownable(_delegate)
120-
{}
121-
122-
function burn(uint256 _value) external returns (bool) {
123-
_burn(msg.sender, _value);
124-
return true;
125-
}
126-
127-
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) public returns (bool) {
128-
TokenSpender spender = TokenSpender(_spender);
129-
if (approve(_spender, _value)) {
130-
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
131-
return true;
132-
}
133-
return false;
134-
}
135-
}
136-
```
137-
13899
## How It Works
139100

140101
1. **Ethereum → Arbitrum:**
@@ -154,6 +115,7 @@ contract RLCOFT is Ownable, OFT {
154115
- The bridge security relies on LayerZero's security model
155116
- Administrative functions are protected by the Ownable pattern
156117
- Use caution when setting trusted remotes to prevent unauthorized cross-chain interactions
118+
- Always test thoroughly on testnets before deploying to mainnet
157119
158120
## Gas Costs and Fees
159121
@@ -164,22 +126,11 @@ LayerZero transactions require fees to cover:
164126
165127
The scripts automatically calculate these fees and include them in the transaction.
166128
167-
## Testing
168-
169-
Testing with Foundry tests is recommended before mainnet deployments.
170-
171-
```bash
172-
forge test
173-
```
174-
175129
## Troubleshooting
176130
177-
Common issues:
178-
- Insufficient gas: Ensure you have enough ETH on both networks
179-
- Missing environment variables: Check your .env file is properly loaded
180-
- Chain ID mismatch: Verify LayerZero chain IDs are correct
181131
182132
## References
183133
184134
- [LayerZero Documentation](https://layerzero.gitbook.io/docs/)
185-
- [OFT Contracts](https://github.com/LayerZero-Labs/solidity-examples/tree/main/contracts/token/oft)
135+
- [OFT Contracts](https://github.com/LayerZero-Labs/solidity-examples/tree/main/contracts/token/oft)
136+
- [iExec Platform Documentation](https://docs.iex.ec/)

0 commit comments

Comments
 (0)