Skip to content

Commit

Permalink
Clean
Browse files Browse the repository at this point in the history
  • Loading branch information
hujw77 committed May 14, 2024
1 parent b5815c4 commit 372456a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
22 changes: 0 additions & 22 deletions src/interfaces/IFeedOracle.sol

This file was deleted.

23 changes: 0 additions & 23 deletions src/security/ExcessivelySafeCall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
}
}
}

0 comments on commit 372456a

Please sign in to comment.