Skip to content

Commit 0d55121

Browse files
committed
example ism
1 parent 249d1eb commit 0d55121

File tree

8 files changed

+5024
-55
lines changed

8 files changed

+5024
-55
lines changed

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
2-
"name": "@ethsign/",
2+
"name": "@hyperlane-xyz/community",
33
"version": "1.0.0",
4-
"description": "",
5-
"repository": {
6-
"type": "git",
7-
"url": "git+https://github.com/EthSign"
8-
},
4+
"description": "A repository for community-contributions to Hyperlane protocol.",
5+
"repository": "https://github.com/hyperlane-xyz/community-isms",
6+
"license": "Apache-2.0",
7+
"keywords": [
8+
"Hyperlane",
9+
"Solidity"
10+
],
911
"scripts": {
1012
"prepare": "husky",
1113
"clean": "forge clean && hardhat clean && rm -rf cache_hardhat",
@@ -18,9 +20,8 @@
1820
"test:coverage": "forge coverage",
1921
"test:gas": "forge test --gas-report"
2022
},
21-
"author": "",
22-
"license": "ISC",
2323
"dependencies": {
24+
"@hyperlane-xyz/core": "^5.8.0",
2425
"@openzeppelin/contracts": "5.0.2",
2526
"@openzeppelin/contracts-upgradeable": "5.0.2"
2627
},

remappings.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
22
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/
3+
@hyperlane-xyz/=node_modules/@hyperlane-xyz/core/
34
ds-test/=node_modules/ds-test/src
45
forge-std/=node_modules/forge-std/src

scripts/01-deploy-upgradeable.ts

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

src/Counter.sol

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

src/ExampleIsm.sol

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// SPDX-License-Identifier: MIT OR Apache-2.0
2+
pragma solidity >=0.8.0;
3+
4+
import { IInterchainSecurityModule } from "@hyperlane-xyz/contracts/interfaces/IInterchainSecurityModule.sol";
5+
6+
contract ExampleIsm is IInterchainSecurityModule {
7+
// @dev The first 128 enum values are reserved for core Hyperlane types
8+
uint8 public constant COMMUNITY_MASK = 0x80;
9+
10+
// TODO: Replace with actual community types you want to use
11+
enum CommunityTypes {
12+
EXAMPLE_ISM
13+
}
14+
15+
// @inheritdoc IInterchainSecurityModule
16+
uint8 public moduleType = uint8(CommunityTypes.EXAMPLE_ISM) | COMMUNITY_MASK;
17+
18+
// @inheritdoc IInterchainSecurityModule
19+
function verify(bytes calldata, bytes calldata) public view returns (bool) {
20+
// TODO: Implement the verification logic for incoming messages and return true if the message is valid
21+
// check AbstractMultisigIsm.sol for a reference implementation
22+
return true;
23+
}
24+
}

test/Counter.t.sol

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

test/ExampleIsm.t.sol

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: MIT or Apache-2.0
2+
pragma solidity ^0.8.13;
3+
4+
import { Test } from "forge-std/Test.sol";
5+
import { ExampleIsm } from "../src/ExampleIsm.sol";
6+
7+
contract ExampleIsmTest is Test {
8+
ExampleIsm public exampleIsm;
9+
uint8 public constant EXAMPLE_ISM_TYPE = 128;
10+
11+
function setUp() public {
12+
exampleIsm = new ExampleIsm();
13+
}
14+
15+
function test_moduleType() public view {
16+
assertEq(exampleIsm.moduleType(), EXAMPLE_ISM_TYPE);
17+
}
18+
19+
// TODO: Implement the test for the verify function
20+
function test_verify() public view {
21+
assertTrue(exampleIsm.verify(abi.encode(""), abi.encode("")));
22+
}
23+
}

0 commit comments

Comments
 (0)