Skip to content

feat: idle escrow yield integration — deposit to external yield protocol#148

Merged
shakurJJ merged 2 commits into
shakurJJ:mainfrom
AJtheManager:idle
Jun 25, 2026
Merged

feat: idle escrow yield integration — deposit to external yield protocol#148
shakurJJ merged 2 commits into
shakurJJ:mainfrom
AJtheManager:idle

Conversation

@AJtheManager

Copy link
Copy Markdown
Contributor

feat: idle escrow yield integration

lib.rs — 3 new public methods + 1 query:

  • set_yield_protocol(admin, protocol) — admin configures the external yield contract address.
  • deposit_idle_to_yield(admin, token, amount) — pushes idle escrow tokens to the yield protocol. Guards: amount ≤ (TotalEscrowed − AlreadyDeposited), paused-check, admin-only.
  • withdraw_from_yield(admin, token) -> i128 — pulls principal + accrued yield back. Any yield above principal is credited to TotalEscrowed so it flows through normal milestone payouts.
  • get_yield_deposited(token) -> i128 / get_yield_balance(token) -> i128 — read-only queries.

The external protocol interface is defined via #[contractclient(name = "YieldProtocolClient")] — matching the same pattern as token::Client — with three methods: deposit, withdraw, balance_of.

New DataKey variants: YieldProtocol, YieldDeposited(Address).


test: fuzz testing for milestone percentage validation

property_tests.rs — new milestone_percent_fuzz module with 8 pure-model proptest cases (10 000 cases each) and a nested contract_percent_tests module with 4 contract-backed proptest cases (200 cases each):

Pure model: sum/min invariant, two-split validity, order independence, zero-entry rejection, >100 entry, augmented sum invalidation, uniform n-way split, empty list and exact-min-split edge cases.

Contract-backed: verifies the live contract accepts valid splits, rejects below-minimum percents, rejects non-100 sums, and accepts a single 100% milestone.


feat: batch create multiple independent shipments

lib.rs — new BatchShipmentParams contracttype struct (mirrors all create_shipment params) and batch_create_shipments(env, params: Vec) -> Vec. Atomicity is free — Soroban transactions are all-or-nothing, so any per-shipment validation failure reverts the entire batch. Emits a batch_shipments_created event with the count.

closes #103
closes #88
closes #106
closes #101

@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@AJtheManager 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

@shakurJJ
shakurJJ merged commit c706011 into shakurJJ:main Jun 25, 2026
0 of 2 checks 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

2 participants