From 9ae0738ebc4547a8ed4eabd8fa4f8dcd506ea1ea Mon Sep 17 00:00:00 2001 From: "tu-do.ron" <18521578@gm.uit.edu.vn> Date: Mon, 20 Nov 2023 14:00:23 +0700 Subject: [PATCH 1/5] Revert "feat: add `LibErrorHandler`" --- src/LibErrorHandler.sol | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/LibErrorHandler.sol diff --git a/src/LibErrorHandler.sol b/src/LibErrorHandler.sol deleted file mode 100644 index 8202fca..0000000 --- a/src/LibErrorHandler.sol +++ /dev/null @@ -1,40 +0,0 @@ -// 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 extcall 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) - } - } - } -} From 7baf56e79952f0baa4e32b9c621cd20204dc8f2a Mon Sep 17 00:00:00 2001 From: "tu-do.ron" Date: Mon, 20 Nov 2023 15:03:27 +0700 Subject: [PATCH 2/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01c6523..5074d76 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# smart-contracts-core +# contract-libs The collections of smart contracts that power the Axie Land Delegation. From 8a94c3b8c395f1e7b97d96f29393bd68daea3eec Mon Sep 17 00:00:00 2001 From: TuDo1403 Date: Mon, 11 Dec 2023 10:49:57 +0700 Subject: [PATCH 3/5] chore: update forge-std --- lib/forge-std | 2 +- lib/openzeppelin-contracts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/forge-std b/lib/forge-std index bdea49f..2f11269 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit bdea49f9bb3c58c8c35850c3bdc17eaeea756e9a +Subproject commit 2f112697506eab12d433a65fdc31a639548fe365 diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index 932fddf..6ba452d 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit 932fddf69a699a9a80fd2396fd1a2ab91cdda123 +Subproject commit 6ba452dea4258afe77726293435f10baf2bed265 From bb4124a8ce96fc0ff725a52a246f3546bcf41c9d Mon Sep 17 00:00:00 2001 From: TuDo1403 Date: Mon, 11 Dec 2023 10:52:05 +0700 Subject: [PATCH 4/5] forge install: openzeppelin-contracts bd325d56b4c62c9c5c1aff048c37c6bb18ac0290 --- lib/openzeppelin-contracts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index 6ba452d..bd325d5 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit 6ba452dea4258afe77726293435f10baf2bed265 +Subproject commit bd325d56b4c62c9c5c1aff048c37c6bb18ac0290 From 68956478b2db5fba124a94697c56ed0da6454c0f Mon Sep 17 00:00:00 2001 From: TuDo1403 Date: Mon, 11 Dec 2023 10:53:15 +0700 Subject: [PATCH 5/5] fix: remove remappings --- foundry.toml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/foundry.toml b/foundry.toml index 596d69b..9082196 100644 --- a/foundry.toml +++ b/foundry.toml @@ -6,12 +6,6 @@ ffi = true # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options -remappings = [ - 'forge-std/=lib/forge-std/src/', - 'ds-test/=lib/forge-std/lib/ds-test/src/', - '@openzeppelin/=lib/openzeppelin-contracts/', -] - solc = '0.8.23' evm_version = 'istanbul' use_literal_content = true