Docs Técnicas
ERC-20 Interoperability
TREA supports an ERC-20-style base token through the BasicToken fixture.
TREA supports an ERC-20-style base token through the BasicToken fixture.
The native interface is:
name() -> String
symbol() -> String
decimals() -> u8
totalSupply() -> u128
balanceOf(owner: Address) -> u128
allowance(owner: Address, spender: Address) -> u128
transfer(to: Address, amount: u128) -> bool
approve(spender: Address, amount: u128) -> bool
transferFrom(from: Address, to: Address, amount: u128) -> boolTREA is stricter than permissive ERC-20 contracts: zero-value accounting operations are rejected with invalid_amount. This keeps the native ledger free of zero-value audit noise.
Ethereum ABI
atlas-trea can export Ethereum JSON ABI items:
let module = atlas_trea::parse_contract(source)?;
let abi = atlas_trea::ethereum_abi_for_module(&module)?;
let erc20 = atlas_trea::ethereum_erc20_abi();Ethereum libraries can consume the serialized ABI. The AtlasDB node exposes an Ethereum Adapter that translates standard calldata into TREA @view executions — no custom client needed for read-only queries. Write calls (@tx) still require a signed ContractCall via POST /api/transaction because AtlasDB uses Ed25519 signatures, not Ethereum ECDSA.
ethereum_abi_for_module(&module) is the exact TREA ABI view, so BasicToken amounts appear as uint128. ethereum_erc20_abi() is the compatibility view for Ethereum tooling and uses standard ERC-20 uint256 amounts; the adapter rejects values outside the native TREA accounting range with an overflow error.
See Ethereum Adapter for endpoint docs and ethers.js / viem integration examples.
Import And Bridge Checklist
- Import metadata and external contract identity.
- Import balances from a proof or migration manifest.
- Validate imported balances against total supply.
- Import allowances only when preserving approvals is required.
- Record a migration audit receipt.
- Map external addresses to AtlasDB addresses.
- Expose
TransferandApprovalevents through an indexer-friendly view.