@openzeppelin/confidential-contracts 0.2.0-rc.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 +24 -0
- package/build/contracts/Checkpoints.json +16 -0
- package/build/contracts/CheckpointsConfidential.json +16 -0
- package/build/contracts/ConfidentialFungibleToken.json +614 -0
- package/build/contracts/ConfidentialFungibleTokenERC20Wrapper.json +793 -0
- package/build/contracts/ConfidentialFungibleTokenUtils.json +10 -0
- package/build/contracts/ConfidentialFungibleTokenVotes.json +1002 -0
- package/build/contracts/ERC7821WithExecutor.json +145 -0
- package/build/contracts/IConfidentialFungibleToken.json +458 -0
- package/build/contracts/IConfidentialFungibleTokenReceiver.json +45 -0
- package/build/contracts/TFHESafeMath.json +10 -0
- package/build/contracts/VestingWalletCliffConfidential.json +275 -0
- package/build/contracts/VestingWalletCliffExecutorConfidential.json +424 -0
- package/build/contracts/VestingWalletCliffExecutorConfidentialFactory.json +290 -0
- package/build/contracts/VestingWalletConfidential.json +246 -0
- package/build/contracts/VotesConfidential.json +412 -0
- package/finance/ERC7821WithExecutor.sol +46 -0
- package/finance/VestingWalletCliffConfidential.sol +62 -0
- package/finance/VestingWalletCliffExecutorConfidentialFactory.sol +203 -0
- package/finance/VestingWalletConfidential.sol +130 -0
- package/governance/utils/VotesConfidential.sol +202 -0
- package/interfaces/IConfidentialFungibleToken.sol +135 -0
- package/interfaces/IConfidentialFungibleTokenReceiver.sol +19 -0
- package/package.json +39 -0
- package/token/ConfidentialFungibleToken.sol +314 -0
- package/token/extensions/ConfidentialFungibleTokenERC20Wrapper.sol +175 -0
- package/token/extensions/ConfidentialFungibleTokenVotes.sol +29 -0
- package/token/utils/ConfidentialFungibleTokenUtils.sol +46 -0
- package/utils/TFHESafeMath.sol +37 -0
- package/utils/structs/CheckpointsConfidential.sol +193 -0
- package/utils/structs/temporary-Checkpoints.sol +835 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "VotesConfidential",
|
|
4
|
+
"sourceName": "contracts/governance/utils/VotesConfidential.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [],
|
|
8
|
+
"name": "CheckpointUnorderedInsertion",
|
|
9
|
+
"type": "error"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"inputs": [],
|
|
13
|
+
"name": "ECDSAInvalidSignature",
|
|
14
|
+
"type": "error"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"inputs": [
|
|
18
|
+
{
|
|
19
|
+
"internalType": "uint256",
|
|
20
|
+
"name": "length",
|
|
21
|
+
"type": "uint256"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"name": "ECDSAInvalidSignatureLength",
|
|
25
|
+
"type": "error"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"inputs": [
|
|
29
|
+
{
|
|
30
|
+
"internalType": "bytes32",
|
|
31
|
+
"name": "s",
|
|
32
|
+
"type": "bytes32"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"name": "ECDSAInvalidSignatureS",
|
|
36
|
+
"type": "error"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"inputs": [
|
|
40
|
+
{
|
|
41
|
+
"internalType": "uint256",
|
|
42
|
+
"name": "timepoint",
|
|
43
|
+
"type": "uint256"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"internalType": "uint48",
|
|
47
|
+
"name": "clock",
|
|
48
|
+
"type": "uint48"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"name": "ERC5805FutureLookup",
|
|
52
|
+
"type": "error"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"inputs": [],
|
|
56
|
+
"name": "ERC6372InconsistentClock",
|
|
57
|
+
"type": "error"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"inputs": [
|
|
61
|
+
{
|
|
62
|
+
"internalType": "address",
|
|
63
|
+
"name": "account",
|
|
64
|
+
"type": "address"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"internalType": "uint256",
|
|
68
|
+
"name": "currentNonce",
|
|
69
|
+
"type": "uint256"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"name": "InvalidAccountNonce",
|
|
73
|
+
"type": "error"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"inputs": [],
|
|
77
|
+
"name": "InvalidShortString",
|
|
78
|
+
"type": "error"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"inputs": [
|
|
82
|
+
{
|
|
83
|
+
"internalType": "uint8",
|
|
84
|
+
"name": "bits",
|
|
85
|
+
"type": "uint8"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"internalType": "uint256",
|
|
89
|
+
"name": "value",
|
|
90
|
+
"type": "uint256"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"name": "SafeCastOverflowedUintDowncast",
|
|
94
|
+
"type": "error"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"inputs": [
|
|
98
|
+
{
|
|
99
|
+
"internalType": "string",
|
|
100
|
+
"name": "str",
|
|
101
|
+
"type": "string"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"name": "StringTooLong",
|
|
105
|
+
"type": "error"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"inputs": [
|
|
109
|
+
{
|
|
110
|
+
"internalType": "uint256",
|
|
111
|
+
"name": "expiry",
|
|
112
|
+
"type": "uint256"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"name": "VotesExpiredSignature",
|
|
116
|
+
"type": "error"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"anonymous": false,
|
|
120
|
+
"inputs": [
|
|
121
|
+
{
|
|
122
|
+
"indexed": true,
|
|
123
|
+
"internalType": "address",
|
|
124
|
+
"name": "delegator",
|
|
125
|
+
"type": "address"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"indexed": true,
|
|
129
|
+
"internalType": "address",
|
|
130
|
+
"name": "fromDelegate",
|
|
131
|
+
"type": "address"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"indexed": true,
|
|
135
|
+
"internalType": "address",
|
|
136
|
+
"name": "toDelegate",
|
|
137
|
+
"type": "address"
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"name": "DelegateChanged",
|
|
141
|
+
"type": "event"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"anonymous": false,
|
|
145
|
+
"inputs": [
|
|
146
|
+
{
|
|
147
|
+
"indexed": true,
|
|
148
|
+
"internalType": "address",
|
|
149
|
+
"name": "delegate",
|
|
150
|
+
"type": "address"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"indexed": false,
|
|
154
|
+
"internalType": "euint64",
|
|
155
|
+
"name": "previousVotes",
|
|
156
|
+
"type": "bytes32"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"indexed": false,
|
|
160
|
+
"internalType": "euint64",
|
|
161
|
+
"name": "newVotes",
|
|
162
|
+
"type": "bytes32"
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"name": "DelegateVotesChanged",
|
|
166
|
+
"type": "event"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"anonymous": false,
|
|
170
|
+
"inputs": [],
|
|
171
|
+
"name": "EIP712DomainChanged",
|
|
172
|
+
"type": "event"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"inputs": [],
|
|
176
|
+
"name": "CLOCK_MODE",
|
|
177
|
+
"outputs": [
|
|
178
|
+
{
|
|
179
|
+
"internalType": "string",
|
|
180
|
+
"name": "",
|
|
181
|
+
"type": "string"
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"stateMutability": "view",
|
|
185
|
+
"type": "function"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"inputs": [],
|
|
189
|
+
"name": "clock",
|
|
190
|
+
"outputs": [
|
|
191
|
+
{
|
|
192
|
+
"internalType": "uint48",
|
|
193
|
+
"name": "",
|
|
194
|
+
"type": "uint48"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"stateMutability": "view",
|
|
198
|
+
"type": "function"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"inputs": [],
|
|
202
|
+
"name": "confidentialTotalSupply",
|
|
203
|
+
"outputs": [
|
|
204
|
+
{
|
|
205
|
+
"internalType": "euint64",
|
|
206
|
+
"name": "",
|
|
207
|
+
"type": "bytes32"
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"stateMutability": "view",
|
|
211
|
+
"type": "function"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"inputs": [
|
|
215
|
+
{
|
|
216
|
+
"internalType": "address",
|
|
217
|
+
"name": "delegatee",
|
|
218
|
+
"type": "address"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"name": "delegate",
|
|
222
|
+
"outputs": [],
|
|
223
|
+
"stateMutability": "nonpayable",
|
|
224
|
+
"type": "function"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"inputs": [
|
|
228
|
+
{
|
|
229
|
+
"internalType": "address",
|
|
230
|
+
"name": "delegatee",
|
|
231
|
+
"type": "address"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"internalType": "uint256",
|
|
235
|
+
"name": "nonce",
|
|
236
|
+
"type": "uint256"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"internalType": "uint256",
|
|
240
|
+
"name": "expiry",
|
|
241
|
+
"type": "uint256"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"internalType": "uint8",
|
|
245
|
+
"name": "v",
|
|
246
|
+
"type": "uint8"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"internalType": "bytes32",
|
|
250
|
+
"name": "r",
|
|
251
|
+
"type": "bytes32"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"internalType": "bytes32",
|
|
255
|
+
"name": "s",
|
|
256
|
+
"type": "bytes32"
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
"name": "delegateBySig",
|
|
260
|
+
"outputs": [],
|
|
261
|
+
"stateMutability": "nonpayable",
|
|
262
|
+
"type": "function"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"inputs": [
|
|
266
|
+
{
|
|
267
|
+
"internalType": "address",
|
|
268
|
+
"name": "account",
|
|
269
|
+
"type": "address"
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
"name": "delegates",
|
|
273
|
+
"outputs": [
|
|
274
|
+
{
|
|
275
|
+
"internalType": "address",
|
|
276
|
+
"name": "",
|
|
277
|
+
"type": "address"
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"stateMutability": "view",
|
|
281
|
+
"type": "function"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"inputs": [],
|
|
285
|
+
"name": "eip712Domain",
|
|
286
|
+
"outputs": [
|
|
287
|
+
{
|
|
288
|
+
"internalType": "bytes1",
|
|
289
|
+
"name": "fields",
|
|
290
|
+
"type": "bytes1"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"internalType": "string",
|
|
294
|
+
"name": "name",
|
|
295
|
+
"type": "string"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"internalType": "string",
|
|
299
|
+
"name": "version",
|
|
300
|
+
"type": "string"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"internalType": "uint256",
|
|
304
|
+
"name": "chainId",
|
|
305
|
+
"type": "uint256"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"internalType": "address",
|
|
309
|
+
"name": "verifyingContract",
|
|
310
|
+
"type": "address"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"internalType": "bytes32",
|
|
314
|
+
"name": "salt",
|
|
315
|
+
"type": "bytes32"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"internalType": "uint256[]",
|
|
319
|
+
"name": "extensions",
|
|
320
|
+
"type": "uint256[]"
|
|
321
|
+
}
|
|
322
|
+
],
|
|
323
|
+
"stateMutability": "view",
|
|
324
|
+
"type": "function"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"inputs": [
|
|
328
|
+
{
|
|
329
|
+
"internalType": "uint256",
|
|
330
|
+
"name": "timepoint",
|
|
331
|
+
"type": "uint256"
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
"name": "getPastTotalSupply",
|
|
335
|
+
"outputs": [
|
|
336
|
+
{
|
|
337
|
+
"internalType": "euint64",
|
|
338
|
+
"name": "",
|
|
339
|
+
"type": "bytes32"
|
|
340
|
+
}
|
|
341
|
+
],
|
|
342
|
+
"stateMutability": "view",
|
|
343
|
+
"type": "function"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"inputs": [
|
|
347
|
+
{
|
|
348
|
+
"internalType": "address",
|
|
349
|
+
"name": "account",
|
|
350
|
+
"type": "address"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"internalType": "uint256",
|
|
354
|
+
"name": "timepoint",
|
|
355
|
+
"type": "uint256"
|
|
356
|
+
}
|
|
357
|
+
],
|
|
358
|
+
"name": "getPastVotes",
|
|
359
|
+
"outputs": [
|
|
360
|
+
{
|
|
361
|
+
"internalType": "euint64",
|
|
362
|
+
"name": "",
|
|
363
|
+
"type": "bytes32"
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
"stateMutability": "view",
|
|
367
|
+
"type": "function"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"inputs": [
|
|
371
|
+
{
|
|
372
|
+
"internalType": "address",
|
|
373
|
+
"name": "account",
|
|
374
|
+
"type": "address"
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
"name": "getVotes",
|
|
378
|
+
"outputs": [
|
|
379
|
+
{
|
|
380
|
+
"internalType": "euint64",
|
|
381
|
+
"name": "",
|
|
382
|
+
"type": "bytes32"
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
"stateMutability": "view",
|
|
386
|
+
"type": "function"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"inputs": [
|
|
390
|
+
{
|
|
391
|
+
"internalType": "address",
|
|
392
|
+
"name": "owner",
|
|
393
|
+
"type": "address"
|
|
394
|
+
}
|
|
395
|
+
],
|
|
396
|
+
"name": "nonces",
|
|
397
|
+
"outputs": [
|
|
398
|
+
{
|
|
399
|
+
"internalType": "uint256",
|
|
400
|
+
"name": "",
|
|
401
|
+
"type": "uint256"
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
"stateMutability": "view",
|
|
405
|
+
"type": "function"
|
|
406
|
+
}
|
|
407
|
+
],
|
|
408
|
+
"bytecode": "0x",
|
|
409
|
+
"deployedBytecode": "0x",
|
|
410
|
+
"linkReferences": {},
|
|
411
|
+
"deployedLinkReferences": {}
|
|
412
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// OpenZeppelin Confidential Contracts (last updated v0.2.0-rc.1) (finance/ERC7821WithExecutor.sol)
|
|
3
|
+
pragma solidity ^0.8.20;
|
|
4
|
+
|
|
5
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
6
|
+
import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @dev Extension of `ERC7821` that adds an {executor} address that is able to execute arbitrary calls via `ERC7821.execute`.
|
|
10
|
+
*/
|
|
11
|
+
abstract contract ERC7821WithExecutor is Initializable, ERC7821 {
|
|
12
|
+
/// @custom:storage-location erc7201:openzeppelin.storage.ERC7821WithExecutor
|
|
13
|
+
struct ERC7821WithExecutorStorage {
|
|
14
|
+
address _executor;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC7821WithExecutor")) - 1)) & ~bytes32(uint256(0xff))
|
|
18
|
+
// solhint-disable-next-line const-name-snakecase
|
|
19
|
+
bytes32 private constant ERC7821WithExecutorStorageLocation =
|
|
20
|
+
0x246106ffca67a7d3806ba14f6748826b9c39c9fa594b14f83fe454e8e9d0dc00;
|
|
21
|
+
|
|
22
|
+
/// @dev Trusted address that is able to execute arbitrary calls from the vesting wallet via `ERC7821.execute`.
|
|
23
|
+
function executor() public view virtual returns (address) {
|
|
24
|
+
return _getERC7821WithExecutorStorage()._executor;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// solhint-disable-next-line func-name-mixedcase
|
|
28
|
+
function __ERC7821WithExecutor_init(address executor_) internal onlyInitializing {
|
|
29
|
+
_getERC7821WithExecutorStorage()._executor = executor_;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/// @inheritdoc ERC7821
|
|
33
|
+
function _erc7821AuthorizedExecutor(
|
|
34
|
+
address caller,
|
|
35
|
+
bytes32 mode,
|
|
36
|
+
bytes calldata executionData
|
|
37
|
+
) internal view virtual override returns (bool) {
|
|
38
|
+
return caller == executor() || super._erc7821AuthorizedExecutor(caller, mode, executionData);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function _getERC7821WithExecutorStorage() private pure returns (ERC7821WithExecutorStorage storage $) {
|
|
42
|
+
assembly {
|
|
43
|
+
$.slot := ERC7821WithExecutorStorageLocation
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// OpenZeppelin Confidential Contracts (last updated v0.2.0-rc.1) (finance/VestingWalletCliffConfidential.sol)
|
|
3
|
+
pragma solidity ^0.8.27;
|
|
4
|
+
|
|
5
|
+
import {euint128} from "@fhevm/solidity/lib/FHE.sol";
|
|
6
|
+
import {VestingWalletConfidential} from "./VestingWalletConfidential.sol";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @dev An extension of {VestingWalletConfidential} that adds a cliff to the vesting schedule. The cliff is `cliffSeconds` long and
|
|
10
|
+
* starts at the vesting start timestamp (see {VestingWalletConfidential}).
|
|
11
|
+
*/
|
|
12
|
+
abstract contract VestingWalletCliffConfidential is VestingWalletConfidential {
|
|
13
|
+
/// @custom:storage-location erc7201:openzeppelin.storage.VestingWalletCliffConfidential
|
|
14
|
+
struct VestingWalletCliffStorage {
|
|
15
|
+
uint64 _cliff;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.VestingWalletCliffConfidential")) - 1)) & ~bytes32(uint256(0xff))
|
|
19
|
+
// solhint-disable-next-line const-name-snakecase
|
|
20
|
+
bytes32 private constant VestingWalletCliffStorageLocation =
|
|
21
|
+
0x3c715f77db997bdb68403fafb54820cd57dedce553ed6315028656b0d601c700;
|
|
22
|
+
|
|
23
|
+
/// @dev The specified cliff duration is larger than the vesting duration.
|
|
24
|
+
error VestingWalletCliffConfidentialInvalidCliffDuration(uint64 cliffSeconds, uint64 durationSeconds);
|
|
25
|
+
|
|
26
|
+
/// @dev The timestamp at which the cliff ends.
|
|
27
|
+
function cliff() public view virtual returns (uint64) {
|
|
28
|
+
return _getVestingWalletCliffStorage()._cliff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @dev Set the duration of the cliff, in seconds. The cliff starts at the vesting
|
|
33
|
+
* start timestamp (see {VestingWalletConfidential-start}) and ends `cliffSeconds` later.
|
|
34
|
+
*/
|
|
35
|
+
// solhint-disable-next-line func-name-mixedcase
|
|
36
|
+
function __VestingWalletCliffConfidential_init(uint48 cliffSeconds) internal onlyInitializing {
|
|
37
|
+
require(
|
|
38
|
+
cliffSeconds <= duration(),
|
|
39
|
+
VestingWalletCliffConfidentialInvalidCliffDuration(cliffSeconds, duration())
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
_getVestingWalletCliffStorage()._cliff = start() + cliffSeconds;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @dev This function returns the amount vested, as a function of time, for
|
|
47
|
+
* an asset given its total historical allocation. Returns 0 if the {cliff} timestamp is not met.
|
|
48
|
+
*
|
|
49
|
+
* IMPORTANT: The cliff not only makes the schedule return 0, but it also ignores every possible side
|
|
50
|
+
* effect from calling the inherited implementation (i.e. `super._vestingSchedule`). Carefully consider
|
|
51
|
+
* this caveat if the overridden implementation of this function has any (e.g. writing to memory or reverting).
|
|
52
|
+
*/
|
|
53
|
+
function _vestingSchedule(euint128 totalAllocation, uint64 timestamp) internal virtual override returns (euint128) {
|
|
54
|
+
return timestamp < cliff() ? euint128.wrap(0) : super._vestingSchedule(totalAllocation, timestamp);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function _getVestingWalletCliffStorage() private pure returns (VestingWalletCliffStorage storage $) {
|
|
58
|
+
assembly {
|
|
59
|
+
$.slot := VestingWalletCliffStorageLocation
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|