Canonical first-party machine-token (MPP Credits / machineUSD) charge routes.
A machine-token payment does not send the challenge currency from the payer.
The payer approves the canonical swapper and calls swapTo; the swapper
pulls and burns the credit token, then transferWithMemos the challenge
currency to the merchant. Merchant-facing verification is therefore a TIP-20
TransferWithMemo whose from is the swapper, not the payer.
On-chain authority: Tempo's verified Moderato MppcSwapper source
(swapTo pulls/burns input, then target.transferWithMemo) plus live
Moderato receipts. Reference SDKs are compatibility evidence only:
- mppx
refs/mppx/src/tempo/internal/machine-token.ts/defaults.ts - mpp-rs
refs/mpp-rs/src/protocol/methods/tempo/machine_token.rs
Calldata/event parsers for this route belong in onchain_tempo. Until that
library ships them, this module holds the MPP-side constants and exact
[approve, swapTo] match the verifier needs.
Summary
Functions
Match the exact canonical [approve, swapTo] route for a charge.
Build the canonical [approve, swapTo] calls for a charge.
Return the canonical swapper address that emits the merchant transfer, or nil.
Return whether a first-party machine-token deployment exists on chain_id.
ABI-encode swapTo(address,uint256,address,address,bytes32) calldata.
Return the canonical machine-token (credit) address on chain_id, or nil.
Types
@type call() :: %{to: binary(), value: non_neg_integer(), input: binary()}
Functions
@spec match_route( [call()], non_neg_integer(), String.t(), String.t(), String.t() | nil, String.t() | nil ) :: {:ok, route()} | :error
Match the exact canonical [approve, swapTo] route for a charge.
When memo is nil, the memo is taken from the swapTo calldata (mppx
matchRoute / mpp-rs match_route). Any other call shape returns :error.
@spec settlement_calls( non_neg_integer(), String.t(), non_neg_integer() | String.t(), String.t(), binary() ) :: {:ok, [call()]} | :error
Build the canonical [approve, swapTo] calls for a charge.
Returns :error when the chain has no first-party deployment or any
address, amount, or memo is invalid.
@spec settlement_sender(non_neg_integer()) :: String.t() | nil
Return the canonical swapper address that emits the merchant transfer, or nil.
@spec supported?(non_neg_integer()) :: boolean()
Return whether a first-party machine-token deployment exists on chain_id.
ABI-encode swapTo(address,uint256,address,address,bytes32) calldata.
@spec token(non_neg_integer()) :: String.t() | nil
Return the canonical machine-token (credit) address on chain_id, or nil.