From 372456a83f323a87829eac26b035bf74ce92d315 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 14 May 2024 11:28:22 +0800 Subject: [PATCH] Clean --- src/interfaces/IFeedOracle.sol | 22 ---------------------- src/security/ExcessivelySafeCall.sol | 23 ----------------------- 2 files changed, 45 deletions(-) delete mode 100644 src/interfaces/IFeedOracle.sol diff --git a/src/interfaces/IFeedOracle.sol b/src/interfaces/IFeedOracle.sol deleted file mode 100644 index 5fa5851..0000000 --- a/src/interfaces/IFeedOracle.sol +++ /dev/null @@ -1,22 +0,0 @@ -// This file is part of Darwinia. -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Darwinia. If not, see . - -pragma solidity 0.8.17; - -interface IFeedOracle { - function messageRootOf(uint256 chainid) external view returns (bytes32); -} diff --git a/src/security/ExcessivelySafeCall.sol b/src/security/ExcessivelySafeCall.sol index a1d6518..6b953a3 100644 --- a/src/security/ExcessivelySafeCall.sol +++ b/src/security/ExcessivelySafeCall.sol @@ -4,8 +4,6 @@ pragma solidity 0.8.17; // Inspired: https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/util/ExcessivelySafeCall.sol library ExcessivelySafeCall { - uint256 private constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff; - /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. @@ -104,25 +102,4 @@ library ExcessivelySafeCall { } return (_success, _returnData); } - - /// @notice Swaps function selectors in encoded contract calls - /// @dev Allows reuse of encoded calldata for functions with identical - /// argument types but different names. It simply swaps out the first 4 bytes - /// for the new selector. This function modifies memory in place, and should - /// only be used with caution. - /// @param _newSelector The new 4-byte selector - /// @param _buf The encoded contract args - function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure { - require(_buf.length >= 4); - uint256 _mask = LOW_28_MASK; - assembly ("memory-safe") { - // load the first word of - let _word := mload(add(_buf, 0x20)) - // mask out the top 4 bytes - // /x - _word := and(_word, _mask) - _word := or(_newSelector, _word) - mstore(add(_buf, 0x20), _word) - } - } }