Skip to content

Commit

Permalink
check toDapp (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
hujw77 authored Jun 13, 2024
1 parent a32c875 commit 9ffae93
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ports/LayerZeroV1Port.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ contract LayerZeroV1Port is Ownable2Step, BaseMessagePort, PeerLookup, LayerZero
_;
}

modifier checkToDapp(address toDapp) override {
require(toDapp != address(LZ), "!toDapp");
_;
}

constructor(address dao, address lzv1, string memory name, uint256[] memory chainIds, uint16[] memory lzChainIds)
BaseMessagePort(name)
LayerZeroV1ChainIdMapping(chainIds, lzChainIds)
Expand Down
5 changes: 5 additions & 0 deletions src/ports/LayerZeroV2Port.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ contract LayerZeroV2Port is Ownable2Step, BaseMessagePort, PeerLookup, LayerZero
_transferOwnership(dao);
}

modifier checkToDapp(address toDapp) override {
require(toDapp != address(endpoint), "!toDapp");
_;
}

function _transferOwnership(address newOwner) internal override(Ownable, Ownable2Step) {
super._transferOwnership(newOwner);
}
Expand Down
5 changes: 5 additions & 0 deletions src/ports/MultiPort.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ contract MultiPort is Ownable2Step, Application, BaseMessagePort, PeerLookup {
event PortMessageExpired(bytes32 indexed portMsgId);
event PortMessageExecution(bytes32 indexed portMsgId);

modifier checkToDapp(address toDapp) override {
require(!_trustedPorts.contains(toDapp), "!toDapp");
_;
}

constructor(address dao, uint256 threshold_, string memory name) BaseMessagePort(name) {
_transferOwnership(dao);
_setThreshold(threshold_);
Expand Down

0 comments on commit 9ffae93

Please sign in to comment.