Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/registry/Registry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "solmate/auth/Owned.sol";

/// @notice Registry - Allows an admin to attest data on-chain
contract Registry is Owned {
struct RegistryItem {
address admin;
string contractType;
uint256 chainId;
}

mapping(address => RegistryItem) registry;

constructor(address _owner) Owned(_owner) {}

/// @notice add an item to the registy
/// @dev Can only be called by the registry owner
function addToRegistry(RegistryItem memory item) public onlyOwner {
registry[item.admin] = item;
}
}
6 changes: 6 additions & 0 deletions test/TestEnvironment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {EIP1167Factory} from "../src/patterns/EIP1167Factory.sol";
import {ImmutableArgsCloneFactory} from "../src/patterns/immutable-args/ImmutableArgsCloneFactory.sol";
import {ImmutableArgsCloneFactory} from "../src/patterns/immutable-args/ImmutableArgsCloneFactory.sol";
import {Create3Factory} from "../src/patterns/create3/Create3Factory.sol";
import {Registry} from "../src/registry/Registry.sol";

contract TestEnvironment is Test {
/// @notice EIP1167 factory
Expand All @@ -18,6 +19,9 @@ contract TestEnvironment is Test {
/// @notice Create3Factory
Create3Factory public create3Factory;

/// @notice vanilla registry
Registry public registry;

uint256 public constant privateKey = 11111111111;

/// @notice deployer nonce (test setup deplyoer)
Expand All @@ -34,5 +38,7 @@ contract TestEnvironment is Test {
immutableArgsCloneFactory = new ImmutableArgsCloneFactory();

create3Factory = new Create3Factory(address(this));

registry = new Registry(owner);
}
}
16 changes: 16 additions & 0 deletions test/registry/Registry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import {TestEnvironment} from "../TestEnvironment.sol";
import {console2} from "forge-std/console2.sol";

contract RegistryTest is TestEnvironment {
function testRegistry() external {
address _admin = vm.addr(1600);
RegistryItem memory item = RegistryItem({admin: _admin, contractType: "test", chainId: 1600});

vm.startPrank(_admin);
registry.addToRegistry(item);
vm.stopPrank();
}
}