Skip to content

fix(dapp): limit every naira payout to 2,000,000 on every chain - #194

Merged
0xDeon merged 1 commit into
mainfrom
fix/naira-cap-all-chains
Nov 12, 2026
Merged

0xDeon merged 1 commit into
mainfrom
fix/naira-cap-all-chains

Conversation

@0xDeon

@0xDeon 0xDeon commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

What was wrong

  • Stellar: the naira form (/api/naira/orders) refused any single payout over ₦200,000.
  • Every other chain: off-ramps from NEAR, Solana, Sui and Avalanche (/api/cashout/orders, through Weave or Linq) had no naira limit at all.

Changes

  • One shared limit, lib/naira/limit.ts: ₦2,000,000 per payout, or NAIRA_MAX_NGN when it's set to a positive number. Nothing is set on Vercel today, so ₦2,000,000 applies.
  • Stellar's naira form: uses the shared limit, up from ₦200,000.
  • The off-ramp route for every other chain, for naira payouts only:
    • It checks the limit before either provider makes an order.
    • It takes the larger of two estimates: Weave's quote, and, on Sui and Solana where Linq may take the order, the naira at Linq's rate. Linq can pay more than Weave's estimate, so the limit holds whichever provider pays.
    • If Linq may take the order and no naira figure can be read, the payout isn't started.
    • Other currencies (KES and so on) aren't limited.
  • When a payout is over the limit, the refusal reads: "One payout is limited to ₦2,000,000. Send less, or split it into more than one payout. Nothing was signed or sent."

Tests

  • naira-limit.test.ts: the default, the env override and its fallback, the larger-of-two estimate, and the refusal message.
  • weave-orders-route.test.ts:
    • over ₦2,000,000 is refused with no Weave order created;
    • exactly ₦2,000,000 goes through;
    • KES isn't limited;
    • the NAIRA_MAX_NGN override works;
    • on Sui, Linq's higher naira figure stops the order before Linq or Weave makes it.
  • naira-orders-route.test.ts: about ₦1,998,500 is allowed on Stellar's form, and over the limit the refusal names ₦2,000,000.
  • Full suite green with SKIP_LIVE=1. The roster and 1Click origin tests time out when run together on a busy machine; each passes when run alone (14 and 89 tests).

Only Stellar's naira form had a limit, of 200,000 naira per payout. An
off-ramp from NEAR, Solana, Sui or Avalanche had none. One shared limit,
lib/naira/limit.ts, now applies to both order routes: 2,000,000 naira per
payout unless NAIRA_MAX_NGN says otherwise.

The off-ramp route checks it before either provider makes an order. It
takes the larger of Weave's quote and, where Linq may take the order, the
naira at Linq's rate, since Linq can pay more than Weave's estimate. When
Linq may take it and no naira figure can be read, the payout is not
started. Other currencies are not limited.
@netlify

netlify Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for useintentadapp ready!

Name Link
🔨 Latest commit 201a54c
🔍 Latest deploy log https://app.netlify.com/projects/useintentadapp/deploys/6af5d64df6923a6354e851b0
😎 Deploy Preview https://deploy-preview-194--useintentadapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for useintent ready!

Name Link
🔨 Latest commit 201a54c
🔍 Latest deploy log https://app.netlify.com/projects/useintent/deploys/6af5d64decd543b67346181a
😎 Deploy Preview https://deploy-preview-194--useintent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@0xDeon
0xDeon merged commit e4e08ee into main Nov 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant