Workspace / Research tools
Vault accounting

Vault Donation and Rounding Sensitivity

A donation changes a vault's assets without necessarily issuing new shares. That can alter the conversion rate faced by a later depositor and make integer rounding more severe. This model follows that accounting sequence with explicit virtual offsets and compares the new depositor's minted shares with an immediate hypothetical redemption under the same simplified proportional rule.

Enable JavaScript to edit assumptions, calculate and compare a baseline locally. The formula and methodology below remain available without JavaScript.

Formula and accounting assumptions

First add the entered donation to adjusted assets while leaving adjusted shares unchanged. Then mint floor(new deposit × adjusted shares ÷ post-donation adjusted assets). For the immediate redemption, add the deposit to assets and its minted shares to supply before converting those shares back into assets with downward rounding. The difference between deposited and returned assets isolates the modeled rounding shortfall; it is not an attacker's profit calculation.

Worked hypothetical example

Suppose a vault contains 100 atomic assets and 100 share units with zero virtual offsets. A new deposit of one asset would mint one share before any donation. After a prior donation of 100 assets, that same deposit mints floor(100 ÷ 200), or zero shares. Its modeled share-based redemption is zero, leaving a one-asset shortfall. A ten-asset deposit under the same totals can mint five shares and recover ten assets, illustrating why deposit granularity matters.

Interpret the scenarios and limits

The scenario is educational accounting, not evidence that a live vault is vulnerable. Actual implementations can use virtual balances, special empty-vault rules, deposit protections, fees or accounting that excludes donations. Transaction ordering and other holders are not simulated. No contract is contacted or transaction constructed. Compare the no-donation row with the entered-donation row, and inspect small deposits separately; a large deposit that rounds cleanly does not establish the behavior of every smaller deposit.

Primary documentation

Your research workspace

Save selected inputs and research notes explicitly in this browser. Compare assumptions and restore a saved setup without submitting a trade. JavaScript enables the controls.

Find a tool or research page