-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove contract-libs and add install.sh
- Loading branch information
Showing
8 changed files
with
62 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Install foundryup | ||
curl -L https://foundry.paradigm.xyz | bash | ||
# Install foundry | ||
$HOME/.foundry/bin/foundryup -v nightly-de33b6af53005037b463318d2628b5cfcaf39916 # Stable version | ||
# Install rustup | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
# Update rustup | ||
$HOME/.cargo/bin/rustup update stable | ||
# Install soldeer | ||
$HOME/.cargo/bin/cargo install soldeer | ||
# Update dependencies with soldeer | ||
$HOME/.cargo/bin/soldeer update | ||
# Run forge build | ||
$HOME/.foundry/bin/forge build | ||
# Install jq | ||
brew install jq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
library LibErrorHandler { | ||
/// @dev Reserves error definition to upload to signature database. | ||
error ExternalCallFailed(bytes4 msgSig, bytes4 callSig); | ||
|
||
/// @notice handle low level call revert if call failed, | ||
/// If external call return empty bytes, reverts with custom error. | ||
/// @param status Status of external call | ||
/// @param callSig function signature of the calldata | ||
/// @param returnOrRevertData bytes result from external call | ||
function handleRevert(bool status, bytes4 callSig, bytes memory returnOrRevertData) internal pure { | ||
// Get the function signature of current context | ||
bytes4 msgSig = msg.sig; | ||
assembly ("memory-safe") { | ||
if iszero(status) { | ||
// Load the length of bytes array | ||
let revertLength := mload(returnOrRevertData) | ||
// Check if length != 0 => revert following reason from external call | ||
if iszero(iszero(revertLength)) { | ||
// Start of revert data bytes. The 0x20 offset is always the same. | ||
revert(add(returnOrRevertData, 0x20), revertLength) | ||
} | ||
|
||
// Load free memory pointer | ||
let ptr := mload(0x40) | ||
// Store 4 bytes the function selector of ExternalCallFailed(msg.sig, callSig) | ||
// Equivalent to revert ExternalCallFailed(bytes4,bytes4) | ||
mstore(ptr, 0x49bf4104) | ||
// Store 4 bytes of msgSig parameter in the next slot | ||
mstore(add(ptr, 0x20), msgSig) | ||
// Store 4 bytes of callSig parameter in the next slot | ||
mstore(add(ptr, 0x40), callSig) | ||
// Revert 68 bytes of error starting from 0x1c | ||
revert(add(ptr, 0x1c), 0x44) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters