@evvm/testnet-contracts 2.3.0 → 3.0.1

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.
Files changed (67) hide show
  1. package/README.md +44 -24
  2. package/contracts/core/Core.sol +1392 -0
  3. package/contracts/core/lib/CoreStorage.sol +171 -0
  4. package/contracts/nameService/NameService.sol +613 -543
  5. package/contracts/nameService/lib/IdentityValidation.sol +15 -21
  6. package/contracts/p2pSwap/P2PSwap.sol +258 -145
  7. package/contracts/staking/Estimator.sol +25 -44
  8. package/contracts/staking/Staking.sol +284 -262
  9. package/contracts/treasury/Treasury.sol +40 -47
  10. package/contracts/treasuryTwoChains/TreasuryExternalChainStation.sol +585 -198
  11. package/contracts/treasuryTwoChains/TreasuryHostChainStation.sol +425 -174
  12. package/contracts/treasuryTwoChains/lib/PayloadUtils.sol +2 -4
  13. package/interfaces/{IEvvm.sol → ICore.sol} +58 -25
  14. package/interfaces/IEstimator.sol +1 -1
  15. package/interfaces/INameService.sol +46 -49
  16. package/interfaces/IP2PSwap.sol +16 -17
  17. package/interfaces/IStaking.sol +21 -17
  18. package/interfaces/ITreasury.sol +2 -1
  19. package/interfaces/ITreasuryExternalChainStation.sol +15 -9
  20. package/interfaces/ITreasuryHostChainStation.sol +14 -11
  21. package/interfaces/IUserValidator.sol +6 -0
  22. package/library/Erc191TestBuilder.sol +336 -471
  23. package/library/EvvmService.sol +27 -71
  24. package/library/errors/CoreError.sol +116 -0
  25. package/library/errors/CrossChainTreasuryError.sol +36 -0
  26. package/library/errors/NameServiceError.sol +79 -0
  27. package/library/errors/StakingError.sol +79 -0
  28. package/{contracts/treasury/lib/ErrorsLib.sol → library/errors/TreasuryError.sol} +9 -17
  29. package/library/structs/CoreStructs.sol +146 -0
  30. package/library/structs/ExternalChainStationStructs.sol +92 -0
  31. package/library/structs/HostChainStationStructs.sol +77 -0
  32. package/library/structs/NameServiceStructs.sol +47 -0
  33. package/library/structs/P2PSwapStructs.sol +127 -0
  34. package/library/structs/StakingStructs.sol +67 -0
  35. package/library/utils/AdvancedStrings.sol +62 -44
  36. package/library/utils/CAUtils.sol +29 -0
  37. package/library/utils/governance/Admin.sol +66 -0
  38. package/library/utils/governance/ProposalStructs.sol +49 -0
  39. package/library/utils/service/CoreExecution.sol +158 -0
  40. package/library/utils/service/StakingServiceUtils.sol +20 -37
  41. package/library/utils/signature/CoreHashUtils.sol +73 -0
  42. package/library/utils/signature/NameServiceHashUtils.sol +156 -0
  43. package/library/utils/signature/P2PSwapHashUtils.sol +65 -0
  44. package/library/utils/signature/StakingHashUtils.sol +41 -0
  45. package/library/utils/signature/TreasuryCrossChainHashUtils.sol +40 -0
  46. package/package.json +1 -1
  47. package/contracts/evvm/Evvm.sol +0 -1300
  48. package/contracts/evvm/lib/ErrorsLib.sol +0 -131
  49. package/contracts/evvm/lib/EvvmStorage.sol +0 -217
  50. package/contracts/evvm/lib/EvvmStructs.sol +0 -208
  51. package/contracts/evvm/lib/SignatureUtils.sol +0 -162
  52. package/contracts/nameService/lib/ErrorsLib.sol +0 -155
  53. package/contracts/nameService/lib/NameServiceStructs.sol +0 -125
  54. package/contracts/nameService/lib/SignatureUtils.sol +0 -420
  55. package/contracts/p2pSwap/lib/P2PSwapStructs.sol +0 -59
  56. package/contracts/p2pSwap/lib/SignatureUtils.sol +0 -98
  57. package/contracts/staking/lib/ErrorsLib.sol +0 -98
  58. package/contracts/staking/lib/SignatureUtils.sol +0 -105
  59. package/contracts/staking/lib/StakingStructs.sol +0 -106
  60. package/contracts/treasuryTwoChains/lib/ErrorsLib.sol +0 -48
  61. package/contracts/treasuryTwoChains/lib/ExternalChainStationStructs.sol +0 -80
  62. package/contracts/treasuryTwoChains/lib/HostChainStationStructs.sol +0 -87
  63. package/contracts/treasuryTwoChains/lib/SignatureUtils.sol +0 -79
  64. package/library/utils/GovernanceUtils.sol +0 -81
  65. package/library/utils/nonces/AsyncNonce.sol +0 -74
  66. package/library/utils/nonces/SyncNonce.sol +0 -71
  67. package/library/utils/service/EvvmPayments.sol +0 -144
package/README.md CHANGED
@@ -1,18 +1,19 @@
1
1
  # EVVM Testnet Contracts
2
2
 
3
- ![Solidity](https://img.shields.io/badge/Solidity-^0.8.0-363636?logo=solidity)
4
- ![Foundry](https://img.shields.io/badge/Built%20with-Foundry-FFDB1C?logo=foundry)
3
+ ![Version](https://img.shields.io/badge/version-3.0.1%20%22Ichiban%22-red.svg)
4
+ ![Solidity](https://img.shields.io/badge/Solidity-^0.8.0-363636?logo=solidity)
5
+ ![Foundry](https://img.shields.io/badge/Built%20with-Foundry-FFDB1C?logo=foundry)
5
6
  ![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?logo=typescript)
6
7
  ![Bun](https://img.shields.io/badge/Runtime-Bun-000000?logo=bun)
7
- [![npm version](https://img.shields.io/npm/v/@evvm/testnet-contracts.svg)](https://www.npmjs.com/package/@evvm/testnet-contracts)
8
- [![license](https://img.shields.io/badge/license-EVVM--NONCOMMERCIAL--1.0-blue.svg)](LICENSE)
8
+ [![license](https://img.shields.io/badge/license-EVVM--NONCOMMERCIAL--1.0-blue.svg)](LICENSE)
9
9
  [![docs](https://img.shields.io/badge/docs-evvm.info-blue.svg)](https://www.evvm.info/)
10
10
  [![npm downloads](https://img.shields.io/npm/dw/@evvm/testnet-contracts.svg)](https://www.npmjs.com/package/@evvm/testnet-contracts)
11
- ![Status](https://img.shields.io/badge/Status-Active-brightgreen)
11
+ ![Status](https://img.shields.io/badge/Status-Active-brightgreen)
12
12
 
13
13
  A compact toolkit for creating virtual EVM chains on testnets.
14
14
 
15
15
  Two ways to use EVVM:
16
+
16
17
  1. As a library - Import Solidity contracts in your dApp
17
18
  2. As a CLI tool - Deploy and manage EVVM instances on testnets
18
19
 
@@ -23,18 +24,21 @@ Docs & hosted library: https://www.evvm.info/
23
24
  ### Install the library (1 min)
24
25
 
25
26
  **NPM (recommended):**
27
+
26
28
  ```bash
27
29
  npm install @evvm/testnet-contracts
28
30
  ```
29
31
 
30
32
  **Or with Forge:**
33
+
31
34
  ```bash
32
35
  forge install EVVM-org/Testnet-Contracts
33
36
  ```
34
37
 
35
38
  **Import in your contracts:**
39
+
36
40
  ```solidity
37
- import "@evvm/testnet-contracts/interfaces/IEvvm.sol";
41
+ import "@evvm/testnet-contracts/interfaces/ICore.sol";
38
42
  ```
39
43
 
40
44
  Guide: How to build on top of EVVM: https://www.evvm.info/docs/HowToMakeAEVVMService
@@ -50,7 +54,9 @@ Before deploying with the CLI, ensure you have the following installed:
50
54
  - **Git** - [Install](https://git-scm.com/downloads)
51
55
 
52
56
  ### Quick start (2 min)
53
- 1) Clone & install
57
+
58
+ 1. Clone & install
59
+
54
60
  ```bash
55
61
  git clone --recursive https://github.com/EVVM-org/Testnet-Contracts
56
62
  cd Testnet-Contracts
@@ -64,30 +70,35 @@ bun install
64
70
  forge install
65
71
  ```
66
72
 
67
- 2) Prepare environment
73
+ 2. Prepare environment
74
+
68
75
  ```bash
69
76
  cp .env.example .env
70
77
  # Edit RPC_URL, ETHERSCAN_API, etc.
71
78
  ```
72
79
 
73
- 3) Import wallet (secure)
80
+ 3. Import wallet (secure)
81
+
74
82
  ```bash
75
83
  cast wallet import defaultKey --interactive
76
84
  ```
77
85
 
78
- 4) Deploy (interactive)
86
+ 4. Deploy (interactive)
79
87
 
80
88
  If you are on Linux or macOS, run:
89
+
81
90
  ```bash
82
91
  ./evvm deploy
83
92
  ```
84
93
 
85
94
  If you are on Windows, run on PowerShell:
95
+
86
96
  ```powershell
87
97
  .\evvm.bat deploy
88
98
  ```
89
99
 
90
100
  Or use Bun from any directory:
101
+
91
102
  ```bash
92
103
  bun run evvm deploy
93
104
  ```
@@ -97,22 +108,24 @@ bun run evvm deploy
97
108
  The repository includes platform-specific wrapper scripts to easily call the CLI:
98
109
 
99
110
  **Linux/macOS:**
111
+
100
112
  ```bash
101
113
  # Make script executable (first time only)
102
114
  chmod +x ./evvm
103
115
 
104
116
  # Run any EVVM CLI command
105
117
  ./evvm deploy
106
- ./evvm register --evvmAddress 0x...
118
+ ./evvm register --coreAddress 0x...
107
119
  ./evvm developer --makeInterface
108
120
  ./evvm help
109
121
  ```
110
122
 
111
123
  **Windows (PowerShell):**
124
+
112
125
  ```powershell
113
126
  # Run any EVVM CLI command
114
127
  .\evvm.bat deploy
115
- .\evvm.bat register --evvmAddress 0x...
128
+ .\evvm.bat register --coreAddress 0x...
116
129
  .\evvm.bat developer --makeInterface
117
130
  .\evvm.bat help
118
131
  ```
@@ -124,31 +137,36 @@ Quick Start (CLI): https://www.evvm.info/docs/QuickStart
124
137
  ## CLI - Available Commands
125
138
 
126
139
  **Deployment & Registration:**
127
- - `evvm deploy` # Deploy EVVM (single or cross-chain)
128
- - `evvm deploy --skipInputConfig` # Deploy with existing config (no prompts)
129
- - `evvm deploy --crossChain` # Deploy cross-chain EVVM instance
130
- - `evvm register --evvmAddress <addr>` # Register EVVM in registry
131
- - `evvm register --crossChain` # Register cross-chain EVVM
140
+
141
+ - `evvm deploy` # Deploy EVVM (single or cross-chain)
142
+ - `evvm deploy --skipInputConfig` # Deploy with existing config (no prompts)
143
+ - `evvm deploy --crossChain` # Deploy cross-chain EVVM instance
144
+ - `evvm register --coreAddress <addr>` # Register EVVM in registry
145
+ - `evvm register --crossChain` # Register cross-chain EVVM
132
146
 
133
147
  **Cross-Chain Management:**
134
- - `evvm setUpCrossChainTreasuries` # Configure treasury station connections
148
+
149
+ - `evvm setUpCrossChainTreasuries` # Configure treasury station connections
135
150
 
136
151
  **Developer Utilities:**
137
- - `evvm developer --makeInterface` # Generate Solidity interfaces from contracts
138
- - `evvm developer --runTest` # Run test suites with custom filters
139
- - `evvm install` # Install Bun and Foundry dependencies
152
+
153
+ - `evvm developer --makeInterface` # Generate Solidity interfaces from contracts
154
+ - `evvm developer --runTest` # Run test suites with custom filters
155
+ - `evvm install` # Install Bun and Foundry dependencies
140
156
 
141
157
  **Information:**
142
- - `evvm help` # Show comprehensive CLI help
143
- - `evvm version` # Show CLI version
158
+
159
+ - `evvm help` # Show comprehensive CLI help
160
+ - `evvm version` # Show CLI version
144
161
 
145
162
  ## Library Usage (Quick Reference)
146
163
 
147
164
  - **NPM install:** `npm install @evvm/testnet-contracts`
148
165
  - **Forge install:** `forge install EVVM-org/Testnet-Contracts`
149
- - **Import in Solidity:** `import "@evvm/testnet-contracts/interfaces/IEvvm.sol";`
166
+ - **Import in Solidity:** `import "@evvm/testnet-contracts/interfaces/ICore.sol";`
150
167
 
151
168
  ## Troubleshooting
169
+
152
170
  - **RPC timeouts**: CLI automatically tries fallback RPCs; set `RPC_URL` in `.env` to a reliable endpoint.
153
171
  - **Wallet not found**: import with `cast wallet import <name> --interactive`.
154
172
  - **Bun missing**: install Bun (`curl -fsSL https://bun.sh/install | bash`).
@@ -157,6 +175,7 @@ Quick Start (CLI): https://www.evvm.info/docs/QuickStart
157
175
  - **Wrong architecture detected**: The wrapper scripts auto-detect OS/architecture. If issues occur, manually run the correct binary from `.executables/`.
158
176
 
159
177
  Files & structure (short)
178
+
160
179
  - `src/contracts/` — core contracts (Evvm, NameService, Staking, Treasury, P2PSwap)
161
180
  - `cli/` — TypeScript CLI source
162
181
  - `script/` — Foundry deployment scripts
@@ -189,6 +208,7 @@ We welcome contributions from the community! Here's how you can help:
189
208
  - **Commit Messages**: Write clear, descriptive commit messages
190
209
 
191
210
  ## Security Best Practices
211
+
192
212
  - **Never commit private keys**: Always use `cast wallet import <YOUR_ALIAS> --interactive` to securely store your keys
193
213
  - **Use test credentials only**: This repository is for testnet deployment only
194
214
  - **Environment variables**: Store sensitive data like API keys in `.env` files (not committed to git)