SRC20
SRC20 token usage with shielded reads/writes
Example
import os
from eth_abi import decode
from seismic_web3 import PrivateKey, SEISMIC_TESTNET, SRC20_ABI
pk = PrivateKey.from_hex_str(os.environ["PRIVATE_KEY"])
w3 = SEISMIC_TESTNET.wallet_client(pk)
token = w3.seismic.contract("0xYourTokenAddress", SRC20_ABI)
# Transparent metadata reads
name = decode(["string"], bytes(token.tread.name()))[0]
symbol = decode(["string"], bytes(token.tread.symbol()))[0]
decimals = decode(["uint8"], bytes(token.tread.decimals()))[0]
# Shielded balance read (signed read — uses msg.sender)
balance = decode(["uint256"], bytes(token.read.balanceOf()))[0]
# Shielded transfer
tx_hash = token.write.transfer("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", 100)
w3.eth.wait_for_transaction_receipt(tx_hash)Notes
See Also
Last updated

