@@ -206,6 +206,8 @@ def set_erc20_721_indexing_status(
206206
207207
208208class IndexingStatus (models .Model ):
209+ """Records the latest processed block for each indexing pipeline."""
210+
209211 objects = IndexingStatusManager ()
210212 indexing_type = models .PositiveSmallIntegerField (
211213 primary_key = True ,
@@ -318,6 +320,8 @@ def until_block(self, block_number: int):
318320
319321
320322class EthereumBlock (models .Model ):
323+ """Ethereum block header and metadata used for indexing and reorg handling."""
324+
321325 objects = EthereumBlockManager .from_queryset (EthereumBlockQuerySet )()
322326 number = models .PositiveIntegerField (primary_key = True )
323327 gas_limit = Uint256Field ()
@@ -411,6 +415,8 @@ def account_abstraction_txs(self) -> RawQuerySet:
411415
412416
413417class EthereumTx (TimeStampedModel ):
418+ """Ethereum transaction enriched with receipt data and indexer bookkeeping."""
419+
414420 objects = EthereumTxManager ()
415421 block = models .ForeignKey (
416422 EthereumBlock ,
@@ -571,6 +577,8 @@ def fast_count(self, address: ChecksumAddress) -> int:
571577
572578
573579class TokenTransfer (models .Model ):
580+ """Abstract base model normalizing token transfer events across standards."""
581+
574582 objects = TokenTransferManager .from_queryset (TokenTransferQuerySet )()
575583 ethereum_tx = models .ForeignKey (EthereumTx , on_delete = models .CASCADE )
576584 timestamp = models .DateTimeField (db_index = True )
@@ -651,6 +659,8 @@ def token_txs(self):
651659
652660
653661class ERC20Transfer (TokenTransfer ):
662+ """ERC-20 `Transfer` event captured for a tracked Safe-related transaction."""
663+
654664 objects = TokenTransferManager .from_queryset (ERC20TransferQuerySet )()
655665 value = Uint256Field ()
656666
@@ -767,6 +777,8 @@ def token_txs(self):
767777
768778
769779class ERC721Transfer (TokenTransfer ):
780+ """ERC-721 `Transfer` event including the non-fungible token identifier."""
781+
770782 objects = ERC721TransferManager .from_queryset (ERC721TransferQuerySet )()
771783 token_id = Uint256Field ()
772784
@@ -1111,6 +1123,11 @@ def can_be_decoded(self):
11111123
11121124
11131125class InternalTx (models .Model ):
1126+ """
1127+ Represents an internal call trace produced while executing a Safe-related transaction.
1128+ For L2 networks, as traces are not available, they are "simulated" from events.
1129+ """
1130+
11141131 objects = InternalTxManager .from_queryset (InternalTxQuerySet )()
11151132 ethereum_tx = models .ForeignKey (
11161133 EthereumTx , on_delete = models .CASCADE , related_name = "internal_txs"
@@ -1326,6 +1343,8 @@ def safes_pending_to_be_processed(self) -> QuerySet[ChecksumAddress]:
13261343
13271344
13281345class InternalTxDecoded (models .Model ):
1346+ """Holds decoded Safe contract call data for an internal transaction."""
1347+
13291348 objects = InternalTxDecodedManager .from_queryset (InternalTxDecodedQuerySet )()
13301349 internal_tx = models .OneToOneField (
13311350 InternalTx ,
@@ -1586,6 +1605,8 @@ def queued(self, safe_address: str):
15861605
15871606
15881607class MultisigTransaction (TimeStampedModel ):
1608+ """Safe multisig transaction with execution status, gas parameters, and signatures."""
1609+
15891610 objects = MultisigTransactionManager .from_queryset (MultisigTransactionQuerySet )()
15901611 safe_tx_hash = Keccak256Field (primary_key = True )
15911612 safe = EthereumAddressBinaryField (db_index = True )
@@ -1707,6 +1728,8 @@ def not_indexed_metadata_contract_addresses(self):
17071728
17081729
17091730class ModuleTransaction (TimeStampedModel ):
1731+ """Safe module execution derived from an internal transaction trace."""
1732+
17101733 objects = ModuleTransactionManager ()
17111734 internal_tx = models .OneToOneField (
17121735 InternalTx , on_delete = models .CASCADE , related_name = "module_tx" , primary_key = True
@@ -1781,6 +1804,8 @@ def with_transaction(self):
17811804
17821805
17831806class MultisigConfirmation (TimeStampedModel ):
1807+ """Owner confirmation or signature associated with a multisig transaction."""
1808+
17841809 objects = MultisigConfirmationManager .from_queryset (MultisigConfirmationQuerySet )()
17851810 ethereum_tx = models .ForeignKey (
17861811 EthereumTx ,
@@ -1847,6 +1872,8 @@ def to_dict(self) -> dict:
18471872
18481873
18491874class MonitoredAddress (models .Model ):
1875+ """Abstract base storing indexing progress for addresses we continuously monitor."""
1876+
18501877 address = EthereumAddressBinaryField (primary_key = True )
18511878 initial_block_number = models .IntegerField (
18521879 default = 0
@@ -1867,6 +1894,8 @@ def __str__(self):
18671894
18681895
18691896class ProxyFactory (MonitoredAddress ):
1897+ """Safe Proxy Factory contract whose emitted events are tracked for deployments."""
1898+
18701899 class Meta :
18711900 verbose_name_plural = "Proxy factories"
18721901 ordering = ["tx_block_number" ]
@@ -1912,6 +1941,8 @@ def relevant(self):
19121941
19131942
19141943class SafeMasterCopy (MonitoredAddress ):
1944+ """Indexed Safe master copy contract including version and deployment metadata."""
1945+
19151946 objects = SafeMasterCopyManager .from_queryset (SafeMasterCopyQueryset )()
19161947 version = models .CharField (max_length = 20 , validators = [validate_version ])
19171948 deployer = models .CharField (max_length = 50 , default = "Safe" )
@@ -1955,6 +1986,8 @@ def banned(
19551986
19561987
19571988class SafeContract (models .Model ):
1989+ """Represents a deployed Safe smart contract and its creation transaction."""
1990+
19581991 objects = SafeContractManager .from_queryset (SafeContractQuerySet )()
19591992 created = models .DateTimeField (auto_now_add = True , db_index = True )
19601993 address = EthereumAddressBinaryField (primary_key = True )
@@ -2135,6 +2168,8 @@ def from_erc20_721_event(
21352168
21362169
21372170class SafeStatusBase (models .Model ):
2171+ """Shared Safe state representation produced after processing an internal transaction."""
2172+
21382173 internal_tx = models .OneToOneField (
21392174 InternalTx ,
21402175 on_delete = models .CASCADE ,
@@ -2255,6 +2290,8 @@ def addresses_for_owner(self, owner_address: str) -> QuerySet[str]:
22552290
22562291
22572292class SafeLastStatus (SafeStatusBase ):
2293+ """Latest known Safe state cached for quick access."""
2294+
22582295 objects = SafeLastStatusManager ()
22592296
22602297 class Meta :
@@ -2330,6 +2367,8 @@ def last_for_address(self, address: str) -> Optional["SafeStatus"]:
23302367
23312368
23322369class SafeStatus (SafeStatusBase ):
2370+ """Historical Safe state snapshot for each processed configuration change."""
2371+
23332372 objects = SafeStatusManager .from_queryset (SafeStatusQuerySet )()
23342373 internal_tx = models .OneToOneField (
23352374 InternalTx ,
0 commit comments