file-contractSRC20_ABI

SRC20 token standard ABI constant

ABI definition for Seismic's privacy-preserving SRC20 token standard.

Overview

SRC20_ABI is a Python list containing the complete ABI for the ISRC20 interface, which defines Seismic's privacy-preserving ERC20-compatible token standard. Unlike standard ERC20, SRC20 uses shielded types (suint256) for amounts to preserve balance and transfer privacy.

The SRC20 standard maintains the familiar ERC20 API while adding privacy features:

  • Token amounts are shielded using suint256 types

  • balanceOf() takes no arguments and returns the caller's own balance

  • Transfer and approval events emit encrypted amounts

Import

from seismic_web3 import SRC20_ABI

Type

SRC20_ABI: list[dict[str, Any]]

ABI Contents

The ABI includes the following functions and events:

Functions

Function
Parameters
Returns
Description

name()

None

string

Token name (view)

symbol()

None

string

Token symbol (view)

decimals()

None

uint8

Token decimals (view)

balanceOf()

None

uint256

Caller's token balance (view)

approve(address, suint256)

spender, amount

bool

Approve spender for shielded amount

transfer(address, suint256)

to, amount

bool

Transfer shielded amount to recipient

transferFrom(address, address, suint256)

from, to, amount

bool

Transfer shielded amount from approved account

Events

Event
Parameters
Description

Transfer

from (indexed), to (indexed), encryptKeyHash (indexed), encryptedAmount

Emitted on transfer with encrypted amount

Approval

owner (indexed), spender (indexed), encryptKeyHash (indexed), encryptedAmount

Emitted on approval with encrypted amount

Full ABI

Usage Examples

Creating a Contract Instance

Reading Token Metadata

Checking Balance

Transferring Tokens

Approving Spender

Using transferFrom

Listening to Transfer Events

When to Use

Use SRC20_ABI when:

  • Interacting with SRC20-compliant privacy tokens

  • Building DeFi applications with shielded balances

  • Deploying privacy-preserving token contracts

  • Creating token swap or exchange interfaces

  • Implementing token approval flows with privacy

Key Differences from ERC20

balanceOf() Takes No Arguments

Standard ERC20:

SRC20:

In SRC20, balanceOf() always returns the caller's balance. Use signed reads (.read) to prove your identity.

Shielded Amounts

All amounts are suint256 (shielded uint256) instead of plain uint256:

Encrypted Events

Events include encryption metadata:

  • encryptKeyHash - Hash of the encryption key used

  • encryptedAmount - AES-GCM encrypted amount

To decrypt events, you need access to the viewing key registered in the Directory contract.

Privacy Features

What Gets Encrypted

  • Token amounts in all operations (transfer, approve, etc.)

  • Event amounts (encrypted before emission)

What Remains Visible

  • Token metadata (name, symbol, decimals)

  • Participant addresses (from, to, spender)

  • Transaction existence and timing

  • Function being called

Viewing Keys

Users must register viewing keys in the Directory contract to decrypt their balances and amounts:

Contract Source

This ABI matches the ISRC20 interface defined in:

See Also

Last updated