Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.1.9 release #56

Merged
merged 1 commit into from
Nov 13, 2023
Merged
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hyperclient"
version = "0.1.8"
version = "0.1.9"
edition = "2021"
description = "A simple CLI application for sending cross-chain requests through Hyperbridge"
repository = "https://github.com/polytope-labs/hyperbridge"
Expand Down
2 changes: 1 addition & 1 deletion evm/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ base-sepolia = "${BASE_SEPOLIA_RPC_URL}"
sepolia = { key = "${SEPOLIA_ETHERSCAN_API_KEY}", chain = 11155111, url = " https://api-sepolia.etherscan.io/api" }
optimism-sepolia = { key = "${OPTIMISM_ETHERSCAN_API_KEY}", chain = 11155420, url = "https://api-sepolia-optimism.etherscan.io/api" }
arbitrum-sepolia = { key = "${ARBITRUM_ETHERSCAN_API_KEY}", chain = 421614, url = "https://api-sepolia.arbiscan.io/api" }
base-sepolia = { key = "${BASE_ETHERSCAN_API_KEY}", chain = 84532, url = "https://api-sepolia.basescan.org/api" }
base-sepolia = { key = "${ARBITRUM_ETHERSCAN_API_KEY}", chain = 84532, url = "https://base-sepolia.blockscout.com/api?", verifier = "blockscout" }
46 changes: 24 additions & 22 deletions evm/script/DeployGateway.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,42 @@ import "../test/PingModule.sol";
import "../test/CrossChainMessenger.sol";

contract DeployScript is Script {
bytes32 public salt = keccak256(bytes("gargantua-v0.0.5"));
bytes32 public salt = keccak256(bytes("gargantua-v0.0.7"));

address public SEPOLIA_HOST = 0x5b5F63C8f3985CaFE1CE53E6374f42AB60dE5a6B;
address public ARB_SEPOLIA_HOST = 0x43E136611Cf74E165116a47e6F9C58AFCc80Ec54;
address public OP_SEPOLIA_HOST = 0x0124f458900FCd101c4CE31A9772fD2c5e6d65BF;
address public BASE_SEPOLIA_HOST =
0x87825f839d95c6021c0e821917F93aDB299eD6F8;
address public BASE_SEPOLIA_HOST = 0x87825f839d95c6021c0e821917F93aDB299eD6F8;

bytes32 public constant MINTER_ROLE = keccak256("MINTER ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER ROLE");

function run() external {
address admin = vm.envAddress("ADMIN");
bytes32 privateKey = vm.envBytes32("PRIVATE_KEY");
string memory host = vm.envString("HOST");

vm.createSelectFork("sepolia");
vm.startBroadcast(uint256(privateKey));
deployMessenger(SEPOLIA_HOST, admin);
vm.stopBroadcast();

vm.createSelectFork("arbitrum-sepolia");
vm.startBroadcast(uint256(privateKey));
deployMessenger(ARB_SEPOLIA_HOST, admin);
vm.stopBroadcast();

vm.createSelectFork("optimism-sepolia");
vm.startBroadcast(uint256(privateKey));
deployMessenger(OP_SEPOLIA_HOST, admin);
vm.stopBroadcast();

vm.createSelectFork("base-sepolia");
vm.startBroadcast(uint256(privateKey));
deployMessenger(BASE_SEPOLIA_HOST, admin);
vm.stopBroadcast();
if (Strings.equal(host, "sepolia") || Strings.equal(host, "ethereum")) {
vm.createSelectFork("sepolia");
vm.startBroadcast(uint256(privateKey));
deployGateway(SEPOLIA_HOST, admin);
vm.stopBroadcast();
} else if (Strings.equal(host, "arbitrum-sepolia")) {
vm.createSelectFork("arbitrum-sepolia");
vm.startBroadcast(uint256(privateKey));
deployGateway(ARB_SEPOLIA_HOST, admin);
vm.stopBroadcast();
} else if (Strings.equal(host, "optimism-sepolia")) {
vm.createSelectFork("optimism-sepolia");
vm.startBroadcast(uint256(privateKey));
deployGateway(OP_SEPOLIA_HOST, admin);
vm.stopBroadcast();
} else if (Strings.equal(host, "base-sepolia")) {
vm.createSelectFork("base-sepolia");
vm.startBroadcast(uint256(privateKey));
deployGateway(BASE_SEPOLIA_HOST, admin);
vm.stopBroadcast();
}
}

function deployMessenger(address host, address admin) public {
Expand Down
11 changes: 2 additions & 9 deletions evm/script/DeployIsmp.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ contract DeployScript is Script {
// handler
HandlerV1 handler = new HandlerV1{salt: salt}();
// cross-chain governor
GovernorParams memory gParams = GovernorParams({
admin: admin,
host: address(0),
paraId: paraId
});
GovernorParams memory gParams = GovernorParams({admin: admin, host: address(0), paraId: paraId});
CrossChainGovernor governor = new CrossChainGovernor{salt: salt}(
gParams
);
Expand All @@ -61,10 +57,7 @@ contract DeployScript is Script {
vm.stopBroadcast();
}

function initHost(
string memory host,
HostParams memory params
) public returns (address) {
function initHost(string memory host, HostParams memory params) public returns (address) {
if (Strings.equal(host, "sepolia") || Strings.equal(host, "ethereum")) {
EthereumHost host = new EthereumHost{salt: salt}(params);
return address(host);
Expand Down
4 changes: 2 additions & 2 deletions evm/script/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ else
# load prod .env
source .env.prod
# deploy
HOST=$1 forge script script/DeployIsmp.s.sol:DeployScript --rpc-url "$1" --broadcast -vvvv --sender="$ADMIN"
HOST=$1 forge script "script/Deploy$2.s.sol:DeployScript" --rpc-url "$1" --broadcast -vvvv --sender="$ADMIN"
# verify
HOST=$1 forge script script/DeployIsmp.s.sol:DeployScript --rpc-url "$1" --resume --verify -vvvv --sender="$ADMIN"
HOST=$1 forge script "script/Deploy$2.s.sol:DeployScript" --rpc-url "$1" --resume --verify -vvvv --sender="$ADMIN"
fi
6 changes: 4 additions & 2 deletions evm/src/modules/TokenGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ contract TokenGateway is IIsmpModule {
}

function onAccept(PostRequest memory request) public onlyIsmpHost {
(address _from, address to, uint256 amount, address tokenContract) = abi.decode(request.body, (address, address, uint256, address));
(address _from, address to, uint256 amount, address tokenContract) =
abi.decode(request.body, (address, address, uint256, address));

IERC6160Ext20(tokenContract).mint(to, amount, "");

emit AssetReceived(request.source, request.nonce);
}

function onPostTimeout(PostRequest memory request) public onlyIsmpHost {
(address from, address _to, uint256 amount, address tokenContract) = abi.decode(request.body, (address, address, uint256, address));
(address from, address _to, uint256 amount, address tokenContract) =
abi.decode(request.body, (address, address, uint256, address));

IERC6160Ext20(tokenContract).mint(from, amount, "");
}
Expand Down
9 changes: 3 additions & 6 deletions evm/test/CrossChainMessenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct CrossChainMessage {

contract CrossChainMessenger is IIsmpModule {
event PostReceived(uint256 nonce, bytes source, string message);

error NotAuthorized();

// restricts call to `IIsmpHost`
Expand Down Expand Up @@ -66,15 +67,11 @@ contract CrossChainMessenger is IIsmpModule {
revert("No timeouts for now");
}

function onPostResponse(
PostResponse memory response
) public view onlyIsmpHost {
function onPostResponse(PostResponse memory response) public view onlyIsmpHost {
revert("CrossChainMessenger doesn't emit responses");
}

function onGetResponse(
GetResponse memory response
) public view onlyIsmpHost {
function onGetResponse(GetResponse memory response) public view onlyIsmpHost {
revert("CrossChainMessenger doesn't emit Get Requests");
}

Expand Down
2 changes: 1 addition & 1 deletion parachain/node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hyperbridge"
version = "0.1.8"
version = "0.1.9"
authors = ["Polytope Labs <[email protected]>"]
description = "The hyperbridge coprocessor node"
edition = "2021"
Expand Down
Loading