46 Commits
Author SHA1 Message Date
sylearn c592d3fb7a fix: fold truncate matching into has_prefix
Per review, drop the separate truncate mode and use its logic for
has_prefix instead. Order amounts are stored without trailing zeros
(1.50 as "1.5"), so the plain string prefix check let the 1.5 order
claim a 1.51 payment meant for a concurrent order on the same address.
Truncate the received amount to the larger of the atom precision and
the order's own decimals, then compare exactly: overpayment below the
atom precision still matches, underpayment and overpayment of a full
atom no longer do.
2026-11-01 22:49:44 +09:00
sylearn 5cb1d6f099 feat: add truncate amount match mode
Truncate the received amount to the atom precision before an exact comparison, so overpayment below the atom precision still matches while concurrent orders on one address (1.50, 1.51, ...) never claim each other's payments.
2026-10-31 23:45:49 +09:00
sylearn 5b3a1ded6d fix(solana): keep lookback progress when the order query fails
lookbackOrdersPending ignored the query error, so a failed read counted
as "no order needs a lookback" and dropped the progress of a range that
was still needed. Return the error and keep the progress until the next
tick can check again.
2026-10-28 13:27:18 +08:00
sylearn 2fdb6e81d3 fix(solana): drop lookback ranges of finished orders
lookbackSlots keeps its progress (lookbackNext/lookbackEnd) across ticks,
but returns early through syncBreak once no order needs scanning. When an
order is paid, canceled or expires before its range is fully queued, the
remainder stays in memory. The next Solana order, possibly days later,
resumes that old range first.

In production the remainder was 627 slots from a week earlier. The RPC
node had already pruned them (-32001), every slot was retried, forward
scanning paused while retries were pending, and the node started to
answer 429. A payment made 90 seconds after the order was created was
seen four minutes late.

Before resuming, check that at least one order of the range still needs
a lookback (same condition as hasLookbackOrders); otherwise drop the
remaining range. The check runs before syncBreak so the state is also
cleared while scanning is idle.
2026-10-28 12:58:19 +08:00
sylearnandClaude Opus 5.5 f46b4b7f74 fix(task): cover every pending order window in lookback
pendingLookbackUnix ended the lookback range at the expiry of the last
expired order in created_at order. When a batch mixes expired and still
waiting orders (common after a restart), or an earlier order has a
longer timeout, part of the other orders' windows was outside the range
but they were still marked as looked back.

End the range at the latest min(expired_at, now) over the batch. Used by
every chain's lookback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 13:25:18 +08:00
betaxab 7eb0263193 fix: Fixed the issue of dropped orders on the TON blockchain
fix: Set "lookbackDone" only after the lookback has truly completed.
misc: Move TON address validation to utils.
2026-07-24 03:57:58 +08:00
Zhisheng HuangandClaude Opus 4.8 8c95b5b5b8 fix: keep block scanner awake while orders await confirmation
On EVM chains an order can stall forever in OrderStatusConfirming and never
fire its notify when block_offset_confirm is enabled, even though the payment
is on-chain and has far more than enough confirmations.

Block scanning is demand-driven: syncBreak() halts the forward scan once
hasLookbackOrders() finds no "receivable" orders, and receivableOrderStatuses()
only listed {Waiting, Expired}. When an order moves Waiting -> Confirming and it
is the only pending order, the scanner stops and the in-memory chainBlockNum
freezes. With block_offset_confirm enabled, tradeConfirmHandle() requires
chainBlockNum - RefBlockNum >= ConfirmedOffset, so a frozen chainBlockNum means
the order never reaches the threshold and stays Confirming indefinitely: no
notify is sent and the merchant is never credited. Low-traffic merchants hit
this on essentially every order.

Include OrderStatusConfirming in receivableOrderStatuses() so the scanner keeps
advancing while any order is awaiting confirmation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 19:28:41 -07:00
v03413 2edf26857e feat: add configurable order lookback hours 2026-06-21 16:23:55 +08:00
v03413 13d3fad174 refactor: move block api package to core 2026-06-21 01:30:04 +08:00
v03413 d458ef7ca3 feat: add API-backed block lookback 2026-06-19 01:33:56 +08:00
v03413 8033ccfe93 fix: exclude failed orders from recovery
「交易确认失败」本身就是一种合法状态
2026-06-18 22:46:41 +08:00
Jason.li 1e52f40a6c Merge origin/main into payment reconciliation fix 2026-06-07 14:40:38 +08:00
Jason.li 24372a9639 fix(task): recover missed payments across chains
Keep recent waiting, expired, and failed orders eligible for transfer matching, and use the same recoverable-order window when bootstrapping chain backfill.

Add periodic reconciliation backfill for EVM, Tron, and Aptos so scanners continue to revisit recent historical blocks or versions when recoverable orders exist, and add regression coverage for recoverable order selection and scanner activation.
2026-06-07 14:05:30 +08:00
Jason.li f28ae2aa8d fix(solana): reconcile missed token payments
Add a Solana reconciliation task that backfills recent waiting, expired, and failed orders by scanning token accounts, signatures, and parsed transactions for matching SPL transfers.

Reuse shared order matching for realtime transfer handling, return DB errors from MarkConfirming, and keep confirming orders eligible when the on-chain payment timestamp was inside the order window even if final confirmation happens after expiry.
2026-06-07 12:51:23 +08:00
v03413 ea113e6e90 feat: 增加支持 Ton 区块链网络扫块
新增交易类型 ton.toncoin usdt.ton
close: https://github.com/v03413/BEpusdt/pull/192
2026-06-02 21:03:19 +08:00
betaxab 609a850e61 update: minor adjustments to order confirmation 2026-04-29 18:52:19 +08:00
v03413 c4d5e20c7a feat: 实现交易监听 MQTT服务器广播 2026-04-15 14:58:24 +08:00
v03413 30eb6659d8 feat: 实现钱包地址独占模式 & 安全优化 2026-04-14 13:36:54 +08:00
v03413 6a2f3b6d6e feat: add PostgreSQL database support 2026-02-26 14:51:53 +08:00
betaxab 0c175e3c82 feat: transfer.go: let order processing task to support orders without tansactions 2026-02-18 18:18:48 +08:00
v03413 58e38efe21 feat: 增加可选订单金额匹配模式 2026-01-12 10:40:43 +08:00
v03413 7b194adfc1 perf: 优化交易匹配大小写问题 2026-01-08 10:25:36 +08:00
v03413 79dafd1145 perf: 优化 transfer 队列处理逻辑 2026-01-07 21:42:05 +08:00
v03413 7521844241 perf: 优化统一管理配置项 & 合并支持 Plasma
ref: https://github.com/v03413/BEpusdt/pull/117/
2026-01-04 16:18:21 +08:00
v03413 bf530dc245 Merge Add BNB-BEP20 & ETH-ERC20 native token support
手动合并入1.23.0 ref: https://github.com/v03413/BEpusdt/pull/128
2026-01-04 01:23:53 +08:00
v03413 c623b4ebe6 针对 交易类型 增加定义强类型校验 2026-01-04 01:23:53 +08:00
v03413 734da0aa83 Update
Update

Update

update

update

update

Update
2026-01-04 01:23:53 +08:00
v03413 b691cb4f1b perf: 优化完善订单状态 2025-08-13 15:02:35 +08:00
v03413 e4941b34ee feat: 增加广播交易二次确认机制 2025-08-13 13:50:59 +08:00
v03413 8b46799a67 refactor: 重写EVM针对ERC20的扫块逻辑
fix: https://github.com/v03413/BEpusdt/issues/100
2025-08-10 22:37:24 +08:00
v03413 83d422df2d perf: bot /start 消息格式调整 2025-07-30 23:29:00 +08:00
v03413 5abb5acc79 perf: 优化EVM扫块USDT监控逻辑 2025-07-25 10:13:35 +08:00
v03413 bfcfcc2f3c feat: aptos 底层扫块实现 2025-07-14 09:37:50 +08:00
v03413 6a82a8550e feat: 实现系统 event webhook 机制 2025-06-23 16:09:41 +08:00
zhiqiang.wang 5e8db1c73a perf: 适配非订单交易监控多链 2025-06-16 09:06:48 +08:00
zhiqiang.wang ae5e3fe5fb perf: 优化支持区块扫描偏移量 2025-06-15 21:17:58 +08:00
zhiqiang.wang 741009d69f fix: evm 地址统一按小写处理 2025-06-15 00:34:38 +08:00
zhiqiang.wang 63c162bd2a chore: 目录结构调整 2025-06-14 23:38:08 +08:00
zhiqiang.wang f7bb776e99 refactor: 重新适配钱包添加逻辑 2025-06-14 22:40:32 +08:00
zhiqiang.wang b1a06b8e17 perf: 优化各EVM 数量精度解析 2025-06-13 21:25:00 +08:00
zhiqiang.wang c57e80b8c3 feat: 增加支持 Xlayer扫描 2025-06-13 19:52:56 +08:00
zhiqiang.wang ac5b1c2abf perf: 区块 evm 扫描优化
基本实现 https://github.com/v03413/bepusdt/issues/56 目前底层已经扫描了 eth polygon 链并解析出了对应数据,但是否开放并接入 eth pol 两种原生币待考虑
2025-06-13 17:07:46 +08:00
zhiqiang.wang 33b67fc850 to: 优化EVM扫描 增加支持Ethereum
这个版本是为增加支持 usdt.erc20 做准备,暂不直接可用
2025-06-12 23:38:23 +08:00
zhiqiang.wang c98aaed49e perf: 更换底层bot 框架
原有bot框架停更,此次主要更新为另外一个框架,涉及逻辑较多可能存在一些问题
2025-05-22 22:10:14 +08:00
zhiqiang.wang eac611798a feat: 弃用环境变量传参 & 支持 toml 文件配置 2025-03-26 17:40:41 +08:00
zhiqiang.wang 64f9f57470 perf: update version 1.17.6 2025-03-20 22:27:37 +08:00