DecryptedApprovalLog

Decoded SRC20 Approval event with decrypted amount

Frozen dataclass representing a decoded SRC20 Approval event with decrypted amount.

Overview

DecryptedApprovalLog contains all data from an SRC20 Approval event, including the decrypted amount. It is returned by event watcher callbacks when an Approval event is detected and successfully decrypted.

SRC20 Approval events have the signature:

event Approval(
    address indexed owner,
    address indexed spender,
    bytes32 indexed encryptKeyHash,
    bytes encryptedAmount
)

Definition

@dataclass(frozen=True)
class DecryptedApprovalLog:
    """Decoded SRC20 Approval event with decrypted amount."""

    owner: ChecksumAddress
    spender: ChecksumAddress
    encrypt_key_hash: bytes
    encrypted_amount: bytes
    decrypted_amount: int
    transaction_hash: HexBytes
    block_number: int

Fields

Field
Type
Description

owner

ChecksumAddress

Address granting the approval (checksummed)

spender

ChecksumAddress

Address receiving the approval (checksummed)

encrypt_key_hash

bytes

32-byte keccak256 hash of the viewing key

encrypted_amount

bytes

Raw encrypted amount bytes (AES-256-GCM ciphertext)

decrypted_amount

int

Decrypted approval amount as integer

transaction_hash

HexBytes

Transaction hash containing this event

block_number

int

Block number containing this event

Properties

  • Immutable - All fields are frozen after creation

  • Type-safe - Uses proper types (ChecksumAddress, HexBytes)

  • Complete - Contains both encrypted and decrypted data

Examples

Basic Callback Usage

Access All Fields

Filter by Address

Store to Database

Async Callback

Format Amount

Track Allowances

Watch for Specific Spender

Wait for Transaction Confirmation

Combine with Transfer Events

Immutability

Check for Infinite Approval

Notes

  • All instances are immutable (frozen dataclass)

  • owner is the address granting the approval

  • spender is the address receiving the approval (can spend on behalf of owner)

  • decrypted_amount is the raw token amount (consider decimals when displaying)

  • encrypted_amount includes the AES-GCM authentication tag

  • encrypt_key_hash matches the key hash in event topics

  • Created automatically by event watchers during decryption

Common Use Cases

  • Track allowances for DeFi protocols

  • Monitor approvals to router contracts

  • Detect infinite approvals (security risk)

  • Audit approval history for compliance

  • Trigger alerts for large approvals

See Also

Last updated