From fab321ee8af549074936c319afd959c9b64ba459 Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Wed, 7 Feb 2024 17:34:43 +0800 Subject: [PATCH] rename msgline->msgport --- helix-contract/address/ln-product.json | 11 ++++++++++- .../{IMessageLine.sol => IMessagePort.sol} | 8 ++++---- .../contracts/messagers/MsgportMessager.sol | 14 +++++++------- ...line_messager.js => deploy_msgport_messager.js} | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) rename helix-contract/contracts/interfaces/{IMessageLine.sol => IMessagePort.sol} (87%) rename helix-contract/deploy/{deploy_msgline_messager.js => deploy_msgport_messager.js} (96%) diff --git a/helix-contract/address/ln-product.json b/helix-contract/address/ln-product.json index a7e1854..6404321 100644 --- a/helix-contract/address/ln-product.json +++ b/helix-contract/address/ln-product.json @@ -80,6 +80,14 @@ "lzChainId": 214, "lzEndpoint": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7", "deployer": "0x80D4c766C5142D1313D531Afe7384D0D5E108Db3" + }, + "darwinia-dvm": { + "name": "darwinia-dvm", + "url": "https://rpc.darwinia.network", + "dao": "0x88a39B052d477CfdE47600a7C9950a441Ce61cb4", + "chainId": 46, + "deployer": "0x80D4c766C5142D1313D531Afe7384D0D5E108Db3", + "ormpPort": "0x0000000005d961F950adA391C1511c92bbc64D9F" } }, "messagers": { @@ -105,7 +113,8 @@ }, "darwinia": { "DarwiniaMsglineMessager": "0x6035Eb7783d7Aab8d0a57a7b154f5DD5D5477Ff2", - "DarwiniaSub2SubMessager": "0x9dF64c435F02fb46bd8eB3757D3dF42dDA912bDe" + "DarwiniaSub2SubMessager": "0x9dF64c435F02fb46bd8eB3757D3dF42dDA912bDe", + "MsgportMessager": "0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0" }, "crab": { "DarwiniaSub2SubMessager": "0x9dF64c435F02fb46bd8eB3757D3dF42dDA912bDe" diff --git a/helix-contract/contracts/interfaces/IMessageLine.sol b/helix-contract/contracts/interfaces/IMessagePort.sol similarity index 87% rename from helix-contract/contracts/interfaces/IMessageLine.sol rename to helix-contract/contracts/interfaces/IMessagePort.sol index d56739a..5ad035b 100644 --- a/helix-contract/contracts/interfaces/IMessageLine.sol +++ b/helix-contract/contracts/interfaces/IMessagePort.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.17; -interface IMessageLine { +interface IMessagePort { function send(uint256 toChainId, address toDapp, bytes calldata message, bytes calldata params) external payable; function fee(uint256 toChainId, address toDapp, bytes calldata message, bytes calldata params) external view returns (uint256); } abstract contract Application { - function _msgSender() internal view returns (address payable _line) { - _line = payable(msg.sender); + function _msgSender() internal view returns (address payable _port) { + _port = payable(msg.sender); } function _fromChainId() internal pure returns (uint256 _msgDataFromChainId) { @@ -19,7 +19,7 @@ abstract contract Application { } function _xmsgSender() internal pure returns (address payable _from) { - require(msg.data.length >= 20, "!line"); + require(msg.data.length >= 20, "!port"); assembly { _from := shr(96, calldataload(sub(calldatasize(), 20))) } diff --git a/helix-contract/contracts/messagers/MsgportMessager.sol b/helix-contract/contracts/messagers/MsgportMessager.sol index 931840c..a9bf728 100644 --- a/helix-contract/contracts/messagers/MsgportMessager.sol +++ b/helix-contract/contracts/messagers/MsgportMessager.sol @@ -2,10 +2,10 @@ pragma solidity ^0.8.17; import "../utils/AccessController.sol"; -import "../interfaces/IMessageLine.sol"; +import "../interfaces/IMessagePort.sol"; contract MsgportMessager is Application, AccessController { - IMessageLine public msgport; + IMessagePort public msgport; struct RemoteMessager { uint256 msgportRemoteChainId; @@ -29,18 +29,18 @@ contract MsgportMessager is Application, AccessController { _; } - modifier onlyMsgline() { + modifier onlyMsgPort() { require(msg.sender == address(msgport), "invalid caller"); _; } constructor(address _dao, address _msgport) { _initialize(_dao); - msgport = IMessageLine(_msgport); + msgport = IMessagePort(_msgport); } - function setMsgline(address _msgport) onlyDao external { - msgport = IMessageLine(_msgport); + function setMsgPort(address _msgport) onlyDao external { + msgport = IMessagePort(_msgport); } function setRemoteMessager(uint256 _appRemoteChainId, uint256 _msgportRemoteChainId, address _remoteMessager) onlyDao external { @@ -80,7 +80,7 @@ contract MsgportMessager is Application, AccessController { ); } - function receiveMessage(uint256 _srcAppChainId, address _remoteAppAddress, address _localAppAddress, bytes memory _message) onlyMsgline external { + function receiveMessage(uint256 _srcAppChainId, address _remoteAppAddress, address _localAppAddress, bytes memory _message) onlyMsgPort external { uint256 srcChainId = _fromChainId(); RemoteMessager memory remoteMessager = remoteMessagers[_srcAppChainId]; require(srcChainId == remoteMessager.msgportRemoteChainId, "invalid remote chainid"); diff --git a/helix-contract/deploy/deploy_msgline_messager.js b/helix-contract/deploy/deploy_msgport_messager.js similarity index 96% rename from helix-contract/deploy/deploy_msgline_messager.js rename to helix-contract/deploy/deploy_msgport_messager.js index 06cef16..834d07b 100644 --- a/helix-contract/deploy/deploy_msgline_messager.js +++ b/helix-contract/deploy/deploy_msgport_messager.js @@ -31,7 +31,7 @@ async function main() { const configure = JSON.parse( fs.readFileSync(pathConfig, "utf8") ); - const network = configure.chains['pangolin']; + const network = configure.chains['sepolia']; const w = wallet(configure, network); await deployMessager(w, network.dao, network.ormpPort, network.deployer, "msgport-messager-v1.0.0"); }