Skip to content

Commit

Permalink
GnosisHost (#308)
Browse files Browse the repository at this point in the history
Co-authored-by: David Salami <[email protected]>
  • Loading branch information
seunlanlege and Wizdave97 authored Sep 14, 2024
1 parent d6576eb commit 06ebda6
Show file tree
Hide file tree
Showing 29 changed files with 158 additions and 97 deletions.
22 changes: 17 additions & 5 deletions docs/pages/developers/evm/contract-addresses.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The current testnet environment for the Hyperbridge network.
|:------------|:-----|
| `HandlerV1` | [`0xb8b5F80f6f58975970d9A5fb99407CF60A8FD3Ff`](https://sepolia.etherscan.io/address/0xb8b5F80f6f58975970d9A5fb99407CF60A8FD3Ff) |
| `PingModule` | [`0x42C6551d05eA47c46Fc7B01BBaaD37c466481361`](https://sepolia.etherscan.io/address/0x42C6551d05eA47c46Fc7B01BBaaD37c466481361) |
| `TokenGateway` | [`0x43B220ae10D0378f974af7F8E46326f9F7cF2cee`](https://sepolia.etherscan.io/address/0x43B220ae10D0378f974af7F8E46326f9F7cF2cee) |
| `TokenGateway` | [`0xf85a6D74eE7F57C068597f78b250a3657640ecA1`](https://sepolia.etherscan.io/address/0xf85a6D74eE7F57C068597f78b250a3657640ecA1) |
| `TokenFaucet` | [`0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1`](https://sepolia.etherscan.io/address/0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1) |
| `FeeToken (USD.h)` | [`0x088f5218efbDfC73992b0906c5d35572DB2db845`](https://sepolia.etherscan.io/address/0x088f5218efbDfC73992b0906c5d35572DB2db845) |

Expand All @@ -24,7 +24,7 @@ The current testnet environment for the Hyperbridge network.
|:------------|:-----|
| `HandlerV1` | [`0xBCb07384915818F6E2fEA3d0e3c19EFa5bef823A`](https://sepolia.arbiscan.io/address/0xBCb07384915818F6E2fEA3d0e3c19EFa5bef823A) |
| `PingModule` | [`0x42C6551d05eA47c46Fc7B01BBaaD37c466481361`](https://sepolia.arbiscan.io/address/0x42C6551d05eA47c46Fc7B01BBaaD37c466481361) |
| `TokenGateway` | [`0x43B220ae10D0378f974af7F8E46326f9F7cF2cee`](https://sepolia.arbiscan.io/address/0x43B220ae10D0378f974af7F8E46326f9F7cF2cee) |
| `TokenGateway` | [`0xf85a6D74eE7F57C068597f78b250a3657640ecA1`](https://sepolia.arbiscan.io/address/0xf85a6D74eE7F57C068597f78b250a3657640ecA1) |
| `TokenFaucet` | [`0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1`](https://sepolia.arbiscan.io/address/0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1) |
| `FeeToken (USD.h)` | [`0x088f5218efbDfC73992b0906c5d35572DB2db845`](https://sepolia.arbiscan.io/address/0x088f5218efbDfC73992b0906c5d35572DB2db845) |

Expand All @@ -35,7 +35,7 @@ The current testnet environment for the Hyperbridge network.
|:------------|:-----|
| `HandlerV1` | [`0x78ba8ea54a141b0f6e43070Bb9F9a303F7E05689`](https://sepolia-optimism.etherscan.io/address/0x78ba8ea54a141b0f6e43070Bb9F9a303F7E05689) |
| `PingModule` | [`0x42C6551d05eA47c46Fc7B01BBaaD37c466481361`](https://sepolia-optimism.etherscan.io/address/0x42C6551d05eA47c46Fc7B01BBaaD37c466481361) |
| `TokenGateway` | [`0x43B220ae10D0378f974af7F8E46326f9F7cF2cee`](https://sepolia-optimism.etherscan.io/address/0x43B220ae10D0378f974af7F8E46326f9F7cF2cee) |
| `TokenGateway` | [`0xf85a6D74eE7F57C068597f78b250a3657640ecA1`](https://sepolia-optimism.etherscan.io/address/0xf85a6D74eE7F57C068597f78b250a3657640ecA1) |
| `TokenFaucet` | [`0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1`](https://sepolia-optimism.etherscan.io/address/0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1) |
| `FeeToken (USD.h)` | [`0x088f5218efbDfC73992b0906c5d35572DB2db845`](https://sepolia-optimism.etherscan.io/address/0x088f5218efbDfC73992b0906c5d35572DB2db845) |

Expand All @@ -46,7 +46,7 @@ The current testnet environment for the Hyperbridge network.
|:------------|:-----|
| `HandlerV1` | [`0x146662aF74f7332Ef3D91826B2F6DaCBf4459dB4`](https://sepolia.basescan.org/address/0x146662aF74f7332Ef3D91826B2F6DaCBf4459dB4) |
| `PingModule` | [`0x42C6551d05eA47c46Fc7B01BBaaD37c466481361`](https://sepolia.basescan.org/address/0x42C6551d05eA47c46Fc7B01BBaaD37c466481361) |
| `TokenGateway` | [`0x43B220ae10D0378f974af7F8E46326f9F7cF2cee`](https://sepolia.basescan.org/address/0x43B220ae10D0378f974af7F8E46326f9F7cF2cee) |
| `TokenGateway` | [`0xf85a6D74eE7F57C068597f78b250a3657640ecA1`](https://sepolia.basescan.org/address/0xf85a6D74eE7F57C068597f78b250a3657640ecA1) |
| `TokenFaucet` | [`0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1`](https://sepolia.basescan.org/address/0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1) |
| `FeeToken (USD.h)` | [`0x088f5218efbDfC73992b0906c5d35572DB2db845`](https://sepolia.basescan.org/address/0x088f5218efbDfC73992b0906c5d35572DB2db845) |

Expand All @@ -57,10 +57,22 @@ The current testnet environment for the Hyperbridge network.
|:------------|:-----|
| `HandlerV1` | [`0x648e59B610630D06cdf5eBCb775b2d33f6BAbBb0`](https://testnet.bscscan.com/address/0x648e59B610630D06cdf5eBCb775b2d33f6BAbBb0) |
| `PingModule` | [`0x42C6551d05eA47c46Fc7B01BBaaD37c466481361`](https://testnet.bscscan.com/address/0x42C6551d05eA47c46Fc7B01BBaaD37c466481361) |
| `TokenGateway` | [`0x43B220ae10D0378f974af7F8E46326f9F7cF2cee`](https://testnet.bscscan.com/address/0x43B220ae10D0378f974af7F8E46326f9F7cF2cee) |
| `TokenGateway` | [`0xf85a6D74eE7F57C068597f78b250a3657640ecA1`](https://testnet.bscscan.com/address/0xf85a6D74eE7F57C068597f78b250a3657640ecA1) |
| `TokenFaucet` | [`0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1`](https://testnet.bscscan.com/address/0x6Ced0D49EBfe3dee51ccBE744464d18cbf549Ef1) |
| `FeeToken (USD.h)` | [`0x088f5218efbDfC73992b0906c5d35572DB2db845`](https://testnet.bscscan.com/address/0x088f5218efbDfC73992b0906c5d35572DB2db845) |


### Gnosis Chiado


| `IsmpHost` | [`0x11EB87c745D97a4Fa8Aec805359837459d240d1b`](https://gnosis-chiado.blockscout.com/address/0x11EB87c745D97a4Fa8Aec805359837459d240d1b) |
|:------------|:-----|
| `HandlerV1` | [`0xc4029227067b4a9bBE93DA618483355708c34067`](https://gnosis-chiado.blockscout.com/address/0xc4029227067b4a9bBE93DA618483355708c34067) |
| `PingModule` | [`0x42C6551d05eA47c46Fc7B01BBaaD37c466481361`](https://gnosis-chiado.blockscout.com/address/0x42C6551d05eA47c46Fc7B01BBaaD37c466481361) |
| `TokenGateway` | [`0xf85a6D74eE7F57C068597f78b250a3657640ecA1`](https://gnosis-chiado.blockscout.com/address/0xf85a6D74eE7F57C068597f78b250a3657640ecA1) |
| `TokenFaucet` | [`0xE2FC77763630ED77E81F3038A983075460319142`](https://gnosis-chiado.blockscout.com/address/0xE2FC77763630ED77E81F3038A983075460319142) |
| `FeeToken (USD.h)` | [`0xD3dBb48A798E7A7443EBb3A3934E18b439dDd241`](https://gnosis-chiado.blockscout.com/address/0xD3dBb48A798E7A7443EBb3A3934E18b439dDd241) |

## Gargantua V2 (Paseo) (Deprecated)

Deprecated testnet environment for Gargantua V2 (Paseo).
Expand Down
6 changes: 3 additions & 3 deletions evm/examples/PingModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import "@polytope-labs/ismp-solidity/IIsmpHost.sol";
import "@polytope-labs/ismp-solidity/StateMachine.sol";
import "@polytope-labs/ismp-solidity/Message.sol";
import "@polytope-labs/ismp-solidity/IDispatcher.sol";
import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {StorageValue} from "@polytope-labs/solidity-merkle-trees/Types.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {StorageValue} from "@polytope-labs/solidity-merkle-trees/src/Types.sol";

struct PingMessage {
bytes dest;
Expand Down Expand Up @@ -103,7 +103,7 @@ contract PingModule is IIsmpModule {
function dispatch(PostRequest memory request) public returns (bytes32) {
uint256 perByteFee = IIsmpHost(_host).perByteFee();
address feeToken = IIsmpHost(_host).feeToken();
uint256 length = 32 > request.body.length ? 32 : request.body.length;
uint256 length = 32 > request.body.length ? 32 : request.body.length;
uint256 fee = perByteFee * length;

IERC20(feeToken).transferFrom(msg.sender, address(this), fee);
Expand Down
2 changes: 2 additions & 0 deletions evm/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ arbitrum-sepolia = "${ARBITRUM_SEPOLIA_RPC_URL}"
base-sepolia = "${BASE_SEPOLIA_RPC_URL}"
polygon-mumbai = "${POLYGON_MUMBAI_RPC_URL}"
bsc-testnet = "${BSC_TESTNET_RPC_URL}"
chiado = "${CHIADO_RPC_URL}"

[etherscan]
# testnet
Expand All @@ -22,5 +23,6 @@ arbitrum-sepolia = { key = "${ARBITRUM_ETHERSCAN_API_KEY}", chain = 421614, url
base-sepolia = { key = "${BASE_ETHERSCAN_API_KEY}", chain = 84532, url = "https://api-sepolia.basescan.org/api" }
polygon-mumbai = { key = "${POLYGON_ETHERSCAN_API_KEY}", chain = 80001, url = "https://api-testnet.polygonscan.com/api" }
bsc-testnet = { key = "${BSC_ETHERSCAN_API_KEY}", chain = 97, url = "https://api-testnet.bscscan.com/api" }
chiado = { key = "${GNOSIS_BLOCKSCOUT_API_KEY}", chain = 10200, url = "https://gnosis-chiado.blockscout.com/api" }

# mainnet
6 changes: 3 additions & 3 deletions evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"license": "ISC",
"description": "",
"dependencies": {
"@polytope-labs/erc6160": "^0.3.0",
"@polytope-labs/ismp-solidity": "^0.5.1",
"@polytope-labs/solidity-merkle-trees": "^0.2.3",
"@polytope-labs/erc6160": "^0.3.1",
"@polytope-labs/ismp-solidity": "^0.6.8",
"@polytope-labs/solidity-merkle-trees": "^0.3.4",
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"openzeppelin-solidity": "4.8.1",
"prettier": "^3.3.3",
Expand Down
4 changes: 2 additions & 2 deletions evm/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@polytope-labs/ismp-solidity/=node_modules/@polytope-labs/ismp-solidity/interfaces/
openzeppelin/=node_modules/openzeppelin-solidity/contracts/
@polytope-labs/solidity-merkle-trees/=node_modules/@polytope-labs/solidity-merkle-trees/src/
@openzeppelin/=node_modules/openzeppelin-solidity
@polytope-labs/solidity-merkle-trees/=node_modules/@polytope-labs/solidity-merkle-trees/
@polytope-labs/erc6160/=node_modules/@polytope-labs/erc6160/src/
@uniswap/v2-periphery/=node_modules/@uniswap/v2-periphery
stringutils/=lib/solidity-stringutils/src/
1 change: 1 addition & 0 deletions evm/script/BaseScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ abstract contract BaseScript is Script {
address payable internal OP_SEPOLIA_HOST = payable(vm.envAddress("OP_SEPOLIA_HOST"));
address payable internal BASE_SEPOLIA_HOST = payable(vm.envAddress("BASE_SEPOLIA_HOST"));
address payable internal BSC_TESTNET_HOST = payable(vm.envAddress("BSC_TESTNET_HOST"));
address payable internal CHIADO_HOST = payable(vm.envAddress("CHIADO_HOST"));
address payable internal FEE_TOKEN = payable(vm.envAddress("FEE_TOKEN"));

/**
Expand Down
6 changes: 5 additions & 1 deletion evm/script/DeployGateway.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {TokenGateway, Asset, TokenGatewayParamsExt, TokenGatewayParams, AssetMet
import {TokenFaucet} from "../src/modules/TokenFaucet.sol";
import {CrossChainMessenger} from "../examples/CrossChainMessenger.sol";
import {BaseScript} from "./BaseScript.sol";
import {IIsmpHost} from "@polytope-labs/ismp-solidity/IIsmpHost.sol";

contract DeployScript is BaseScript {
bytes32 public constant MINTER_ROLE = keccak256("MINTER ROLE");
Expand Down Expand Up @@ -35,6 +36,9 @@ contract DeployScript is BaseScript {
} else if (equal(host, "bsc-testnet")) {
vm.startBroadcast(uint256(privateKey));
deployGateway(BSC_TESTNET_HOST, admin, callDispatcher);
} else if (equal(host, "chiado")) {
vm.startBroadcast(uint256(privateKey));
deployGateway(CHIADO_HOST, admin, callDispatcher);
}
}

Expand All @@ -44,7 +48,7 @@ contract DeployScript is BaseScript {
}

function deployGateway(address host, address admin, address callDispatcher) public {
IERC6160Ext20 feeToken = IERC6160Ext20(FEE_TOKEN);
IERC6160Ext20 feeToken = IERC6160Ext20(IIsmpHost(host).feeToken());

TokenGateway gateway = new TokenGateway{salt: salt}(admin);
feeToken.grantRole(MINTER_ROLE, address(gateway));
Expand Down
2 changes: 1 addition & 1 deletion evm/script/DeployHostUpdates.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.13;

import "forge-std/Script.sol";
import "openzeppelin/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "stringutils/strings.sol";

import {EvmHost, HostParams} from "../src/hosts/EvmHost.sol";
Expand Down
4 changes: 4 additions & 0 deletions evm/script/DeployIsmp.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "../src/hosts/Ethereum.sol";
import "../src/hosts/Arbitrum.sol";
import "../src/hosts/Optimism.sol";
import "../src/hosts/Base.sol";
import "../src/hosts/Gnosis.sol";

import {ERC6160Ext20} from "@polytope-labs/erc6160/tokens/ERC6160Ext20.sol";
import {TokenGateway, Asset, TokenGatewayParamsExt, TokenGatewayParams, AssetMetadata} from "../src/modules/TokenGateway.sol";
Expand Down Expand Up @@ -114,6 +115,9 @@ contract DeployScript is BaseScript {
} else if (host.toSlice().startsWith("polygon".toSlice())) {
PolygonHost h = new PolygonHost{salt: salt}(params);
return address(h);
} else if (host.toSlice().startsWith("chiado".toSlice())) {
GnosisHost h = new GnosisHost{salt: salt}(params);
return address(h);
}

revert("Unknown host");
Expand Down
2 changes: 1 addition & 1 deletion evm/script/batchDeploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

declare -a arr=("sepolia" "arbitrum-sepolia" "optimism-sepolia" "base-sepolia" "bsc-testnet")
declare -a arr=("sepolia" "arbitrum-sepolia" "optimism-sepolia" "base-sepolia" "bsc-testnet" "chiado")

for i in "${arr[@]}"
do
Expand Down
18 changes: 9 additions & 9 deletions evm/src/consensus/BeefyV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import "./Codec.sol";
import "@polytope-labs/ismp-solidity/StateMachine.sol";
import "@polytope-labs/ismp-solidity/IConsensusClient.sol";

import {MerkleMultiProof} from "@polytope-labs/solidity-merkle-trees/MerkleMultiProof.sol";
import {MerkleMountainRange} from "@polytope-labs/solidity-merkle-trees/MerkleMountainRange.sol";
import {MerklePatricia} from "@polytope-labs/solidity-merkle-trees/MerklePatricia.sol";
import {StorageValue, MmrLeaf} from "@polytope-labs/solidity-merkle-trees/Types.sol";
import {ScaleCodec} from "@polytope-labs/solidity-merkle-trees/trie/substrate/ScaleCodec.sol";
import {Bytes} from "@polytope-labs/solidity-merkle-trees/trie/Bytes.sol";

import {ECDSA} from "openzeppelin/utils/cryptography/ECDSA.sol";
import {ERC165} from "openzeppelin/utils/introspection/ERC165.sol";
import {MerkleMultiProof} from "@polytope-labs/solidity-merkle-trees/src/MerkleMultiProof.sol";
import {MerkleMountainRange} from "@polytope-labs/solidity-merkle-trees/src/MerkleMountainRange.sol";
import {MerklePatricia} from "@polytope-labs/solidity-merkle-trees/src/MerklePatricia.sol";
import {StorageValue, MmrLeaf} from "@polytope-labs/solidity-merkle-trees/src/Types.sol";
import {ScaleCodec} from "@polytope-labs/solidity-merkle-trees/src/trie/substrate/ScaleCodec.sol";
import {Bytes} from "@polytope-labs/solidity-merkle-trees/src/trie/Bytes.sol";

import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";

struct Vote {
// secp256k1 signature from a member of the authority set
Expand Down
6 changes: 3 additions & 3 deletions evm/src/consensus/Codec.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// limitations under the License.
pragma solidity 0.8.17;

import "@polytope-labs/solidity-merkle-trees/MerkleMultiProof.sol";
import "@polytope-labs/solidity-merkle-trees/trie/substrate/ScaleCodec.sol";
import "@polytope-labs/solidity-merkle-trees/trie/Bytes.sol";
import "@polytope-labs/solidity-merkle-trees/src/MerkleMultiProof.sol";
import "@polytope-labs/solidity-merkle-trees/src/trie/substrate/ScaleCodec.sol";
import "@polytope-labs/solidity-merkle-trees/src/trie/Bytes.sol";
import "./Header.sol";

struct Payload {
Expand Down
4 changes: 2 additions & 2 deletions evm/src/consensus/Header.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
pragma solidity 0.8.17;

import {StateCommitment} from "@polytope-labs/ismp-solidity/IConsensusClient.sol";
import "@polytope-labs/solidity-merkle-trees/trie/Bytes.sol";
import "@polytope-labs/solidity-merkle-trees/trie/substrate/ScaleCodec.sol";
import "@polytope-labs/solidity-merkle-trees/src/trie/Bytes.sol";
import "@polytope-labs/solidity-merkle-trees/src/trie/substrate/ScaleCodec.sol";

struct DigestItem {
bytes4 consensusId;
Expand Down
10 changes: 5 additions & 5 deletions evm/src/consensus/UltraPlonkBeefy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ pragma solidity 0.8.17;
import "@polytope-labs/ismp-solidity/StateMachine.sol";
import "@polytope-labs/ismp-solidity/IConsensusClient.sol";

import "@polytope-labs/solidity-merkle-trees/MerkleMultiProof.sol";
import "@polytope-labs/solidity-merkle-trees/MerkleMountainRange.sol";
import "@polytope-labs/solidity-merkle-trees/trie/substrate/ScaleCodec.sol";
import "@polytope-labs/solidity-merkle-trees/trie/Bytes.sol";
import "@polytope-labs/solidity-merkle-trees/src/MerkleMultiProof.sol";
import "@polytope-labs/solidity-merkle-trees/src/MerkleMountainRange.sol";
import "@polytope-labs/solidity-merkle-trees/src/trie/substrate/ScaleCodec.sol";
import "@polytope-labs/solidity-merkle-trees/src/trie/Bytes.sol";
import "./verifiers/IVerifier.sol";
import "./Codec.sol";

import {ERC165} from "openzeppelin/utils/introspection/ERC165.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";

struct UltraPlonkConsensusProof {
// Commitment message
Expand Down
10 changes: 5 additions & 5 deletions evm/src/hosts/EvmHost.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
// limitations under the License.
pragma solidity 0.8.17;

import {Context} from "openzeppelin/utils/Context.sol";
import {Strings} from "openzeppelin/utils/Strings.sol";
import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin/token/ERC20/utils/SafeERC20.sol";
import {IERC165} from "openzeppelin/utils/introspection/IERC165.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";

import {IIsmpModule, IncomingPostRequest, IncomingPostResponse, IncomingGetResponse} from "@polytope-labs/ismp-solidity/IIsmpModule.sol";
import {DispatchPost, DispatchPostResponse, DispatchGet} from "@polytope-labs/ismp-solidity/IDispatcher.sol";
Expand Down
35 changes: 35 additions & 0 deletions evm/src/hosts/Gnosis.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (C) Polytope Labs Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
pragma solidity 0.8.17;

import {EvmHost, HostParams} from "./EvmHost.sol";

/**
* @title The GnosisHost
* @author Polytope Labs ([email protected])
*
* @notice The IsmpHost and IsmpDispatcher implementation for the Gnosis state machine.
* Refer to the official ISMP specification. https://docs.hyperbridge.network/protocol/ismp
*/
contract GnosisHost is EvmHost {
constructor(HostParams memory params) EvmHost(params) {}

/// chainId for the Gnosis mainnet
uint256 public constant CHAIN_ID = 100;

function chainId() public pure override returns (uint256) {
return CHAIN_ID;
}
}
29 changes: 7 additions & 22 deletions evm/src/modules/HandlerV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,17 @@
// limitations under the License.
pragma solidity 0.8.17;

import {MerkleMountainRange, MmrLeaf} from "@polytope-labs/solidity-merkle-trees/MerkleMountainRange.sol";
import {MerklePatricia, StorageValue} from "@polytope-labs/solidity-merkle-trees/MerklePatricia.sol";
import {Bytes} from "@polytope-labs/solidity-merkle-trees/trie/Bytes.sol";
import {MerkleMountainRange, MmrLeaf} from "@polytope-labs/solidity-merkle-trees/src/MerkleMountainRange.sol";
import {MerklePatricia, StorageValue} from "@polytope-labs/solidity-merkle-trees/src/MerklePatricia.sol";
import {Bytes} from "@polytope-labs/solidity-merkle-trees/src/trie/Bytes.sol";

import {IConsensusClient, IntermediateState, StateMachineHeight, StateCommitment} from "@polytope-labs/ismp-solidity/IConsensusClient.sol";
import {IIsmpHost, FeeMetadata, FrozenStatus} from "@polytope-labs/ismp-solidity/IIsmpHost.sol";
import {IHandler} from "@polytope-labs/ismp-solidity/IHandler.sol";
import {
Message,
PostResponse,
PostRequest,
GetRequest,
GetResponse,
PostRequestMessage,
PostResponseMessage,
GetResponseMessage,
PostRequestTimeoutMessage,
PostResponseTimeoutMessage,
GetTimeoutMessage,
PostRequestLeaf,
PostResponseLeaf,
GetResponseLeaf
} from "@polytope-labs/ismp-solidity/Message.sol";

import {Context} from "openzeppelin/utils/Context.sol";
import {ERC165} from "openzeppelin/utils/introspection/ERC165.sol";
import {Message, PostResponse, PostRequest, GetRequest, GetResponse, PostRequestMessage, PostResponseMessage, GetResponseMessage, PostRequestTimeoutMessage, PostResponseTimeoutMessage, GetTimeoutMessage, PostRequestLeaf, PostResponseLeaf, GetResponseLeaf} from "@polytope-labs/ismp-solidity/Message.sol";

import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";

// Storage prefix for request receipts in the pallet-ismp child trie
bytes constant REQUEST_RECEIPTS_STORAGE_PREFIX = hex"526571756573745265636569707473";
Expand Down
Loading

0 comments on commit 06ebda6

Please sign in to comment.