Indexed

Solidity

परिभाषा

Indexed keyword event parameters को mark करने के लिए use होता है ताकि वे searchable बन सकें। Maximum 3 indexed parameters allowed हैं per event। Indexed parameters को topics के रूप में store किया जाता है, जिससे off-chain applications efficiently filter कर सकते हैं।

English version

The indexed keyword is used to mark event parameters so they become searchable. A maximum of 3 indexed parameters are allowed per event. Indexed parameters are stored as topics, allowing off-chain applications to filter efficiently.

Code Example

// Event avec 3 paramètres indexed
event Transfer(
    address indexed from,
    address indexed to,
    uint256 indexed tokenId
);

// Filtrer les événements (JavaScript)
const filter = contract.filters.Transfer(
    senderAddress,  // from
    null,          // to (tous)
    null           // tokenId (tous)
);
const events = await contract.queryFilter(filter);

संबंधित शब्द

Solingo पर इस concept को practice करें

Indexed को interactive exercises और integrated IDE के साथ master करें।

मुफ्त में शुरू करें