@evvm/testnet-contracts 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,868 +1,83 @@
1
1
  # EVVM Testnet Contracts
2
2
 
3
- EVVM is an innovative blockchain virtualization system that allows you to create and deploy your own virtual blockchains on top of existing Ethereum networks where you can:
3
+ [![npm version](https://img.shields.io/npm/v/@evvm/testnet-contracts.svg)](https://www.npmjs.com/package/@evvm/testnet-contracts) [![license](https://img.shields.io/badge/license-EVVM--NONCOMMERCIAL--1.0-blue.svg)](LICENSE) [![docs](https://img.shields.io/badge/docs-evvm.info-blue.svg)](https://www.evvm.info/)[![npm downloads](https://img.shields.io/npm/dw/@evvm/testnet-contracts.svg)](https://www.npmjs.com/package/@evvm/testnet-contracts)
4
4
 
5
- - **Create your own virtual blockchain** with custom tokens and governance
6
- - **Deploy on testnets** like Ethereum Sepolia or Arbitrum Sepolia for testing
7
- - **Use proven, audited contracts** for staking, treasury management, and domain services
8
- - **Scale to mainnet** when ready for production
5
+ A compact toolkit for creating virtual EVM chains on testnets.
9
6
 
10
- ## What's included?
7
+ Quick overview
8
+ - Use the Solidity packages in `src/` as a library (install via NPM or Forge).
9
+ - Use the `evvm` CLI to deploy and manage EVVM instances.
11
10
 
12
- EVVM provides a complete ecosystem of smart contracts:
13
- - **Core EVVM**: Your virtual blockchain's main engine
14
- - **NameService**: Domain name system for your blockchain (like ENS)
15
- - **Staking**: Token staking and rewards system
16
- - **Treasury**: Secure fund management inside the host chain or across chains
17
- - **Estimator**: Reward calculation and optimization
18
- - **P2PSwap**: Peer-to-peer token exchange service with automated market making
11
+ Docs & hosted library: https://www.evvm.info/
19
12
 
20
- ## Latest Features
21
13
 
22
- **Enhanced Deployment Experience:**
23
- - **CLI Executable**: Global `evvm` command for seamless deployment and management
24
- - **Interactive Wizard**: User-friendly deployment wizard with comprehensive guidance
25
- - **Automatic RPC Fallback**: 99%+ deployment success rate with multiple fallback endpoints
26
- - **Deployment Summary**: Instant access to all deployed contract addresses with explorer links
27
- - **Auto Registry Integration**: Automatic EVVM registration and ID configuration
28
- - **Smart Prerequisites Check**: Automatic dependency initialization and validation
29
- - **Multi-Wallet Support**: Easy selection from your Foundry keystores
30
-
31
- **CLI Commands Available:**
32
- - `evvm deploy` - Deploy new EVVM instance with interactive setup
33
- - `evvm register` - Register existing EVVM in the registry
34
- - `evvm fulltest` - Run complete test suite
35
- - `evvm help` - Display comprehensive help
36
- - `evvm version` - Show CLI version
37
-
38
- **Reliability Improvements:**
39
- - Intelligent retry mechanism for network failures
40
- - Comprehensive error handling and troubleshooting guides
41
- - Verified high-performance RPC endpoints
42
- - Zero-configuration setup for most users
43
-
44
- ## Use Cases
45
-
46
- This repository serves two main purposes:
47
-
48
- ### Deploy Your Own EVVM Instance
49
- Create and deploy a complete virtual blockchain with all EVVM contracts on testnets for experimentation and testing.
50
-
51
- ### Build Services Using Existing EVVM
52
- Use EVVM contracts as a library to build services that interact with already deployed EVVM instances.
53
-
54
- ---
55
-
56
- ## Quick Start Options
57
-
58
- Choose your path based on what you want to achieve:
59
-
60
- ### Option A: Building Services on Existing EVVM
61
-
62
- **Perfect if you want to create smart contracts that interact with already deployed EVVM instances.**
63
-
64
- Simply install the library and start building:
14
+ Install the library (1 min)
65
15
 
66
16
  ```bash
67
- # Install via NPM
17
+ # NPM (recommended for dApp developers)
68
18
  npm install @evvm/testnet-contracts
69
19
 
70
- # OR install via Forge
20
+ # Or with Forge
71
21
  forge install EVVM-org/Testnet-Contracts
72
22
  ```
73
23
 
74
- **What you get**: Access to all EVVM interfaces and contracts to build services that interact with live EVVM instances on testnets.
75
-
76
- **Next steps**: Jump to [Library Usage](#library-usage) section below.
77
-
78
- ### Option B: Deploy Your Own Complete EVVM Instance
79
-
80
- **Perfect if you want to create your own virtual blockchain with custom tokens and governance.**
81
-
82
- Follow the complete deployment process:
83
-
84
- **What you get**: Your own virtual blockchain with custom tokens, domain system, staking rewards, and treasury management - all deployed and verified on public testnets.
24
+ Guide: How to build on top of EVVM (library): https://www.evvm.info/docs/HowToMakeAEVVMService
85
25
 
86
- **Next steps**: Jump to [Deploy Your Own EVVM](#deploy-your-own-evvm) section below.
87
-
88
- ---
89
-
90
- ## Library Usage
91
-
92
- > **For Building Services**: This section is for developers who want to build smart contracts that interact with existing EVVM instances. If you want to deploy your own complete EVVM instance, skip to [Deploy Your Own EVVM](#deploy-your-own-evvm).
93
-
94
- This repository can be used as a library in your Solidity projects through multiple installation methods:
95
-
96
- ### Installation Options
97
-
98
- #### Option 1: NPM
99
- ```bash
100
- npm install @evvm/testnet-contracts
101
- ```
102
-
103
- #### Option 2: Forge
104
- ```bash
105
- forge install EVVM-org/Testnet-Contracts
106
- ```
107
-
108
- ### Configuration
109
-
110
- #### If using NPM installation
111
- Add to your `foundry.toml`:
112
- ```toml
113
- remappings = [
114
- "@evvm/testnet-contracts/=node_modules/@evvm/testnet-contracts/src/",
115
- ]
116
- ```
117
-
118
- #### If using Forge installation
119
- Add to your `foundry.toml`:
120
- ```toml
121
- remappings = [
122
- "@evvm/testnet-contracts/=lib/Testnet-Contracts/src/",
123
- ]
124
- ```
125
-
126
- ### Package Structure
127
-
128
- ```
129
- @evvm/testnet-contracts/
130
- ├── src/
131
- │ ├── contracts/
132
- │ │ ├── evvm/Evvm.sol # Core EVVM implementation
133
- │ │ ├── nameService/NameService.sol # Domain name resolution
134
- │ │ ├── staking/Staking.sol # Staking mechanism
135
- │ │ ├── staking/Estimator.sol # Rewards estimation
136
- │ │ ├── treasury/Treasury.sol # Treasury management
137
- │ │ ├── treasuryTwoChains/ # Cross-chain treasury contracts
138
- │ │ └── p2pSwap/P2PSwap.sol # Peer-to-peer token exchange
139
- │ ├── interfaces/ # All contract interfaces
140
- │ └── lib/ # Utility libraries
141
- ```
142
-
143
- ### Quick Integration Example
144
-
145
- ```solidity
146
- // SPDX-License-Identifier: MIT
147
- pragma solidity ^0.8.19;
148
-
149
- import "@evvm/testnet-contracts/interfaces/IEvvm.sol";
150
- import "@evvm/testnet-contracts/interfaces/ITreasury.sol";
151
-
152
- contract MyDApp {
153
- IEvvm public immutable evvm;
154
- ITreasury public immutable treasury;
155
-
156
- constructor(address _evvm, address _treasury) {
157
- evvm = IEvvm(_evvm);
158
- treasury = ITreasury(_treasury);
159
- }
160
-
161
- function getEvvmInfo() external view returns (string memory name, uint256 id) {
162
- name = evvm.getEvvmName();
163
- id = evvm.getEvvmID();
164
- }
165
- }
166
- ```
167
-
168
- ### Available Contracts
169
-
170
- #### Core Contracts
171
- - `contracts/evvm/Evvm.sol` - Main EVVM virtual machine implementation
172
- - `contracts/nameService/NameService.sol` - Domain name resolution system
173
- - `contracts/staking/Staking.sol` - Token staking and rewards mechanism
174
- - `contracts/staking/Estimator.sol` - Staking rewards estimation and calculation
175
- - `contracts/treasury/Treasury.sol` - Manages deposits and withdrawals
176
- - `contracts/p2pSwap/P2PSwap.sol` - Peer-to-peer decentralized token exchange service
177
-
178
- #### Cross-chain Treasury
179
- - `contracts/treasuryTwoChains/TreasuryHostChainStation.sol` - Host chain treasury management
180
- - `contracts/treasuryTwoChains/TreasuryExternalChainStation.sol` - External chain treasury management
181
-
182
- #### Interfaces
183
- All contracts have corresponding interfaces in the `interfaces/` directory:
184
- - `interfaces/IEvvm.sol`
185
- - `interfaces/INameService.sol`
186
- - `interfaces/IStaking.sol`
187
- - `interfaces/IEstimator.sol`
188
- - `interfaces/ITreasury.sol`
189
- - `interfaces/ITreasuryHostChainStation.sol`
190
- - `interfaces/ITreasuryExternalChainStation.sol`
191
- - `interfaces/IP2PSwap.sol`
192
-
193
- #### Utility Libraries
194
- - `lib/AdvancedStrings.sol` - Advanced string manipulation utilities
195
- - `lib/SignatureRecover.sol` - Signature recovery utilities
196
- - `lib/Erc191TestBuilder.sol` - ERC-191 signature testing utilities
197
- - `lib/StakingServiceHooks.sol` - Simplified staking integration for service contracts
198
-
199
- ### Import Patterns
200
-
201
- #### Individual Contract Imports
202
- ```solidity
203
- import "@evvm/testnet-contracts/contracts/evvm/Evvm.sol";
204
- import "@evvm/testnet-contracts/interfaces/IEvvm.sol";
205
- import "@evvm/testnet-contracts/lib/AdvancedStrings.sol";
206
- ```
207
-
208
- #### Interface-Only Imports (Recommended for DApps)
209
- ```solidity
210
- import "@evvm/testnet-contracts/interfaces/IEvvm.sol";
211
- import "@evvm/testnet-contracts/interfaces/IStaking.sol";
212
- ```
213
-
214
- ### Dependencies
215
-
216
- #### If using NPM installation
217
- Dependencies are automatically handled when you install the package. However, you need to ensure you have the peer dependencies:
218
-
219
- ```bash
220
- npm install @openzeppelin/contracts
221
- ```
222
-
223
- For cross-chain functionality, you might also need:
224
- ```bash
225
- npm install @hyperlane-xyz/core
226
- ```
227
-
228
- #### If using Forge installation
229
- You need to manually install all dependencies:
230
-
231
- ```bash
232
- forge install OpenZeppelin/openzeppelin-contracts
233
- forge install hyperlane-xyz/hyperlane-monorepo # For cross-chain functionality
234
- ```
235
-
236
- ## Repository Structure
237
- - `evvm` — CLI executable - Main entry point for all EVVM commands
238
- - `cli/` — CLI source code (TypeScript)
239
- - `index.ts` — Main entry point and CLI initialization
240
- - `commands/` — Command implementations
241
- - `deploy/` — Deployment command modules
242
- - `deploySingle.ts` — Single-chain deployment
243
- - `deployCross.ts` — Cross-chain deployment
244
- - `register/` — Registration command modules
245
- - `registerSingle.ts` — Single-chain registration
246
- - `registerCross.ts` — Cross-chain registration
247
- - `developer.ts` — Developer utilities
248
- - `help.ts` — Help documentation
249
- - `version.ts` — Version information
250
- - `registerEvvm.ts` — EVVM registration logic
251
- - `setUpCrossChainTreasuries.ts` — Cross-chain treasury setup
252
- - `utils/` — Utility functions
253
- - `configurationInputs.ts` — Configuration input handling
254
- - `crossChain.ts` — Cross-chain utilities
255
- - `explorerVerification.ts` — Block explorer contract verification
256
- - `foundry.ts` — Foundry integration and scripts
257
- - `prompts.ts` — Interactive CLI prompts
258
- - `rpc.ts` — RPC endpoint management and fallback
259
- - `validators.ts` — Input validation functions
260
- - `constants/` — CLI constants and configuration
261
- - `ChainData.json` — Network and chain configuration data
262
- - `index.ts` — Constants exports
263
- - `types/` — TypeScript type definitions
264
- - `index.ts` — Type definitions
265
- - `src/contracts/evvm/` — Core EVVM contracts and storage
266
- - `src/contracts/nameService/` — NameService contracts for domain management
267
- - `src/contracts/staking/` — Staking and Estimator contracts
268
- - `src/contracts/treasury/` — Treasury contract for managing deposits and withdrawals
269
- - `src/contracts/p2pSwap/` — P2P token exchange service contracts
270
- - `src/lib/` — Shared Solidity libraries (AdvancedStrings, SignatureRecover, etc.)
271
- - `script/` — Foundry deployment scripts (e.g., `Deploy.s.sol`)
272
- - `lib/` — External dependencies (OpenZeppelin, Uniswap v3, forge-std)
273
- - `broadcast/` — Foundry deployment artifacts and transaction history
274
- - `cache/` — Foundry compilation cache
275
- - `input/` — Configuration files for deployment (generated by CLI)
276
-
277
- ## Prerequisites
278
- - [Foundry](https://getfoundry.sh/) (Solidity development toolkit)
279
- - [Bun](https://bun.sh/) v1.0 or higher (JavaScript runtime for CLI - faster than Node.js)
280
- - Git (for cloning and managing the repository)
281
- - Environment variables set up (`.env` file with API keys and RPC URLs)
282
-
283
- > **Note**: The CLI uses Bun for superior performance. If you don't have Bun installed, you can install it with:
284
- > ```bash
285
- > curl -fsSL https://bun.sh/install | bash
286
- > ```
287
-
288
- ### Environment Setup
289
- Create a `.env` file with your configuration:
290
- ```bash
291
- # Ethereum Sepolia RPC (primary endpoint)
292
- RPC_URL_ETH_SEPOLIA=https://0xrpc.io/sep
293
-
294
- # Arbitrum Sepolia RPC (primary endpoint)
295
- RPC_URL_ARB_SEPOLIA=https://sepolia-rollup.arbitrum.io/rpc
296
-
297
- # Etherscan API key for contract verification
298
- ETHERSCAN_API=<YOUR_ETHERSCAN_API_KEY>
299
- ```
300
-
301
- **Note**: The deployment wizard includes automatic RPC fallback mechanisms. If your primary RPC endpoint fails, it will automatically try alternative endpoints to ensure deployment success. See the [RPC Reliability](#rpc-reliability) section for details.
302
-
303
- ### Security Setup - Import Private Key
304
- Before deploying to testnets, securely import your private key using Foundry:
305
- ```bash
306
- cast wallet import defaultKey --interactive
307
- ```
308
- This command will prompt you to enter your private key securely. The key will be encrypted and stored locally by Foundry.
309
-
310
- > **Note**: `defaultKey` is the default alias used in the makefile and deployment scripts. If you prefer to use a different alias, simply replace `defaultKey` with your chosen name in both the import command and update the corresponding references in the makefile and scripts.
311
-
312
- > **Security Note**: Never commit real private keys to version control. Always use the secure wallet import method above for testnet and mainnet deployments.
313
-
314
- ## Key Dependencies
315
- - [OpenZeppelin Contracts](https://github.com/OpenZeppelin/openzeppelin-contracts)
316
-
317
- ## Deploy Your Own EVVM
318
-
319
- Want to create your own virtual blockchain? Follow these steps to deploy a complete EVVM instance on testnets:
320
-
321
- > **What you'll get**: Your own virtual blockchain with custom tokens, domain system, staking rewards, and treasury management - all deployed and verified on public testnets.
322
-
323
- ### 1. Clone and Install
26
+ Quick start (2 min)
27
+ 1) Clone & install
324
28
  ```bash
325
29
  git clone --recursive https://github.com/EVVM-org/Testnet-Contracts
326
30
  cd Testnet-Contracts
327
31
  make install
328
32
  ```
329
33
 
330
- ### 2. Make CLI Globally Available (Optional but Recommended)
331
- ```bash
332
- # Make the CLI executable
333
- chmod +x evvm
334
-
335
- # Add to your PATH (choose one method):
336
- # Method 1: Create symlink in local bin
337
- mkdir -p ~/.local/bin
338
- ln -s $(pwd)/evvm ~/.local/bin/evvm
339
-
340
- # Method 2: Add to PATH in your shell profile
341
- echo 'export PATH="'$(pwd)':$PATH"' >> ~/.bashrc # or ~/.zshrc
342
- source ~/.bashrc # or source ~/.zshrc
343
-
344
- # Verify installation
345
- evvm version
346
- ```
347
-
348
- Once installed, you can use `evvm` commands from anywhere in your terminal.
349
-
350
- ### 3. Environment Setup
351
- Create `.env` file with your configuration:
34
+ 2) Prepare environment
352
35
  ```bash
353
36
  cp .env.example .env
354
- # Add your RPC URLs and API keys
37
+ # Edit RPC_URL, ETHERSCAN_API, etc.
355
38
  ```
356
39
 
357
- ### 4. Secure Key Import
40
+ 3) Import wallet (secure)
358
41
  ```bash
359
42
  cast wallet import defaultKey --interactive
360
43
  ```
361
44
 
362
- ### 5. Deploy Using the CLI
363
-
364
- The **recommended way** to deploy is using the EVVM CLI. You have two options:
365
-
366
- **Option A: Using Global CLI (Recommended - if you completed step 2)**
367
- ```bash
368
- evvm deploy
369
- ```
370
-
371
- **Option B: Using NPM from the repository directory**
372
- ```bash
373
- npm run wizard
374
- ```
375
-
376
- **Option C: Using CLI with custom options**
45
+ 4) Deploy (interactive)
377
46
  ```bash
378
- # Skip interactive setup and use existing configuration
379
- evvm deploy --skipInputConfig
380
-
381
- # Deploy with a specific wallet
382
- evvm deploy --walletName myWallet
383
-
384
- # Combine options for quick deployment
385
- evvm deploy -s -w myWallet
386
- ```
387
-
388
- The interactive deployment wizard will guide you through:
389
- - **Prerequisites check** (Foundry, Git, Node.js)
390
- - **Dependency initialization** (git submodules - automatic)
391
- - **Administrator addresses** (admin, golden fisher, activator)
392
- - **EVVM metadata** (name, principal token details)
393
- - **Advanced parameters** (supply, rewards) - optional
394
- - **Network selection** (Ethereum Sepolia, Arbitrum Sepolia, or custom RPC)
395
- - **Wallet selection** (from your Foundry keystores)
396
- - **Automatic deployment** with contract verification
397
- - **Deployment summary** with all contract addresses and explorer links
398
- - **Registry EVVM registration** (cross-chain registration on Ethereum Sepolia)
399
- - **EVVM ID configuration** (automatic setup on your deployment chain)
400
-
401
- **What happens after deployment:**
402
- - All 6 core contracts deployed and verified on your chosen network
403
- - Complete deployment summary displayed with:
404
- - EVVM Core contract address
405
- - Treasury contract address
406
- - Staking, Estimator, NameService, and P2PSwap addresses
407
- - Direct links to block explorer for each contract
408
- - **Cross-chain registration flow:**
409
- 1. Registry registration happens on Ethereum Sepolia (where the Registry EVVM lives)
410
- 2. You receive a unique EVVM ID (e.g., ID: 1090)
411
- 3. The EVVM ID is then set on your deployed contract (on your deployment chain)
412
- 4. Both transactions show explorer links for verification
413
-
414
- That's it! Your EVVM virtual blockchain is now deployed, verified, and ready to use.
415
-
416
- ## CLI Commands Reference
417
-
418
- The EVVM CLI provides powerful commands for managing your EVVM deployments:
419
-
420
- ### Deploy Command
421
-
422
- Deploy a new EVVM instance with interactive configuration:
423
-
424
- ```bash
425
- evvm deploy [options]
426
- ```
427
-
428
- **Options:**
429
- - `--skipInputConfig`, `-s` - Skip interactive setup, use existing `./input/Inputs.sol`
430
- - `--walletName <name>`, `-w <name>` - Specify Foundry wallet (default: `defaultKey`)
431
-
432
- **Examples:**
433
- ```bash
434
- # Interactive deployment with configuration wizard
47
+ # If installed globally:
435
48
  evvm deploy
436
-
437
- # Deploy using existing configuration
438
- evvm deploy --skipInputConfig
439
-
440
- # Deploy with specific wallet
441
- evvm deploy --walletName myWallet
442
-
443
- # Quick deploy with existing config and custom wallet
444
- evvm deploy -s -w production
445
- ```
446
-
447
- ### Register Command
448
-
449
- Register an existing EVVM instance in the registry:
450
-
451
- ```bash
452
- evvm register [options]
453
- ```
454
-
455
- **Options:**
456
- - `--evvmAddress <address>` - EVVM contract address to register
457
- - `--walletName <name>`, `-w <name>` - Foundry wallet name (default: `defaultKey`)
458
- - `--useCustomEthRpc` - Use custom Ethereum Sepolia RPC for registry calls
459
-
460
- **Examples:**
461
- ```bash
462
- # Register with prompts for missing information
463
- evvm register
464
-
465
- # Register with specific EVVM address
466
- evvm register --evvmAddress 0x123...
467
-
468
- # Register with custom wallet and RPC
469
- evvm register --evvmAddress 0x123... --walletName myWallet --useCustomEthRpc
470
- ```
471
-
472
- **Note**: The RPC URL for your deployment chain is read from the `RPC_URL` environment variable in your `.env` file.
473
-
474
- ### Test Command
475
-
476
- Run the complete EVVM test suite:
477
-
478
- ```bash
479
- evvm fulltest
480
- ```
481
-
482
- Executes all unit tests with:
483
- - Test results summary
484
- - Detailed execution logs
485
- - Gas usage reports
486
- - Progress indicators
487
-
488
- ### Help Command
489
-
490
- Display comprehensive CLI documentation:
491
-
492
- ```bash
493
- evvm help
494
- # or
495
- evvm --help
496
- evvm -h
497
- ```
498
-
499
- ### Version Command
500
-
501
- Show current CLI version:
502
-
503
- ```bash
504
- evvm version
505
- # or
506
- evvm --version
507
- evvm -v
508
- ```
509
-
510
- ### Global Options
511
-
512
- These options work with any command:
513
-
514
- - `-h`, `--help` - Show help for the command
515
- - `-v`, `--version` - Show CLI version
516
-
517
- ### Environment Variables
518
-
519
- The CLI reads configuration from your `.env` file:
520
-
521
- ```bash
522
- # Required for deployment
523
- RPC_URL=https://sepolia-rollup.arbitrum.io/rpc
524
-
525
- # Optional: Custom Ethereum Sepolia RPC (for registry operations)
526
- ETH_SEPOLIA_RPC=https://eth-sepolia.public.blastapi.io
527
-
528
- # Optional: Block explorer API key for contract verification
529
- ETHERSCAN_API=your_api_key_here
530
-
531
- # Optional: For Blockscout verification
532
- BLOCKSCOUT_HOMEPAGE=https://sepolia.explorer.com
533
- ```
534
-
535
- ### CLI Features
536
-
537
- Automatic RPC Fallback:
538
- - Automatically tries 5 fallback endpoints if primary RPC fails
539
- - 99%+ deployment success rate
540
- - No manual intervention required
541
-
542
- Smart Prerequisites Check:
543
- - Validates Foundry installation
544
- - Verifies wallet configuration
545
- - Checks network connectivity
546
- - Initializes git submodules automatically
547
-
548
- Interactive Prompts:
549
- - Address validation with format checking
550
- - Secure password input for sensitive data
551
- - Arrow-key selection menus
552
- - Confirmation dialogs with defaults
553
-
554
- Comprehensive Error Handling:
555
- - Clear error messages with troubleshooting tips
556
- - Automatic retry on transient failures
557
- - Helpful suggestions for common issues
558
- - Direct links to documentation
559
-
560
- ## Manual Configuration (Alternative)
561
-
562
- If you prefer manual control over configuration, create these files in `input/`:
563
-
564
- **input/address.json**:
565
- ```json
566
- {
567
- "admin": "0x...",
568
- "goldenFisher": "0x...",
569
- "activator": "0x..."
570
- }
571
- ```
572
-
573
- **input/evvmBasicMetadata.json**:
574
- ```json
575
- {
576
- "EvvmName": "EVVM",
577
- "EvvmID": 1,
578
- "principalTokenName": "Mate token",
579
- "principalTokenSymbol": "MATE"
580
- }
581
- ```
582
-
583
- **input/evvmAdvancedMetadata.json**:
584
- ```json
585
- {
586
- "eraTokens": 1016666666500000000000000000,
587
- "reward": 5000000000000000000,
588
- "totalSupply": 2033333333000000000000000000
589
- }
590
- ```
591
-
592
- > **Important**: The field order in `evvmAdvancedMetadata.json` **must be alphabetical** (`eraTokens`, `reward`, `totalSupply`). Foundry's `vm.parseJson` decodes fields alphabetically, not by matching field names. Do not use code formatters (like Prettier) on these files as they may reorder fields incorrectly.
593
-
594
- ## Local Development & Manual Deployment
595
-
596
- ### Start Local Development
597
- ```bash
598
- make anvil # Start local blockchain
599
- make deployLocalTestnet # Deploy to local chain
600
- ```
601
-
602
- ### Manual Deployment to Testnets
603
-
604
- If you prefer to deploy manually after configuration:
605
-
606
- ```bash
607
- # Ethereum Sepolia
608
- make deployTestnet NETWORK=eth
609
-
610
- # Arbitrum Sepolia
611
- make deployTestnet NETWORK=arb
612
-
613
- # Custom RPC
614
- forge script script/DeployTestnet.s.sol:DeployTestnet \
615
- --rpc-url <YOUR_RPC_URL> \
616
- --account defaultKey \
617
- --broadcast \
618
- --verify \
619
- --etherscan-api-key $ETHERSCAN_API
620
- ```
621
-
622
- ## Development Commands
623
- ```bash
624
- make install # Install dependencies and compile
625
- make compile # Recompile contracts
626
- make seeSizes # Check contract sizes
627
- make help # Show all available commands
628
- ```
629
-
630
- ### NPM Scripts
631
- ```bash
632
- npm run wizard # Run interactive deployment wizard (uses CLI internally)
633
- npm run build # Copy src/ files to root (for NPM publishing)
634
- npm run clean # Remove copied files from root
635
- npm run compile # forge build
636
- npm run test # forge test
637
- npm run deploy:anvil # Deploy to local Anvil
638
- npm run deploy:sepolia # Deploy to Ethereum Sepolia
639
- npm run deploy:arbitrum # Deploy to Arbitrum Sepolia
640
- ```
641
-
642
- ### Direct CLI Usage
643
-
644
- Once you've set up the CLI executable, use it directly:
645
-
646
- ```bash
647
- evvm deploy # Deploy new EVVM instance
648
- evvm register # Register existing EVVM
649
- evvm fulltest # Run test suite
650
- evvm help # Show all commands
651
- evvm version # Show CLI version
652
- ```
653
-
654
- Advantages of direct CLI usage:
655
- - Faster execution with Bun runtime
656
- - Available globally from any directory
657
- - Cleaner syntax
658
- - Better error messages
659
- - Tab completion support in compatible shells
660
-
661
- ## RPC Reliability
662
-
663
- The deployment wizard includes an intelligent RPC fallback mechanism to ensure maximum deployment success rates, even when individual RPC providers experience downtime.
664
-
665
- ### How It Works
666
-
667
- **Automatic Failover**: If your primary RPC endpoint fails, the wizard automatically tries alternative endpoints without user intervention.
668
-
669
- **Multi-Provider Support**: Each network has 5 verified RPC endpoints:
670
-
671
- **Ethereum Sepolia Fallback Chain:**
672
- 1. `https://1rpc.io/sepolia` (1RPC - fastest)
673
- 2. `https://ethereum-sepolia.rpc.subquery.network/public` (SubQuery)
674
- 3. `https://ethereum-sepolia-rpc.publicnode.com` (PublicNode - stable)
675
- 4. `https://sepolia.drpc.org` (dRPC)
676
- 5. `https://gateway.tenderly.co/public/sepolia` (Tenderly)
677
-
678
- **Arbitrum Sepolia Fallback Chain:**
679
- 1. `https://sepolia-rollup.arbitrum.io/rpc` (Official Arbitrum)
680
- 2. `https://arbitrum-sepolia.gateway.tenderly.co` (Tenderly)
681
- 3. `https://endpoints.omniatech.io/v1/arbitrum/sepolia/public` (Omnia)
682
- 4. `https://arbitrum-sepolia-rpc.publicnode.com` (PublicNode)
683
- 5. `https://arbitrum-sepolia.drpc.org` (dRPC)
684
-
685
- **Smart Retry Logic**: The wizard displays clear progress messages during fallback attempts and provides troubleshooting tips if all endpoints fail.
686
-
687
- ### Benefits
688
- - **99%+ success rate** through endpoint redundancy
689
- - **Zero configuration** required for most users
690
- - **Automatic recovery** from individual RPC failures
691
- - **Clear visibility** into which RPC is being used
692
- - **Future-proof** against provider outages
693
-
694
- ## Deployment Summary
695
-
696
- After successful deployment, the wizard displays a comprehensive summary of all deployed contracts:
697
-
698
- ```
699
- DEPLOYED CONTRACTS SUMMARY
700
- ==========================
701
-
702
- Network: Arbitrum Sepolia (Chain ID: 421614)
703
-
704
- Core Contracts:
705
- EVVM: 0x3e562a2e932afd6c1630d5f3b8eb3d88a4b058c2
706
- https://sepolia.arbiscan.io/address/0x3e56...
707
- Treasury: 0x5c3a673dcf38e08b1f4e361ed7ed7be76df7b188
708
- https://sepolia.arbiscan.io/address/0x5c3a...
709
-
710
- Supporting Contracts:
711
- Staking: 0xcdef28d767f0029f0e75563c8e7ed44a2aab6cf2
712
- Estimator: 0xcfff3e950c3b1f7b850394d4cf3d60b31041f139
713
- NameService: 0xdfa5e2529b06683dcec37f67f0607f294809a512
714
- P2PSwap: 0xef2efb60d353731287696d74d360c635844f0ae2
715
-
716
- REGISTRY EVVM REGISTRATION
717
- ==========================
718
-
719
- EVVM Address: 0x3e562a2e932afd6c1630d5f3b8eb3d88a4b058c2
720
- Deployed on: Arbitrum Sepolia (Chain ID: 421614)
721
- Registry: Ethereum Sepolia (cross-chain registration)
722
-
723
- EVVM registered with ID: 1090
724
- EVVM ID 1090 set on Arbitrum Sepolia
725
- ```
726
-
727
- This summary includes:
728
- - Network name and chain ID
729
- - All 6 deployed contract addresses
730
- - Direct links to block explorer for verification (Etherscan for ETH Sepolia, Arbiscan for Arbitrum Sepolia)
731
- - Organized by contract importance (Core vs Supporting)
732
- - Cross-chain registration status and assigned EVVM ID
733
-
734
- ## Troubleshooting
735
-
736
- ### RPC Connection Issues
737
-
738
- Problem: Deployment fails with "Connection timed out" or "HTTP error 522"
739
-
740
- Solution: The wizard automatically tries fallback RPCs. If all fail:
741
- 1. Check your internet connection
742
- 2. Verify firewall/VPN settings aren't blocking RPC endpoints
743
- 3. Try again later (temporary provider downtime)
744
- 4. Update your `.env` file with a custom RPC from [chainlist.org](https://chainlist.org/)
745
-
746
- ### Wallet Not Found
747
-
748
- Problem: "No wallets found" error during deployment
749
-
750
- Solution:
751
- ```bash
752
- cast wallet import <WALLET_NAME> --interactive
753
- ```
754
- Then run the wizard again and select your imported wallet.
755
-
756
- ### Insufficient Funds
757
-
758
- Problem: Deployment fails with "insufficient funds for gas"
759
-
760
- Solution:
761
- 1. Get testnet ETH from faucets:
762
- - Ethereum Sepolia: [sepoliafaucet.com](https://sepoliafaucet.com/)
763
- - Arbitrum Sepolia: [faucet.quicknode.com/arbitrum/sepolia](https://faucet.quicknode.com/arbitrum/sepolia)
764
- 2. Verify your wallet address has received funds
765
- 3. Run the wizard again
766
-
767
- ### Git Submodules Not Initialized
768
-
769
- Problem: Compilation fails with missing dependencies
770
-
771
- Solution: The wizard automatically initializes submodules, but you can also do it manually:
772
- ```bash
773
- git submodule update --init --recursive
774
- ```
775
-
776
- ### Contract Size Too Large
777
-
778
- Problem: "Contract code size exceeds 24576 bytes"
779
-
780
- Solution: The project uses `via-ir` optimization to stay under limits. If you modified contracts:
781
- ```bash
782
- make seeSizes # Check contract sizes
783
- ```
784
- Consider refactoring large contracts or using libraries.
785
-
786
- ### CLI Command Not Found
787
-
788
- Problem: `evvm: command not found` when trying to run CLI commands
789
-
790
- Solution: The CLI executable is not in your PATH. You have three options:
791
-
792
- 1. **Run from the repository directory:**
793
- ```bash
794
- ./evvm deploy
795
- ```
796
-
797
- 2. **Add to PATH temporarily (current session only):**
798
- ```bash
799
- export PATH="$(pwd):$PATH"
800
- evvm deploy
801
- ```
802
-
803
- 3. **Add to PATH permanently (recommended):**
804
- ```bash
805
- # For bash
806
- echo 'export PATH="'$(pwd)':$PATH"' >> ~/.bashrc
807
- source ~/.bashrc
808
-
809
- # For zsh
810
- echo 'export PATH="'$(pwd)':$PATH"' >> ~/.zshrc
811
- source ~/.zshrc
812
- ```
813
-
814
- ### Bun Not Installed
815
-
816
- Problem: CLI fails with "bun: command not found"
817
-
818
- Solution: Install Bun runtime:
819
- ```bash
820
- curl -fsSL https://bun.sh/install | bash
821
-
822
- # Restart your terminal or run:
823
- source ~/.bashrc # or source ~/.zshrc
824
-
825
- # Verify installation
826
- bun --version
827
- ```
828
-
829
- ### TypeScript/TSX Not Found
830
-
831
- Problem: `npm run wizard` fails with "tsx: command not found"
832
-
833
- Solution:
834
- ```bash
835
- npm install # Reinstall dependencies
836
- ```
837
-
838
- ## Contract Architecture
839
- The EVVM ecosystem consists of six main contracts:
840
- - **Evvm.sol**: Core virtual machine implementation
841
- - **NameService.sol**: Domain name resolution system
842
- - **Staking.sol**: Token staking and rewards mechanism
843
- - **Estimator.sol**: Staking rewards estimation and calculation
844
- - **Treasury.sol**: Manages deposits and withdrawals of ETH and ERC20 tokens
845
- - **P2PSwap.sol**: Peer-to-peer decentralized exchange for token trading
846
-
847
-
848
- ## Configuration Files
849
- Key files for EVVM deployment:
850
- - `evvm` — CLI executable entry point (run with `./evvm` or just `evvm` if in PATH)
851
- - `cli/` — CLI implementation (TypeScript with Bun runtime)
852
- - `input/Inputs.sol` — Generated deployment configuration (created by CLI wizard)
853
- - `.env` — Environment variables (RPC URLs, API keys)
854
- - `foundry.toml` — Foundry project configuration
855
- - `makefile` — Build and deployment automation
856
- - `package.json` — NPM scripts and dependencies
857
-
858
- ## Contributing
859
-
860
- **Development Flow Context**: This repository is the next step after successful playground testing. It is dedicated to advanced integration, deployment, and validation on public testnets, before mainnet implementation.
861
-
862
- ### Development Flow
863
- 1. **Playground**: Prototype and experiment with new features in the playground repo.
864
- 2. **Testnet (this repo)**: Integrate, test, and validate on public testnets.
865
- 3. **Mainnet**: After successful testnet validation, proceed to mainnet deployment.
49
+ # Or from repo:
50
+ bun run evvm deploy
51
+ ```
52
+ Quick Start (CLI): https://www.evvm.info/docs/QuickStart
53
+
54
+ CLI - common commands
55
+ - evvm deploy # deploy EVVM (single or cross-chain)
56
+ - evvm register # register EVVM in registry
57
+ - evvm fulltest # run full test suite
58
+ - evvm help # show CLI help
59
+ - evvm version # CLI version
60
+
61
+ Library usage (quick)
62
+ - NPM: `npm install @evvm/testnet-contracts`
63
+ - Forge: `forge install EVVM-org/Testnet-Contracts`
64
+ - Import interfaces: `import "@evvm/testnet-contracts/interfaces/IEvvm.sol";`
65
+
66
+ Troubleshooting (short)
67
+ - RPC timeouts: CLI automatically tries fallback RPCs; set `RPC_URL` in `.env` to a reliable endpoint.
68
+ - Wallet not found: import with `cast wallet import <name> --interactive`.
69
+ - Bun missing: install Bun (`curl -fsSL https://bun.sh/install | bash`).
70
+ - Tests: run `evvm fulltest` or `forge test`.
71
+
72
+ Files & structure (short)
73
+ - `src/contracts/` — core contracts (Evvm, NameService, Staking, Treasury, P2PSwap)
74
+ - `cli/` — TypeScript CLI source
75
+ - `script/` Foundry deployment scripts
76
+ - `input/` — optional JSON/Sol files generated by CLI
77
+
78
+ Security & contributing (short)
79
+ - Never commit private keys. Use `cast wallet import`.
80
+ - Add tests for new features and open a PR.
866
81
 
867
82
  ### How to Contribute
868
83
  1. Fork the repository
@@ -128,9 +128,9 @@ contract P2PSwap is
128
128
  requestPay(
129
129
  user,
130
130
  metadata.tokenA,
131
- _nonce_Evvm,
132
131
  metadata.amountA,
133
132
  _priorityFee_Evvm,
133
+ _nonce_Evvm,
134
134
  _priority_Evvm,
135
135
  _signature_Evvm
136
136
  );
@@ -219,9 +219,9 @@ contract P2PSwap is
219
219
  requestPay(
220
220
  user,
221
221
  MATE_TOKEN_ADDRESS,
222
- _nonce_Evvm,
223
222
  0,
224
223
  _priorityFee_Evvm,
224
+ _nonce_Evvm,
225
225
  _priority_Evvm,
226
226
  _signature_Evvm
227
227
  );
@@ -295,9 +295,9 @@ contract P2PSwap is
295
295
  requestPay(
296
296
  user,
297
297
  metadata.tokenB,
298
- _nonce_Evvm,
299
298
  metadata.amountOfTokenBToFill,
300
299
  _priorityFee_Evvm,
300
+ _nonce_Evvm,
301
301
  _priority_Evvm,
302
302
  _signature_Evvm
303
303
  );
@@ -416,9 +416,9 @@ contract P2PSwap is
416
416
  requestPay(
417
417
  user,
418
418
  metadata.tokenB,
419
- _nonce_Evvm,
420
419
  metadata.amountOfTokenBToFill,
421
420
  _priorityFee_Evvm,
421
+ _nonce_Evvm,
422
422
  _priority_Evvm,
423
423
  _signature_Evvm
424
424
  );
@@ -58,9 +58,6 @@ interface IEvvm {
58
58
  function acceptImplementation() external;
59
59
  function addAmountToUser(address user, address token, uint256 amount) external;
60
60
  function addBalance(address user, address token, uint256 quantity) external;
61
- function payMultiple(EvvmStructs.PayData[] memory payData)
62
- external
63
- returns (uint256 successfulTransactions, bool[] memory results);
64
61
  function caPay(address to, address token, uint256 amount) external;
65
62
  function disperseCaPay(EvvmStructs.DisperseCaPayMetadata[] memory toData, address token, uint256 amount) external;
66
63
  function dispersePay(
@@ -108,6 +105,9 @@ interface IEvvm {
108
105
  address executor,
109
106
  bytes memory signature
110
107
  ) external;
108
+ function payMultiple(EvvmStructs.PayData[] memory payData)
109
+ external
110
+ returns (uint256 successfulTransactions, bool[] memory results);
111
111
  function pointStaker(address user, bytes1 answer) external;
112
112
  function proposeAdmin(address _newOwner) external;
113
113
  function proposeImplementation(address _newImpl) external;
@@ -8,7 +8,9 @@ import {IEvvm, EvvmStructs} from "@evvm/testnet-contracts/interfaces/IEvvm.sol";
8
8
  abstract contract EvvmPayments {
9
9
  IEvvm internal evvm;
10
10
 
11
- constructor(address evvmAddress) {}
11
+ constructor(address evvmAddress) {
12
+ evvm = IEvvm(evvmAddress);
13
+ }
12
14
 
13
15
  function requestPay(
14
16
  address from,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evvm/testnet-contracts",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "type": "module",
5
5
  "description": "EVVM Testnet Contracts - Smart contracts and tools for scalable, modular, and cross-chain EVM virtualization",
6
6
  "files": [