@evvm/testnet-contracts 1.0.0

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 (34) hide show
  1. package/LICENSE +166 -0
  2. package/README.md +216 -0
  3. package/package.json +51 -0
  4. package/src/contracts/evvm/Evvm.sol +1327 -0
  5. package/src/contracts/evvm/EvvmLegacy.sol +1553 -0
  6. package/src/contracts/evvm/lib/ErrorsLib.sol +17 -0
  7. package/src/contracts/evvm/lib/EvvmStorage.sol +60 -0
  8. package/src/contracts/evvm/lib/EvvmStructs.sol +64 -0
  9. package/src/contracts/evvm/lib/SignatureUtils.sol +124 -0
  10. package/src/contracts/nameService/NameService.sol +1751 -0
  11. package/src/contracts/nameService/lib/ErrorsLib.sol +27 -0
  12. package/src/contracts/nameService/lib/SignatureUtils.sol +239 -0
  13. package/src/contracts/staking/Estimator.sol +358 -0
  14. package/src/contracts/staking/Staking.sol +1148 -0
  15. package/src/contracts/staking/lib/ErrorsLib.sol +19 -0
  16. package/src/contracts/staking/lib/SignatureUtils.sol +68 -0
  17. package/src/contracts/treasury/Treasury.sol +104 -0
  18. package/src/contracts/treasury/lib/ErrorsLib.sol +11 -0
  19. package/src/contracts/treasuryTwoChains/TreasuryExternalChainStation.sol +551 -0
  20. package/src/contracts/treasuryTwoChains/TreasuryHostChainStation.sol +512 -0
  21. package/src/contracts/treasuryTwoChains/lib/ErrorsLib.sol +15 -0
  22. package/src/contracts/treasuryTwoChains/lib/ExternalChainStationStructs.sol +41 -0
  23. package/src/contracts/treasuryTwoChains/lib/HostChainStationStructs.sol +52 -0
  24. package/src/contracts/treasuryTwoChains/lib/SignatureUtils.sol +47 -0
  25. package/src/interfaces/IEstimator.sol +102 -0
  26. package/src/interfaces/IEvvm.sol +195 -0
  27. package/src/interfaces/INameService.sol +283 -0
  28. package/src/interfaces/IStaking.sol +202 -0
  29. package/src/interfaces/ITreasury.sol +17 -0
  30. package/src/interfaces/ITreasuryExternalChainStation.sol +262 -0
  31. package/src/interfaces/ITreasuryHostChainStation.sol +251 -0
  32. package/src/lib/AdvancedStrings.sol +77 -0
  33. package/src/lib/Erc191TestBuilder.sol +402 -0
  34. package/src/lib/SignatureRecover.sol +56 -0
package/LICENSE ADDED
@@ -0,0 +1,166 @@
1
+ Copyright (c) 2025
2
+ GERMAN MARIA ABAL BAZZANO <g@evvm.org>
3
+
4
+ EVVM is licensed under the EVVM Noncommercial License v1.0 (the "License").
5
+ You may obtain a copy of the License text in this file or at:
6
+ https://polyformproject.org/licenses/noncommercial/1.0.0/
7
+
8
+ COMMERCIAL USE OF THIS SOFTWARE REQUIRES A SEPARATE COMMERCIAL LICENSE.
9
+ For commercial licensing, please contact g@evvm.org.
10
+
11
+ --------------------------------------------------------------------------------
12
+
13
+ # PolyForm Noncommercial License 1.0.0
14
+
15
+ https://polyformproject.org/licenses/noncommercial/1.0.0
16
+
17
+ ## Acceptance
18
+
19
+ In order to get any license under these terms, you must agree
20
+ to them as both strict obligations and conditions to all
21
+ your licenses.
22
+
23
+ ## Copyright License
24
+
25
+ The licensor grants you a copyright license for the
26
+ software to do everything you might do with the software
27
+ that would otherwise infringe the licensor's copyright
28
+ in it for any permitted purpose. However, you may
29
+ only distribute the software according to [Distribution
30
+ License](#distribution-license) and make changes or new works
31
+ based on the software according to [Changes and New Works
32
+ License](#changes-and-new-works-license).
33
+
34
+ ## Distribution License
35
+
36
+ The licensor grants you an additional copyright license
37
+ to distribute copies of the software. Your license
38
+ to distribute covers distributing the software with
39
+ changes and new works permitted by [Changes and New Works
40
+ License](#changes-and-new-works-license).
41
+
42
+ ## Notices
43
+
44
+ You must ensure that anyone who gets a copy of any part of
45
+ the software from you also gets a copy of these terms or the
46
+ URL for them above, as well as copies of any plain-text lines
47
+ beginning with `Required Notice:` that the licensor provided
48
+ with the software. For example:
49
+
50
+ > Required Notice: Copyright (c) 2025 GERMAN MARIA ABAL BAZZANO (g@evvm.org)
51
+
52
+ ## Changes and New Works License
53
+
54
+ The licensor grants you an additional copyright license to
55
+ make changes and new works based on the software for any
56
+ permitted purpose.
57
+
58
+ ## Patent License
59
+
60
+ The licensor grants you a patent license for the software that
61
+ covers patent claims the licensor can license, or becomes able
62
+ to license, that you would infringe by using the software.
63
+
64
+ ## Noncommercial Purposes
65
+
66
+ Any noncommercial purpose is a permitted purpose.
67
+
68
+ ## Personal Uses
69
+
70
+ Personal use for research, experiment, and testing for
71
+ the benefit of public knowledge, personal study, private
72
+ entertainment, hobby projects, amateur pursuits, or religious
73
+ observance, without any anticipated commercial application,
74
+ is use for a permitted purpose.
75
+
76
+ ## Noncommercial Organizations
77
+
78
+ Use by any charitable organization, educational institution,
79
+ public research organization, public safety or health
80
+ organization, environmental protection organization,
81
+ or government institution is use for a permitted purpose
82
+ regardless of the source of funding or obligations resulting
83
+ from the funding.
84
+
85
+ ## Fair Use
86
+
87
+ You may have "fair use" rights for the software under the
88
+ law. These terms do not limit them.
89
+
90
+ ## No Other Rights
91
+
92
+ These terms do not allow you to sublicense or transfer any of
93
+ your licenses to anyone else, or prevent the licensor from
94
+ granting licenses to anyone else. These terms do not imply
95
+ any other licenses.
96
+
97
+ ## Patent Defense
98
+
99
+ If you make any written claim that the software infringes or
100
+ contributes to infringement of any patent, your patent license
101
+ for the software granted under these terms ends immediately. If
102
+ your company makes such a claim, your patent license ends
103
+ immediately for work on behalf of your company.
104
+
105
+ ## Violations
106
+
107
+ The first time you are notified in writing that you have
108
+ violated any of these terms, or done anything with the software
109
+ not covered by your licenses, your licenses can nonetheless
110
+ continue if you come into full compliance with these terms,
111
+ and take practical steps to correct past violations, within
112
+ 32 days of receiving notice. Otherwise, all your licenses
113
+ end immediately.
114
+
115
+ ## No Liability
116
+
117
+ ***As far as the law allows, the software comes as is, without
118
+ any warranty or condition, and the licensor will not be liable
119
+ to you for any damages arising out of these terms or the use
120
+ or nature of the software, under any kind of legal claim.***
121
+
122
+ ## Definitions
123
+
124
+ The **licensor** is GERMAN MARIA ABAL BAZZANO (g@evvm.org),
125
+ and the **software** is EVVM and related components made
126
+ available under these terms.
127
+
128
+ **You** refers to the individual or entity agreeing to these
129
+ terms.
130
+
131
+ **Your company** is any legal entity, sole proprietorship,
132
+ or other kind of organization that you work for, plus all
133
+ organizations that have control over, are under the control of,
134
+ or are under common control with that organization. **Control**
135
+ means ownership of substantially all the assets of an entity,
136
+ or the power to direct its management and policies by vote,
137
+ contract, or otherwise. Control can be direct or indirect.
138
+
139
+ **Your licenses** are all the licenses granted to you for the
140
+ software under these terms.
141
+
142
+ **Use** means anything you do with the software requiring one
143
+ of your licenses.
144
+
145
+ --------------------------------------------------------------------------------
146
+
147
+ ADDITIONAL TERMS (Share-Alike Requirement):
148
+
149
+ 1. Any modifications, enhancements, or derivative works created under non-commercial use
150
+ must be publicly released under this same License within 90 days of creation,
151
+ distribution, or other availability.
152
+
153
+ 2. "Publicly released" requires making source code freely accessible on platforms like
154
+ GitHub or GitLab, with clear attribution to the original work.
155
+
156
+ 3. These terms supplement and do not replace any conditions in the PolyForm
157
+ Noncommercial 1.0.0 license.
158
+
159
+ --------------------------------------------------------------------------------
160
+
161
+ DISCLAIMER OF WARRANTY:
162
+ THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
163
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
164
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
165
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING
166
+ FROM THE USE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,216 @@
1
+ # EVVM Testnet Contracts
2
+
3
+ ![](https://github.com/user-attachments/assets/08d995ee-7512-42e4-a26c-0d62d2e8e0bf)
4
+
5
+ The Ethereum Virtual Virtual Machine (EVVM) ⚙️
6
+
7
+ **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.**
8
+
9
+ EVVM provides a comprehensive set of smart contracts and tools for scalable, modular, and cross-chain EVM virtualization. This repo is intended for developers who want to:
10
+ - Test and validate contracts on public testnets (Ethereum Sepolia, Arbitrum Sepolia)
11
+ - Prepare for mainnet deployment after testnet validation
12
+ - Contribute to the evolution of the EVVM protocol
13
+
14
+ ## Repository Structure
15
+ - `src/contracts/evvm/` — Core EVVM contracts and storage
16
+ - `src/contracts/nameService/` — NameService contracts for domain management
17
+ - `src/contracts/staking/` — Staking and Estimator contracts
18
+ - `src/contracts/treasury/` — Treasury contract for managing deposits and withdrawals
19
+ - `src/lib/` — Shared Solidity libraries (AdvancedStrings, SignatureRecover, etc.)
20
+ - `script/` — Deployment and automation scripts (e.g., `DeployTestnet.s.sol`)
21
+ - `lib/` — External dependencies (OpenZeppelin, Uniswap v3, forge-std)
22
+ - `broadcast/` — Foundry deployment artifacts and transaction history
23
+ - `cache/` — Foundry compilation cache
24
+ - `input/` — Configuration files for deployment (generated by `evvm-init.sh`)
25
+ - `evvm-init.sh` — Interactive setup and deployment script
26
+
27
+ ## Public EVVM Contract Address
28
+
29
+ ### Ethereum Sepolia Testnet
30
+ - **EVVM**: [0x2029bb5e15E22c19Bc8bde3426fab29dD4db8A98](https://sepolia.etherscan.io/address/0x2029bb5e15E22c19Bc8bde3426fab29dD4db8A98#code)
31
+ - **NameService**: [0xD904f38B8c9968AbAb63f47c21aB120FCe59F013](https://sepolia.etherscan.io/address/0xD904f38B8c9968AbAb63f47c21aB120FCe59F013#code)
32
+ - **Staking**: [0xA68D4a0cFFDc6145D35Ae27521d01b166Fe4AE46](https://sepolia.etherscan.io/address/0xA68D4a0cFFDc6145D35Ae27521d01b166Fe4AE46#code)
33
+ - **Estimator**: [0x2aBEAD7519c9AFc14eEc2582dDD9FF04f0da0F42](https://sepolia.etherscan.io/address/0x2aBEAD7519c9AFc14eEc2582dDD9FF04f0da0F42#code)
34
+ - **Treasury**: [0x98465F828b82d0b676937e159547F35BBDBdfe91](https://sepolia.etherscan.io/address/0x98465F828b82d0b676937e159547F35BBDBdfe91#code)
35
+
36
+ ### Arbitrum Sepolia Testnet
37
+ - **EVVM**: [0xC688C12541Ff85EF3E63755F6889317f312d03A3](https://sepolia.arbiscan.io/address/0xC688C12541Ff85EF3E63755F6889317f312d03A3#code)
38
+ - **NameService**: [0x82Fbac7857E8407cE6578E02B0be0d3Cd15Fb790](https://sepolia.arbiscan.io/address/0x82Fbac7857E8407cE6578E02B0be0d3Cd15Fb790#code)
39
+ - **Staking**: [0xaC3C70604a5633807Ae0149B6E6766452355635C](https://sepolia.arbiscan.io/address/0xaC3C70604a5633807Ae0149B6E6766452355635C#code)
40
+ - **Estimator**: [0xC4FF60fBAEf050FC476f4Ab10CA75378A2Cc79A3](https://sepolia.arbiscan.io/address/0xC4FF60fBAEf050FC476f4Ab10CA75378A2Cc79A3#code)
41
+ - **Treasury**: [0x7d4F9D95e84f6903c7247527e6BF1FA864F7c764](https://sepolia.arbiscan.io/address/0x7d4F9D95e84f6903c7247527e6BF1FA864F7c764#code)
42
+
43
+ ## Development Flow
44
+ 1. **Playground**: Prototype and experiment with new features in the playground repo.
45
+ 2. **Testnet (this repo)**: Integrate, test, and validate on public testnets.
46
+ 3. **Mainnet**: After successful testnet validation, proceed to mainnet deployment.
47
+
48
+ ## Prerequisites
49
+ - [Foundry](https://getfoundry.sh/) (Solidity development toolkit)
50
+ - Node.js (for dependency management)
51
+ - Bash shell (for running `evvm-init.sh`)
52
+ - Environment variables set up (`.env` file with API keys and RPC URLs)
53
+
54
+ ### Environment Setup
55
+ Create a `.env` file with your configuration:
56
+ ```bash
57
+ RPC_URL_ETH_SEPOLIA=<YOUR_ETH_SEPOLIA_RPC_URL>
58
+ RPC_URL_ARB_SEPOLIA=<YOUR_ARB_SEPOLIA_RPC_URL>
59
+ ETHERSCAN_API=<YOUR_ETHERSCAN_API_KEY>
60
+ ```
61
+
62
+ ### Security Setup - Import Private Key
63
+ Before deploying to testnets, securely import your private key using Foundry:
64
+ ```bash
65
+ cast wallet import defaultKey --interactive
66
+ ```
67
+ This command will prompt you to enter your private key securely. The key will be encrypted and stored locally by Foundry.
68
+
69
+ > **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.
70
+
71
+ > **Security Note**: Never commit real private keys to version control. Always use the secure wallet import method above for testnet and mainnet deployments.
72
+
73
+ ## Key Dependencies
74
+ - [OpenZeppelin Contracts](https://github.com/OpenZeppelin/openzeppelin-contracts)
75
+
76
+ ## Quick Start
77
+
78
+ Deploy your EVVM virtual blockchain on testnet in 4 simple steps:
79
+
80
+ ### 1. Clone and Install
81
+ ```bash
82
+ git clone https://github.com/EVVM-org/Testnet-Contracts
83
+ cd Testnet-Contracts
84
+ make install
85
+ ```
86
+
87
+ ### 2. Environment Setup
88
+ Create `.env` file with your configuration:
89
+ ```bash
90
+ cp .env.example .env
91
+ # Add your RPC URLs and API keys
92
+ ```
93
+
94
+ ### 3. Secure Key Import
95
+ ```bash
96
+ cast wallet import defaultKey --interactive
97
+ ```
98
+
99
+ ### 4. Interactive Setup & Deploy
100
+ ```bash
101
+ ./evvm-init.sh
102
+ ```
103
+
104
+ The wizard will configure:
105
+ - **Administrator addresses** (admin, golden fisher, activator)
106
+ - **EVVM metadata** (name, ID, principal token details)
107
+ - **Advanced parameters** (supply, rewards) - optional
108
+ - **Network selection** (Ethereum Sepolia, Arbitrum Sepolia, or custom)
109
+ - **Automatic deployment** with contract verification
110
+
111
+ That's it! Your EVVM virtual blockchain is now deployed and verified on your chosen host blockchain.
112
+
113
+ ## Manual Configuration (Alternative)
114
+
115
+ If you prefer manual control over configuration, create these files in `input/`:
116
+
117
+ **input/address.json**:
118
+ ```json
119
+ {
120
+ "admin": "0x...",
121
+ "goldenFisher": "0x...",
122
+ "activator": "0x..."
123
+ }
124
+ ```
125
+
126
+ **input/evvmBasicMetadata.json**:
127
+ ```json
128
+ {
129
+ "EvvmName": "EVVM",
130
+ "EvvmID": 1,
131
+ "principalTokenName": "Mate token",
132
+ "principalTokenSymbol": "MATE"
133
+ }
134
+ ```
135
+
136
+ **input/evvmAdvancedMetadata.json**:
137
+ ```json
138
+ {
139
+ "totalSupply": 2033333333000000000000000000,
140
+ "eraTokens": 1016666666500000000000000000,
141
+ "reward": 5000000000000000000
142
+ }
143
+ ```
144
+
145
+ ## Local Development
146
+ Start a local Anvil chain:
147
+ ```bash
148
+ make anvil
149
+ ```
150
+
151
+ Deploy contracts to local testnet:
152
+ ```bash
153
+ make deployLocalTestnet
154
+ ```
155
+
156
+ ## Manual Deployment
157
+
158
+ If you prefer to deploy manually after configuration:
159
+
160
+ ```bash
161
+ # Ethereum Sepolia
162
+ make deployTestnet NETWORK=eth
163
+
164
+ # Arbitrum Sepolia
165
+ make deployTestnet NETWORK=arb
166
+
167
+ # Custom RPC
168
+ forge script script/DeployTestnet.s.sol:DeployTestnet \
169
+ --rpc-url <YOUR_RPC_URL> \
170
+ --account defaultKey \
171
+ --broadcast \
172
+ --verify \
173
+ --etherscan-api-key $ETHERSCAN_API
174
+ ```
175
+
176
+ ## Local Development
177
+ ```bash
178
+ make anvil # Start local blockchain
179
+ make deployLocalTestnet # Deploy to local chain
180
+ ```
181
+
182
+ ## Development Commands
183
+ ```bash
184
+ make install # Install dependencies and compile
185
+ make compile # Recompile contracts
186
+ make seeSizes # Check contract sizes
187
+ make help # Show all available commands
188
+ ```
189
+
190
+ ## Contract Architecture
191
+ The EVVM ecosystem consists of five main contracts:
192
+ - **Evvm.sol**: Core virtual machine implementation
193
+ - **NameService.sol**: Domain name resolution system
194
+ - **Staking.sol**: Token staking and rewards mechanism
195
+ - **Estimator.sol**: Staking rewards estimation and calculation
196
+ - **Treasury.sol**: Manages deposits and withdrawals of ETH and ERC20 tokens
197
+ - **Treasury.sol**: Manages deposits and withdrawals of ETH and ERC20 tokens
198
+
199
+ ## Configuration Files
200
+ Key files for EVVM deployment:
201
+ - `evvm-init.sh` — Interactive setup wizard
202
+ - `input/` — Generated configuration files (address.json, evvmBasicMetadata.json, evvmAdvancedMetadata.json)
203
+ - `foundry.toml` — Foundry project configuration
204
+ - `makefile` — Build and deployment automation
205
+
206
+ ## Contributing
207
+ 1. Fork the repository
208
+ 2. Create a feature branch and make changes
209
+ 3. Add tests for new features
210
+ 4. Submit a PR with a detailed description
211
+
212
+ ## Security Best Practices
213
+ - **Never commit private keys**: Always use `cast wallet import <YOUR_ALIAS> --interactive` to securely store your keys
214
+ - **Use test credentials only**: This repository is for testnet deployment only
215
+ - **Environment variables**: Store sensitive data like API keys in `.env` files (not committed to git)
216
+ - **Verify contracts**: Always verify your deployed contracts on block explorers
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@evvm/testnet-contracts",
3
+ "version": "1.0.0",
4
+ "description": "EVVM Testnet Contracts - Smart contracts and tools for scalable, modular, and cross-chain EVM virtualization",
5
+ "files": [
6
+ "src/**/*.sol",
7
+ "README.md",
8
+ "LICENSE"
9
+ ],
10
+ "keywords": [
11
+ "evvm",
12
+ "ethereum",
13
+ "virtual-machine",
14
+ "solidity",
15
+ "smart-contracts",
16
+ "cross-chain",
17
+ "testnet",
18
+ "evm",
19
+ "blockchain",
20
+ "defi"
21
+ ],
22
+ "author": "EVVM Organization",
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/EVVM-org/Testnet-Contracts.git"
27
+ },
28
+ "homepage": "https://github.com/EVVM-org/Testnet-Contracts#readme",
29
+ "bugs": {
30
+ "url": "https://github.com/EVVM-org/Testnet-Contracts/issues"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "compile": "forge build",
37
+ "test": "forge test",
38
+ "deploy:anvil": "make deployLocalTestnet",
39
+ "deploy:sepolia": "make deployTestnet NETWORK=eth",
40
+ "deploy:arbitrum": "make deployTestnet NETWORK=arb"
41
+ },
42
+ "peerDependencies": {
43
+ "@openzeppelin/contracts": "^5.0.0"
44
+ },
45
+ "dependencies": {
46
+ "@hyperlane-xyz/core": "^3.6.1"
47
+ },
48
+ "devDependencies": {
49
+ "forge-std": "^1.0.0"
50
+ }
51
+ }