70 lines
2.6 KiB
Markdown
70 lines
2.6 KiB
Markdown
|
|
# Contract Revert Errors - Expected Behavior
|
||
|
|
|
||
|
|
## Overview
|
||
|
|
The "call revert exception" errors you see in the console are **expected** when:
|
||
|
|
1. Contracts are not deployed at the specified addresses on Chain 138
|
||
|
|
2. The wallet is not connected (we now prevent queries in this case)
|
||
|
|
3. Contract methods revert for valid reasons (e.g., invalid parameters)
|
||
|
|
|
||
|
|
## What We've Fixed
|
||
|
|
|
||
|
|
### 1. Conditional Query Execution ✅
|
||
|
|
- **Before**: Queries were executed even with zero address placeholder, causing revert errors
|
||
|
|
- **After**: Queries only execute when:
|
||
|
|
- Wallet is connected (`address` is defined)
|
||
|
|
- Contract instances are available
|
||
|
|
- Valid parameters are provided
|
||
|
|
|
||
|
|
### 2. QueryClient Configuration ✅
|
||
|
|
- Configured to not retry on `CALL_EXCEPTION` errors
|
||
|
|
- These errors are expected and don't need retries
|
||
|
|
|
||
|
|
## Remaining Errors
|
||
|
|
|
||
|
|
If you still see "call revert exception" errors, they indicate:
|
||
|
|
|
||
|
|
1. **Contracts Not Deployed**: The contracts at the addresses in `config/bridge.ts` may not be deployed on Chain 138
|
||
|
|
- Check: `CONTRACTS.WETH9`
|
||
|
|
- Check: `CONTRACTS.WETH9_BRIDGE`
|
||
|
|
- Check: `CONTRACTS.LINK_TOKEN`
|
||
|
|
|
||
|
|
2. **Wrong Contract Addresses**: The addresses may be incorrect for Chain 138
|
||
|
|
- Verify addresses match deployed contracts on Chain 138
|
||
|
|
- Update `config/bridge.ts` with correct addresses
|
||
|
|
|
||
|
|
3. **Network Issues**: RPC connection problems
|
||
|
|
- Check: `VITE_RPC_URL_138` in `.env`
|
||
|
|
- Verify RPC endpoint is accessible
|
||
|
|
|
||
|
|
## How to Verify Contracts
|
||
|
|
|
||
|
|
To check if contracts exist at the specified addresses:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Using cast (Foundry)
|
||
|
|
cast code 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 --rpc-url <CHAIN_138_RPC>
|
||
|
|
|
||
|
|
# Using curl
|
||
|
|
curl -X POST <CHAIN_138_RPC> \
|
||
|
|
-H "Content-Type: application/json" \
|
||
|
|
-d '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2","latest"],"id":1}'
|
||
|
|
```
|
||
|
|
|
||
|
|
If the result is `"0x"`, the contract doesn't exist at that address.
|
||
|
|
|
||
|
|
## Next Steps
|
||
|
|
|
||
|
|
1. **Verify Contract Addresses**: Confirm all contracts are deployed on Chain 138
|
||
|
|
2. **Update Config**: If addresses are wrong, update `config/bridge.ts`
|
||
|
|
3. **Test with Deployed Contracts**: Once contracts are deployed, errors should stop
|
||
|
|
|
||
|
|
## Error Suppression
|
||
|
|
|
||
|
|
The errors are logged by thirdweb's React Query integration. They don't break functionality but can clutter the console. To fully suppress them, you would need to:
|
||
|
|
|
||
|
|
1. Override `console.error` temporarily (not recommended)
|
||
|
|
2. Use a custom error boundary (complex)
|
||
|
|
3. Wait for contracts to be deployed (recommended)
|
||
|
|
|
||
|
|
For now, the errors are informational and indicate that contracts need to be deployed or addresses need to be updated.
|