@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
@@ -1,131 +0,0 @@
1
- // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
- // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
-
4
- pragma solidity ^0.8.0;
5
-
6
- /**
7
- * @title ErrorsLib
8
- * @author Mate labs
9
- * @notice Library containing custom error definitions exclusively for the Evvm.sol contract
10
- * @dev This library defines all custom errors used by the Evvm.sol core contract.
11
- * Custom errors are more gas-efficient than require statements with strings
12
- * and provide better error handling in client applications.
13
- *
14
- * Error Categories:
15
- * - Access Control: Errors related to unauthorized access attempts
16
- * - Validation: Errors for invalid inputs or state conditions
17
- * - Nonce Management: Errors for transaction replay protection
18
- * - Time-Lock: Errors for governance time delay mechanisms
19
- * - Balance: Errors for insufficient funds or invalid amounts
20
- *
21
- * @custom:scope Exclusive to the Evvm.sol contract
22
- * @custom:security All errors are designed to provide clear failure reasons
23
- * without exposing sensitive internal state information
24
- */
25
- library ErrorsLib {
26
- //░▒▓█ Access Control Errors ████████████████████████████████████████████████▓▒░
27
-
28
- /**
29
- * @notice Thrown when a function restricted to admin is called by a non-admin address
30
- * @dev Used in functions with the `onlyAdmin` modifier
31
- */
32
- error SenderIsNotAdmin();
33
-
34
- /**
35
- * @notice Thrown when attempting to use the proxy without a valid implementation contract
36
- * @dev Occurs when the fallback function is called but currentImplementation is address(0)
37
- */
38
- error ImplementationIsNotActive();
39
-
40
- /**
41
- * @notice Thrown when the provided cryptographic signature is invalid or doesn't match the signer
42
- * @dev Used in payment functions to verify EIP-191 signatures
43
- */
44
- error InvalidSignature();
45
-
46
- /**
47
- * @notice Thrown when a transaction specifies an executor but the caller is not that executor
48
- * @dev Enforces that only the designated executor can process certain transactions
49
- */
50
- error SenderIsNotTheExecutor();
51
-
52
- /**
53
- * @notice Thrown when a function restricted to treasury is called by a non-treasury address
54
- * @dev Used in treasury-exclusive functions like addAmountToUser and removeAmountFromUser
55
- */
56
- error SenderIsNotTreasury();
57
-
58
- /**
59
- * @notice Thrown when the proposed admin tries to accept before the time lock expires
60
- * @dev Part of the time-delayed admin transfer mechanism
61
- */
62
- error SenderIsNotTheProposedAdmin();
63
-
64
- /**
65
- * @notice Thrown when a caller is not a smart contract (Contract Account)
66
- * @dev Used in caPay and disperseCaPay to ensure only contracts can call these functions
67
- */
68
- error NotAnCA();
69
-
70
- //░▒▓█ Nonce Management Errors ██████████████████████████████████████████████▓▒░
71
-
72
- /**
73
- * @notice Thrown when the provided synchronous nonce doesn't match the expected sequential nonce
74
- * @dev Sync nonces must be used in order (0, 1, 2, ...)
75
- */
76
- error SyncNonceMismatch();
77
-
78
- /**
79
- * @notice Thrown when attempting to use an asynchronous nonce that has already been consumed
80
- * @dev Async nonces can be used in any order but only once
81
- */
82
- error AsyncNonceAlreadyUsed();
83
-
84
- //░▒▓█ Balance and Amount Errors ████████████████████████████████████████████▓▒░
85
-
86
- /**
87
- * @notice Thrown when a user doesn't have enough tokens to complete a transfer
88
- * @dev Checked before any balance deduction to prevent underflows
89
- */
90
- error InsufficientBalance();
91
-
92
- /**
93
- * @notice Thrown when the provided amount doesn't match expected values
94
- * @dev Used in dispersePay to verify total amount equals sum of individual amounts
95
- */
96
- error InvalidAmount();
97
-
98
- //░▒▓█ Initialization and Setup Errors ██████████████████████████████████████▓▒░
99
-
100
- /**
101
- * @notice Thrown when attempting to call a one-time setup function after it has been used
102
- * @dev Used in _setupNameServiceAndTreasuryAddress to prevent reconfiguration
103
- */
104
- error BreakerExploded();
105
-
106
- /**
107
- * @notice Thrown when attempting to change EVVM ID after the allowed time window has passed
108
- * @dev The EVVM ID can only be changed within 24 hours of the last change
109
- */
110
- error WindowExpired();
111
-
112
- /**
113
- * @notice Thrown when address(0) is provided where a valid address is required
114
- * @dev Used in constructor and setup functions to validate critical addresses
115
- */
116
- error AddressCantBeZero();
117
-
118
- /**
119
- * @notice Thrown when an address input doesn't meet validation requirements
120
- * @dev Used when proposing new admin or implementation with invalid addresses
121
- */
122
- error IncorrectAddressInput();
123
-
124
- //░▒▓█ Time-Lock Errors █████████████████████████████████████████████████████▓▒░
125
-
126
- /**
127
- * @notice Thrown when attempting to execute a time-locked action before the delay has passed
128
- * @dev Used in acceptImplementation (30 days) and acceptAdmin (1 day) functions
129
- */
130
- error TimeLockNotExpired();
131
- }
@@ -1,217 +0,0 @@
1
- // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
- // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
-
4
- pragma solidity ^0.8.0;
5
-
6
- import {EvvmStructs} from "./EvvmStructs.sol";
7
-
8
- /**
9
- * @title EvvmStorage
10
- * @author Mate labs
11
- * @notice Storage layout contract exclusively for the Evvm.sol core contract
12
- * @dev This contract inherits all structures from EvvmStructs and defines
13
- * the storage layout used by the Evvm.sol proxy pattern implementation.
14
- * All state variables declared here are used by Evvm.sol and its upgradeable
15
- * implementation contracts.
16
- *
17
- * Storage Organization:
18
- * - Constants: System-wide immutable values
19
- * - External Addresses: Integration points with other contracts
20
- * - Governance State: Admin and proposal management
21
- * - Balance Management: User token balances and nonce tracking
22
- * - Configuration: System parameters and metadata
23
- *
24
- * @custom:inheritance Inherited by Evvm.sol, should not be deployed directly
25
- * @custom:scope Exclusive to Evvm.sol contract and its implementations
26
- * @custom:proxy Storage layout must remain consistent across upgrades
27
- */
28
-
29
- abstract contract EvvmStorage is EvvmStructs {
30
- //░▒▓█ Constants ██████████████████████████████████████████████████████████████████▓▒░
31
-
32
- /**
33
- * @notice Sentinel address representing native ETH in token operations
34
- * @dev address(0) is used to represent the native blockchain token (ETH, MATIC, etc.)
35
- */
36
- address constant ETH_ADDRESS = address(0);
37
-
38
- /**
39
- * @notice Flag value indicating an address is a registered staker
40
- * @dev Used in stakerList mapping to mark addresses with staking privileges
41
- * Value of 0x01 indicates active staker status
42
- */
43
- bytes1 constant FLAG_IS_STAKER = 0x01;
44
-
45
- /**
46
- * @notice Time delay required before accepting admin change proposals
47
- * @dev 1 day delay provides time for community review of admin changes
48
- * Used in proposeAdmin and acceptAdmin functions
49
- */
50
- uint256 constant TIME_TO_ACCEPT_PROPOSAL = 1 days;
51
-
52
- /**
53
- * @notice Time delay required before accepting implementation upgrades
54
- * @dev 30 day delay provides extended review period for critical contract upgrades
55
- * Used in proposeImplementation and acceptImplementation functions
56
- */
57
- uint256 constant TIME_TO_ACCEPT_IMPLEMENTATION = 30 days;
58
-
59
- //░▒▓█ External Contract Addresses █████████████████████████████████████████████████▓▒░
60
-
61
- /**
62
- * @notice Address of the NameService contract for identity resolution
63
- * @dev Used to resolve username identities to wallet addresses in payment functions
64
- * Enables payments to usernames like "alice.evvm" instead of raw addresses
65
- */
66
- address nameServiceAddress;
67
-
68
- /**
69
- * @notice Address of the authorized staking contract
70
- * @dev Controls staker status updates and receives staking-related rewards
71
- * Only this address can call pointStaker() to update staker status
72
- */
73
- address stakingContractAddress;
74
-
75
- /**
76
- * @notice Address of the Treasury contract with privileged balance operations
77
- * @dev Can call addAmountToUser and removeAmountFromUser for token management
78
- * Used for cross-chain bridging, reward distributions, and system operations
79
- */
80
- address treasuryAddress;
81
-
82
- //░▒▓█ Token Whitelist Proposal State ██████████████████████████████████████████████▓▒░
83
-
84
- /**
85
- * @notice Address of the token pending whitelist approval
86
- * @dev Part of time-delayed token whitelisting mechanism
87
- * Set during prepareWhitelistToken(), cleared on acceptance
88
- */
89
- address whitelistTokenToBeAdded_address;
90
-
91
- /**
92
- * @notice Liquidity pool address for the token pending whitelist approval
93
- * @dev Used to validate token has sufficient liquidity before whitelisting
94
- * Typically a Uniswap V3 pool address
95
- */
96
- address whitelistTokenToBeAdded_pool;
97
-
98
- /**
99
- * @notice Timestamp when the pending token whitelist can be accepted
100
- * @dev After this timestamp, the token can be officially whitelisted
101
- * Zero value indicates no pending whitelist proposal
102
- */
103
- uint256 whitelistTokenToBeAdded_dateToSet;
104
-
105
- //░▒▓█ Proxy Implementation State ██████████████████████████████████████████████████▓▒░
106
-
107
- /**
108
- * @notice Address of the current active implementation contract
109
- * @dev All non-matching function calls are delegated to this address
110
- * Updated through time-delayed governance process
111
- * @custom:proxy Slot used by assembly in fallback for delegatecall
112
- */
113
- address currentImplementation;
114
-
115
- /**
116
- * @notice Address of the proposed implementation for upgrade
117
- * @dev Set by admin, becomes active after time delay via acceptImplementation()
118
- * Zero address indicates no pending upgrade proposal
119
- */
120
- address proposalImplementation;
121
-
122
- /**
123
- * @notice Timestamp after which the implementation upgrade can be accepted
124
- * @dev Must be >= current timestamp to call acceptImplementation()
125
- * Zero value indicates no pending implementation proposal
126
- */
127
- uint256 timeToAcceptImplementation;
128
-
129
- //░▒▓█ EVVM Configuration State ████████████████████████████████████████████████████▓▒░
130
-
131
- /**
132
- * @notice Deadline for changing the EVVM ID
133
- * @dev EVVM ID can only be changed within 24 hours of deployment or last change
134
- * Prevents unauthorized ID changes after initial configuration period
135
- */
136
- uint256 windowTimeToChangeEvvmID;
137
-
138
- /**
139
- * @notice Core metadata configuration for the EVVM instance
140
- * @dev Contains:
141
- * - EvvmName: Human-readable name of this EVVM instance
142
- * - EvvmID: Unique identifier used in signature verification
143
- * - principalTokenName/Symbol: Principal token details
144
- * - principalTokenAddress: Address representing the Principal Token in balances
145
- * - totalSupply: Current total supply of principal token
146
- * - eraTokens: Threshold for next reward halving era
147
- * - reward: Current reward amount per transaction
148
- */
149
- EvvmMetadata evvmMetadata;
150
-
151
- //░▒▓█ Admin Governance State ██████████████████████████████████████████████████████▓▒░
152
-
153
- /**
154
- * @notice Admin address management with time-delayed transitions
155
- * @dev Contains:
156
- * - current: Active admin address with full privileges
157
- * - proposal: Proposed new admin (awaiting acceptance)
158
- * - timeToAccept: Timestamp when proposal can be accepted
159
- */
160
- AddressTypeProposal admin;
161
-
162
- //░▒▓█ Initialization State ████████████████████████████████████████████████████████▓▒░
163
-
164
- /**
165
- * @notice One-time setup breaker flag for NameService and Treasury configuration
166
- * @dev Set to FLAG_IS_STAKER (0x01) in constructor, set to 0x00 after setup
167
- * Prevents _setupNameServiceAndTreasuryAddress from being called twice
168
- */
169
- bytes1 breakerSetupNameServiceAddress;
170
-
171
- //░▒▓█ Staker Registry █████████████████████████████████████████████████████████████▓▒░
172
-
173
- /**
174
- * @notice Registry mapping addresses to their staker status
175
- * @dev Key: User address
176
- * Value: Staker flag (FLAG_IS_STAKER = 0x01 for active stakers)
177
- * Stakers receive priority fees and Principal Token rewards for processing transactions
178
- */
179
- mapping(address => bytes1) stakerList;
180
-
181
- //░▒▓█ Balance Management ██████████████████████████████████████████████████████████▓▒░
182
-
183
- /**
184
- * @notice Token balance storage for all users across all tokens
185
- * @dev Primary balance mapping: user address => token address => balance
186
- * Supports Principal Token, ETH (address(0)), and whitelisted ERC20s
187
- * All payment operations update these balances
188
- */
189
- mapping(address user => mapping(address token => uint256 quantity)) balances;
190
-
191
- //░▒▓█ Nonce Management █████████████████████████████████████████████████████████████▓▒░
192
-
193
- /**
194
- * @notice Sequential nonce tracking for synchronous transactions
195
- * @dev Nonces must be used in strict sequential order (0, 1, 2, ...)
196
- * Provides ordered transaction execution and simpler replay protection
197
- * Incremented after each successful sync transaction
198
- */
199
- mapping(address user => uint256 nonce) nextSyncUsedNonce;
200
-
201
- /**
202
- * @notice Flexible nonce tracking for asynchronous transactions
203
- * @dev Nonces can be used in any order but only once
204
- * Provides flexibility for parallel transaction submission
205
- * Marked as used (true) after consumption
206
- */
207
- mapping(address user => mapping(uint256 nonce => bool isUsed)) asyncUsedNonce;
208
-
209
- //░▒▓█ Fisher Bridge State ██████████████████████████████████████████████████████████▓▒░
210
-
211
- /**
212
- * @notice Sequential nonce for Fisher Bridge cross-chain deposits
213
- * @dev Tracks deposit operations for cross-chain asset bridging
214
- * Ensures ordered processing of bridge deposit transactions
215
- */
216
- mapping(address user => uint256 nonce) nextFisherDepositNonce;
217
- }
@@ -1,208 +0,0 @@
1
- // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
- // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
-
4
- pragma solidity ^0.8.0;
5
-
6
- /**
7
- * @title EvvmStructs
8
- * @author Mate labs
9
- * @notice Library of data structures used exclusively by the Evvm.sol core contract
10
- * @dev This contract defines the type system for the Evvm.sol contract,
11
- * providing structured data types for payment operations, governance proposals,
12
- * and system configuration. These structures are not shared with external services.
13
- *
14
- * Structure Categories:
15
- * - Payment Structures: PayData, DispersePayData, CaPayData for transaction processing
16
- * - Governance Structures: AddressTypeProposal, UintTypeProposal for time-delayed changes
17
- * - Metadata Structures: EvvmMetadata for system-wide configuration
18
- *
19
- * @custom:inheritance This contract is inherited by EvvmStorage, which is then inherited by Evvm.sol
20
- * @custom:scope Exclusive to the Evvm.sol contract and its storage layout
21
- * @custom:version 1.0.0
22
- */
23
-
24
- abstract contract EvvmStructs {
25
- //░▒▓█ Payment Data Structures ██████████████████████████████████████████████████████▓▒░
26
-
27
- /**
28
- * @notice Data structure for single payment operations
29
- * @dev Used in pay() and payMultiple() functions for individual transfers
30
- *
31
- * @param from Address of the payment sender (signer of the transaction)
32
- * @param to_address Direct recipient address (used if to_identity is empty)
33
- * @param to_identity Username/identity to resolve via NameService (takes priority)
34
- * @param token Address of the token to transfer (address(0) for ETH)
35
- * @param amount Amount of tokens to transfer to the recipient
36
- * @param priorityFee Additional fee paid to staker for transaction processing
37
- * @param nonce Transaction nonce for replay protection
38
- * @param priorityFlag False for sync nonce (sequential), true for async nonce (flexible)
39
- * @param executor Address authorized to execute this transaction (address(0) = any)
40
- * @param signature EIP-191 signature authorizing this payment
41
- */
42
- struct PayData {
43
- address from;
44
- address to_address;
45
- string to_identity;
46
- address token;
47
- uint256 amount;
48
- uint256 priorityFee;
49
- uint256 nonce;
50
- bool priorityFlag;
51
- address executor;
52
- bytes signature;
53
- }
54
-
55
- /**
56
- * @notice Data structure for single-source multi-recipient payment distributions
57
- * @dev Used in dispersePay() for efficient batch distributions from one sender
58
- *
59
- * @param from Address of the payment sender (signer of the transaction)
60
- * @param toData Array of recipient metadata with individual amounts and addresses
61
- * @param token Address of the token to distribute (address(0) for ETH)
62
- * @param totalAmount Total amount being distributed (must equal sum of toData amounts)
63
- * @param priorityFee Fee paid to staker for processing the distribution
64
- * @param nonce Transaction nonce for replay protection
65
- * @param priorityFlag False for sync nonce, true for async nonce
66
- * @param executor Address authorized to execute this distribution (address(0) = any)
67
- * @param signature EIP-191 signature authorizing this distribution
68
- */
69
- struct DispersePayData {
70
- address from;
71
- DispersePayMetadata[] toData;
72
- address token;
73
- uint256 totalAmount;
74
- uint256 priorityFee;
75
- uint256 nonce;
76
- bool priorityFlag;
77
- address executor;
78
- bytes signature;
79
- }
80
-
81
- /**
82
- * @notice Data structure for contract-to-address payments without signatures
83
- * @dev Used in caPay() for authorized contract distributions
84
- *
85
- * @param from Address of the sending contract (must be a contract, not EOA)
86
- * @param to Address of the token recipient
87
- * @param token Address of the token to transfer (address(0) for ETH)
88
- * @param amount Amount of tokens to transfer
89
- */
90
- struct CaPayData {
91
- address from;
92
- address to;
93
- address token;
94
- uint256 amount;
95
- }
96
-
97
- /**
98
- * @notice Data structure for contract-based multi-recipient distributions
99
- * @dev Used in disperseCaPay() for batch distributions from contracts
100
- *
101
- * @param from Address of the sending contract (must be a contract, not EOA)
102
- * @param toData Array of recipient metadata with individual amounts and addresses
103
- * @param token Address of the token to distribute (address(0) for ETH)
104
- * @param amount Total amount being distributed (must equal sum of toData amounts)
105
- */
106
- struct DisperseCaPayData{
107
- address from;
108
- DisperseCaPayMetadata[] toData;
109
- address token;
110
- uint256 amount;
111
- }
112
-
113
- //░▒▓█ Payment Metadata Structures ██████████████████████████████████████████████████▓▒░
114
-
115
- /**
116
- * @notice Recipient metadata for user-signed disperse payments
117
- * @dev Used within DispersePayData to specify individual recipients
118
- *
119
- * @param amount Amount of tokens to send to this recipient
120
- * @param to_address Direct recipient address (used if to_identity is empty)
121
- * @param to_identity Username/identity to resolve via NameService (takes priority)
122
- */
123
- struct DispersePayMetadata {
124
- uint256 amount;
125
- address to_address;
126
- string to_identity;
127
- }
128
-
129
- /**
130
- * @notice Recipient metadata for contract-based disperse payments
131
- * @dev Used within DisperseCaPayData to specify individual recipients
132
- * Simpler than DispersePayMetadata as identity resolution is not supported
133
- *
134
- * @param amount Amount of tokens to send to this recipient
135
- * @param toAddress Direct recipient address
136
- */
137
- struct DisperseCaPayMetadata {
138
- uint256 amount;
139
- address toAddress;
140
- }
141
-
142
- //░▒▓█ System Configuration Structures ██████████████████████████████████████████████▓▒░
143
-
144
- /**
145
- * @notice Core metadata configuration for the EVVM instance
146
- * @dev Contains all system-wide parameters for the EVVM ecosystem
147
- *
148
- * Economic Model:
149
- * - reward: Base Principal Tokens distributed per successful transaction
150
- * - eraTokens: Supply threshold that triggers the next reward halving
151
- * - totalSupply: Current total supply tracking for era calculations
152
- *
153
- * @param EvvmName Human-readable name of this EVVM instance
154
- * @param EvvmID Unique identifier used in signature verification to prevent cross-chain replay
155
- * @param principalTokenName Full name of the principal token (customizable)
156
- * @param principalTokenSymbol Symbol of the principal token (customizable)
157
- * @param principalTokenAddress Virtual address representing the Principal Token in balance mappings
158
- * @param totalSupply Current total supply of principal tokens in circulation
159
- * @param eraTokens Token supply threshold for next reward halving era
160
- * @param reward Current reward amount in Principal Tokens per successful transaction
161
- */
162
- struct EvvmMetadata {
163
- string EvvmName;
164
- uint256 EvvmID;
165
- string principalTokenName;
166
- string principalTokenSymbol;
167
- address principalTokenAddress;
168
- uint256 totalSupply;
169
- uint256 eraTokens;
170
- uint256 reward;
171
- }
172
-
173
- //░▒▓█ Governance Proposal Structures ███████████████████████████████████████████████▓▒░
174
-
175
- /**
176
- * @notice Time-delayed proposal structure for address-type governance changes
177
- * @dev Used for admin changes (1-day delay) and can be extended for other address proposals
178
- *
179
- * Governance Flow:
180
- * 1. Admin proposes new address -> sets proposal and timeToAccept
181
- * 2. Time delay passes (1 day for admin, 30 days for implementation)
182
- * 3. Proposed address calls accept -> current is updated, proposal is cleared
183
- *
184
- * @param current Currently active address with the role/privilege
185
- * @param proposal Proposed new address awaiting acceptance after time delay
186
- * @param timeToAccept Timestamp after which the proposal can be accepted
187
- */
188
- struct AddressTypeProposal {
189
- address current;
190
- address proposal;
191
- uint256 timeToAccept;
192
- }
193
-
194
- /**
195
- * @notice Time-delayed proposal structure for uint-type governance changes
196
- * @dev Used for numeric parameter changes requiring time-delayed governance
197
- * Follows the same pattern as AddressTypeProposal for consistency
198
- *
199
- * @param current Currently active value for the parameter
200
- * @param proposal Proposed new value awaiting acceptance after time delay
201
- * @param timeToAccept Timestamp after which the proposal can be accepted
202
- */
203
- struct UintTypeProposal {
204
- uint256 current;
205
- uint256 proposal;
206
- uint256 timeToAccept;
207
- }
208
- }