DocsSmart contracts

Docs/How it works

Smart contracts

The three contracts behind Scarf on Base Sepolia.

Addresses#

ContractAddressRole
Scarf0x0382…AE43Profiles, conversations, messages, media, payments
Forwarder0x61d6…fCf1Verifies signed requests (ERC-2771)
ScarfPaymaster0xA3bF…5F4fRelays requests and refunds the relayer

Chain ID 84532. Built with Solidity 0.8.28 and OpenZeppelin, deployed with Hardhat Ignition.

Scarf#

Main functions

FunctionWhat it does
registerUser(publicKey, username)Creates your profile.
createConversation(participants, keyHash)Creates a conversation with 2+ registered participants.
sendMessage(recipient, hash, token, amount, ipfsHash, mediaType, size, text)Sends a message, file and/or payment.
sendBatchMessages(…)Sends up to 10 messages in one call.
deleteMessage(messageId)Marks a message deleted (sender or recipient only).
updatePublicKey(newKey)Replaces your profile's public key.

Events

UserRegistered, ConversationCreated, MessageSent, BatchMessageSent, MediaUploaded, PaymentSettled, MessageDeleted.

Limits

ConstantValue
MAX_FILE_SIZE50,000,000 bytes (50 MB)
MAX_STORAGE_PER_USER1,000,000,000 bytes (1 GB)
MAX_MESSAGES_PER_USER10,000
Batch size10 recipients

Forwarder#

OpenZeppelin's MinimalForwarder. It checks the EIP-712 signature and nonce of a ForwardRequest, then calls the target with the signer's address appended, which Scarf reads as the sender.

Paymaster#

Holds ETH and exposes relay(req, signature, relayer, reimbursement): it executes the request through the Forwarder, then pays the relayer the reimbursement, up to maxReimbursementPerTx. The owner can change that cap and withdraw.