Skip to content

Commit c71be79

Browse files
committed
feat(base-sepolia): add support for Base Sepolia network
- Introduced Base Sepolia network definitions across multiple modules, including EVM chains, ERC20 token support, and payment detection. - Updated contract artifacts to include deployment addresses for Base Sepolia, ensuring compatibility with the new network. - Enhanced type definitions to recognize Base Sepolia as a valid EVM chain name.
1 parent 367fcd5 commit c71be79

File tree

12 files changed

+442
-0
lines changed

12 files changed

+442
-0
lines changed

BASE_SEPOLIA_README.md

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# Base Sepolia Support for Request Network
2+
3+
This directory contains all the changes needed to deploy and use ERC20FeeProxy and ERC20CommerceEscrowWrapper contracts on Base Sepolia testnet.
4+
5+
## Quick Start
6+
7+
### 1. Set up your environment
8+
9+
```bash
10+
# Set your private key (without 0x prefix)
11+
export DEPLOYMENT_PRIVATE_KEY=your_private_key_here
12+
13+
# Get Base Sepolia ETH from faucet
14+
# https://www.coinbase.com/faucets/base-ethereum-sepolia-faucet
15+
```
16+
17+
### 2. Deploy contracts
18+
19+
```bash
20+
cd packages/smart-contracts
21+
22+
# Build contracts
23+
yarn build:sol
24+
25+
# Deploy using helper script
26+
./scripts/deploy-base-sepolia.sh
27+
28+
# OR deploy directly
29+
yarn hardhat deploy-erc20-commerce-escrow-wrapper --network base-sepolia
30+
```
31+
32+
### 3. Update deployed addresses
33+
34+
After deployment, update the contract addresses in:
35+
36+
- `packages/smart-contracts/src/lib/artifacts/ERC20FeeProxy/index.ts`
37+
- `packages/smart-contracts/src/lib/artifacts/ERC20CommerceEscrowWrapper/index.ts`
38+
39+
### 4. Rebuild packages
40+
41+
```bash
42+
cd packages/smart-contracts
43+
yarn build
44+
```
45+
46+
## Network Details
47+
48+
| Property | Value |
49+
| ------------ | ----------------------------- |
50+
| Network Name | Base Sepolia |
51+
| Chain ID | 84532 |
52+
| RPC URL | https://sepolia.base.org |
53+
| Explorer | https://sepolia.basescan.org/ |
54+
| Type | Testnet |
55+
56+
## Deployed Contracts
57+
58+
### Official Coinbase Contracts
59+
60+
- **AuthCaptureEscrow**: `0xBdEA0D1bcC5966192B070Fdf62aB4EF5b4420cff`
61+
62+
### Request Network Contracts (to be deployed)
63+
64+
- **ERC20FeeProxy**: Pending deployment
65+
- **ERC20CommerceEscrowWrapper**: Pending deployment
66+
67+
## Supported Tokens
68+
69+
| Token | Address | Decimals |
70+
| ----- | -------------------------------------------- | -------- |
71+
| USDC | `0x036CbD53842c5426634e7929541eC2318f3dCF7e` | 6 |
72+
73+
## SDK Usage Example
74+
75+
```typescript
76+
import { RequestNetwork, Types } from '@requestnetwork/request-client.js';
77+
78+
const requestNetwork = new RequestNetwork({
79+
nodeConnectionConfig: {
80+
baseURL: 'https://sepolia.gateway.request.network/',
81+
},
82+
});
83+
84+
// Create a request on Base Sepolia
85+
const request = await requestNetwork.createRequest({
86+
requestInfo: {
87+
currency: {
88+
type: Types.RequestLogic.CURRENCY.ERC20,
89+
value: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', // USDC
90+
network: 'base-sepolia',
91+
},
92+
expectedAmount: '1000000', // 1 USDC
93+
payee: {
94+
type: Types.Identity.TYPE.ETHEREUM_ADDRESS,
95+
value: '0xPayeeAddress',
96+
},
97+
},
98+
paymentNetwork: {
99+
id: Types.Extension.PAYMENT_NETWORK_ID.ERC20_FEE_PROXY_CONTRACT,
100+
parameters: {
101+
paymentNetworkName: 'base-sepolia',
102+
paymentAddress: '0xPayeeAddress',
103+
},
104+
},
105+
signer: yourSigner,
106+
});
107+
```
108+
109+
## Files Changed
110+
111+
### Type System
112+
113+
-`packages/types/src/currency-types.ts` - Added `'base-sepolia'` to EvmChainName
114+
115+
### Currency Package
116+
117+
-`packages/currency/src/chains/evm/data/base-sepolia.ts` - New chain definition
118+
-`packages/currency/src/erc20/chains/base-sepolia.ts` - New token list
119+
-`packages/currency/src/chains/evm/index.ts` - Export chain
120+
-`packages/currency/src/erc20/chains/index.ts` - Export tokens
121+
122+
### Smart Contracts
123+
124+
-`packages/smart-contracts/src/lib/artifacts/ERC20FeeProxy/index.ts` - Added deployment config
125+
-`packages/smart-contracts/src/lib/artifacts/AuthCaptureEscrow/index.ts` - Added official address
126+
-`packages/smart-contracts/src/lib/artifacts/ERC20CommerceEscrowWrapper/index.ts` - Added deployment config
127+
-`packages/smart-contracts/hardhat.config.ts` - Already configured ✓
128+
129+
### Payment Detection
130+
131+
-`packages/payment-detection/src/eth/multichainExplorerApiProvider.ts` - Added network
132+
133+
## Documentation Files
134+
135+
- 📖 **BASE_SEPOLIA_DEPLOYMENT_GUIDE.md** - Complete deployment guide
136+
- 📖 **BASE_SEPOLIA_CHANGES_SUMMARY.md** - Detailed list of all changes
137+
- 📖 **BASE_SEPOLIA_README.md** - This file (quick reference)
138+
139+
## Helper Scripts
140+
141+
- 🛠️ **packages/smart-contracts/scripts/deploy-base-sepolia.sh** - Interactive deployment script
142+
- 🛠️ **packages/smart-contracts/scripts/deploy-erc20-commerce-escrow-wrapper.ts** - Core deployment logic
143+
- 🛠️ **packages/smart-contracts/scripts/test-base-sepolia-deployment.ts** - Test connection script
144+
145+
## Testing Checklist
146+
147+
- [ ] Fund deployment wallet with Base Sepolia ETH
148+
- [ ] Deploy ERC20FeeProxy to Base Sepolia
149+
- [ ] Deploy ERC20CommerceEscrowWrapper to Base Sepolia
150+
- [ ] Update artifact files with deployed addresses
151+
- [ ] Rebuild all packages
152+
- [ ] Create a test request using Base Sepolia USDC
153+
- [ ] Pay the test request
154+
- [ ] Verify payment is detected correctly
155+
- [ ] Test commerce escrow flow
156+
157+
## Troubleshooting
158+
159+
### Insufficient funds
160+
161+
Get Base Sepolia ETH from: https://www.coinbase.com/faucets/base-ethereum-sepolia-faucet
162+
163+
### RPC connection issues
164+
165+
Try alternative RPC: `https://base-sepolia-rpc.publicnode.com`
166+
167+
### Contract verification failed
168+
169+
Manually verify on Basescan:
170+
171+
```bash
172+
yarn hardhat verify --network base-sepolia <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS>
173+
```
174+
175+
### Linting errors
176+
177+
Run linter:
178+
179+
```bash
180+
yarn lint
181+
```
182+
183+
## Resources
184+
185+
- [Base Documentation](https://docs.base.org/)
186+
- [Request Network Documentation](https://docs.request.network/)
187+
- [Coinbase Commerce Payments](https://github.com/base/commerce-payments)
188+
- [Base Sepolia Faucet](https://www.coinbase.com/faucets/base-ethereum-sepolia-faucet)
189+
- [Base Sepolia Explorer](https://sepolia.basescan.org/)
190+
191+
## Support
192+
193+
- Request Network Discord: https://discord.gg/requestnetwork
194+
- GitHub Issues: https://github.com/RequestNetwork/requestNetwork/issues
195+
196+
## License
197+
198+
MIT
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { CurrencyTypes } from '@requestnetwork/types';
2+
import { supportedBaseSepoliaERC20 } from '../../../erc20/chains/base-sepolia';
3+
4+
export const chainId = 84532;
5+
export const testnet = true;
6+
export const currencies: CurrencyTypes.TokenMap = {
7+
...supportedBaseSepoliaERC20,
8+
};

packages/currency/src/chains/evm/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import * as SepoliaDefinition from './data/sepolia';
2828
import * as ZkSyncEraTestnetDefinition from './data/zksync-era-testnet';
2929
import * as ZkSyncEraDefinition from './data/zksync-era';
3030
import * as BaseDefinition from './data/base';
31+
import * as BaseSepoliaDefinition from './data/base-sepolia';
3132
import * as SonicDefinition from './data/sonic';
3233

3334
export type EvmChain = CurrencyTypes.Chain & {
@@ -63,5 +64,6 @@ export const chains: Record<CurrencyTypes.EvmChainName, EvmChain> = {
6364
zksynceratestnet: ZkSyncEraTestnetDefinition,
6465
zksyncera: ZkSyncEraDefinition,
6566
base: BaseDefinition,
67+
'base-sepolia': BaseSepoliaDefinition,
6668
sonic: SonicDefinition,
6769
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { CurrencyTypes } from '@requestnetwork/types';
2+
3+
// List of the supported base sepolia testnet tokens
4+
export const supportedBaseSepoliaERC20: CurrencyTypes.TokenMap = {
5+
// USDC on Base Sepolia
6+
'0x036CbD53842c5426634e7929541eC2318f3dCF7e': {
7+
name: 'USD Coin',
8+
symbol: 'USDC',
9+
decimals: 6,
10+
},
11+
// Add more tokens as needed for testing on Base Sepolia
12+
};

packages/currency/src/erc20/chains/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { supportedOptimismERC20 } from './optimism';
1313
import { supportedRinkebyERC20 } from './rinkeby';
1414
import { supportedXDAIERC20 } from './xdai';
1515
import { supportedSepoliaERC20 } from './sepolia';
16+
import { supportedBaseSepoliaERC20 } from './base-sepolia';
1617

1718
export const supportedNetworks: Partial<
1819
Record<CurrencyTypes.EvmChainName, CurrencyTypes.TokenMap>
@@ -31,4 +32,5 @@ export const supportedNetworks: Partial<
3132
optimism: supportedOptimismERC20,
3233
moonbeam: supportedMoonbeamERC20,
3334
sepolia: supportedSepoliaERC20,
35+
'base-sepolia': supportedBaseSepoliaERC20,
3436
};

packages/payment-detection/src/eth/multichainExplorerApiProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const networks: Record<string, ethers.providers.Network> = {
1717
core: { chainId: 1116, name: 'core' },
1818
zksynceratestnet: { chainId: 280, name: 'zksynceratestnet' },
1919
zksyncera: { chainId: 324, name: 'zksyncera' },
20+
'base-sepolia': { chainId: 84532, name: 'base-sepolia' },
2021
sonic: { chainId: 146, name: 'sonic' },
2122
};
2223

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/bin/bash
2+
3+
# Base Sepolia Deployment Script
4+
# This script helps deploy ERC20FeeProxy and ERC20CommerceEscrowWrapper to Base Sepolia
5+
6+
set -e # Exit on error
7+
8+
echo "╔═══════════════════════════════════════════════════════════╗"
9+
echo "║ Base Sepolia Deployment Helper Script ║"
10+
echo "║ Request Network - ERC20 Commerce Escrow Wrapper ║"
11+
echo "╚═══════════════════════════════════════════════════════════╝"
12+
echo ""
13+
14+
# Colors for output
15+
RED='\033[0;31m'
16+
GREEN='\033[0;32m'
17+
YELLOW='\033[1;33m'
18+
BLUE='\033[0;34m'
19+
NC='\033[0m' # No Color
20+
21+
# Load .env file if it exists
22+
if [ -f .env ]; then
23+
echo -e "${BLUE}Loading .env file...${NC}"
24+
export $(cat .env | grep -v '^#' | grep -v '^$' | xargs)
25+
echo ""
26+
fi
27+
28+
# Check if private key is set
29+
if [ -z "$DEPLOYMENT_PRIVATE_KEY" ] && [ -z "$ADMIN_PRIVATE_KEY" ]; then
30+
echo -e "${RED}❌ Error: No private key found!${NC}"
31+
echo ""
32+
echo "Please set either DEPLOYMENT_PRIVATE_KEY or ADMIN_PRIVATE_KEY environment variable:"
33+
echo ""
34+
echo -e "${YELLOW}export DEPLOYMENT_PRIVATE_KEY=your_private_key_here${NC}"
35+
echo ""
36+
echo "OR"
37+
echo ""
38+
echo -e "${YELLOW}export ADMIN_PRIVATE_KEY=your_private_key_here${NC}"
39+
echo ""
40+
echo "⚠️ Make sure to fund your wallet with Base Sepolia ETH:"
41+
echo " https://www.coinbase.com/faucets/base-ethereum-sepolia-faucet"
42+
exit 1
43+
fi
44+
45+
echo -e "${GREEN}${NC} Private key found"
46+
echo ""
47+
48+
# Network information
49+
echo -e "${BLUE}Network Information:${NC}"
50+
echo " Name: Base Sepolia"
51+
echo " Chain ID: 84532"
52+
echo " RPC URL: https://sepolia.base.org"
53+
echo " Explorer: https://sepolia.basescan.org/"
54+
echo ""
55+
56+
# Check if contracts are built
57+
if [ ! -d "build" ]; then
58+
echo -e "${YELLOW}⚠️ Contracts not built. Building now...${NC}"
59+
yarn build:sol
60+
echo ""
61+
fi
62+
63+
echo -e "${BLUE}Deployment Plan:${NC}"
64+
echo " 1. Deploy ERC20FeeProxy"
65+
echo " 2. Use official AuthCaptureEscrow: 0xBdEA0D1bcC5966192B070Fdf62aB4EF5b4420cff"
66+
echo " 3. Deploy ERC20CommerceEscrowWrapper"
67+
echo ""
68+
69+
# Ask for confirmation
70+
read -p "Do you want to proceed with deployment? (y/n) " -n 1 -r
71+
echo ""
72+
73+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
74+
echo -e "${YELLOW}Deployment cancelled.${NC}"
75+
exit 0
76+
fi
77+
78+
echo ""
79+
echo -e "${GREEN}Starting deployment...${NC}"
80+
echo ""
81+
82+
# Run deployment
83+
yarn hardhat deploy-erc20-commerce-escrow-wrapper --network base-sepolia
84+
85+
echo ""
86+
echo -e "${GREEN}╔═══════════════════════════════════════════════════════════╗${NC}"
87+
echo -e "${GREEN}║ Deployment Complete! ║${NC}"
88+
echo -e "${GREEN}╚═══════════════════════════════════════════════════════════╝${NC}"
89+
echo ""
90+
echo -e "${YELLOW}📝 Next Steps:${NC}"
91+
echo ""
92+
echo "1. Update the deployed addresses in these files:"
93+
echo " - packages/smart-contracts/src/lib/artifacts/ERC20FeeProxy/index.ts"
94+
echo " - packages/smart-contracts/src/lib/artifacts/ERC20CommerceEscrowWrapper/index.ts"
95+
echo ""
96+
echo "2. Rebuild the packages:"
97+
echo " cd packages/smart-contracts && yarn build"
98+
echo ""
99+
echo "3. Verify contracts were verified on Basescan:"
100+
echo " https://sepolia.basescan.org/"
101+
echo ""
102+
echo -e "${BLUE}ℹ️ For more information, see BASE_SEPOLIA_DEPLOYMENT_GUIDE.md${NC}"
103+
echo ""
104+

0 commit comments

Comments
 (0)