···92929393### 6.2 Read (Resolution)
94949595-Call `resolveCow(initial_controller_address, initial_wrapped_did)` against the registry contract.
9595+Call `resolve(initial_controller_address, initial_wrapped_did)` against the registry contract.
96969797 The did:cow registry contract performs the following steps:
9898···114114115115Call `deactivate(initial_controller_address, initial_wrapped_did)` from the current controller to permanently deactivate a did:cow ID. If the did:cow ID has not been registered on-chain yet, it will be registered automatically in the same transaction.
116116117117-After deactivation, `resolveCow` returns an empty string and the DID cannot be reactivated.
117117+After deactivation, `resolve` returns an empty string and the DID cannot be reactivated.
118118119119NB: It is permitted to set the controller to `0x0` via `updateController` without deactivating, in which case the DID continues to resolve but can never be updated or deactivated.
120120···166166Deployed on Sepolia testnet: [`0xfca809F35369b6A5F47f52226893Ae1B55eE281b`](https://sepolia.etherscan.io/address/0xfca809F35369b6A5F47f52226893Ae1B55eE281b)
167167168168**Contract functions (`CowRegistry.sol`):**
169169-- `calculateCowHash(controller, wrappedDID)` — derive the registry key for a did:cow ID
170170-- `resolveCow(controller, wrappedDID)` — return current controller and wrapped DID without needing to pre-compute the hash
171171-- `initializeCow(controller, wrappedDID)` — optionally pre-register before first update
169169+- `calculateHash(controller, wrappedDID)` — derive the registry key for a did:cow ID
170170+- `resolve(controller, wrappedDID)` — return current controller and wrapped DID without needing to pre-compute the hash
171171+- `initialize(controller, wrappedDID)` — optionally pre-register before first update
172172- `updateWrappedDID(controller, wrappedDID, newWrappedDID)` — update wrapped DID, registering if needed
173173- `updateWrappedDIDByHash(cowHash, newWrappedDID)` — update wrapped DID by pre-computed hash
174174- `updateController(controller, wrappedDID, newController)` — transfer control, registering if needed
···2929 mapping(bytes32 => Cow) public cows;
30303131 /// @notice Emitted when a cow is registered on-chain for the first time.
3232- event CowInitialized(bytes32 indexed cowHash, address controller, string wrappedDID);
3232+ event Initialized(bytes32 indexed cowHash, address controller, string wrappedDID);
33333434 /// @notice Emitted when a cow is permanently deactivated.
3535- event CowDeactivated(bytes32 indexed cowHash);
3535+ event Deactivated(bytes32 indexed cowHash);
36363737 /// @notice Emitted when a cow's controller address is updated.
3838 event ControllerUpdated(bytes32 indexed cowHash, address controller);
···4444 /// @param _controller The initial controller address.
4545 /// @param _wrappedDID The initial wrapped DID, without the leading "did:" prefix.
4646 /// @return The keccak256 hash used as the key in the cows mapping.
4747- function calculateCowHash(address _controller, string memory _wrappedDID) public pure returns (bytes32) {
4747+ function calculateHash(address _controller, string memory _wrappedDID) public pure returns (bytes32) {
4848 return keccak256(abi.encodePacked(_controller, _wrappedDID));
4949 }
5050···5353 /// @param _controller The initial controller address from the did:cow identifier.
5454 /// @param _wrappedDID The initial wrapped DID from the did:cow identifier, without "did:".
5555 /// @return cowHash The registry key for this did:cow identifier.
5656- function _ensureCowInitialized(address _controller, string memory _wrappedDID) internal returns (bytes32 cowHash) {
5757- cowHash = calculateCowHash(_controller, _wrappedDID);
5656+ function _ensureInitialized(address _controller, string memory _wrappedDID) internal returns (bytes32 cowHash) {
5757+ cowHash = calculateHash(_controller, _wrappedDID);
5858 Cow storage cow = cows[cowHash];
5959 if (cow.deactivated) revert AlreadyDeactivated();
6060 if (!cow.initialized) {
···6262 cow.initialized = true;
6363 cow.controller = _controller;
6464 cow.wrappedDID = _wrappedDID;
6565- emit CowInitialized(cowHash, _controller, _wrappedDID);
6565+ emit Initialized(cowHash, _controller, _wrappedDID);
6666 }
6767 return cowHash;
6868 }
···7272 /// may not yet be registered on-chain.
7373 /// Setting _controller to address(0) makes the cow permanently uncontrollable
7474 /// without deactivating it — it will continue to resolve but can never be updated.
7575- /// @param _cowHash The cow's registry key, as returned by calculateCowHash.
7575+ /// @param _cowHash The cow's registry key, as returned by calculateHash.
7676 /// @param _controller The new controller address.
7777 function updateControllerByHash(bytes32 _cowHash, address _controller) public {
7878 Cow storage cow = cows[_cowHash];
···8787 /// @notice Update the wrapped DID for an already-registered cow.
8888 /// @dev Caller must be the current controller. Use updateWrappedDID if the cow
8989 /// may not yet be registered on-chain.
9090- /// @param _cowHash The cow's registry key, as returned by calculateCowHash.
9090+ /// @param _cowHash The cow's registry key, as returned by calculateHash.
9191 /// @param _wrappedDID The new wrapped DID, without the leading "did:" prefix.
9292 function updateWrappedDIDByHash(bytes32 _cowHash, string memory _wrappedDID) public {
9393 Cow storage cow = cows[_cowHash];
···103103 /// @notice Permanently deactivate an already-registered cow.
104104 /// @dev Caller must be the current controller. Deactivation is irreversible.
105105 /// Use deactivate if the cow may not yet be registered on-chain.
106106- /// @param _cowHash The cow's registry key, as returned by calculateCowHash.
106106+ /// @param _cowHash The cow's registry key, as returned by calculateHash.
107107 function deactivateByHash(bytes32 _cowHash) public {
108108 Cow storage cow = cows[_cowHash];
109109 if (!cow.initialized) revert NotInitialized();
···114114 cow.controller = address(0);
115115 cow.wrappedDID = "";
116116117117- emit CowDeactivated(_cowHash);
117117+ emit Deactivated(_cowHash);
118118 }
119119120120 /// @notice Optionally pre-register a cow on-chain before its first update.
···122122 /// deactivate all register the cow automatically if needed.
123123 /// @param _controller The initial controller address.
124124 /// @param _wrappedDID The initial wrapped DID, without the leading "did:" prefix.
125125- function initializeCow(address _controller, string memory _wrappedDID) external {
126126- _ensureCowInitialized(_controller, _wrappedDID);
125125+ function initialize(address _controller, string memory _wrappedDID) external {
126126+ _ensureInitialized(_controller, _wrappedDID);
127127 }
128128129129 /// @notice Transfer control to a new address, registering the cow on-chain if not already present.
···131131 /// @param _wrappedDID The initial wrapped DID from the did:cow identifier, without "did:".
132132 /// @param _newController The new controller address.
133133 function updateController(address _controller, string memory _wrappedDID, address _newController) external {
134134- bytes32 cowHash = _ensureCowInitialized(_controller, _wrappedDID);
134134+ bytes32 cowHash = _ensureInitialized(_controller, _wrappedDID);
135135 updateControllerByHash(cowHash, _newController);
136136 }
137137···140140 /// @param _wrappedDID The initial wrapped DID from the did:cow identifier, without "did:".
141141 /// @param _newWrappedDID The new wrapped DID, without the leading "did:" prefix.
142142 function updateWrappedDID(address _controller, string memory _wrappedDID, string memory _newWrappedDID) external {
143143- bytes32 cowHash = _ensureCowInitialized(_controller, _wrappedDID);
143143+ bytes32 cowHash = _ensureInitialized(_controller, _wrappedDID);
144144 updateWrappedDIDByHash(cowHash, _newWrappedDID);
145145 }
146146···149149 /// @param _controller The initial controller address from the did:cow identifier.
150150 /// @param _wrappedDID The initial wrapped DID from the did:cow identifier, without "did:".
151151 function deactivate(address _controller, string memory _wrappedDID) external {
152152- bytes32 cowHash = _ensureCowInitialized(_controller, _wrappedDID);
152152+ bytes32 cowHash = _ensureInitialized(_controller, _wrappedDID);
153153 deactivateByHash(cowHash);
154154 }
155155···159159 /// @param _wrappedDID The initial wrapped DID from the did:cow identifier, without "did:".
160160 /// @return wrappedDID The current full wrapped DID (with "did:" prepended), or empty string if deactivated.
161161 /// @return controller The current controller address.
162162- function resolveCow(address _controller, string memory _wrappedDID)
162162+ function resolve(address _controller, string memory _wrappedDID)
163163 external
164164 view
165165 returns (string memory wrappedDID, address controller)
166166 {
167167- bytes32 cowHash = calculateCowHash(_controller, _wrappedDID);
167167+ bytes32 cowHash = calculateHash(_controller, _wrappedDID);
168168 Cow storage cow = cows[cowHash];
169169 if (cow.deactivated) {
170170 return ("", address(0));