feat: Implement generic callback

--- don't change below this line ---
ENG-4047 Took 26 minutes


Took 4 minutes

Took 8 seconds

Took 59 seconds

Took 22 seconds
This commit is contained in:
Diana Carvalho
2025-01-28 18:05:10 +00:00
parent e481ceb304
commit fafeba9248
3 changed files with 20 additions and 5 deletions

View File

@@ -79,7 +79,22 @@ contract TychoRouter is
* caller is not a pool.
*/
fallback() external {
// TODO execute generic callback
_executeGenericCallback(msg.data);
}
/**
* @dev Check if the sender is correct and executes callback actions.
* @param msgData encoded data. It must includes data for the verification.
*/
function _executeGenericCallback(bytes calldata msgData) internal {
(
uint256 amountOwed,
uint256 amountReceived,
address tokenOwed,
uint16 offset // I think we actually don't need this!
) = _callVerifyCallback(msgData);
IERC20(tokenOwed).safeTransfer(msg.sender, amountOwed);
}
/**