Smart Contracts
Every on-chain rule in Superhero lives in a Sophia contract running on the FATE virtual machine. These pages are the contract-level reference: what each contract does, the exact signature of every entrypoint, the record and variant types you need to build arguments, the events each one emits, and how to call all of it from JavaScript.
The contract suite
| Contract | Role |
|---|---|
Tipping.aes (v3) | Post registry and delegated posting |
CommunityFactory.aes | Collections, community deployment, ProtocolDAO minting |
AffiliationBondingCurveTokenSale.aes | Buy and sell against the curve, affiliation fees |
BondingCurveExponential.aes | Price computation |
BondingCurve.aes | The curve interface the sale calls through |
DAO.aes | One community's treasury, vote creation and execution |
DAOVote.aes | One proposal and its locked stake |
ReplaceableDAO.aes | The interface a replacement DAO must implement |
CommunityManagement.aes | Moderators, write threshold, community metadata |
AffiliationTreasury.aes | Referral accounting, invite codes, payouts |
FungibleTokenFull.aes | The AEX-9 token implementation |
Registry.aes / Poll.aes | æternity governance polls |
AddressLink | Identity: provider-keyed links from an address to an X handle, AENS name or nostr key |
DAO, DAOVote, CommunityManagement, AffiliationTreasury, VoteSubjects, Set, Frac
and FungibleTokenFull have no ACI file of their own: the compiler inlines them into
CommunityFactory.aci.json. Load the factory ACI when you need any of those interfaces.
How the pieces fit together
CommunityFactory one per network, deployed once
├── create_collection(...) registers a naming namespace (555 AE, burned)
└── create_community(...) deploys four contracts in one transaction:
├── CommunityManagement moderators, mute list, write threshold
├── DAO owner + beneficiary of the sale
│ └── add_vote(...) deploys a DAOVote (555 AE)
└── AffiliationBondingCurveTokenSale
├── FungibleTokenFull the community's AEX-9 token, created in the sale's init
├── buy mints tokens, splits the 1% spread
└── sell burns tokens, pays out AEThree contracts sit outside that tree and are shared by every community:
BondingCurveExponential, which prices every trade; AffiliationTreasury, which accounts for
referral rewards across all sales; and the ProtocolDAO AEX-9 token, which the factory mints
into every buyer's account.
buy_with_affiliation is factory-only, used for the creator's initial buy. An ordinary buy
already credits the buyer's own referral chain. See
AffiliationBondingCurveTokenSale.
Sophia and FATE
Sophia is a strongly typed functional language in the ML family. A contract has exactly one
state value, replaced rather than mutated, so there is no partially updated storage for a
failed call to leave behind. Every FATE instruction is typed, and a type mismatch aborts the
call and reverts all changes. See Sophia and FATE.
Cross-cutting pages
| Page | What it gives you |
|---|---|
| Deployed Addresses | Every shared address, per network, and how to resolve per-community contracts at runtime |
| Calling Contracts | A complete runnable SDK example, dry runs, gas, events, reverts |
| Events | One cross-contract event catalogue, with topic hashes |
| Security Model | The cryptographic, economic and governance mechanisms that protect users |
Related
- Calling Contracts: start here if you want working code rather than a reference table
- Deployed Addresses: the addresses every example on these pages needs
- Bonding curve: the conceptual explanation behind
BondingCurveExponential - æternity Sophia language documentation (opens in a new tab): the language reference