Repository navigation
fix: resolve issues #887 #888 #889 #890 in treasury contract and backend - #993
Open
ahmadrabiumustapha wants to merge 1 commit into
Open
ahmadrabiumustapha wants to merge 1 commit into
ahmadrabiumustapha wants to merge 1 commit into
Conversation
…CK#890 in treasury contract and backend WHEELBACK#887 - deposit() now rejects all tokens when the allowlist is empty. Previously the guard was `if !allowlist.contains(&token)` which passed on an empty Vec, allowing any token. Changed to `if allowlist.is_empty() || !allowlist.contains(&token)`. WHEELBACK#888 - withdraw() now actually transfers tokens to the recipient. The `_to` parameter was declared but never used; the token transfer call was missing entirely. Renamed to `to` and added `token::Client::new(&e, &token).transfer(..., &to, &(amount as i128))`. WHEELBACK#889 - executeSettlementWithBalanceCheck: fixed runtime crash caused by `res.locals.logger` reference in the exported function (res is not in scope outside the route handler). Replaced with `console.info`. Added idempotency guard: if settlement.status === 'Executed' return early instead of re-submitting. WHEELBACK#890 - After a failed submitContractCall the handler now re-fetches the on-chain settlement status and treasury balance. If the balance dropped but the settlement is still Pending it surfaces an EscrowBalanceMismatch error (409) so the caller can reconcile rather than blindly re-executing. Also: added missing TreasuryError variants to the enum (SettlementNotFound=15, SettlementExpired=16, NotDisputed=17, InvalidSettlementTtl=18) that were referenced in contract code but absent from the declaration, causing a compile-time error. Fixed missing closing paren on asyncHandler call in the execute-settlement route. Deduplicated .gitignore (removed repeated entries for playwright-report, playwright/.auth, vitest-report, .vite/, coverage/, html/, lcov.info).
|
@ahmadrabiumustapha Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
#887 - deposit() now rejects all tokens when the allowlist is empty.
Previously the guard was
if !allowlist.contains(&token)which passedon an empty Vec, allowing any token. Changed to
if allowlist.is_empty() || !allowlist.contains(&token).#888 - withdraw() now actually transfers tokens to the recipient.
The
_toparameter was declared but never used; the token transfercall was missing entirely. Renamed to
toand addedtoken::Client::new(&e, &token).transfer(..., &to, &(amount as i128)).#889 - executeSettlementWithBalanceCheck: fixed runtime crash caused by
res.locals.loggerreference in the exported function (res is not inscope outside the route handler). Replaced with
console.info. Addedidempotency guard: if settlement.status === 'Executed' return early
instead of re-submitting.
#890 - After a failed submitContractCall the handler now re-fetches the
on-chain settlement status and treasury balance. If the balance dropped
but the settlement is still Pending it surfaces an EscrowBalanceMismatch
error (409) so the caller can reconcile rather than blindly re-executing.
Also: added missing TreasuryError variants to the enum (SettlementNotFound=15, SettlementExpired=16, NotDisputed=17, InvalidSettlementTtl=18) that were referenced in contract code but absent from the declaration, causing a compile-time error. Fixed missing closing paren on asyncHandler call in the execute-settlement route. Deduplicated .gitignore (removed repeated entries for playwright-report, playwright/.auth, vitest-report, .vite/, coverage/, html/, lcov.info).
Pull Request
Summary
Checklist
abis/andCOMEBACKHERE-contracts/)Notes
make check-abi-snapshots.closes SAMPLE 041: Treasury deposit accepts a token outside the allowlist #887
closes SAMPLE 042: Treasury release transfers funds to an unexpected recipient #888
closes SAMPLE 043: Settlement execution can be submitted twice for one invoice #889
closes SAMPLE 044: Failed settlement leaves escrow balance out of sync #890