LadderMine / LadderMine/yieldladder
[NF-16] [CONTRACT] Batch Multi-Tier Deposit
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 26
- Avg merge
- 4h 36m
- Merged PRs (30d)
- 8
Description
Overview
A user who wants to spread capital across multiple tiers in one sitting currently has to submit one transaction per tier. This issue adds a single-transaction batch deposit.
Problem
VaultRouter.deposit(user, tier, amount) accepts exactly one tier/amount pair per call. Building a ladder across Flex/L3/L6/L12 in a single sitting today costs 4 separate transactions, 4 separate USDC transfers, and 4 separate signature prompts in the wallet.
Proposed Solution
- Add
VaultRouter.batch_deposit(user: Address, deposits: Vec<(Tier, i128)>). - Validates every
(tier, amount)pair up front (all tiers valid, all amounts meet their tier minimum) before moving any funds, so the whole batch is atomic — either every deposit in the batch succeeds or the entire transaction reverts, with no partial state where some tiers received funds and others didn't. - Internally loops the existing single-tier
depositlogic per pair, reusing that code path rather than duplicating it. - Single USDC
transferfor the summed total where possible, or per-tier transfers if that's simpler to keep the existing per-vault forwarding logic intact — implementation detail for the PR, but must not double-charge or under-charge the depositor relative to the sum of individual deposits.
Acceptance Criteria
- A single
batch_depositcall correctly creates positions in all specified tiers - If any single pair in the batch is invalid (bad tier or below minimum), the entire transaction reverts — no partial deposits
- Total USDC moved equals the exact sum of the batch's amounts, no more, no less
- Gas/resource cost of one
batch_depositfor N tiers is meaningfully lower than N separatedepositcalls - Unit tests cover: successful 4-tier batch, one invalid pair causing full revert, batch with duplicate tiers (define and test the intended behavior — reject duplicates or sum them, documented explicitly in the PR)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the existing VaultRouter.deposit entry point and trace its validation, transfer, and per-vault forwarding behavior before defining the batch path. Review the contract's unit-test setup, then cover the four-tier success case, atomic failure, exact total transfer, gas/resource improvement, and an explicitly documented duplicate-tier behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100