Skip to content

Commit

Permalink
Support native value fills
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes committed Nov 22, 2024
1 parent dde2435 commit aa714c3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/HyperlaneArbiter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {TheCompact} from "the-compact/src/TheCompact.sol";
import {ClaimWithWitness} from "the-compact/src/types/Claims.sol";
import {Compact} from "the-compact/src/types/EIP712Types.sol";

import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {SafeTransferLib} from "solady/utils/SafeTransferLib.sol";
import {Router} from "hyperlane/contracts/client/Router.sol";

Expand Down Expand Up @@ -106,10 +107,18 @@ contract HyperlaneArbiter is Router {

// TODO: support Permit2 fills
address filler = msg.sender;
intent.token.safeTransferFrom(filler, intent.recipient, intent.amount);

_dispatch(
claimChain, Message.encode(compact, allocatorSignature, sponsorSignature, hash(intent), intent.fee, filler)
if (intent.token == address(0)) {
Address.sendValue(payable(intent.recipient), intent.amount);
} else {
intent.token.safeTransferFrom(filler, intent.recipient, intent.amount);
}

_Router_dispatch(
claimChain,
msg.value - intent.amount,
Message.encode(compact, allocatorSignature, sponsorSignature, hash(intent), intent.fee, filler),
"",
address(hook)
);
}

Expand Down

0 comments on commit aa714c3

Please sign in to comment.