Skip to content

Commit

Permalink
Extract abi part to compare and update IERC6538
Browse files Browse the repository at this point in the history
  • Loading branch information
garyghayrat committed Jan 30, 2024
1 parent e5c6598 commit 07861cd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ jobs:

- name: Ensure correctness of the `IERC5564Announcer` interface
run: |
diff=$(jd -set out/ERC5564Announcer.sol/ERC5564Announcer.json out/IERC5564Announcer.sol/IERC5564Announcer.json)
diff=$(jd -set <(jq '.abi' out/ERC5564Announcer.sol/ERC5564Announcer.json) <(jq '.abi' out/IERC5564Announcer.sol/IERC5564Announcer.json))
if [[ -n $diff ]]; then exit 1; fi
- name: Ensure correctness of the `IERC6538Registry` interface
run: |
diff=$(jd -set out/ERC6538Registry.sol/ERC6538Registry.json out/IERC6538Registry.sol/IERC6538Registry.json)
if [[ -n $diff ]]; then exit 1; fi
diff=$(jd -set <(jq '.abi' out/ERC6538Registry.sol/ERC6538Registry.json) <(jq '.abi' out/IERC6538Registry.sol/IERC6538Registry.json))
expected_diff="@ [[\"set\"],{}] - {\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}"
if [[ $diff != $expected_diff ]]; then exit 1; fi
coverage:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions src/ERC6538Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ contract ERC6538Registry {
mapping(address registrant => mapping(uint256 schemeId => bytes)) public stealthMetaAddressOf;

/// @notice A nonce used to ensure a signature can only be used once.
/// @dev `user` is the registrant address.
/// @dev `registrant` is the user address.
/// @dev `nonce` will be incremented after each valid `registerKeysOnBehalf` call.
mapping(address user => uint256) public nonceOf;
mapping(address registrant => uint256) public nonceOf;

/// @notice The EIP-712 type hash used in `registerKeysOnBehalf`.
bytes32 public constant ERC6538REGISTRY_ENTRY_TYPE_HASH =
Expand Down
15 changes: 15 additions & 0 deletions src/interfaces/IERC6538Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ pragma solidity 0.8.23;
/// @dev Interface for calling the `ERC6538Registry` contract to map accounts to their stealth
/// meta-address. See [ERC-6538](https://eips.ethereum.org/EIPS/eip-6538) to learn more.
interface IERC6538Registry {
/// @notice Emitted when an invalid signature is provided to `registerKeysOnBehalf`.
error ERC6538Registry__InvalidSignature();

/// @dev Emitted when a registrant updates their stealth meta-address.
/// @param registrant The account that registered the stealth meta-address.
/// @param schemeId Identifier corresponding to the applied stealth address scheme, e.g. 0 for
Expand Down Expand Up @@ -45,4 +48,16 @@ interface IERC6538Registry {

/// @notice Returns the domain separator used in this contract.
function DOMAIN_SEPARATOR() external view returns (bytes32);

/// @notice Returns the stealth meta-address for the given `registrant` and `schemeId`.
function stealthMetaAddressOf(address registrant, uint256 schemeId)
external
view
returns (bytes memory);

/// @notice Returns the EIP-712 type hash used in `registerKeysOnBehalf`.
function ERC6538REGISTRY_ENTRY_TYPE_HASH() external view returns (bytes32);

/// @notice Returns the nonce of the given `registrant`.
function nonceOf(address registrant) external view returns (uint256);
}

0 comments on commit 07861cd

Please sign in to comment.