From 906fb656cbbc52f0d75e323c1ba9ad356ea9e393 Mon Sep 17 00:00:00 2001 From: Tina Zheng Date: Tue, 21 Nov 2023 15:06:27 -0500 Subject: [PATCH] add erics custom error handler --- contracts/base/Multicall.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contracts/base/Multicall.sol b/contracts/base/Multicall.sol index 5eccb34c..bd926766 100644 --- a/contracts/base/Multicall.sol +++ b/contracts/base/Multicall.sol @@ -13,6 +13,12 @@ abstract contract Multicall is IMulticall { (bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { + // handle custom errors + if (result.length == 4) { + assembly { + revert(add(result, 0x20), mload(result)) + } + } // Next 5 lines from https://ethereum.stackexchange.com/a/83577 if (result.length < 68) revert(); assembly {