I'm fairly new to solidity so thanks in advance for your patience with this question.
I'm trying to implement a contract that uses the following line from the 0x sample provided here: https://github.com/0xProject/0x-api-starter-guide-code/blob/master/contracts/SimpleTokenSwap.sol#L90
I understand that the call won't revert itself, but will return a boolean "success" depending on whether or not it worked. However, the next line doesn't provide anything useful, as it has a hardcoded "SWAP_CALL_FAILED"
string.
I'd like to bubble up the reason why it failed. According to the 0x documentation, the 0x protocol uses "rich revert" reasons that are not simply strings, but custom errors with custom params: https://0x.org/docs/guides/v3-specification#rich-reverts
My problem: How am I supposed to decode the bytes memory response
without knowing in advance which error profile is in there? Is there any way to get meaningful error data from the swapTarget.call{value: msg.value}(swapCallData);
call?
I should mention that I'm using a hardhat local fork, if that makes a difference.