Docs
/
Reference

Errors and events

Every custom error and event across both contracts, with what triggers each one and what a client should do about it.

Both contracts use custom errors rather than revert strings. They are cheaper and they give a client something precise to match on.

MailRegistry errors

ErrorTriggered whenWhat the client should do
NotOwner()An owner-only method was called by someone elseHide the control entirely
NameTaken()The name already resolves to a walletOffer alternatives
NameIsReserved()The name is on the reserved listExplain it is not available for registration
InvalidName()Charset, length or hyphen placement is wrongValidate before submitting
AlreadyRegistered()This wallet already holds a nameOffer release or transfer instead
NotRegistered()The action needs an existing accountSend them to registration
InsufficientFee(uint256 required)Value sent is below the premium feeShow required
FeeAboveMax(uint256 required)The fee exceeds the caller's maxFeeThe price moved; re-quote before retrying
NoPendingTransfer()Accepting a transfer that does not existRefresh state
TransferExpired()Past TRANSFER_WINDOWAsk the sender to initiate again
BadPubkey()Zero, top-bit set, or a small-order pointRe-derive; never publish an unscreened key
InvalidRecipient()Transfer target is not validCheck the address
ZeroAddress()A zero address was suppliedValidate input
BatchTooLarge()Over MAX_RESERVE_BATCHChunk the call
NameInGrace(address prevOwner, uint64 freeAt)Inside another owner's release graceShow when it frees up
WithdrawFailed()Fee withdrawal transfer failedRetry to a different address
RefundFailed()Overpayment refund failedAvoid contract wallets that reject value

MailBox errors

ErrorTriggered whenWhat the client should do
SenderNotRegistered()The sender has no accountRegister first
RecipientNotRegistered()The target has no published keyExplain they must join before they can receive
Blocked()The recipient blocked this senderNo price clears this
WrongStamp(uint256 required)Value sent does not match the requirementRe-read requiredStamp and retry
StampAboveMax(uint256 required)Requirement exceeds the caller's maxStampThe price moved; confirm the new one
PriceOutOfRange(uint256 min, uint256 max)Price outside minStamp to MAX_STAMPClamp in the interface
BadRegistry()Registry address is not a valid registryDeployment misconfiguration
EnvelopeTooLarge()Over MAX_ENVELOPE_BYTESWarn on size before sealing
BatchTooLarge()Over MAX_BATCHChunk the call
NoSuchStamp()No escrow row for that mailIdRefresh
StampAlreadySettled()Already refunded, claimed or reclaimedRefresh; likely a double submission
NotStampRecipient()Caller is not the recipientHide the control
NotStampSender()Caller is not the senderHide the control
StampNotExpired()Settling before 30 daysShow the unlock time
StampExpired()Refunding after 30 daysBy design: time never refunds a spammer
RecipientStillReachable()Reclaim attempted while the recipient is reachableReclaim is not a general timeout
RecipientBlockedYou()Claim attempted while blocking the senderUnblock or refund instead
NothingToWithdraw()Credit balance is zeroDisable the control
WithdrawFailed()Credit withdrawal failedTry withdrawCreditsTo
InsufficientGas()Not enough gas left to attempt a payout safelyRaise the gas limit

MailRegistry events

EventEmitted when
Registered(wallet, name, pubkey, keyVersion, epoch)A name is minted
KeyRotated(wallet, oldPubkey, newPubkey, keyVersion)An encryption key is replaced
TransferInitiated(name, from, to, expiresAt)A handover starts
TransferCancelled(name, from)A pending handover is revoked
TransferAccepted(name, from, to, pubkey, epoch)A handover completes
NameReleased(wallet, name, freeAt, epoch)A name is given up; grace begins
NameReserved(name, flag)Reservation set or cleared
ReservedWhileRegistered(name, holder)Reservation hit an existing holder, who keeps it
ReserveSkipped(name, reason)A batch entry was skipped
PricesSet(price3, price4)Premium pricing changed
OwnershipTransferStarted / Cancelled / TransferredContract ownership handover
Withdrawn(to, amount)Fees withdrawn

MailBox events

EventEmitted when
Mail(from, to, mailId, convoId, inReplyTo, stampValue, envelope)A message is sent. The whole inbox is built from this one event.
StampPriceSet(wallet, price)A recipient changes their price
StampRefunded(mailId, recipient, sender, amount)Escrow returned
StampClaimed(mailId, recipient, sender, amount)Escrow taken
StampReclaimed(mailId, recipient, sender, amount)Sender recovered escrow
BatchSettled(caller, settledCount, totalAmount)A batch call finished, reporting what actually moved
PaymentCredited(to, amount)A push payment failed and was credited instead
CreditsWithdrawn(to, amount)Credits pulled
SenderAllowed(recipient, sender, until)Allowlist entry set
SenderBlocked(recipient, sender, blocked)Block set or cleared

Indexing notes

Building an inbox

Filter Mail on the to topic for received mail and the from topic for sent mail. convoId is the keccak of the sorted address pair, derivable from the two topics, so it is not indexed separately. stampValue is the value escrowed at write time, not a live balance: it may already have been settled later in the same transaction. Read stamps(mailId) for current state.

bMail is an independent, community-built project. It is not affiliated with, endorsed by, or operated by Binance or BNB Chain.