Skip to Content
GuidesWind down with a waterfall

Wind down with a waterfall

An asset whose proceeds, if it is wound down, pay a lender 5 aeUSD first and then the ECONOMIC holders pro rata.

1. The asset and its waterfall

aevad keys add lender --home "$AEVA_HOME" --keyring-backend test --no-backup >/dev/null 2>&1 || true LENDER=$(aevad keys show lender -a --home "$AEVA_HOME" --keyring-backend test) R=$(alias_tx asset create-asset ECONOMIC --settlement-denom aeusd --from issuer) WA=$(wait_tx "$(jq -r .txhash <<<"$R")" | created_asset) R=$(alias_tx rights issue "$WA" 0 "$ISSUER" 1000 --from issuer); wait_tx "$(jq -r .txhash <<<"$R")" >/dev/null R=$(alias_tx rights transfer "$INVESTOR" "$WA" 0:250 --from issuer); wait_tx "$(jq -r .txhash <<<"$R")" >/dev/null R=$(alias_tx waterfall set-waterfall "$WA" "fixed:$LENDER:5000000aeusd,pro_rata:0:aeusd" --from issuer); wait_tx "$(jq -r .txhash <<<"$R")" >/dev/null echo "asset and its waterfall: $AEVA_EXPLORER/assets/$WA"

2. Liquidate

The issuer starts the liquidation with a 15-second exercise window (up to 365 days in practice, to let beneficiaries exercise pledges). Transfers stop at once; when the window ends the asset becomes LIQUIDATED.

R=$(alias_tx waterfall liquidate "$WA" 15s --from issuer); wait_tx "$(jq -r .txhash <<<"$R")" >/dev/null aevad query asset asset "$WA" --node "$AEVA_NODE" -o json | jq -r '"status: \(.asset.status)"' sleep 20 aevad query asset asset "$WA" --node "$AEVA_NODE" -o json | jq -r '"status: \(.asset.status)"'
Expected output
status: ASSET_STATUS_LIQUIDATING status: ASSET_STATUS_LIQUIDATED

3. Deposit proceeds and run the waterfall

Anyone may deposit proceeds and anyone may run the waterfall:

R=$(alias_tx waterfall deposit-proceeds "$WA" 25000000aeusd --from issuer); wait_tx "$(jq -r .txhash <<<"$R")" >/dev/null R=$(alias_tx waterfall run "$WA" --from investor); wait_tx "$(jq -r .txhash <<<"$R")" >/dev/null aevad query bank balance "$LENDER" aeusd --node "$AEVA_NODE" -o json | jq -r '"lender: \(.balance.amount) aeusd"' aevad query payout claimable "$INVESTOR" --asset-id "$WA" --node "$AEVA_NODE" -o json | jq -r '"investor can claim: \([.claimable[] | .total | tonumber] | add) aeusd"'
Expected output
lender: 5000000 aeusd investor can claim: 5000000 aeusd

The fixed tier took 5 aeUSD; the remaining 20 went to the ECONOMIC holders pro rata — 5 to the investor (250 of 1000 units), 15 to the issuer — as claimable income. See Waterfalls & redemption.

Last updated