feat: escrow contract scaffolding, cancel_and_refund guards, doc updates, and database migration runner (#149, #151, #156, #157) - #220
Merged
dark-sarge merged 1 commit intoAug 28, 2026
Conversation
…tes, and database migration runner (arflexx#149, arflexx#151, arflexx#156, arflexx#157)
|
@GF-Hunter 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.
Description
This pull request addresses and resolves issues #149, #151, #156, and #157 across the escrow smart contract and server layers:
Escrow Contract Scaffolding ([contract] - Create
contracts/escrow/Rust Project Scaffold withCargo.toml#149):contracts/escrow/Cargo.tomlwithsoroban-sdk = { workspace = true, features = ["alloc"] }to provide the required memory allocator forwasm32-unknown-unknownandwasm32v1-nonetargets.#![no_std]andextern crate alloc;tocontracts/escrow/src/lib.rs.stellar contract buildproducing the compiled.wasmartifact.Contract Documentation Correction and Function Reordering ([contract] - Fix Incorrect Contract Function Name in
contracts/readme.md#151):contracts/readme.mdby replacing occurrences ofNotesingwithcreate_listing.create_listingto includeexpires_at: u64and documented thatexpires_atis validated to be in the future.Returns: u64forcreate_listing,Returns: ()fordeposit_to_escrow,release_payment, andcancel_and_refund).## ⚡ Contract Functionsin logical execution order:create_listing→deposit_to_escrow→release_payment→cancel_and_refund.Last Updated: August 28, 2026to the top ofcontracts/readme.md.Caller Guard & Timelock Validation for
cancel_and_refund([contract] - Addcancel_and_refundCaller Guard (Buyer or Admin Only) #156):UnauthorizedandTimelockNotExpiredvariants toContractError.cancel_and_refund.now < trade.expires_at), while bypassing timelock checks for admin cancellations to permit immediate dispute resolution.contracts/readme.md.contracts/escrow/src/lib.rscovering buyer after timelock, buyer before timelock, admin immediate cancellation, and seller rejection.Standalone Database Schema Migration CLI Runner ([server] - Add
server/src/db/migrate.tsCLI Script to Run Migrations at Startup #157):server/src/db/migrate.tsstandalone CLI runner that sequentially executes.sqlfiles fromserver/src/db/migrations/in lexicographical order againstDATABASE_URL.schema_migrationstable (id SERIAL PRIMARY KEY, filename TEXT UNIQUE NOT NULL, applied_at TIMESTAMPTZ NOT NULL DEFAULT NOW()), skipping already-applied files."db:migrate": "ts-node src/db/migrate.ts"and"db:migrate:rollback": "ts-node src/db/migrate.ts rollback"scripts toserver/package.json.schema_migrationsand outputting the filename for manual SQL reversal.No pending migrationsand exits 0 when no migrations are pending.server/src/db/migrate.test.tsmocking PostgreSQL pool and asserting migration application, skipping, and rollback behavior.Issues Closed
Closes #149
Closes #151
Closes #156
Closes #157