Summary
MeridianVault::deposit transfers USDC from the caller to the vault, then immediately transfers the same amount from the vault to the adapter, as two separate TokenClient::transfer calls.
Motivation
The intermediate vault-owned balance is never used for anything between the two transfers; it exists for exactly one instruction. Each transfer is a separate cross-contract call with its own instruction and resource cost on Soroban, so this doubles the token-transfer overhead of every deposit for no behavioral benefit.
Proposed Solution
Transfer USDC directly from the caller to the adapter in one call, since the adapter address is already known before any transfer happens.
Scope
| Field |
Value |
| Area |
Contracts |
| Protocol affected |
Both |
| Network |
testnet, mainnet |
| Breaking change? |
No |
Alternatives Considered
Leaving it as-is: works correctly today, but pays unnecessary transaction cost on every deposit.
Acceptance Criteria
Additional Context
packages/contracts/vault/src/lib.rs, deposit function, the two TokenClient::new(&env, &usdc).transfer(...) calls.
Summary
MeridianVault::deposittransfers USDC from the caller to the vault, then immediately transfers the same amount from the vault to the adapter, as two separateTokenClient::transfercalls.Motivation
The intermediate vault-owned balance is never used for anything between the two transfers; it exists for exactly one instruction. Each transfer is a separate cross-contract call with its own instruction and resource cost on Soroban, so this doubles the token-transfer overhead of every deposit for no behavioral benefit.
Proposed Solution
Transfer USDC directly from the caller to the adapter in one call, since the adapter address is already known before any transfer happens.
Scope
Alternatives Considered
Leaving it as-is: works correctly today, but pays unnecessary transaction cost on every deposit.
Acceptance Criteria
depositperforms a singlecaller -> adaptertransfer instead ofcaller -> vault -> adaptercargo clippy --all-targets -- -D warnings && cargo testpassAdditional Context
packages/contracts/vault/src/lib.rs,depositfunction, the twoTokenClient::new(&env, &usdc).transfer(...)calls.