Document how the revert error message is propagated.
@@ -37,6 +37,10 @@ contract RedemptionScript {
tbtcToken.approve(address(vendingMachine), _amount);
(bool success, bytes memory returnData) = address(this).call(_extraData);
+ // By default, `address.call` will catch any revert messages.
+ // Converting the `returnData` to a string will effectively forward any revert messages.
+ // https://ethereum.stackexchange.com/questions/69133/forward-revert-message-from-low-level-solidity-call
+ // TODO: there's some noisy couple bytes at the beginning of the converted string, maybe the ABI-coded length?
require(success, string(returnData));
}
