@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.
- package/README.md +44 -24
- package/contracts/core/Core.sol +1392 -0
- package/contracts/core/lib/CoreStorage.sol +171 -0
- package/contracts/nameService/NameService.sol +613 -543
- package/contracts/nameService/lib/IdentityValidation.sol +15 -21
- package/contracts/p2pSwap/P2PSwap.sol +258 -145
- package/contracts/staking/Estimator.sol +25 -44
- package/contracts/staking/Staking.sol +284 -262
- package/contracts/treasury/Treasury.sol +40 -47
- package/contracts/treasuryTwoChains/TreasuryExternalChainStation.sol +585 -198
- package/contracts/treasuryTwoChains/TreasuryHostChainStation.sol +425 -174
- package/contracts/treasuryTwoChains/lib/PayloadUtils.sol +2 -4
- package/interfaces/{IEvvm.sol → ICore.sol} +58 -25
- package/interfaces/IEstimator.sol +1 -1
- package/interfaces/INameService.sol +46 -49
- package/interfaces/IP2PSwap.sol +16 -17
- package/interfaces/IStaking.sol +21 -17
- package/interfaces/ITreasury.sol +2 -1
- package/interfaces/ITreasuryExternalChainStation.sol +15 -9
- package/interfaces/ITreasuryHostChainStation.sol +14 -11
- package/interfaces/IUserValidator.sol +6 -0
- package/library/Erc191TestBuilder.sol +336 -471
- package/library/EvvmService.sol +27 -71
- package/library/errors/CoreError.sol +116 -0
- package/library/errors/CrossChainTreasuryError.sol +36 -0
- package/library/errors/NameServiceError.sol +79 -0
- package/library/errors/StakingError.sol +79 -0
- package/{contracts/treasury/lib/ErrorsLib.sol → library/errors/TreasuryError.sol} +9 -17
- package/library/structs/CoreStructs.sol +146 -0
- package/library/structs/ExternalChainStationStructs.sol +92 -0
- package/library/structs/HostChainStationStructs.sol +77 -0
- package/library/structs/NameServiceStructs.sol +47 -0
- package/library/structs/P2PSwapStructs.sol +127 -0
- package/library/structs/StakingStructs.sol +67 -0
- package/library/utils/AdvancedStrings.sol +62 -44
- package/library/utils/CAUtils.sol +29 -0
- package/library/utils/governance/Admin.sol +66 -0
- package/library/utils/governance/ProposalStructs.sol +49 -0
- package/library/utils/service/CoreExecution.sol +158 -0
- package/library/utils/service/StakingServiceUtils.sol +20 -37
- package/library/utils/signature/CoreHashUtils.sol +73 -0
- package/library/utils/signature/NameServiceHashUtils.sol +156 -0
- package/library/utils/signature/P2PSwapHashUtils.sol +65 -0
- package/library/utils/signature/StakingHashUtils.sol +41 -0
- package/library/utils/signature/TreasuryCrossChainHashUtils.sol +40 -0
- package/package.json +1 -1
- package/contracts/evvm/Evvm.sol +0 -1300
- package/contracts/evvm/lib/ErrorsLib.sol +0 -131
- package/contracts/evvm/lib/EvvmStorage.sol +0 -217
- package/contracts/evvm/lib/EvvmStructs.sol +0 -208
- package/contracts/evvm/lib/SignatureUtils.sol +0 -162
- package/contracts/nameService/lib/ErrorsLib.sol +0 -155
- package/contracts/nameService/lib/NameServiceStructs.sol +0 -125
- package/contracts/nameService/lib/SignatureUtils.sol +0 -420
- package/contracts/p2pSwap/lib/P2PSwapStructs.sol +0 -59
- package/contracts/p2pSwap/lib/SignatureUtils.sol +0 -98
- package/contracts/staking/lib/ErrorsLib.sol +0 -98
- package/contracts/staking/lib/SignatureUtils.sol +0 -105
- package/contracts/staking/lib/StakingStructs.sol +0 -106
- package/contracts/treasuryTwoChains/lib/ErrorsLib.sol +0 -48
- package/contracts/treasuryTwoChains/lib/ExternalChainStationStructs.sol +0 -80
- package/contracts/treasuryTwoChains/lib/HostChainStationStructs.sol +0 -87
- package/contracts/treasuryTwoChains/lib/SignatureUtils.sol +0 -79
- package/library/utils/GovernanceUtils.sol +0 -81
- package/library/utils/nonces/AsyncNonce.sol +0 -74
- package/library/utils/nonces/SyncNonce.sol +0 -71
- package/library/utils/service/EvvmPayments.sol +0 -144
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
|
|
2
|
-
// Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
|
|
3
|
-
pragma solidity ^0.8.0;
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
SignatureUtil
|
|
7
|
-
} from "@evvm/testnet-contracts/library/utils/SignatureUtil.sol";
|
|
8
|
-
import {
|
|
9
|
-
AdvancedStrings
|
|
10
|
-
} from "@evvm/testnet-contracts/library/utils/AdvancedStrings.sol";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @title SignatureUtils
|
|
14
|
-
* @author Mate labs
|
|
15
|
-
* @notice Library for EIP-191 signature verification exclusively for Evvm.sol payment functions
|
|
16
|
-
* @dev This library provides signature verification utilities for the Evvm.sol contract,
|
|
17
|
-
* specifically for payment operations (pay and dispersePay). It constructs the message
|
|
18
|
-
* format expected by users and validates their signatures.
|
|
19
|
-
*
|
|
20
|
-
* Signature Verification:
|
|
21
|
-
* - Uses EIP-191 standard for message signing and verification
|
|
22
|
-
* - Constructs deterministic message strings from payment parameters
|
|
23
|
-
* - Integrates with SignatureUtil for cryptographic verification
|
|
24
|
-
* - Prevents replay attacks through nonce inclusion
|
|
25
|
-
* - Supports cross-chain safety through EvvmID inclusion
|
|
26
|
-
*
|
|
27
|
-
* Message Format:
|
|
28
|
-
* - pay: "receiver,token,amount,priorityFee,nonce,priorityFlag,executor"
|
|
29
|
-
* - dispersePay: "hashOfRecipients,token,amount,priorityFee,nonce,priorityFlag,executor"
|
|
30
|
-
*
|
|
31
|
-
* @custom:scope Exclusive to Evvm.sol payment functions
|
|
32
|
-
* @custom:standard EIP-191 (https://eips.ethereum.org/EIPS/eip-191)
|
|
33
|
-
* @custom:security All signatures include EvvmID to prevent cross-chain replay attacks
|
|
34
|
-
*/
|
|
35
|
-
library SignatureUtils {
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @notice Verifies EIP-191 signature for single payment operations
|
|
39
|
-
* @dev Constructs the expected message from payment parameters and verifies
|
|
40
|
-
* the signature matches the signer. Used in pay() and payMultiple() functions.
|
|
41
|
-
*
|
|
42
|
-
* Message Construction:
|
|
43
|
-
* - If receiverAddress is address(0): uses receiverIdentity string
|
|
44
|
-
* - Otherwise: converts receiverAddress to string
|
|
45
|
-
* - Concatenates all parameters with comma separators
|
|
46
|
-
* - Includes EvvmID for cross-chain replay protection
|
|
47
|
-
*
|
|
48
|
-
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
49
|
-
* @param signer Address that signed the message (payment sender)
|
|
50
|
-
* @param receiverAddress Direct recipient address (used if receiverIdentity is empty)
|
|
51
|
-
* @param receiverIdentity Username/identity to resolve (takes priority over address)
|
|
52
|
-
* @param token Address of the token to transfer
|
|
53
|
-
* @param amount Amount of tokens to transfer
|
|
54
|
-
* @param priorityFee Fee paid to the staker/fisher processing the transaction
|
|
55
|
-
* @param nonce Transaction nonce for replay protection
|
|
56
|
-
* @param priorityFlag False for sync nonce (sequential), true for async nonce (flexible)
|
|
57
|
-
* @param executor Address authorized to execute this transaction (address(0) = anyone)
|
|
58
|
-
* @param signature EIP-191 signature from the signer
|
|
59
|
-
* @return bool True if the signature is valid and matches the signer
|
|
60
|
-
*/
|
|
61
|
-
function verifyMessageSignedForPay(
|
|
62
|
-
uint256 evvmID,
|
|
63
|
-
address signer,
|
|
64
|
-
address receiverAddress,
|
|
65
|
-
string memory receiverIdentity,
|
|
66
|
-
address token,
|
|
67
|
-
uint256 amount,
|
|
68
|
-
uint256 priorityFee,
|
|
69
|
-
uint256 nonce,
|
|
70
|
-
bool priorityFlag,
|
|
71
|
-
address executor,
|
|
72
|
-
bytes memory signature
|
|
73
|
-
) internal pure returns (bool) {
|
|
74
|
-
return
|
|
75
|
-
SignatureUtil.verifySignature(
|
|
76
|
-
evvmID,
|
|
77
|
-
"pay",
|
|
78
|
-
string.concat(
|
|
79
|
-
receiverAddress == address(0)
|
|
80
|
-
? receiverIdentity
|
|
81
|
-
: AdvancedStrings.addressToString(receiverAddress),
|
|
82
|
-
",",
|
|
83
|
-
AdvancedStrings.addressToString(token),
|
|
84
|
-
",",
|
|
85
|
-
AdvancedStrings.uintToString(amount),
|
|
86
|
-
",",
|
|
87
|
-
AdvancedStrings.uintToString(priorityFee),
|
|
88
|
-
",",
|
|
89
|
-
AdvancedStrings.uintToString(nonce),
|
|
90
|
-
",",
|
|
91
|
-
AdvancedStrings.boolToString(priorityFlag),
|
|
92
|
-
",",
|
|
93
|
-
AdvancedStrings.addressToString(executor)
|
|
94
|
-
),
|
|
95
|
-
signature,
|
|
96
|
-
signer
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* @notice Verifies EIP-191 signature for multi-recipient disperse payment operations
|
|
102
|
-
* @dev Constructs the expected message from disperse parameters and verifies
|
|
103
|
-
* the signature matches the signer. Used in dispersePay() function.
|
|
104
|
-
*
|
|
105
|
-
* Message Construction:
|
|
106
|
-
* - Uses sha256 hash of recipient array instead of full data (gas optimization)
|
|
107
|
-
* - Concatenates hash and all other parameters with comma separators
|
|
108
|
-
* - Includes EvvmID for cross-chain replay protection
|
|
109
|
-
*
|
|
110
|
-
* Hash Calculation:
|
|
111
|
-
* - Client must calculate: sha256(abi.encode(toData))
|
|
112
|
-
* - toData is DispersePayMetadata[] array with recipients and amounts
|
|
113
|
-
* - Ensures tamper-proof verification of all recipients
|
|
114
|
-
*
|
|
115
|
-
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
116
|
-
* @param signer Address that signed the message (payment sender)
|
|
117
|
-
* @param hashList SHA256 hash of the recipient data array: sha256(abi.encode(toData))
|
|
118
|
-
* @param token Address of the token to distribute
|
|
119
|
-
* @param amount Total amount being distributed (must equal sum of individual amounts)
|
|
120
|
-
* @param priorityFee Fee paid to the staker/fisher processing the distribution
|
|
121
|
-
* @param nonce Transaction nonce for replay protection
|
|
122
|
-
* @param priorityFlag False for sync nonce (sequential), true for async nonce (flexible)
|
|
123
|
-
* @param executor Address authorized to execute this distribution (address(0) = anyone)
|
|
124
|
-
* @param signature EIP-191 signature from the signer
|
|
125
|
-
* @return bool True if the signature is valid and matches the signer
|
|
126
|
-
*/
|
|
127
|
-
function verifyMessageSignedForDispersePay(
|
|
128
|
-
uint256 evvmID,
|
|
129
|
-
address signer,
|
|
130
|
-
bytes32 hashList,
|
|
131
|
-
address token,
|
|
132
|
-
uint256 amount,
|
|
133
|
-
uint256 priorityFee,
|
|
134
|
-
uint256 nonce,
|
|
135
|
-
bool priorityFlag,
|
|
136
|
-
address executor,
|
|
137
|
-
bytes memory signature
|
|
138
|
-
) internal pure returns (bool) {
|
|
139
|
-
return
|
|
140
|
-
SignatureUtil.verifySignature(
|
|
141
|
-
evvmID,
|
|
142
|
-
"dispersePay",
|
|
143
|
-
string.concat(
|
|
144
|
-
AdvancedStrings.bytes32ToString(hashList),
|
|
145
|
-
",",
|
|
146
|
-
AdvancedStrings.addressToString(token),
|
|
147
|
-
",",
|
|
148
|
-
AdvancedStrings.uintToString(amount),
|
|
149
|
-
",",
|
|
150
|
-
AdvancedStrings.uintToString(priorityFee),
|
|
151
|
-
",",
|
|
152
|
-
AdvancedStrings.uintToString(nonce),
|
|
153
|
-
",",
|
|
154
|
-
AdvancedStrings.boolToString(priorityFlag),
|
|
155
|
-
",",
|
|
156
|
-
AdvancedStrings.addressToString(executor)
|
|
157
|
-
),
|
|
158
|
-
signature,
|
|
159
|
-
signer
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
@@ -1,155 +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 NameService.sol contract
|
|
10
|
-
* @dev This library defines all custom errors used by the NameService.sol 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 ownership and admin permissions
|
|
16
|
-
* - Validation: Errors for invalid usernames, signatures, and input validation
|
|
17
|
-
* - Registration: Errors specific to username registration and pre-registration
|
|
18
|
-
* - Marketplace: Errors for offer management and username trading
|
|
19
|
-
* - Metadata: Errors for custom metadata operations
|
|
20
|
-
* - Time-Lock: Errors for governance and renewal timing
|
|
21
|
-
*
|
|
22
|
-
* @custom:scope Exclusive to the NameService.sol contract
|
|
23
|
-
* @custom:security All errors provide clear failure reasons without exposing sensitive data
|
|
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 an operation is attempted by someone other than the username owner
|
|
36
|
-
* @dev Used in functions that modify username data or accept offers
|
|
37
|
-
*/
|
|
38
|
-
error UserIsNotOwnerOfIdentity();
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @notice Thrown when an operation is attempted by someone other than the offer creator
|
|
42
|
-
* @dev Used in withdrawOffer to ensure only the offerer can withdraw their own offer
|
|
43
|
-
*/
|
|
44
|
-
error UserIsNotOwnerOfOffer();
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @notice Thrown when the proposed admin tries to accept before meeting requirements
|
|
48
|
-
* @dev Part of the time-delayed admin transfer mechanism
|
|
49
|
-
*/
|
|
50
|
-
error SenderIsNotProposedAdmin();
|
|
51
|
-
|
|
52
|
-
//█ Validation Errors ███████████████████████████████████████████████████████
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @notice Thrown when the provided EIP-191 signature is invalid or doesn't match the signer
|
|
56
|
-
* @dev Used in all operations requiring signature verification
|
|
57
|
-
*/
|
|
58
|
-
error InvalidSignatureOnNameService();
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @notice Thrown when a username doesn't meet format requirements
|
|
62
|
-
* @dev Username must be 4+ characters, start with letter, contain only alphanumeric
|
|
63
|
-
*/
|
|
64
|
-
error InvalidUsername();
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @notice Thrown when an amount parameter is zero but should be positive
|
|
68
|
-
* @dev Used in makeOffer to ensure offers have value
|
|
69
|
-
*/
|
|
70
|
-
error AmountMustBeGreaterThanZero();
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @notice Thrown when a custom metadata key is invalid
|
|
74
|
-
* @dev Used when trying to remove metadata with a key that doesn't exist
|
|
75
|
-
*/
|
|
76
|
-
error InvalidKey();
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @notice Thrown when attempting to add empty custom metadata
|
|
80
|
-
* @dev Custom metadata value cannot be an empty string
|
|
81
|
-
*/
|
|
82
|
-
error EmptyCustomMetadata();
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @notice Thrown when a proposed address or configuration is invalid
|
|
86
|
-
* @dev Used in admin proposal functions
|
|
87
|
-
*/
|
|
88
|
-
error InvalidAdminProposal();
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @notice Thrown when the EVVM address being proposed is invalid
|
|
92
|
-
* @dev Used when updating the EVVM contract integration address
|
|
93
|
-
*/
|
|
94
|
-
error InvalidEvvmAddress();
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @notice Thrown when the withdrawal amount is invalid or exceeds available balance
|
|
98
|
-
* @dev Used in token withdrawal functions
|
|
99
|
-
*/
|
|
100
|
-
error InvalidWithdrawAmount();
|
|
101
|
-
|
|
102
|
-
//█ Registration and Time-Based Errors █████████████████████████████████████
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @notice Thrown when attempting to register a username that is already taken
|
|
106
|
-
* @dev Usernames are unique and cannot be registered twice
|
|
107
|
-
*/
|
|
108
|
-
error UsernameAlreadyRegistered();
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @notice Thrown when the pre-registration doesn't exist or has expired
|
|
112
|
-
* @dev Pre-registration must be completed within 30 minutes and by the same user
|
|
113
|
-
*/
|
|
114
|
-
error PreRegistrationNotValid();
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* @notice Thrown when a timestamp/date is set to before the current time
|
|
118
|
-
* @dev Used for offer expiration dates and other future-dated operations
|
|
119
|
-
*/
|
|
120
|
-
error CannotBeBeforeCurrentTime();
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @notice Thrown when attempting operations on an expired username
|
|
124
|
-
* @dev Username ownership expires after the expireDate timestamp
|
|
125
|
-
*/
|
|
126
|
-
error OwnershipExpired();
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @notice Thrown when trying to renew a username beyond the maximum allowed period
|
|
130
|
-
* @dev Usernames can only be renewed up to 100 years in advance
|
|
131
|
-
*/
|
|
132
|
-
error RenewalTimeLimitExceeded();
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* @notice Thrown when attempting to execute a time-locked action prematurely
|
|
136
|
-
* @dev Used in governance functions with time-delay requirements
|
|
137
|
-
*/
|
|
138
|
-
error LockTimeNotExpired();
|
|
139
|
-
|
|
140
|
-
//█ Marketplace and Offer Errors ███████████████████████████████████████████
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* @notice Thrown when trying to accept or interact with an expired or non-existent offer
|
|
144
|
-
* @dev Offers expire at their expireDate timestamp or when offerer is address(0)
|
|
145
|
-
*/
|
|
146
|
-
error OfferInactive();
|
|
147
|
-
|
|
148
|
-
//█ Identity Type Errors ██████████████████████████████████████████████████
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* @notice Thrown when an operation requiring a fully registered username is attempted on a pre-registration
|
|
152
|
-
* @dev Pre-registrations have flagNotAUsername = 0x01, full usernames have 0x00
|
|
153
|
-
*/
|
|
154
|
-
error IdentityIsNotAUsername();
|
|
155
|
-
}
|
|
@@ -1,125 +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 NameServiceStructs
|
|
8
|
-
* @author Mate labs
|
|
9
|
-
* @notice Library of data structures used exclusively by the NameService.sol contract
|
|
10
|
-
* @dev This contract defines the type system for the NameService.sol contract,
|
|
11
|
-
* providing structured data types for identity management, marketplace operations,
|
|
12
|
-
* and governance proposals. These structures are not shared with external services.
|
|
13
|
-
*
|
|
14
|
-
* Structure Categories:
|
|
15
|
-
* - Identity Structures: IdentityBaseMetadata for username registration data
|
|
16
|
-
* - Marketplace Structures: OfferMetadata for username trading
|
|
17
|
-
* - Governance Structures: AddressTypeProposal, UintTypeProposal, BoolTypeProposal for time-delayed changes
|
|
18
|
-
*
|
|
19
|
-
* @custom:inheritance This contract is inherited by NameService.sol
|
|
20
|
-
* @custom:scope Exclusive to the NameService.sol contract
|
|
21
|
-
*/
|
|
22
|
-
abstract contract NameServiceStructs {
|
|
23
|
-
//░▒▓█ Governance Proposal Structures ███████████████████████████████████████████████▓▒░
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @notice Time-delayed proposal structure for address-type governance changes
|
|
27
|
-
* @dev Used for admin changes and EVVM contract address updates with 1-day delay
|
|
28
|
-
*
|
|
29
|
-
* Governance Flow:
|
|
30
|
-
* 1. Admin proposes new address -> sets proposal and timeToAccept
|
|
31
|
-
* 2. Time delay passes (1 day)
|
|
32
|
-
* 3. Proposed address calls accept -> current is updated, proposal is cleared
|
|
33
|
-
*
|
|
34
|
-
* @param current Currently active address with the role/privilege
|
|
35
|
-
* @param proposal Proposed new address awaiting acceptance after time delay
|
|
36
|
-
* @param timeToAccept Timestamp after which the proposal can be accepted
|
|
37
|
-
*/
|
|
38
|
-
struct AddressTypeProposal {
|
|
39
|
-
address current;
|
|
40
|
-
address proposal;
|
|
41
|
-
uint256 timeToAccept;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @notice Time-delayed proposal structure for uint-type governance changes
|
|
46
|
-
* @dev Used for token withdrawal amount changes with time-delayed governance
|
|
47
|
-
* Follows the same pattern as AddressTypeProposal for consistency
|
|
48
|
-
*
|
|
49
|
-
* @param current Currently active value for the parameter
|
|
50
|
-
* @param proposal Proposed new value awaiting acceptance after time delay
|
|
51
|
-
* @param timeToAccept Timestamp after which the proposal can be accepted
|
|
52
|
-
*/
|
|
53
|
-
struct UintTypeProposal {
|
|
54
|
-
uint256 current;
|
|
55
|
-
uint256 proposal;
|
|
56
|
-
uint256 timeToAccept;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @notice Time-delayed proposal structure for boolean flag changes
|
|
61
|
-
* @dev Used for feature toggles and system state changes requiring governance
|
|
62
|
-
*
|
|
63
|
-
* @param flag Current boolean state of the feature/setting
|
|
64
|
-
* @param timeToAcceptChange Timestamp when the flag change can be executed
|
|
65
|
-
*/
|
|
66
|
-
struct BoolTypeProposal {
|
|
67
|
-
bool flag;
|
|
68
|
-
uint256 timeToAcceptChange;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
//░▒▓█ Identity Management Structures ███████████████████████████████████████████████▓▒░
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @notice Core metadata for each registered identity/username
|
|
75
|
-
* @dev Stores essential registration information and ownership details
|
|
76
|
-
*
|
|
77
|
-
* Registration States:
|
|
78
|
-
* - flagNotAUsername = 0x01: Pre-registration (temporary reservation)
|
|
79
|
-
* - flagNotAUsername = 0x00: Full username registration (active identity)
|
|
80
|
-
*
|
|
81
|
-
* Ownership Model:
|
|
82
|
-
* - Owner has full control over the username
|
|
83
|
-
* - Ownership expires at expireDate (renewable up to 100 years)
|
|
84
|
-
* - Can be transferred through marketplace offers
|
|
85
|
-
*
|
|
86
|
-
* @param owner Address that owns this identity/username
|
|
87
|
-
* @param expireDate Timestamp when the registration expires (renewable)
|
|
88
|
-
* @param customMetadataMaxSlots Number of custom metadata entries stored for this identity
|
|
89
|
-
* @param offerMaxSlots Highest offer ID that has been created for this username
|
|
90
|
-
* @param flagNotAUsername 0x01 for pre-registration, 0x00 for full username
|
|
91
|
-
*/
|
|
92
|
-
struct IdentityBaseMetadata {
|
|
93
|
-
address owner;
|
|
94
|
-
uint256 expireDate;
|
|
95
|
-
uint256 customMetadataMaxSlots;
|
|
96
|
-
uint256 offerMaxSlots;
|
|
97
|
-
bytes1 flagNotAUsername;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
//░▒▓█ Marketplace Structures ███████████████████████████████████████████████████████▓▒░
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* @notice Metadata for marketplace offers on usernames
|
|
104
|
-
* @dev Represents a locked offer to purchase a username at a specific price
|
|
105
|
-
*
|
|
106
|
-
* Offer Lifecycle:
|
|
107
|
-
* 1. Created: Tokens are locked in contract (after 0.5% marketplace fee deduction)
|
|
108
|
-
* 2. Active: Can be accepted by owner or withdrawn by offerer before expiration
|
|
109
|
-
* 3. Expired/Completed: offerer set to address(0), tokens released
|
|
110
|
-
*
|
|
111
|
-
* Fee Structure:
|
|
112
|
-
* - 0.5% marketplace fee deducted from offer amount
|
|
113
|
-
* - Remaining 99.5% locked for potential acceptance
|
|
114
|
-
* - Additional fees for stakers processing the transaction
|
|
115
|
-
*
|
|
116
|
-
* @param offerer Address that created and can withdraw this offer
|
|
117
|
-
* @param expireDate Timestamp when the offer expires and can no longer be accepted
|
|
118
|
-
* @param amount Amount offered in Principal Tokens (after 0.5% marketplace fee deduction)
|
|
119
|
-
*/
|
|
120
|
-
struct OfferMetadata {
|
|
121
|
-
address offerer;
|
|
122
|
-
uint256 expireDate;
|
|
123
|
-
uint256 amount;
|
|
124
|
-
}
|
|
125
|
-
}
|