For the complete documentation index, see llms.txt. This page is also available as Markdown.

Protocol contracts

The OCC v1 contracts the SDK uses: mail, chat, user and app fee manager.

The @4thtech-sdk/ethereum package (version 0.5.13) configures four contracts for each supported network. This page names them and says what each does. Addresses are on the Deployments page.

Contract
Role

Mail

Records mails: the link to the stored envelope, its checksum, sender and receiver, opened and deleted state. Keeps each receiver's whitelist.

Chat

Records one-to-one and group conversations and their messages. For groups, holds each member's encrypted copy of the conversation key.

User

Stores each account's encryption public key, so others can encrypt to them.

AppFeeManager

Holds app registrations and the fee settings per app ID. Mail and Chat ask it what fee an app requires.

Figure: Mail, Chat and User are used by apps; Mail and Chat read fee settings from AppFeeManager and collect fees.

Mail

Main operations (from the SDK's contract interface): send a mail with an envelope URL and checksum, mark a mail opened, delete one or several mails, read mails by page, add or remove accounts from your whitelist, and read the whitelist. Events announce each new mail.

Chat

Main operations: send a one-to-one message, create a group conversation, add messages to a group conversation, delete a message, add and remove members, and read conversations and messages. In a group, each member has an encrypted copy of the conversation key.

User

Main operations: set your encryption public key (with its key type) and read any user's public key.

AppFeeManager

Holds the fee configuration that Mail and Chat read through getAppRequiredFee. See Fees and app registration.

Upgradeable and owned

The Mail, Chat and User contracts in the SDK's ABIs are upgradeable and have an owner account. The ABIs also show owner-only functions such as withdrawing owner fees.

TierManager and Lock: to be confirmed

The earlier version of this documentation listed six contracts: Mails, Chat, Users, AppFeeManager, TierManager (tiers and fee discounts) and Lock (locking ERC20 tokens for a period). SDK 0.5.x does not use TierManager or Lock. Their current status is being confirmed, so this page does not describe them as part of the supported protocol.

Last updated