Fill notification hook
if (
orderData.orderType == OrderEncoder.PUBLIC_ORDER_WITH_HOOK
|| orderData.orderType == OrderEncoder.PRIVATE_ORDER_WITH_HOOK
) {
IHook7683Recipient(recipient).onFilledOrder(orderData);
}Implementation
Interface
interface IHook7683Recipient {
function onFilledOrder(OrderData memory orderData) external;
}function onFilledOrder(OrderData calldata orderData) external {
require(msg.sender == GATEWAY, "not gateway");
address token = _bytes32ToAddress(orderData.outputToken);
bytes32 commitment = sha256(abi.encodePacked(token, orderData.data));
require(finalizableDeposits[commitment] == 0, "commitment already used");
// NOTE: Only the user who owns the full zkPassport proof can call `claim` by providing the proof.
// The proof commitment must also include `msg.sender` to prevent others from stealing the proof
// and using it to fraudulently claim the amount.
finalizableDeposits[commitment] = orderData.amountOut;
emit NewDepositToFinalize(commitment, token, orderData.amountOut);
}Last updated