-
Notifications
You must be signed in to change notification settings - Fork 17
/
IdentityRegistry.sol
633 lines (531 loc) · 27.1 KB
/
IdentityRegistry.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
pragma solidity ^0.5.0;
import "./SignatureVerifier.sol";
import "./AddressSet/AddressSet.sol";
/// @title The ERC-1484 Identity Registry.
/// @author Noah Zinsmeister
/// @author Andy Chorlian
contract IdentityRegistry is SignatureVerifier {
using AddressSet for AddressSet.Set;
// Identity Data Structure and Parameters //////////////////////////////////////////////////////////////////////////
struct Identity {
address recoveryAddress;
AddressSet.Set associatedAddresses;
AddressSet.Set providers;
AddressSet.Set resolvers;
}
mapping (uint => Identity) private identityDirectory;
mapping (address => uint) private associatedAddressDirectory;
uint public nextEIN = 1;
uint public maxAssociatedAddresses = 50;
// Signature Timeout ///////////////////////////////////////////////////////////////////////////////////////////////
uint public signatureTimeout = 1 days;
/// @dev Enforces that the passed timestamp is within signatureTimeout seconds of now.
/// @param timestamp The timestamp to check the validity of.
modifier ensureSignatureTimeValid(uint timestamp) {
require(
// solium-disable-next-line security/no-block-members
block.timestamp >= timestamp && block.timestamp < timestamp + signatureTimeout, "Timestamp is not valid."
);
_;
}
// Recovery Address Change Logging /////////////////////////////////////////////////////////////////////////////////
struct RecoveryAddressChange {
uint timestamp;
address oldRecoveryAddress;
}
mapping (uint => RecoveryAddressChange) private recoveryAddressChangeLogs;
// Recovery Logging ////////////////////////////////////////////////////////////////////////////////////////////////
struct Recovery {
uint timestamp;
bytes32 hashedOldAssociatedAddresses;
}
mapping (uint => Recovery) private recoveryLogs;
// Recovery Timeout ////////////////////////////////////////////////////////////////////////////////////////////////
uint public recoveryTimeout = 2 weeks;
/// @dev Checks if the passed EIN has changed their recovery address within recoveryTimeout seconds of now.
function canChangeRecoveryAddress(uint ein) private view returns (bool) {
// solium-disable-next-line security/no-block-members
return block.timestamp > recoveryAddressChangeLogs[ein].timestamp + recoveryTimeout;
}
/// @dev Checks if the passed EIN has recovered within recoveryTimeout seconds of now.
function canRecover(uint ein) private view returns (bool) {
// solium-disable-next-line security/no-block-members
return block.timestamp > recoveryLogs[ein].timestamp + recoveryTimeout;
}
// Identity View Functions /////////////////////////////////////////////////////////////////////////////////////////
/// @notice Checks if the passed EIN exists.
/// @dev Does not throw.
/// @param ein The EIN to check the existence of.
/// @return true if the passed EIN exists, false otherwise.
function identityExists(uint ein) public view returns (bool) {
return ein < nextEIN && ein > 0;
}
/// @dev Ensures that the passed EIN exists.
/// @param ein The EIN to check the existence of.
modifier _identityExists(uint ein) {
require(identityExists(ein), "The identity does not exist.");
_;
}
/// @notice Checks if the passed address is associated with an Identity.
/// @dev Does not throw.
/// @param _address The address to check.
/// @return true if the passed address is associated with an Identity, false otherwise.
function hasIdentity(address _address) public view returns (bool) {
return identityExists(associatedAddressDirectory[_address]);
}
/// @dev Ensures that the passed address is or is not associated with an Identity.
/// @param _address The address to check.
/// @param check If true, ensures that the address has an Identity, if false, vice versa.
/// @return true if the associated status is equal to check, false otherwise.
modifier _hasIdentity(address _address, bool check) {
require(
hasIdentity(_address) == check,
check ?
"The passed address does not have an identity but should." :
"The passed address has an identity but should not."
);
_;
}
/// @notice Gets the EIN associated with the passed address.
/// @dev Throws if the address is not associated with an Identity.
/// @param _address The address to check.
/// @return The associated EIN.
function getEIN(address _address) public view _hasIdentity(_address, true) returns (uint ein) {
return associatedAddressDirectory[_address];
}
/// @notice Checks whether the passed EIN is associated with the passed address.
/// @dev Does not throw.
/// @param ein The EIN to check.
/// @param _address The address to check.
/// @return true if the passed address is associated with the passed EIN, false otherwise.
function isAssociatedAddressFor(uint ein, address _address) public view returns (bool) {
return identityDirectory[ein].associatedAddresses.contains(_address);
}
/// @notice Checks whether the passed provider is set for the passed EIN.
/// @dev Does not throw.
/// @param ein The EIN to check.
/// @param provider The provider to check.
/// @return true if the provider is set for the passed EIN, false otherwise.
function isProviderFor(uint ein, address provider) public view returns (bool) {
return identityDirectory[ein].providers.contains(provider);
}
/// @dev Ensures that the msg.sender is a provider for the passed EIN.
/// @param ein The EIN to check.
modifier _isProviderFor(uint ein) {
require(isProviderFor(ein, msg.sender), "The identity has not set the passed provider.");
_;
}
/// @notice Checks whether the passed resolver is set for the passed EIN.
/// @dev Does not throw.
/// @param ein The EIN to check.
/// @param resolver The resolver to check.
/// @return true if the resolver is set for the passed EIN, false otherwise.
function isResolverFor(uint ein, address resolver) public view returns (bool) {
return identityDirectory[ein].resolvers.contains(resolver);
}
/// @notice Gets all identity-related information for the passed EIN.
/// @dev Throws if the passed EIN does not exist.
/// @param ein The EIN to get information for.
/// @return All the information for the Identity denominated by the passed EIN.
function getIdentity(uint ein) public view _identityExists(ein)
returns (
address recoveryAddress,
address[] memory associatedAddresses, address[] memory providers, address[] memory resolvers
)
{
Identity storage _identity = identityDirectory[ein];
return (
_identity.recoveryAddress,
_identity.associatedAddresses.members,
_identity.providers.members,
_identity.resolvers.members
);
}
// Identity Management Functions ///////////////////////////////////////////////////////////////////////////////////
/// @notice Create an new Identity for the transaction sender.
/// @dev Sets the msg.sender as the only associatedAddress.
/// @param recoveryAddress A recovery address to set for the new Identity.
/// @param providers A list of providers to set for the new Identity.
/// @param resolvers A list of resolvers to set for the new Identity.
/// @return The EIN of the new Identity.
function createIdentity(address recoveryAddress, address[] memory providers, address[] memory resolvers)
public returns (uint ein)
{
return createIdentity(recoveryAddress, msg.sender, providers, resolvers, false);
}
/// @notice Allows creation of a new Identity for the passed associatedAddress.
/// @param recoveryAddress A recovery address to set for the new Identity.
/// @param associatedAddress An associated address to set for the new Identity (must have produced the signature).
/// @param providers A list of providers to set for the new Identity.
/// @param resolvers A list of resolvers to set for the new Identity.
/// @param v The v component of the signature.
/// @param r The r component of the signature.
/// @param s The s component of the signature.
/// @param timestamp The timestamp of the signature.
/// @return The EIN of the new Identity.
function createIdentityDelegated(
address recoveryAddress, address associatedAddress, address[] memory providers, address[] memory resolvers,
uint8 v, bytes32 r, bytes32 s, uint timestamp
)
public ensureSignatureTimeValid(timestamp) returns (uint ein)
{
require(
isSigned(
associatedAddress,
keccak256(
abi.encodePacked(
byte(0x19), byte(0), address(this),
"I authorize the creation of an Identity on my behalf.",
recoveryAddress, associatedAddress, providers, resolvers, timestamp
)
),
v, r, s
),
"Permission denied."
);
return createIdentity(recoveryAddress, associatedAddress, providers, resolvers, true);
}
/// @dev Common logic for all identity creation.
function createIdentity(
address recoveryAddress,
address associatedAddress, address[] memory providers, address[] memory resolvers, bool delegated
)
private _hasIdentity(associatedAddress, false) returns (uint)
{
uint ein = nextEIN++;
Identity storage _identity = identityDirectory[ein];
_identity.recoveryAddress = recoveryAddress;
addAssociatedAddress(ein, associatedAddress);
addProviders(ein, providers, delegated);
addResolvers(ein, resolvers, delegated);
emit IdentityCreated(msg.sender, ein, recoveryAddress, associatedAddress, providers, resolvers, delegated);
return ein;
}
/// @notice Allows an associated address to add another associated address to its Identity.
/// @param approvingAddress An associated address for an Identity.
/// @param addressToAdd A new address to set for the Identity of the sender.
/// @param v The v component of the signature.
/// @param r The r component of the signature.
/// @param s The s component of the signature.
/// @param timestamp The timestamp of the signature.
function addAssociatedAddress(
address approvingAddress, address addressToAdd, uint8 v, bytes32 r, bytes32 s, uint timestamp
)
public ensureSignatureTimeValid(timestamp)
{
bool fromApprovingAddress = msg.sender == approvingAddress;
require(
fromApprovingAddress || msg.sender == addressToAdd, "One or both of the passed addresses are malformed."
);
uint ein = getEIN(approvingAddress);
require(
isSigned(
fromApprovingAddress ? addressToAdd : approvingAddress,
keccak256(
abi.encodePacked(
byte(0x19), byte(0), address(this),
fromApprovingAddress ?
"I authorize being added to this Identity." :
"I authorize adding this address to my Identity.",
ein, addressToAdd, timestamp
)
),
v, r, s
),
"Permission denied."
);
addAssociatedAddress(ein, addressToAdd);
emit AssociatedAddressAdded(msg.sender, ein, approvingAddress, addressToAdd, false);
}
/// @notice Allows addition of an associated address to an Identity.
/// @dev The first signature must be that of the approvingAddress.
/// @param approvingAddress An associated address for an Identity.
/// @param addressToAdd A new address to set for the Identity of approvingAddress.
/// @param v The v component of the signatures.
/// @param r The r component of the signatures.
/// @param s The s component of the signatures.
/// @param timestamp The timestamp of the signatures.
function addAssociatedAddressDelegated(
address approvingAddress, address addressToAdd,
uint8[2] memory v, bytes32[2] memory r, bytes32[2] memory s, uint[2] memory timestamp
)
public ensureSignatureTimeValid(timestamp[0]) ensureSignatureTimeValid(timestamp[1])
{
uint ein = getEIN(approvingAddress);
require(
isSigned(
approvingAddress,
keccak256(
abi.encodePacked(
byte(0x19), byte(0), address(this),
"I authorize adding this address to my Identity.",
ein, addressToAdd, timestamp[0]
)
),
v[0], r[0], s[0]
),
"Permission denied from approving address."
);
require(
isSigned(
addressToAdd,
keccak256(
abi.encodePacked(
byte(0x19), byte(0), address(this),
"I authorize being added to this Identity.",
ein, addressToAdd, timestamp[1]
)
),
v[1], r[1], s[1]
),
"Permission denied from address to add."
);
addAssociatedAddress(ein, addressToAdd);
emit AssociatedAddressAdded(msg.sender, ein, approvingAddress, addressToAdd, true);
}
/// @dev Common logic for all address addition.
function addAssociatedAddress(uint ein, address addressToAdd) private _hasIdentity(addressToAdd, false) {
require(
identityDirectory[ein].associatedAddresses.length() < maxAssociatedAddresses, "Too many addresses."
);
identityDirectory[ein].associatedAddresses.insert(addressToAdd);
associatedAddressDirectory[addressToAdd] = ein;
}
/// @notice Allows an associated address to remove itself from its Identity.
function removeAssociatedAddress() public {
uint ein = getEIN(msg.sender);
removeAssociatedAddress(ein, msg.sender);
emit AssociatedAddressRemoved(msg.sender, ein, msg.sender, false);
}
/// @notice Allows removal of an associated address from an Identity.
/// @param addressToRemove An associated address to remove from its Identity.
/// @param v The v component of the signature.
/// @param r The r component of the signature.
/// @param s The s component of the signature.
/// @param timestamp The timestamp of the signature.
function removeAssociatedAddressDelegated(address addressToRemove, uint8 v, bytes32 r, bytes32 s, uint timestamp)
public ensureSignatureTimeValid(timestamp)
{
uint ein = getEIN(addressToRemove);
require(
isSigned(
addressToRemove,
keccak256(
abi.encodePacked(
byte(0x19), byte(0), address(this),
"I authorize removing this address from my Identity.",
ein, addressToRemove, timestamp
)
),
v, r, s
),
"Permission denied."
);
removeAssociatedAddress(ein, addressToRemove);
emit AssociatedAddressRemoved(msg.sender, ein, addressToRemove, true);
}
/// @dev Common logic for all address removal.
function removeAssociatedAddress(uint ein, address addressToRemove) private {
identityDirectory[ein].associatedAddresses.remove(addressToRemove);
delete associatedAddressDirectory[addressToRemove];
}
/// @notice Allows an associated address to add providers to its Identity.
/// @param providers A list of providers.
function addProviders(address[] memory providers) public {
addProviders(getEIN(msg.sender), providers, false);
}
/// @notice Allows providers to add providers to an Identity.
/// @param ein The EIN to add providers to.
/// @param providers A list of providers.
function addProvidersFor(uint ein, address[] memory providers) public _isProviderFor(ein) {
addProviders(ein, providers, true);
}
/// @dev Common logic for all provider adding.
function addProviders(uint ein, address[] memory providers, bool delegated) private {
Identity storage _identity = identityDirectory[ein];
for (uint i; i < providers.length; i++) {
_identity.providers.insert(providers[i]);
emit ProviderAdded(msg.sender, ein, providers[i], delegated);
}
}
/// @notice Allows an associated address to remove providers from its Identity.
/// @param providers A list of providers.
function removeProviders(address[] memory providers) public {
removeProviders(getEIN(msg.sender), providers, false);
}
/// @notice Allows providers to remove providers to an Identity.
/// @param ein The EIN to remove providers from.
/// @param providers A list of providers.
function removeProvidersFor(uint ein, address[] memory providers) public _isProviderFor(ein) {
removeProviders(ein, providers, true);
}
/// @dev Common logic for all provider removal.
function removeProviders(uint ein, address[] memory providers, bool delegated) private {
Identity storage _identity = identityDirectory[ein];
for (uint i; i < providers.length; i++) {
_identity.providers.remove(providers[i]);
emit ProviderRemoved(msg.sender, ein, providers[i], delegated);
}
}
/// @notice Allows an associated address to add resolvers to its Identity.
/// @param resolvers A list of resolvers.
function addResolvers(address[] memory resolvers) public {
addResolvers(getEIN(msg.sender), resolvers, false);
}
/// @notice Allows providers to add resolvers to an Identity.
/// @param ein The EIN to add resolvers to.
/// @param resolvers A list of resolvers.
function addResolversFor(uint ein, address[] memory resolvers) public _isProviderFor(ein) {
addResolvers(ein, resolvers, true);
}
/// @dev Common logic for all resolver adding.
function addResolvers(uint ein, address[] memory resolvers, bool delegated) private {
Identity storage _identity = identityDirectory[ein];
for (uint i; i < resolvers.length; i++) {
_identity.resolvers.insert(resolvers[i]);
emit ResolverAdded(msg.sender, ein, resolvers[i], delegated);
}
}
/// @notice Allows an associated address to remove resolvers from its Identity.
/// @param resolvers A list of resolvers.
function removeResolvers(address[] memory resolvers) public {
removeResolvers(getEIN(msg.sender), resolvers, true);
}
/// @notice Allows providers to remove resolvers from an Identity.
/// @param ein The EIN to remove resolvers from.
/// @param resolvers A list of resolvers.
function removeResolversFor(uint ein, address[] memory resolvers) public _isProviderFor(ein) {
removeResolvers(ein, resolvers, true);
}
/// @dev Common logic for all resolver removal.
function removeResolvers(uint ein, address[] memory resolvers, bool delegated) private {
Identity storage _identity = identityDirectory[ein];
for (uint i; i < resolvers.length; i++) {
_identity.resolvers.remove(resolvers[i]);
emit ResolverRemoved(msg.sender, ein, resolvers[i], delegated);
}
}
// Recovery Management Functions ///////////////////////////////////////////////////////////////////////////////////
/// @notice Allows an associated address to change the recovery address for its Identity.
/// @dev Recovery addresses can be changed at most once every recoveryTimeout seconds.
/// @param newRecoveryAddress A recovery address to set for the sender's EIN.
function triggerRecoveryAddressChange(address newRecoveryAddress) public {
triggerRecoveryAddressChange(getEIN(msg.sender), newRecoveryAddress, false);
}
/// @notice Allows providers to change the recovery address for an Identity.
/// @dev Recovery addresses can be changed at most once every recoveryTimeout seconds.
/// @param ein The EIN to set the recovery address of.
/// @param newRecoveryAddress A recovery address to set for the passed EIN.
function triggerRecoveryAddressChangeFor(uint ein, address newRecoveryAddress) public _isProviderFor(ein) {
triggerRecoveryAddressChange(ein, newRecoveryAddress, true);
}
/// @dev Common logic for all recovery address changes.
function triggerRecoveryAddressChange(uint ein, address newRecoveryAddress, bool delegated) private {
Identity storage _identity = identityDirectory[ein];
require(canChangeRecoveryAddress(ein), "Cannot trigger a change in recovery address yet.");
// solium-disable-next-line security/no-block-members
recoveryAddressChangeLogs[ein] = RecoveryAddressChange(block.timestamp, _identity.recoveryAddress);
emit RecoveryAddressChangeTriggered(msg.sender, ein, _identity.recoveryAddress, newRecoveryAddress, delegated);
_identity.recoveryAddress = newRecoveryAddress;
}
/// @notice Allows recovery addresses to trigger the recovery process for an Identity.
/// @dev msg.sender must be current recovery address, or the old one if it was changed recently.
/// @param ein The EIN to trigger recovery for.
/// @param newAssociatedAddress A recovery address to set for the passed EIN.
/// @param v The v component of the signature.
/// @param r The r component of the signature.
/// @param s The s component of the signature.
/// @param timestamp The timestamp of the signature.
function triggerRecovery(uint ein, address newAssociatedAddress, uint8 v, bytes32 r, bytes32 s, uint timestamp)
public _identityExists(ein) _hasIdentity(newAssociatedAddress, false) ensureSignatureTimeValid(timestamp)
{
require(canRecover(ein), "Cannot trigger recovery yet.");
Identity storage _identity = identityDirectory[ein];
// ensure the sender is the recovery address/old recovery address if there's been a recent change
if (canChangeRecoveryAddress(ein)) {
require(
msg.sender == _identity.recoveryAddress, "Only the current recovery address can trigger recovery."
);
} else {
require(
msg.sender == recoveryAddressChangeLogs[ein].oldRecoveryAddress,
"Only the recently removed recovery address can trigger recovery."
);
}
require(
isSigned(
newAssociatedAddress,
keccak256(
abi.encodePacked(
byte(0x19), byte(0), address(this),
"I authorize being added to this Identity via recovery.",
ein, newAssociatedAddress, timestamp
)
),
v, r, s
),
"Permission denied."
);
// log the old associated addresses to facilitate destruction if necessary
recoveryLogs[ein] = Recovery(
block.timestamp, // solium-disable-line security/no-block-members
keccak256(abi.encodePacked(_identity.associatedAddresses.members))
);
emit RecoveryTriggered(msg.sender, ein, _identity.associatedAddresses.members, newAssociatedAddress);
// remove identity data, and add the new address as the sole associated address
resetIdentityData(_identity, msg.sender, false);
addAssociatedAddress(ein, newAssociatedAddress);
}
/// @notice Allows associated addresses recently removed via recovery to permanently disable their old Identity.
/// @param ein The EIN to trigger destruction of.
/// @param firstChunk The array of addresses before the msg.sender in the pre-recovery associated addresses array.
/// @param lastChunk The array of addresses after the msg.sender in the pre-recovery associated addresses array.
/// @param resetResolvers true if the destroyer wants resolvers to be removed, false otherwise.
function triggerDestruction(uint ein, address[] memory firstChunk, address[] memory lastChunk, bool resetResolvers)
public _identityExists(ein)
{
require(!canRecover(ein), "Recovery has not recently been triggered.");
Identity storage _identity = identityDirectory[ein];
// ensure that the msg.sender was an old associated address for the referenced identity
address payable[1] memory middleChunk = [msg.sender];
require(
keccak256(
abi.encodePacked(firstChunk, middleChunk, lastChunk)
) == recoveryLogs[ein].hashedOldAssociatedAddresses,
"Cannot destroy an EIN from an address that was not recently removed from said EIN via recovery."
);
emit IdentityDestroyed(msg.sender, ein, _identity.recoveryAddress, resetResolvers);
resetIdentityData(_identity, address(0), resetResolvers);
}
/// @dev Common logic for clearing the data of an Identity.
function resetIdentityData(Identity storage identity, address newRecoveryAddress, bool resetResolvers) private {
for (uint i; i < identity.associatedAddresses.members.length; i++) {
delete associatedAddressDirectory[identity.associatedAddresses.members[i]];
}
delete identity.associatedAddresses;
delete identity.providers;
if (resetResolvers) delete identity.resolvers;
identity.recoveryAddress = newRecoveryAddress;
}
// Events //////////////////////////////////////////////////////////////////////////////////////////////////////////
event IdentityCreated(
address indexed initiator, uint indexed ein,
address recoveryAddress, address associatedAddress, address[] providers, address[] resolvers, bool delegated
);
event AssociatedAddressAdded(
address indexed initiator, uint indexed ein, address approvingAddress, address addedAddress, bool delegated
);
event AssociatedAddressRemoved(address indexed initiator, uint indexed ein, address removedAddress, bool delegated);
event ProviderAdded(address indexed initiator, uint indexed ein, address provider, bool delegated);
event ProviderRemoved(address indexed initiator, uint indexed ein, address provider, bool delegated);
event ResolverAdded(address indexed initiator, uint indexed ein, address resolvers, bool delegated);
event ResolverRemoved(address indexed initiator, uint indexed ein, address resolvers, bool delegated);
event RecoveryAddressChangeTriggered(
address indexed initiator, uint indexed ein,
address oldRecoveryAddress, address newRecoveryAddress, bool delegated
);
event RecoveryTriggered(
address indexed initiator, uint indexed ein, address[] oldAssociatedAddresses, address newAssociatedAddress
);
event IdentityDestroyed(address indexed initiator, uint indexed ein, address recoveryAddress, bool resolversReset);
}