Repository navigation
fix(dapp): limit every naira payout to 2,000,000 on every chain - #194
Merged
Merged
Conversation
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.
✅ Deploy Preview for useintentadapp ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for useintent ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
/api/naira/orders) refused any single payout over ₦200,000./api/cashout/orders, through Weave or Linq) had no naira limit at all.Changes
lib/naira/limit.ts: ₦2,000,000 per payout, orNAIRA_MAX_NGNwhen it's set to a positive number. Nothing is set on Vercel today, so ₦2,000,000 applies.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:NAIRA_MAX_NGNoverride works;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.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).