@evvm/testnet-contracts 2.2.0 → 2.2.2
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/LICENSE +2 -2
- package/README.md +46 -521
- package/contracts/evvm/Evvm.sol +28 -31
- package/contracts/evvm/lib/ErrorsLib.sol +2 -1
- package/contracts/evvm/lib/EvvmStructs.sol +27 -1
- package/contracts/evvm/lib/SignatureUtils.sol +2 -5
- package/contracts/nameService/NameService.sol +118 -363
- package/contracts/nameService/lib/ErrorsLib.sol +1 -7
- package/contracts/nameService/lib/IdentityValidation.sol +182 -0
- package/contracts/nameService/lib/NameServiceStructs.sol +69 -0
- package/contracts/nameService/lib/SignatureUtils.sol +11 -4
- package/contracts/p2pSwap/P2PSwap.sol +41 -154
- package/contracts/p2pSwap/lib/P2PSwapStructs.sol +59 -0
- package/contracts/p2pSwap/lib/SignatureUtils.sol +1 -2
- package/contracts/staking/Estimator.sol +7 -6
- package/contracts/staking/Staking.sol +46 -146
- package/contracts/staking/lib/SignatureUtils.sol +1 -2
- package/contracts/staking/lib/StakingStructs.sol +94 -0
- package/contracts/treasury/Treasury.sol +18 -20
- package/contracts/treasuryTwoChains/TreasuryExternalChainStation.sol +88 -35
- package/contracts/treasuryTwoChains/TreasuryHostChainStation.sol +81 -47
- package/contracts/treasuryTwoChains/lib/ErrorsLib.sol +2 -0
- package/contracts/treasuryTwoChains/lib/ExternalChainStationStructs.sol +3 -14
- package/contracts/treasuryTwoChains/lib/HostChainStationStructs.sol +3 -7
- package/contracts/treasuryTwoChains/lib/SignatureUtils.sol +5 -7
- package/interfaces/IEstimator.sol +7 -50
- package/interfaces/IEvvm.sol +16 -90
- package/interfaces/INameService.sol +37 -88
- package/interfaces/IP2PSwap.sol +19 -15
- package/interfaces/IStaking.sol +20 -50
- package/interfaces/ITreasury.sol +1 -4
- package/interfaces/ITreasuryExternalChainStation.sol +11 -15
- package/interfaces/ITreasuryHostChainStation.sol +7 -10
- package/library/Erc191TestBuilder.sol +0 -1
- package/library/EvvmService.sol +14 -78
- package/library/primitives/IERC20.sol +79 -0
- package/library/utils/GovernanceUtils.sol +81 -0
- package/library/utils/{service/AsyncNonceService.sol → nonces/AsyncNonce.sol} +9 -11
- package/library/utils/nonces/SyncNonce.sol +27 -0
- package/library/utils/service/EvvmPayments.sol +77 -0
- package/library/utils/service/StakingServiceUtils.sol +15 -20
- package/package.json +11 -13
- package/library/utils/service/MakeServicePaymentOnEvvm.sol +0 -49
- package/library/utils/service/SyncNonceService.sol +0 -18
package/LICENSE
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Copyright (c) 2025
|
|
2
|
-
|
|
2
|
+
MATE Labs Inc., a Delaware corporation ("Licensor")
|
|
3
3
|
|
|
4
4
|
EVVM is licensed under the EVVM Noncommercial License v1.0 (the "License").
|
|
5
5
|
You may obtain a copy of the License text in this file or at:
|
|
@@ -47,7 +47,7 @@ URL for them above, as well as copies of any plain-text lines
|
|
|
47
47
|
beginning with `Required Notice:` that the licensor provided
|
|
48
48
|
with the software. For example:
|
|
49
49
|
|
|
50
|
-
> Required Notice: Copyright (c) 2025
|
|
50
|
+
> Required Notice: Copyright (c) 2025 MATE Labs Inc., a Delaware corporation ("Licensor")
|
|
51
51
|
|
|
52
52
|
## Changes and New Works License
|
|
53
53
|
|
package/README.md
CHANGED
|
@@ -1,561 +1,86 @@
|
|
|
1
1
|
# EVVM Testnet Contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@evvm/testnet-contracts) [](LICENSE) [](https://www.evvm.info/)[](https://www.npmjs.com/package/@evvm/testnet-contracts)
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
23
|
-
- **Interactive TypeScript Wizard**: Modern, user-friendly deployment wizard with comprehensive guidance
|
|
24
|
-
- **Automatic RPC Fallback**: 99%+ deployment success rate with 5 fallback RPCs per network
|
|
25
|
-
- **Deployment Summary**: Instant access to all deployed contract addresses with explorer links
|
|
26
|
-
- **Auto Registry Integration**: Automatic EVVM registration and ID configuration
|
|
27
|
-
- **Smart Prerequisites Check**: Automatic dependency initialization and validation
|
|
28
|
-
- **Multi-Wallet Support**: Easy selection from your Foundry keystores
|
|
29
|
-
|
|
30
|
-
**Reliability Improvements:**
|
|
31
|
-
- Intelligent retry mechanism for network failures
|
|
32
|
-
- Comprehensive error handling and troubleshooting guides
|
|
33
|
-
- Verified high-performance RPC endpoints
|
|
34
|
-
- Zero-configuration setup for most users
|
|
35
|
-
|
|
36
|
-
## Use Cases
|
|
37
|
-
|
|
38
|
-
This repository serves two main purposes:
|
|
39
|
-
|
|
40
|
-
### Deploy Your Own EVVM Instance
|
|
41
|
-
Create and deploy a complete virtual blockchain with all EVVM contracts on testnets for experimentation and testing.
|
|
42
|
-
|
|
43
|
-
### Build Services Using Existing EVVM
|
|
44
|
-
Use EVVM contracts as a library to build services that interact with already deployed EVVM instances.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Quick Start Options
|
|
49
|
-
|
|
50
|
-
Choose your path based on what you want to achieve:
|
|
51
|
-
|
|
52
|
-
### Option A: Building Services on Existing EVVM
|
|
53
|
-
|
|
54
|
-
**Perfect if you want to create smart contracts that interact with already deployed EVVM instances.**
|
|
55
|
-
|
|
56
|
-
Simply install the library and start building:
|
|
14
|
+
Install the library (1 min)
|
|
57
15
|
|
|
58
16
|
```bash
|
|
59
|
-
#
|
|
17
|
+
# NPM (recommended for dApp developers)
|
|
60
18
|
npm install @evvm/testnet-contracts
|
|
61
19
|
|
|
62
|
-
#
|
|
20
|
+
# Or with Forge
|
|
63
21
|
forge install EVVM-org/Testnet-Contracts
|
|
64
22
|
```
|
|
65
23
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
**Next steps**: Jump to [Library Usage](#library-usage) section below.
|
|
69
|
-
|
|
70
|
-
### Option B: Deploy Your Own Complete EVVM Instance
|
|
71
|
-
|
|
72
|
-
**Perfect if you want to create your own virtual blockchain with custom tokens and governance.**
|
|
73
|
-
|
|
74
|
-
Follow the complete deployment process:
|
|
75
|
-
|
|
76
|
-
**What you get**: Your own virtual blockchain with custom tokens, domain system, staking rewards, and treasury management - all deployed and verified on public testnets.
|
|
77
|
-
|
|
78
|
-
**Next steps**: Jump to [Deploy Your Own EVVM](#deploy-your-own-evvm) section below.
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## Library Usage
|
|
83
|
-
|
|
84
|
-
> **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).
|
|
85
|
-
|
|
86
|
-
This repository can be used as a library in your Solidity projects through multiple installation methods:
|
|
87
|
-
|
|
88
|
-
### Installation Options
|
|
89
|
-
|
|
90
|
-
#### Option 1: NPM
|
|
91
|
-
```bash
|
|
92
|
-
npm install @evvm/testnet-contracts
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### Option 2: Forge
|
|
96
|
-
```bash
|
|
97
|
-
forge install EVVM-org/Testnet-Contracts
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Configuration
|
|
101
|
-
|
|
102
|
-
#### If using NPM installation
|
|
103
|
-
Add to your `foundry.toml`:
|
|
104
|
-
```toml
|
|
105
|
-
remappings = [
|
|
106
|
-
"@evvm/testnet-contracts/=node_modules/@evvm/testnet-contracts/src/",
|
|
107
|
-
]
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
#### If using Forge installation
|
|
111
|
-
Add to your `foundry.toml`:
|
|
112
|
-
```toml
|
|
113
|
-
remappings = [
|
|
114
|
-
"@evvm/testnet-contracts/=lib/Testnet-Contracts/src/",
|
|
115
|
-
]
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Package Structure
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
@evvm/testnet-contracts/
|
|
122
|
-
├── src/
|
|
123
|
-
│ ├── contracts/
|
|
124
|
-
│ │ ├── evvm/Evvm.sol # Core EVVM implementation
|
|
125
|
-
│ │ ├── nameService/NameService.sol # Domain name resolution
|
|
126
|
-
│ │ ├── staking/Staking.sol # Staking mechanism
|
|
127
|
-
│ │ ├── staking/Estimator.sol # Rewards estimation
|
|
128
|
-
│ │ ├── treasury/Treasury.sol # Treasury management
|
|
129
|
-
│ │ ├── treasuryTwoChains/ # Cross-chain treasury contracts
|
|
130
|
-
│ │ └── p2pSwap/P2PSwap.sol # Peer-to-peer token exchange
|
|
131
|
-
│ ├── interfaces/ # All contract interfaces
|
|
132
|
-
│ └── lib/ # Utility libraries
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Quick Integration Example
|
|
136
|
-
|
|
137
|
-
```solidity
|
|
138
|
-
// SPDX-License-Identifier: MIT
|
|
139
|
-
pragma solidity ^0.8.19;
|
|
140
|
-
|
|
141
|
-
import "@evvm/testnet-contracts/interfaces/IEvvm.sol";
|
|
142
|
-
import "@evvm/testnet-contracts/interfaces/ITreasury.sol";
|
|
143
|
-
|
|
144
|
-
contract MyDApp {
|
|
145
|
-
IEvvm public immutable evvm;
|
|
146
|
-
ITreasury public immutable treasury;
|
|
147
|
-
|
|
148
|
-
constructor(address _evvm, address _treasury) {
|
|
149
|
-
evvm = IEvvm(_evvm);
|
|
150
|
-
treasury = ITreasury(_treasury);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function getEvvmInfo() external view returns (string memory name, uint256 id) {
|
|
154
|
-
name = evvm.getEvvmName();
|
|
155
|
-
id = evvm.getEvvmID();
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Available Contracts
|
|
161
|
-
|
|
162
|
-
#### Core Contracts
|
|
163
|
-
- `contracts/evvm/Evvm.sol` - Main EVVM virtual machine implementation
|
|
164
|
-
- `contracts/nameService/NameService.sol` - Domain name resolution system
|
|
165
|
-
- `contracts/staking/Staking.sol` - Token staking and rewards mechanism
|
|
166
|
-
- `contracts/staking/Estimator.sol` - Staking rewards estimation and calculation
|
|
167
|
-
- `contracts/treasury/Treasury.sol` - Manages deposits and withdrawals
|
|
168
|
-
- `contracts/p2pSwap/P2PSwap.sol` - Peer-to-peer decentralized token exchange service
|
|
169
|
-
|
|
170
|
-
#### Cross-chain Treasury
|
|
171
|
-
- `contracts/treasuryTwoChains/TreasuryHostChainStation.sol` - Host chain treasury management
|
|
172
|
-
- `contracts/treasuryTwoChains/TreasuryExternalChainStation.sol` - External chain treasury management
|
|
173
|
-
|
|
174
|
-
#### Interfaces
|
|
175
|
-
All contracts have corresponding interfaces in the `interfaces/` directory:
|
|
176
|
-
- `interfaces/IEvvm.sol`
|
|
177
|
-
- `interfaces/INameService.sol`
|
|
178
|
-
- `interfaces/IStaking.sol`
|
|
179
|
-
- `interfaces/IEstimator.sol`
|
|
180
|
-
- `interfaces/ITreasury.sol`
|
|
181
|
-
- `interfaces/ITreasuryHostChainStation.sol`
|
|
182
|
-
- `interfaces/ITreasuryExternalChainStation.sol`
|
|
183
|
-
- `interfaces/IP2PSwap.sol`
|
|
184
|
-
|
|
185
|
-
#### Utility Libraries
|
|
186
|
-
- `lib/AdvancedStrings.sol` - Advanced string manipulation utilities
|
|
187
|
-
- `lib/SignatureRecover.sol` - Signature recovery utilities
|
|
188
|
-
- `lib/Erc191TestBuilder.sol` - ERC-191 signature testing utilities
|
|
189
|
-
- `lib/StakingServiceHooks.sol` - Simplified staking integration for service contracts
|
|
190
|
-
|
|
191
|
-
### Import Patterns
|
|
192
|
-
|
|
193
|
-
#### Individual Contract Imports
|
|
194
|
-
```solidity
|
|
195
|
-
import "@evvm/testnet-contracts/contracts/evvm/Evvm.sol";
|
|
196
|
-
import "@evvm/testnet-contracts/interfaces/IEvvm.sol";
|
|
197
|
-
import "@evvm/testnet-contracts/lib/AdvancedStrings.sol";
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
#### Interface-Only Imports (Recommended for DApps)
|
|
201
|
-
```solidity
|
|
202
|
-
import "@evvm/testnet-contracts/interfaces/IEvvm.sol";
|
|
203
|
-
import "@evvm/testnet-contracts/interfaces/IStaking.sol";
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Dependencies
|
|
207
|
-
|
|
208
|
-
#### If using NPM installation
|
|
209
|
-
Dependencies are automatically handled when you install the package. However, you need to ensure you have the peer dependencies:
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
npm install @openzeppelin/contracts
|
|
213
|
-
```
|
|
24
|
+
Guide: How to build on top of EVVM (library): https://www.evvm.info/docs/HowToMakeAEVVMService
|
|
214
25
|
|
|
215
|
-
|
|
26
|
+
Quick start (2 min)
|
|
27
|
+
1) Clone & install
|
|
216
28
|
```bash
|
|
217
|
-
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
#### If using Forge installation
|
|
221
|
-
You need to manually install all dependencies:
|
|
222
|
-
|
|
223
|
-
```bash
|
|
224
|
-
forge install OpenZeppelin/openzeppelin-contracts
|
|
225
|
-
forge install hyperlane-xyz/hyperlane-monorepo # For cross-chain functionality
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## Repository Structure
|
|
229
|
-
- `src/contracts/evvm/` — Core EVVM contracts and storage
|
|
230
|
-
- `src/contracts/nameService/` — NameService contracts for domain management
|
|
231
|
-
- `src/contracts/staking/` — Staking and Estimator contracts
|
|
232
|
-
- `src/contracts/treasury/` — Treasury contract for managing deposits and withdrawals
|
|
233
|
-
- `src/contracts/p2pSwap/` — P2P token exchange service contracts
|
|
234
|
-
- `src/lib/` — Shared Solidity libraries (AdvancedStrings, SignatureRecover, etc.)
|
|
235
|
-
- `script/` — Foundry deployment scripts (e.g., `DeployTestnet.s.sol`)
|
|
236
|
-
- `scripts/` — TypeScript utilities and deployment wizard (`evvm-init.ts`)
|
|
237
|
-
- `lib/` — External dependencies (OpenZeppelin, Uniswap v3, forge-std)
|
|
238
|
-
- `broadcast/` — Foundry deployment artifacts and transaction history
|
|
239
|
-
- `cache/` — Foundry compilation cache
|
|
240
|
-
- `input/` — Configuration files for deployment (generated by wizard)
|
|
241
|
-
- `evvm-init.sh` — Legacy bash wizard (deprecated, use `npm run wizard` instead)
|
|
242
|
-
|
|
243
|
-
## Prerequisites
|
|
244
|
-
- [Foundry](https://getfoundry.sh/) (Solidity development toolkit)
|
|
245
|
-
- [Node.js](https://nodejs.org/) v16 or higher (required for deployment wizard)
|
|
246
|
-
- Git (for cloning and managing the repository)
|
|
247
|
-
- Environment variables set up (`.env` file with API keys and RPC URLs)
|
|
248
|
-
|
|
249
|
-
### Environment Setup
|
|
250
|
-
Create a `.env` file with your configuration:
|
|
251
|
-
```bash
|
|
252
|
-
# Ethereum Sepolia RPC (primary endpoint)
|
|
253
|
-
RPC_URL_ETH_SEPOLIA=https://0xrpc.io/sep
|
|
254
|
-
|
|
255
|
-
# Arbitrum Sepolia RPC (primary endpoint)
|
|
256
|
-
RPC_URL_ARB_SEPOLIA=https://sepolia-rollup.arbitrum.io/rpc
|
|
257
|
-
|
|
258
|
-
# Etherscan API key for contract verification
|
|
259
|
-
ETHERSCAN_API=<YOUR_ETHERSCAN_API_KEY>
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
**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.
|
|
263
|
-
|
|
264
|
-
### Security Setup - Import Private Key
|
|
265
|
-
Before deploying to testnets, securely import your private key using Foundry:
|
|
266
|
-
```bash
|
|
267
|
-
cast wallet import defaultKey --interactive
|
|
268
|
-
```
|
|
269
|
-
This command will prompt you to enter your private key securely. The key will be encrypted and stored locally by Foundry.
|
|
270
|
-
|
|
271
|
-
> **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.
|
|
272
|
-
|
|
273
|
-
> **Security Note**: Never commit real private keys to version control. Always use the secure wallet import method above for testnet and mainnet deployments.
|
|
274
|
-
|
|
275
|
-
## Key Dependencies
|
|
276
|
-
- [OpenZeppelin Contracts](https://github.com/OpenZeppelin/openzeppelin-contracts)
|
|
277
|
-
|
|
278
|
-
## Deploy Your Own EVVM
|
|
279
|
-
|
|
280
|
-
Want to create your own virtual blockchain? Follow these steps to deploy a complete EVVM instance on testnets:
|
|
281
|
-
|
|
282
|
-
> **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.
|
|
283
|
-
|
|
284
|
-
### 1. Clone and Install
|
|
285
|
-
```bash
|
|
286
|
-
git clone https://github.com/EVVM-org/Testnet-Contracts
|
|
29
|
+
git clone --recursive https://github.com/EVVM-org/Testnet-Contracts
|
|
287
30
|
cd Testnet-Contracts
|
|
288
31
|
make install
|
|
289
32
|
```
|
|
290
33
|
|
|
291
|
-
|
|
292
|
-
Create `.env` file with your configuration:
|
|
34
|
+
2) Prepare environment
|
|
293
35
|
```bash
|
|
294
36
|
cp .env.example .env
|
|
295
|
-
#
|
|
37
|
+
# Edit RPC_URL, ETHERSCAN_API, etc.
|
|
296
38
|
```
|
|
297
39
|
|
|
298
|
-
|
|
40
|
+
3) Import wallet (secure)
|
|
299
41
|
```bash
|
|
300
42
|
cast wallet import defaultKey --interactive
|
|
301
43
|
```
|
|
302
44
|
|
|
303
|
-
|
|
45
|
+
4) Deploy (interactive)
|
|
304
46
|
```bash
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
- **Prerequisites check** (Foundry, Git, Node.js)
|
|
310
|
-
- **Dependency initialization** (git submodules - automatic)
|
|
311
|
-
- **Administrator addresses** (admin, golden fisher, activator)
|
|
312
|
-
- **EVVM metadata** (name, principal token details)
|
|
313
|
-
- **Advanced parameters** (supply, rewards) - optional
|
|
314
|
-
- **Network selection** (Ethereum Sepolia, Arbitrum Sepolia, or custom RPC)
|
|
315
|
-
- **Wallet selection** (from your Foundry keystores)
|
|
316
|
-
- **Automatic deployment** with contract verification
|
|
317
|
-
- **Deployment summary** with all contract addresses and explorer links
|
|
318
|
-
- **Registry EVVM registration** (automatic for supported networks)
|
|
319
|
-
- **EVVM ID configuration** (automatic setup)
|
|
320
|
-
|
|
321
|
-
**What happens after deployment:**
|
|
322
|
-
- All 6 core contracts deployed and verified on your chosen network
|
|
323
|
-
- Complete deployment summary displayed with:
|
|
324
|
-
- EVVM Core contract address
|
|
325
|
-
- Treasury contract address
|
|
326
|
-
- Staking, Estimator, NameService, and P2PSwap addresses
|
|
327
|
-
- Direct links to block explorer for each contract
|
|
328
|
-
- Automatic registration with Registry EVVM (Ethereum Sepolia)
|
|
329
|
-
- EVVM ID assigned and configured
|
|
330
|
-
|
|
331
|
-
That's it! Your EVVM virtual blockchain is now deployed, verified, and ready to use.
|
|
332
|
-
|
|
333
|
-
## Manual Configuration (Alternative)
|
|
334
|
-
|
|
335
|
-
If you prefer manual control over configuration, create these files in `input/`:
|
|
336
|
-
|
|
337
|
-
**input/address.json**:
|
|
338
|
-
```json
|
|
339
|
-
{
|
|
340
|
-
"admin": "0x...",
|
|
341
|
-
"goldenFisher": "0x...",
|
|
342
|
-
"activator": "0x..."
|
|
343
|
-
}
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
**input/evvmBasicMetadata.json**:
|
|
347
|
-
```json
|
|
348
|
-
{
|
|
349
|
-
"EvvmName": "EVVM",
|
|
350
|
-
"EvvmID": 1,
|
|
351
|
-
"principalTokenName": "Mate token",
|
|
352
|
-
"principalTokenSymbol": "MATE"
|
|
353
|
-
}
|
|
47
|
+
# If installed globally:
|
|
48
|
+
evvm deploy
|
|
49
|
+
# Or from repo:
|
|
50
|
+
bun run evvm deploy
|
|
354
51
|
```
|
|
52
|
+
Quick Start (CLI): https://www.evvm.info/docs/QuickStart
|
|
355
53
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
## Local Development & Manual Deployment
|
|
366
|
-
|
|
367
|
-
### Start Local Development
|
|
368
|
-
```bash
|
|
369
|
-
make anvil # Start local blockchain
|
|
370
|
-
make deployLocalTestnet # Deploy to local chain
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
### Manual Deployment to Testnets
|
|
374
|
-
|
|
375
|
-
If you prefer to deploy manually after configuration:
|
|
376
|
-
|
|
377
|
-
```bash
|
|
378
|
-
# Ethereum Sepolia
|
|
379
|
-
make deployTestnet NETWORK=eth
|
|
380
|
-
|
|
381
|
-
# Arbitrum Sepolia
|
|
382
|
-
make deployTestnet NETWORK=arb
|
|
383
|
-
|
|
384
|
-
# Custom RPC
|
|
385
|
-
forge script script/DeployTestnet.s.sol:DeployTestnet \
|
|
386
|
-
--rpc-url <YOUR_RPC_URL> \
|
|
387
|
-
--account defaultKey \
|
|
388
|
-
--broadcast \
|
|
389
|
-
--verify \
|
|
390
|
-
--etherscan-api-key $ETHERSCAN_API
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
## Development Commands
|
|
394
|
-
```bash
|
|
395
|
-
make install # Install dependencies and compile
|
|
396
|
-
make compile # Recompile contracts
|
|
397
|
-
make seeSizes # Check contract sizes
|
|
398
|
-
make help # Show all available commands
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
### NPM Scripts
|
|
402
|
-
```bash
|
|
403
|
-
npm run wizard # Run interactive deployment wizard (recommended)
|
|
404
|
-
npm run build # Copy src/ files to root (for NPM publishing)
|
|
405
|
-
npm run clean # Remove copied files from root
|
|
406
|
-
npm run compile # forge build
|
|
407
|
-
npm run test # forge test
|
|
408
|
-
npm run deploy:anvil # Deploy to local Anvil
|
|
409
|
-
npm run deploy:sepolia # Deploy to Ethereum Sepolia
|
|
410
|
-
npm run deploy:arbitrum # Deploy to Arbitrum Sepolia
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
## RPC Reliability
|
|
414
|
-
|
|
415
|
-
The deployment wizard includes an intelligent RPC fallback mechanism to ensure maximum deployment success rates, even when individual RPC providers experience downtime.
|
|
416
|
-
|
|
417
|
-
### How It Works
|
|
418
|
-
|
|
419
|
-
**Automatic Failover**: If your primary RPC endpoint fails, the wizard automatically tries alternative endpoints without user intervention.
|
|
420
|
-
|
|
421
|
-
**Multi-Provider Support**: Each network has 5 verified RPC endpoints:
|
|
422
|
-
|
|
423
|
-
**Ethereum Sepolia Fallback Chain:**
|
|
424
|
-
1. `https://0xrpc.io/sep` (Primary)
|
|
425
|
-
2. `https://ethereum-sepolia.rpc.subquery.network/public` (0.165s latency)
|
|
426
|
-
3. `https://ethereum-sepolia.gateway.tatum.io` (0.172s latency)
|
|
427
|
-
4. `https://sepolia.drpc.org` (0.192s latency)
|
|
428
|
-
5. `https://gateway.tenderly.co/public/sepolia` (0.184s latency)
|
|
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
|
|
429
60
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
4. `https://arbitrum-sepolia.drpc.org` (0.590s latency)
|
|
435
|
-
5. `https://arbitrum-sepolia-rpc.publicnode.com` (0.430s latency)
|
|
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";`
|
|
436
65
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
-
|
|
441
|
-
-
|
|
442
|
-
- **Automatic recovery** from individual RPC failures
|
|
443
|
-
- **Clear visibility** into which RPC is being used
|
|
444
|
-
- **Future-proof** against provider outages
|
|
445
|
-
|
|
446
|
-
## Deployment Summary
|
|
447
|
-
|
|
448
|
-
After successful deployment, the wizard displays a comprehensive summary of all deployed contracts:
|
|
449
|
-
|
|
450
|
-
```
|
|
451
|
-
═══════════════════════════════════════════════════════════
|
|
452
|
-
DEPLOYED CONTRACTS SUMMARY
|
|
453
|
-
═══════════════════════════════════════════════════════════
|
|
454
|
-
|
|
455
|
-
Network: Ethereum Sepolia (Chain ID: 11155111)
|
|
456
|
-
|
|
457
|
-
Core Contracts:
|
|
458
|
-
EVVM: 0xb0994626541c9bd3d64605dee610386c7a005a39
|
|
459
|
-
https://sepolia.etherscan.io/address/0xb099...
|
|
460
|
-
Treasury: 0x47be342c4d803490530737cac7bcf34916cf7e80
|
|
461
|
-
https://sepolia.etherscan.io/address/0x47be...
|
|
462
|
-
|
|
463
|
-
Supporting Contracts:
|
|
464
|
-
Staking: 0xc2cd4ec40bb4fa6f98c7b7095f692588e6b68fd4
|
|
465
|
-
Estimator: 0x1adf3fd08f0744f24bb29bbfcfb57a5f37f144cb
|
|
466
|
-
NameService: 0xe28eedff481b7c640394f44070309a0afe06de00
|
|
467
|
-
P2PSwap: 0xc90dc57d848fae4ecf46268b8a90015085968645
|
|
468
|
-
|
|
469
|
-
═══════════════════════════════════════════════════════════
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
This summary includes:
|
|
473
|
-
- Network name and chain ID
|
|
474
|
-
- All 6 deployed contract addresses
|
|
475
|
-
- Direct links to block explorer for verification
|
|
476
|
-
- Organized by contract importance (Core vs Supporting)
|
|
477
|
-
|
|
478
|
-
## Troubleshooting
|
|
479
|
-
|
|
480
|
-
### RPC Connection Issues
|
|
481
|
-
|
|
482
|
-
**Problem**: Deployment fails with "Connection timed out" or "HTTP error 522"
|
|
483
|
-
|
|
484
|
-
**Solution**: The wizard automatically tries fallback RPCs. If all fail:
|
|
485
|
-
1. Check your internet connection
|
|
486
|
-
2. Verify firewall/VPN settings aren't blocking RPC endpoints
|
|
487
|
-
3. Try again later (temporary provider downtime)
|
|
488
|
-
4. Update your `.env` file with a custom RPC from [chainlist.org](https://chainlist.org/)
|
|
489
|
-
|
|
490
|
-
### Wallet Not Found
|
|
491
|
-
|
|
492
|
-
**Problem**: "No wallets found" error during deployment
|
|
493
|
-
|
|
494
|
-
**Solution**:
|
|
495
|
-
```bash
|
|
496
|
-
cast wallet import <WALLET_NAME> --interactive
|
|
497
|
-
```
|
|
498
|
-
Then run the wizard again and select your imported wallet.
|
|
499
|
-
|
|
500
|
-
### Insufficient Funds
|
|
501
|
-
|
|
502
|
-
**Problem**: Deployment fails with "insufficient funds for gas"
|
|
503
|
-
|
|
504
|
-
**Solution**:
|
|
505
|
-
1. Get testnet ETH from faucets:
|
|
506
|
-
- Ethereum Sepolia: [sepoliafaucet.com](https://sepoliafaucet.com/)
|
|
507
|
-
- Arbitrum Sepolia: [faucet.quicknode.com/arbitrum/sepolia](https://faucet.quicknode.com/arbitrum/sepolia)
|
|
508
|
-
2. Verify your wallet address has received funds
|
|
509
|
-
3. Run the wizard again
|
|
510
|
-
|
|
511
|
-
### Git Submodules Not Initialized
|
|
512
|
-
|
|
513
|
-
**Problem**: Compilation fails with missing dependencies
|
|
514
|
-
|
|
515
|
-
**Solution**: The wizard automatically initializes submodules, but you can also do it manually:
|
|
516
|
-
```bash
|
|
517
|
-
git submodule update --init --recursive
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
### Contract Size Too Large
|
|
521
|
-
|
|
522
|
-
**Problem**: "Contract code size exceeds 24576 bytes"
|
|
523
|
-
|
|
524
|
-
**Solution**: The project uses `via-ir` optimization to stay under limits. If you modified contracts:
|
|
525
|
-
```bash
|
|
526
|
-
make seeSizes # Check contract sizes
|
|
527
|
-
```
|
|
528
|
-
Consider refactoring large contracts or using libraries.
|
|
529
|
-
|
|
530
|
-
### TypeScript/TSX Not Found
|
|
531
|
-
|
|
532
|
-
**Problem**: `npm run wizard` fails with "tsx: command not found"
|
|
533
|
-
|
|
534
|
-
**Solution**:
|
|
535
|
-
```bash
|
|
536
|
-
npm install # Reinstall dependencies
|
|
537
|
-
```
|
|
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`.
|
|
538
71
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
-
|
|
542
|
-
-
|
|
543
|
-
-
|
|
544
|
-
- **Estimator.sol**: Staking rewards estimation and calculation
|
|
545
|
-
- **Treasury.sol**: Manages deposits and withdrawals of ETH and ERC20 tokens
|
|
546
|
-
- **P2PSwap.sol**: Peer-to-peer decentralized exchange for token trading
|
|
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
|
|
547
77
|
|
|
78
|
+
Security & contributing (short)
|
|
79
|
+
- Never commit private keys. Use `cast wallet import`.
|
|
80
|
+
- Add tests for new features and open a PR.
|
|
548
81
|
|
|
549
|
-
|
|
550
|
-
Key files for EVVM deployment:
|
|
551
|
-
- `scripts/evvm-init.ts` — Interactive TypeScript deployment wizard (run with `npm run wizard`)
|
|
552
|
-
- `input/` — Generated configuration files (address.json, evvmBasicMetadata.json, evvmAdvancedMetadata.json)
|
|
553
|
-
- `.env` — Environment variables (RPC URLs, API keys)
|
|
554
|
-
- `foundry.toml` — Foundry project configuration
|
|
555
|
-
- `makefile` — Build and deployment automation
|
|
556
|
-
- `package.json` — NPM scripts and dependencies
|
|
82
|
+
If you want, I can further shorten a specific section (CLI, Library, or Troubleshooting).
|
|
557
83
|
|
|
558
|
-
## Contributing
|
|
559
84
|
|
|
560
85
|
**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.
|
|
561
86
|
|