@evvm/testnet-contracts 3.0.0 → 3.0.2
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 +3 -1
- package/contracts/core/Core.sol +327 -133
- package/contracts/core/lib/CoreStorage.sol +60 -24
- package/contracts/p2pSwap/P2PSwap.sol +183 -141
- package/interfaces/ICore.sol +1 -1
- package/interfaces/IP2PSwap.sol +0 -2
- package/library/errors/CoreError.sol +25 -11
- package/library/structs/P2PSwapStructs.sol +1 -57
- package/library/utils/governance/ProposalStructs.sol +6 -0
- package/library/utils/service/CoreExecution.sol +0 -19
- package/package.json +1 -1
package/interfaces/ICore.sol
CHANGED
|
@@ -145,7 +145,7 @@ interface ICore {
|
|
|
145
145
|
function rejectUpgrade() external;
|
|
146
146
|
function removeAmountFromUser(address user, address token, uint256 amount) external;
|
|
147
147
|
function reserveAsyncNonce(uint256 nonce, address serviceAddress) external;
|
|
148
|
-
function revokeAsyncNonce(
|
|
148
|
+
function revokeAsyncNonce(uint256 nonce) external;
|
|
149
149
|
function setEvvmID(uint256 newEvvmID) external;
|
|
150
150
|
function setPointStaker(address user, bytes1 answer) external;
|
|
151
151
|
function validateAndConsumeNonce(
|
package/interfaces/IP2PSwap.sol
CHANGED
|
@@ -133,8 +133,6 @@ interface IP2PSwap {
|
|
|
133
133
|
function rejectProposeOwner() external;
|
|
134
134
|
function rejectProposePercentageFee() external;
|
|
135
135
|
function rejectProposeWithdrawal() external;
|
|
136
|
-
function reserveAsyncNonceToService(uint256 nonce) external;
|
|
137
|
-
function revokeAsyncNonceToService(address user, uint256 nonce) external;
|
|
138
136
|
function stake(uint256 amount) external;
|
|
139
137
|
function unstake(uint256 amount) external;
|
|
140
138
|
}
|
|
@@ -74,13 +74,12 @@ library CoreError {
|
|
|
74
74
|
/// @dev Thrown when address validation fails in proposals
|
|
75
75
|
error IncorrectAddressInput();
|
|
76
76
|
|
|
77
|
-
//░▒▓█
|
|
78
|
-
|
|
79
|
-
/// @dev Thrown when attempting time-locked action before delay (30d impl, 1d admin)
|
|
80
|
-
error TimeLockNotExpired();
|
|
81
|
-
|
|
77
|
+
//░▒▓█ Proposal Errors █████████████████████████████████████████████████████▓▒░
|
|
82
78
|
|
|
79
|
+
/// @dev Thrown when accepting before timelock
|
|
80
|
+
error ProposalNotReadyToAccept();
|
|
83
81
|
|
|
82
|
+
//░▒▓█ Async/Sync Nonce Errors ██████████████████████████████████████████████▓▒░
|
|
84
83
|
/// @dev Thrown when async nonce already consumed
|
|
85
84
|
error AsyncNonceAlreadyUsed();
|
|
86
85
|
|
|
@@ -102,15 +101,30 @@ library CoreError {
|
|
|
102
101
|
/// @dev Thrown when using async nonce reserved by different service
|
|
103
102
|
error AsyncNonceIsReservedByAnotherService();
|
|
104
103
|
|
|
105
|
-
/// @dev Thrown when accepting UserValidator proposal before timelock
|
|
106
|
-
error ProposalForUserValidatorNotReady();
|
|
107
|
-
|
|
108
104
|
/// @dev Thrown when validateAndConsumeNonce caller is EOA (contracts only)
|
|
109
105
|
error MsgSenderIsNotAContract();
|
|
110
106
|
|
|
111
|
-
/// @dev Thrown when accepting EVVM address proposal before timelock
|
|
112
|
-
error ProposalForEvvmAddressNotReady();
|
|
113
|
-
|
|
114
107
|
/// @dev Thrown when reserving nonce with service == address(0)
|
|
115
108
|
error InvalidServiceAddress();
|
|
109
|
+
|
|
110
|
+
//░▒▓█ Token List Errors ████████████████████████████████████████████████████▓▒░
|
|
111
|
+
/**
|
|
112
|
+
* @dev Thrown when a token is in
|
|
113
|
+
* - the denylist (if the denylist is active)
|
|
114
|
+
* - not in the allowlist (if the allowlist is active)
|
|
115
|
+
*/
|
|
116
|
+
error TokenIsDeniedForExecution();
|
|
117
|
+
|
|
118
|
+
/// @dev Thrown when list status is invalid (not 0x00, 0x01, or 0x02)
|
|
119
|
+
error InvalidListStatus();
|
|
120
|
+
|
|
121
|
+
//░▒▓█ Reward Distribution State ██████████████████████████████████████████████████████▓▒░
|
|
122
|
+
|
|
123
|
+
error RewardFlowDistributionChangeNotAllowed();
|
|
124
|
+
|
|
125
|
+
error BaseRewardIncreaseNotAllowed();
|
|
126
|
+
|
|
127
|
+
//░▒▓█ Total Supply State ██████████████████████████████████████████████████████▓▒░
|
|
128
|
+
|
|
129
|
+
error MaxSupplyDeletionNotAllowed();
|
|
116
130
|
}
|
|
@@ -10,7 +10,7 @@ pragma solidity ^0.8.0;
|
|
|
10
10
|
* @dev All operations validated via Core.sol async nonces. Payments via Core.sol.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
library P2PSwapStructs {
|
|
14
14
|
/**
|
|
15
15
|
* @notice Market metadata for token pair trading
|
|
16
16
|
* @dev Tracks order slot allocation and active order count.
|
|
@@ -68,60 +68,4 @@ abstract contract P2PSwapStructs {
|
|
|
68
68
|
uint256 service;
|
|
69
69
|
uint256 mateStaker;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @notice Metadata for makeOrder operation signature
|
|
74
|
-
* @dev Hashed via P2PSwapHashUtils. Validated via Core.sol with async nonce.
|
|
75
|
-
* @param nonce Async nonce
|
|
76
|
-
* @param tokenA Token offered
|
|
77
|
-
* @param tokenB Token requested
|
|
78
|
-
* @param amountA Amount offered
|
|
79
|
-
* @param amountB Amount requested
|
|
80
|
-
*/
|
|
81
|
-
struct MetadataMakeOrder {
|
|
82
|
-
uint256 nonce;
|
|
83
|
-
address originExecutor;
|
|
84
|
-
address tokenA;
|
|
85
|
-
address tokenB;
|
|
86
|
-
uint256 amountA;
|
|
87
|
-
uint256 amountB;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @notice Metadata for cancelOrder operation signature
|
|
92
|
-
* @dev Hashed via P2PSwapHashUtils. Only order owner can cancel. Async nonce.
|
|
93
|
-
* @param nonce Async nonce
|
|
94
|
-
* @param tokenA Token A in pair
|
|
95
|
-
* @param tokenB Token B in pair
|
|
96
|
-
* @param orderId Order ID to cancel
|
|
97
|
-
* @param signature EIP-191 signature from seller
|
|
98
|
-
*/
|
|
99
|
-
struct MetadataCancelOrder {
|
|
100
|
-
uint256 nonce;
|
|
101
|
-
address originExecutor;
|
|
102
|
-
address tokenA;
|
|
103
|
-
address tokenB;
|
|
104
|
-
uint256 orderId;
|
|
105
|
-
bytes signature;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* @notice Metadata for dispatchOrder operation signature
|
|
110
|
-
* @dev Hashed via P2PSwapHashUtils. Used by both proportional and fixed fee variants. Async nonce.
|
|
111
|
-
* @param nonce Async nonce
|
|
112
|
-
* @param tokenA Token A in pair
|
|
113
|
-
* @param tokenB Token B in pair
|
|
114
|
-
* @param orderId Order ID to fill
|
|
115
|
-
* @param amountOfTokenBToFill Total tokenB including fees
|
|
116
|
-
* @param signature EIP-191 signature from buyer
|
|
117
|
-
*/
|
|
118
|
-
struct MetadataDispatchOrder {
|
|
119
|
-
uint256 nonce;
|
|
120
|
-
address originExecutor;
|
|
121
|
-
address tokenA;
|
|
122
|
-
address tokenB;
|
|
123
|
-
uint256 orderId;
|
|
124
|
-
uint256 amountOfTokenBToFill;
|
|
125
|
-
bytes signature;
|
|
126
|
-
}
|
|
127
71
|
}
|
|
@@ -121,25 +121,6 @@ abstract contract CoreExecution {
|
|
|
121
121
|
core.disperseCaPay(toData, token, amount);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
/**
|
|
125
|
-
* @notice Reserves async nonce for user and this service exclusively
|
|
126
|
-
* @dev Calls core.reserveAsyncNonce(user, nonce, address(this)). Nonce can be revoked before use.
|
|
127
|
-
* @param nonce Async nonce number to reserve
|
|
128
|
-
*/
|
|
129
|
-
function reserveAsyncNonceToService(uint256 nonce) external {
|
|
130
|
-
core.reserveAsyncNonce(nonce, address(this));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @notice Revokes reserved async nonce before use
|
|
135
|
-
* @dev Calls core.revokeAsyncNonce(user, nonce). Cannot revoke consumed nonces.
|
|
136
|
-
* @param user User address that reserved nonce
|
|
137
|
-
* @param nonce Async nonce number to revoke
|
|
138
|
-
*/
|
|
139
|
-
function revokeAsyncNonceToService(address user, uint256 nonce) external {
|
|
140
|
-
core.revokeAsyncNonce(user, nonce);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
124
|
/**
|
|
144
125
|
* @notice Gets next sequential sync nonce for user
|
|
145
126
|
* @dev View function returning core.getNextCurrentSyncNonce(user). Auto-increments after each use.
|
package/package.json
CHANGED