📌 Description
In internal/soroban/escrow.go the read-only methods GetEscrowInfo/getEscrowInfoRPC and GetBalance/getBalanceRPC are stubs that log a warning and return without real data; the same is true for GetProgramInfo/getProgramInfoRPC and GetRemainingBalance/getRemainingBalanceRPC in internal/soroban/program.go. They never decode the contract return value from a simulation. Any payout flow that needs to read on-chain escrow state has nothing to call.
💡 Why it matters: Without working read paths, the backend cannot verify on-chain escrow/program balances before or after writes, undermining the payout lifecycle.
🧩 Requirements and context
- Implement the read paths using
SimulateTransaction against the escrow/program contracts and decode the returned ScVal via the helpers in internal/soroban/xdr_helpers.go.
- Return typed Go structs for escrow info, balance, program info, and remaining balance.
- Propagate context and the existing 30s HTTP timeout; return clear errors instead of logging-and-returning-empty.
- Add unit tests decoding representative simulation responses (mock RPC).
- Keep write paths (Init/Lock/Release/Refund/Payout) unchanged.
Non-functional requirements
- Must be secure, tested, and documented.
- Should be efficient and easy to review.
🛠️ Suggested execution
1. Fork the repo and create a branch
git checkout -b feat/soroban-readonly-calls
2. Implement changes
- Write/modify the relevant source:
internal/soroban/escrow.go, internal/soroban/program.go, possibly internal/soroban/rpc.go
- Write comprehensive tests:
internal/soroban/escrow_test.go, internal/soroban/program_test.go
- Add documentation: GoDoc on the new return types
- Include GoDoc comments explaining ScVal decoding
- Validate security assumptions: treat simulation results as untrusted; validate types before decoding
3. Test and commit
go test ./internal/soroban/...
- Cover edge cases: empty result, unexpected ScVal type, RPC error
- Include test output and security notes in the PR description.
Example commit message
feat(soroban): implement read-only escrow/program contract calls
✅ Acceptance criteria
🔒 Security notes
Simulation output is attacker-influenceable on a public RPC; validate every decoded field and never trust length/type without checks.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
In
internal/soroban/escrow.gothe read-only methodsGetEscrowInfo/getEscrowInfoRPCandGetBalance/getBalanceRPCare stubs that log a warning and return without real data; the same is true forGetProgramInfo/getProgramInfoRPCandGetRemainingBalance/getRemainingBalanceRPCininternal/soroban/program.go. They never decode the contract return value from a simulation. Any payout flow that needs to read on-chain escrow state has nothing to call.🧩 Requirements and context
SimulateTransactionagainst the escrow/program contracts and decode the returnedScValvia the helpers ininternal/soroban/xdr_helpers.go.Non-functional requirements
🛠️ Suggested execution
1. Fork the repo and create a branch
2. Implement changes
internal/soroban/escrow.go,internal/soroban/program.go, possiblyinternal/soroban/rpc.gointernal/soroban/escrow_test.go,internal/soroban/program_test.go3. Test and commit
go test ./internal/soroban/...Example commit message
✅ Acceptance criteria
🔒 Security notes
Simulation output is attacker-influenceable on a public RPC; validate every decoded field and never trust length/type without checks.
📋 Guidelines