Skip to content

Commit 54f452c

Browse files
authored
Remove indexed from DSNPRegistryUpdate (#32)
* Update Hardhat * Update typescript * Update typechain deps * Update types and testing * Update lint packages * Update Ethers and remove unneeded dep * Cleanup docs * Remove indexed from DSNPRegistryUpdate * Collapse resolveHandleToAddress and resolveHandleToId into just resolveRegistration
1 parent 9e87703 commit 54f452c

8 files changed

+4753
-2677
lines changed

contracts/IRegistry.sol

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ interface IRegistry {
2626
* @param addr The address the DSNP Id is pointing at
2727
* @param handle The actual UTF-8 string used for the handle
2828
*/
29-
event DSNPRegistryUpdate(uint64 indexed id, address indexed addr, string indexed handle);
29+
event DSNPRegistryUpdate(uint64 indexed id, address indexed addr, string handle);
3030

3131
/**
3232
* @dev Register a new DSNP Id
3333
* @param addr Address for the new DSNP Id to point at
3434
* @param handle The handle for discovery
35-
* @return id for new registration
3635
*
3736
* MUST reject if the handle is already in use
3837
* MUST emit DSNPRegistryUpdate
3938
* MUST check that addr implements IDelegation interface
39+
* @return id for new registration
4040
*/
4141
function register(address addr, string calldata handle) external returns (uint64);
4242

@@ -48,7 +48,7 @@ interface IRegistry {
4848
* MUST be called by someone who is authorized on the contract
4949
* via `IDelegation(oldAddr).isAuthorizedTo(oldAddr, Permission.OWNERSHIP_TRANSFER, block.number)`
5050
* MUST emit DSNPRegistryUpdate
51-
* MUST check that addr implements IDelegation interface
51+
* MUST check that newAddr implements IDelegation interface
5252
*/
5353
function changeAddress(address newAddr, string calldata handle) external;
5454

@@ -103,26 +103,20 @@ interface IRegistry {
103103
) external;
104104

105105
/**
106-
* @dev Resolve a handle to a contract address
107-
* @param handle The handle to resolve
108-
*
109-
* @return Address of the contract
110-
*/
111-
function resolveHandleToAddress(string calldata handle) external view returns (address);
112-
113-
/**
114-
* @dev Resolve a handle to a DSNP Id
106+
* @dev Resolve a handle to a DSNP Id and contract address
115107
* @param handle The handle to resolve
116108
*
117-
* @return DSNP Id
109+
* rejects if not found
110+
* @return A tuple of the DSNP Id and the Address of the contract
118111
*/
119-
function resolveHandleToId(string calldata handle) external view returns (uint64);
112+
function resolveRegistration(string calldata handle) external view returns (uint64, address);
120113

121114
/**
122-
* @dev Resolve a handle to nonce
115+
* @dev Resolve a handle to a EIP 712 nonce
123116
* @param handle The handle to resolve
124117
*
125-
* @return nonce value for handle
118+
* rejects if not found
119+
* @return expected nonce for next EIP 712 update
126120
*/
127121
function resolveHandleToNonce(string calldata handle) external view returns (uint32);
128122
}

contracts/Registry.sol

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -257,36 +257,23 @@ contract Registry is IRegistry {
257257
}
258258

259259
/**
260-
* @dev Resolve a handle to a contract address
260+
* @dev Resolve a handle to a DSNP Id and contract address
261261
* @param handle The handle to resolve
262262
*
263-
* @return Address of the contract
263+
* rejects if not found
264+
* @return A tuple of the DSNP Id and the Address of the contract
264265
*/
265-
function resolveHandleToAddress(string calldata handle)
266+
function resolveRegistration(string calldata handle)
266267
external
267268
view
268269
override
269-
returns (address)
270+
returns (uint64, address)
270271
{
271272
Registration memory reg = registrations[handle];
272273

273274
require(reg.id != 0, "Handle does not exist");
274275

275-
return reg.identityAddress;
276-
}
277-
278-
/**
279-
* @dev Resolve a handle to a DSNP Id
280-
* @param handle The handle to resolve
281-
*
282-
* @return DSNP Id
283-
*/
284-
function resolveHandleToId(string calldata handle) external view override returns (uint64) {
285-
Registration memory reg = registrations[handle];
286-
287-
require(reg.id != 0, "Handle does not exist");
288-
289-
return reg.id;
276+
return (reg.id, reg.identityAddress);
290277
}
291278

292279
/**

0 commit comments

Comments
 (0)