invoice-in-crypto-with-a-quote-expiry
Use when invoicing a customer in crypto and the price moves between issue and payment. Fixes the amount in crypto at a rate with a short expiry and states the exact unit and chain.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- invoice-in-crypto-with-a-quote-expiry
- description
- Use when invoicing a customer in crypto and the price moves between issue and payment. Fixes the amount in crypto at a rate with a short expiry and states the exact unit and chain.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md363 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Invoice in crypto with a quote expiry
A crypto invoice with no expiry is an open FX position: the customer pays in the right coin at the wrong rate a day later. Fix the amount in base units, tie it to a rate with a short validity window, and state chain and token unambiguously.
Procedure
- Choose the denomination: bill in fiat and convert, or bill in crypto. Billing in fiat with a crypto settlement amount makes the FX risk explicit and short.
- Fetch the rate from a source with a timestamp (exchange ticker, Chainlink feed):
cast call $FEED "latestRoundData()(uint80,int256,uint256,uint256,uint80)" --rpc-url $RPC. - Add a buffer for volatility over the payment window (e.g. +1.5% for a 24h window on ETH).
- Convert to base units with the correct decimals and floor, never round up:
python3 -c "print(int(1500/(rate*1.015)*10**6))"for a 6-decimal stablecoin. - Set the expiry: both a block height and a wall-clock time. After expiry the invoice is void and a new rate is issued.
- On the invoice state the token contract address, chain id, amount in base units, destination address, and the accepted tolerance. Do not rely on ticker symbols alone.
- Record the rate, timestamp, feed id, and expiry alongside the invoice for reconciliation and tax.
Pitfalls
- Omitting the token contract address: two tokens share a ticker and the customer pays the worthless one.
- Using a rate with no timestamp; you cannot prove the rate at dispute time.
- Rounding the crypto amount up for the customer creates a mismatch you reconcile forever.
- A long expiry silently becomes a free option for the customer against you.
- A quote expiry in wall-clock time means nothing if the chain halts; pair it with a block-height expiry.
- Buffering the rate protects against adverse moves but can silently overcharge and look like a hidden fee.
- An invoice can be paid late and still land on-chain before your void; reconcile the on-chain time, not the receipt time.
- A stablecoin invoice still carries peg risk; the buffer for a stablecoin is depeg risk, not volatility.
Verification
python3 -c "print(int(1500/(rate*1.015)*10**6))" # amount in base units
# cross-check: amount_base_units / 10**decimals * rate ~= invoice_usd + buffer
Report the locked rate and its timestamp, the base-unit amount, the expiry, and the token contract on the invoice.
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.