Skip to content

Commit de06ed4

Browse files
feat: add KeyRegistry (#257)
* feat: add KeyRegistry * feat: transfer ownership in constructor * feat(KeyRegistry): add migration switch * feat(KeyRegistry): bulk add/remove signers * feat(KeyRegistry): add admin migration grace period * chore: rename scope to keyType * feat: remove ability to freeze signers * feat: a signer key can only be associated with one type * test: assert state of signer as part of all fuzz tests * chore: remove invalid comments * feat: add metadata to Register event * refactor: rename for clarity * test: add coverage for cases, pull out shared helpers * refactor: parameter ordering in Add event * change scheme from uint200 to uint32 * fix: test helper after rebase * feat: add the migrated timestamp to the event --------- Co-authored-by: Varun Srinivasan <[email protected]>
1 parent 8a0e4bb commit de06ed4

File tree

15 files changed

+947
-49
lines changed

15 files changed

+947
-49
lines changed

.vscode/settings.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
".git": true,
44
"out": true,
55
"cache": true,
6-
"lib": true,
6+
"lib": true
77
},
88
"editor.formatOnSave": true,
99
"editor.rulers": [119],
@@ -14,12 +14,6 @@
1414
"editor.defaultFormatter": "JuanBlanco.solidity"
1515
},
1616
"solidity.formatter": "forge",
17-
"cSpell.words": [
18-
"curr",
19-
"Fname",
20-
"Seedable",
21-
"Pausable",
22-
"UUPS"
23-
],
24-
"solidity.compileUsingRemoteVersion": "v0.8.18+commit.87f61d96"
17+
"cSpell.words": ["curr", "Fname", "Seedable", "Pausable", "UUPS"],
18+
"solidity.compileUsingRemoteVersion": "v0.8.19+commit.7dd6d404"
2519
}

script/Deploy.s.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "forge-std/Script.sol";
55
import "forge-std/console.sol";
66
import {AggregatorV3Interface} from "chainlink/v0.8/interfaces/AggregatorV3Interface.sol";
77

8-
import {IdRegistryFab} from "./helpers/IdRegistryFab.sol";
8+
import {IdRegistry} from "../src/IdRegistry.sol";
99
import {StorageRent} from "../src/StorageRent.sol";
1010
import {MockPriceFeed, MockUptimeFeed, MockChainlinkFeed} from "../test/Utils.sol";
1111

@@ -32,7 +32,7 @@ contract Deploy is Script {
3232

3333
vm.startBroadcast();
3434
(AggregatorV3Interface priceFeed, AggregatorV3Interface uptimeFeed) = _getOrDeployPriceFeeds();
35-
IdRegistryFab idRegistry = new IdRegistryFab(initialOwner, ID_REGISTRY_CREATE2_SALT);
35+
IdRegistry idRegistry = new IdRegistry{ salt: ID_REGISTRY_CREATE2_SALT }(initialOwner);
3636
StorageRent storageRent = new StorageRent{ salt: STORAGE_RENT_CREATE2_SALT }(
3737
priceFeed,
3838
uptimeFeed,
@@ -46,7 +46,7 @@ contract Deploy is Script {
4646
treasurer
4747
);
4848
vm.stopBroadcast();
49-
console.log("ID Registry: %s", idRegistry.registryAddr());
49+
console.log("ID Registry: %s", address(idRegistry));
5050
console.log("Storage Rent: %s", address(storageRent));
5151
}
5252

script/IdRegistry.s.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity 0.8.19;
33

44
import "forge-std/Script.sol";
5-
import {IdRegistryFab} from "./helpers/IdRegistryFab.sol";
5+
import {IdRegistry} from "../src/IdRegistry.sol";
66

77
contract IdRegistryScript is Script {
88
bytes32 internal constant CREATE2_SALT = "fc";
@@ -11,6 +11,6 @@ contract IdRegistryScript is Script {
1111
address initialOwner = vm.envAddress("ID_REGISTRY_OWNER_ADDRESS");
1212

1313
vm.broadcast();
14-
new IdRegistryFab(initialOwner, CREATE2_SALT);
14+
new IdRegistry{ salt: CREATE2_SALT }(initialOwner);
1515
}
1616
}

script/helpers/IdRegistryFab.sol

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/Bundler.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ contract Bundler is Ownable2Step {
7575
* @param _storageRent Address of the StorageRent contract
7676
* @param _trustedCaller Address that can call trustedRegister and trustedBatchRegister
7777
*/
78-
constructor(address _idRegistry, address _storageRent, address _trustedCaller) {
78+
constructor(address _idRegistry, address _storageRent, address _trustedCaller, address _owner) {
79+
_transferOwnership(_owner);
80+
7981
idRegistry = IdRegistry(_idRegistry);
8082
storageRent = StorageRent(_storageRent);
8183
trustedCaller = _trustedCaller;

src/FnameResolver.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ contract FnameResolver is IExtendedResolver, EIP712, ERC165, Ownable2Step {
100100
* @param _url Lookup gateway URL. This value is set permanently.
101101
* @param _signer Initial authorized signer address.
102102
*/
103-
constructor(string memory _url, address _signer) EIP712("Farcaster name verification", "1") {
103+
constructor(string memory _url, address _signer, address _owner) EIP712("Farcaster name verification", "1") {
104+
_transferOwnership(_owner);
104105
url = _url;
105106
signers[_signer] = true;
106107
emit AddSigner(_signer);

src/IdRegistry.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ contract IdRegistry is Ownable2Step, Pausable, EIP712, Nonces {
144144
* @notice Set the owner of the contract to the deployer.
145145
*/
146146
// solhint-disable-next-line no-empty-blocks
147-
constructor() EIP712("Farcaster IdRegistry", "1") {}
147+
constructor(address _owner) EIP712("Farcaster IdRegistry", "1") {}
148148

149149
/*//////////////////////////////////////////////////////////////
150150
REGISTRATION LOGIC

0 commit comments

Comments
 (0)