-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(world,store): add ERC165 checks for all registration methods (#1458
- Loading branch information
Showing
121 changed files
with
5,067 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
"@latticexyz/store": major | ||
"@latticexyz/world": major | ||
--- | ||
|
||
The `World` now performs `ERC165` interface checks to ensure that the `StoreHook`, `SystemHook`, `System`, `DelegationControl` and `Module` contracts to actually implement their respective interfaces before registering them in the World. | ||
|
||
The required `supportsInterface` methods are implemented on the respective base contracts. | ||
When creating one of these contracts, the recommended approach is to extend the base contract rather than the interface. | ||
|
||
```diff | ||
- import { IStoreHook } from "@latticexyz/store/src/IStore.sol"; | ||
+ import { StoreHook } from "@latticexyz/store/src/StoreHook.sol"; | ||
|
||
- contract MyStoreHook is IStoreHook {} | ||
+ contract MyStoreHook is StoreHook {} | ||
``` | ||
|
||
```diff | ||
- import { ISystemHook } from "@latticexyz/world/src/interfaces/ISystemHook.sol"; | ||
+ import { SystemHook } from "@latticexyz/world/src/SystemHook.sol"; | ||
|
||
- contract MySystemHook is ISystemHook {} | ||
+ contract MySystemHook is SystemHook {} | ||
``` | ||
|
||
```diff | ||
- import { IDelegationControl } from "@latticexyz/world/src/interfaces/IDelegationControl.sol"; | ||
+ import { DelegationControl } from "@latticexyz/world/src/DelegationControl.sol"; | ||
|
||
- contract MyDelegationControl is IDelegationControl {} | ||
+ contract MyDelegationControl is DelegationControl {} | ||
``` | ||
|
||
```diff | ||
- import { IModule } from "@latticexyz/world/src/interfaces/IModule.sol"; | ||
+ import { Module } from "@latticexyz/world/src/Module.sol"; | ||
|
||
- contract MyModule is IModule {} | ||
+ contract MyModule is Module {} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes4", | ||
"name": "interfaceID", | ||
"type": "bytes4" | ||
} | ||
], | ||
"name": "supportsInterface", | ||
"outputs": [ | ||
{ | ||
"internalType": "bool", | ||
"name": "", | ||
"type": "bool" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
declare const abi: [ | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "bytes4"; | ||
name: "interfaceID"; | ||
type: "bytes4"; | ||
} | ||
]; | ||
name: "supportsInterface"; | ||
outputs: [ | ||
{ | ||
internalType: "bool"; | ||
name: ""; | ||
type: "bool"; | ||
} | ||
]; | ||
stateMutability: "view"; | ||
type: "function"; | ||
} | ||
]; | ||
export default abi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.