Skip to content

feat(agent): wire rebalance execution to vault contract#36

Merged
robertocarlous merged 1 commit intoNeurowealth:mainfrom
edehvictor:codex/feat-agent-rebalance-contract-33
Mar 29, 2026
Merged

feat(agent): wire rebalance execution to vault contract#36
robertocarlous merged 1 commit intoNeurowealth:mainfrom
edehvictor:codex/feat-agent-rebalance-contract-33

Conversation

@edehvictor
Copy link
Copy Markdown
Contributor

Closes #33

Changes

  • replace mock rebalance transaction generation in src/agent/router.ts with a real call to the vault Soroban contract
  • convert best APY percent values into expectedApyBasisPoints (u32) before invoking the contract
  • persist the returned on-chain txHash as a Prisma Transaction with:
    • type: REBALANCE
    • status: PENDING
  • keep rebalance details returned from the agent flow aligned with the real contract submission result
  • start the vault event listener during app startup so rebalance confirmations can be picked up by the existing event-processing path
  • add unit coverage that mocks Stellar contract calls and verifies:
    • APY to basis-point conversion
    • real tx hash persistence
    • pending rebalance transaction creation

Notes

  • Rebalance execution now submits a real agent-signed Soroban transaction through src/stellar/contract.ts
  • Transaction confirmation and follow-up DB updates remain delegated to the vault event listener flow

Testing

  • node .\node_modules\typescript\bin\tsc --noEmit
  • node .\node_modules\jest\bin\jest.js --runInBand

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@edehvictor 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! 🚀

Learn more about application limits

@robertocarlous robertocarlous merged commit 8524ab5 into Neurowealth:main Mar 29, 2026
1 check 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.

Wire Agent Rebalance Execution to Vault Contract

2 participants