@evvm/testnet-contracts 2.0.3 → 2.1.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.
- package/README.md +10 -2
- package/contracts/nameService/NameService.sol +13 -5
- package/contracts/p2pSwap/P2PSwap.sol +1361 -0
- package/contracts/p2pSwap/lib/SignatureUtils.sol +100 -0
- package/contracts/staking/Estimator.sol +1 -1
- package/interfaces/INameService.sol +5 -48
- package/interfaces/IP2PSwap.sol +135 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ EVVM provides a complete ecosystem of smart contracts:
|
|
|
17
17
|
- **Staking**: Token staking and rewards system
|
|
18
18
|
- **Treasury**: Secure fund management inside the host chain or across chains
|
|
19
19
|
- **Estimator**: Reward calculation and optimization
|
|
20
|
+
- **P2PSwap**: Peer-to-peer token exchange service with automated market making
|
|
20
21
|
|
|
21
22
|
## Use Cases
|
|
22
23
|
|
|
@@ -111,7 +112,8 @@ remappings = [
|
|
|
111
112
|
│ │ ├── staking/Staking.sol # Staking mechanism
|
|
112
113
|
│ │ ├── staking/Estimator.sol # Rewards estimation
|
|
113
114
|
│ │ ├── treasury/Treasury.sol # Treasury management
|
|
114
|
-
│ │
|
|
115
|
+
│ │ ├── treasuryTwoChains/ # Cross-chain treasury contracts
|
|
116
|
+
│ │ └── p2pSwap/P2PSwap.sol # Peer-to-peer token exchange
|
|
115
117
|
│ ├── interfaces/ # All contract interfaces
|
|
116
118
|
│ └── lib/ # Utility libraries
|
|
117
119
|
```
|
|
@@ -149,6 +151,7 @@ contract MyDApp {
|
|
|
149
151
|
- `contracts/staking/Staking.sol` - Token staking and rewards mechanism
|
|
150
152
|
- `contracts/staking/Estimator.sol` - Staking rewards estimation and calculation
|
|
151
153
|
- `contracts/treasury/Treasury.sol` - Manages deposits and withdrawals
|
|
154
|
+
- `contracts/p2pSwap/P2PSwap.sol` - Peer-to-peer decentralized token exchange service
|
|
152
155
|
|
|
153
156
|
#### Cross-chain Treasury
|
|
154
157
|
- `contracts/treasuryTwoChains/TreasuryHostChainStation.sol` - Host chain treasury management
|
|
@@ -163,11 +166,13 @@ All contracts have corresponding interfaces in the `interfaces/` directory:
|
|
|
163
166
|
- `interfaces/ITreasury.sol`
|
|
164
167
|
- `interfaces/ITreasuryHostChainStation.sol`
|
|
165
168
|
- `interfaces/ITreasuryExternalChainStation.sol`
|
|
169
|
+
- `interfaces/IP2PSwap.sol`
|
|
166
170
|
|
|
167
171
|
#### Utility Libraries
|
|
168
172
|
- `lib/AdvancedStrings.sol` - Advanced string manipulation utilities
|
|
169
173
|
- `lib/SignatureRecover.sol` - Signature recovery utilities
|
|
170
174
|
- `lib/Erc191TestBuilder.sol` - ERC-191 signature testing utilities
|
|
175
|
+
- `lib/StakingServiceHooks.sol` - Simplified staking integration for service contracts
|
|
171
176
|
|
|
172
177
|
### Import Patterns
|
|
173
178
|
|
|
@@ -211,6 +216,7 @@ forge install hyperlane-xyz/hyperlane-monorepo # For cross-chain functionality
|
|
|
211
216
|
- `src/contracts/nameService/` — NameService contracts for domain management
|
|
212
217
|
- `src/contracts/staking/` — Staking and Estimator contracts
|
|
213
218
|
- `src/contracts/treasury/` — Treasury contract for managing deposits and withdrawals
|
|
219
|
+
- `src/contracts/p2pSwap/` — P2P token exchange service contracts
|
|
214
220
|
- `src/lib/` — Shared Solidity libraries (AdvancedStrings, SignatureRecover, etc.)
|
|
215
221
|
- `script/` — Deployment and automation scripts (e.g., `DeployTestnet.s.sol`)
|
|
216
222
|
- `lib/` — External dependencies (OpenZeppelin, Uniswap v3, forge-std)
|
|
@@ -355,12 +361,14 @@ make help # Show all available commands
|
|
|
355
361
|
```
|
|
356
362
|
|
|
357
363
|
## Contract Architecture
|
|
358
|
-
The EVVM ecosystem consists of
|
|
364
|
+
The EVVM ecosystem consists of six main contracts:
|
|
359
365
|
- **Evvm.sol**: Core virtual machine implementation
|
|
360
366
|
- **NameService.sol**: Domain name resolution system
|
|
361
367
|
- **Staking.sol**: Token staking and rewards mechanism
|
|
362
368
|
- **Estimator.sol**: Staking rewards estimation and calculation
|
|
363
369
|
- **Treasury.sol**: Manages deposits and withdrawals of ETH and ERC20 tokens
|
|
370
|
+
- **P2PSwap.sol**: Peer-to-peer decentralized exchange for token trading
|
|
371
|
+
|
|
364
372
|
|
|
365
373
|
## Configuration Files
|
|
366
374
|
Key files for EVVM deployment:
|
|
@@ -299,7 +299,7 @@ contract NameService {
|
|
|
299
299
|
|
|
300
300
|
makePay(
|
|
301
301
|
user,
|
|
302
|
-
|
|
302
|
+
getPriceOfRegistration(username),
|
|
303
303
|
priorityFee_EVVM,
|
|
304
304
|
nonce_EVVM,
|
|
305
305
|
priorityFlag_EVVM,
|
|
@@ -1659,12 +1659,20 @@ contract NameService {
|
|
|
1659
1659
|
}
|
|
1660
1660
|
|
|
1661
1661
|
/**
|
|
1662
|
-
* @notice Gets
|
|
1663
|
-
* @dev Price is dynamic
|
|
1662
|
+
* @notice Gets price to register an username
|
|
1663
|
+
* @dev Price is fully dynamic based on existing offers and timing
|
|
1664
|
+
* - If dosnt have offers, price is 100x current EVVM reward amount
|
|
1665
|
+
* - If has offers, price is calculated via seePriceToRenew function
|
|
1666
|
+
* @param username The username to get registration price for
|
|
1664
1667
|
* @return The current registration price in Principal Tokens
|
|
1665
1668
|
*/
|
|
1666
|
-
function
|
|
1667
|
-
|
|
1669
|
+
function getPriceOfRegistration(
|
|
1670
|
+
string memory username
|
|
1671
|
+
) public view returns (uint256) {
|
|
1672
|
+
return
|
|
1673
|
+
identityDetails[username].offerMaxSlots > 0
|
|
1674
|
+
? seePriceToRenew(username)
|
|
1675
|
+
: Evvm(evvmAddress.current).getRewardAmount() * 100;
|
|
1668
1676
|
}
|
|
1669
1677
|
|
|
1670
1678
|
//█ Administrative Getters ███████████████████████████████████████████████████████████████████████
|