StorageDepositTransferredAndHeld

Event v334 → current #8

Emitted when storage deposit is transferred and held by the contract system.

View events on chain
Useful for: developersanalytics

The Big Picture

Contracts pay for storage through deposits. This tracks who paid and how much.

Use Cases

  • Track storage costs
  • Monitor deposit flows
  • Build cost analysis tools

From Chain Metadata

Some funds have been transferred and held as storage deposit.

Triggers

Preconditions

  • Contract operation increased storage
  • Payer has sufficient balance

Effects

Postconditions

  • Deposit transferred from payer
  • Deposit held for storage

Side Effects

  • Payer's free balance decreased

Event Data

#NameTypeDescription
0
from
AccountId Account paying the storage deposit (hex -> SS58)
1
to
AccountId Contract or system receiving the deposit (hex -> SS58)
2
amount
u64 BalanceOf<T>Deposit amount transferred (RAO) (RAO -> TAO (/ 10^9))

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Subscribe to StorageDepositTransferredAndHeld events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.Contracts.StorageDepositTransferredAndHeld.get(block.hash);
  for (const evt of events) {
    console.log("StorageDepositTransferredAndHeld:", evt.payload);
  }
});

Runtime Info

Pallet Index
29
Event Index
8
First Version
v334
Current Version
v411