Every revert below is a standardized
Errorcode, not a message string. Seedocs/error-codes.mdfor the full code table and SDK/dashboard mapping guidance. Seedocs/events.mdfor the full event topic/payload schema and compatibility guarantees.
initialize(env, admin): Sets the initial admin and grants them the Admin role. Reverts withAlreadyInitializedif already initialized.
set_role(env, admin, target, role): Assigns a role totarget. Requires Admin role (Unauthorized). Cannot assign the Admin role — usetransfer_admininstead (CannotAssignAdminRole). EmitsRoleAssignedEvent.remove_role(env, admin, target): Revokes the role fromtarget. Requires Admin role (Unauthorized). Reverts withNoRoleToRevokeif target has no role. EmitsRoleRevokedEvent.get_role_of(env, address): Returns the role assigned toaddress, orRole::None.transfer_admin(env, admin, candidate): Initiates a 2-step admin transfer. Requires Admin role (Unauthorized). EmitsAdminTransferInitiatedEvent.accept_admin(env, candidate): Completes a 2-step admin transfer. Reverts withNoPendingAdminTransferif none is in flight, orNotPendingCandidateif the caller isn't the recorded candidate. EmitsAdminTransferredEvent.renounce_admin(env, admin): The admin renounces their own role. Requires Admin role (Unauthorized). Irreversible. EmitsAdminTransferredEvent.
Any call above made before initialize reverts with NotInitialized.
pause(env, caller): Pauses the contract. Requires Admin or EmergencyOfficer role (Unauthorized). Reverts withAlreadyPausedif already paused. EmitsContractPausedEvent.unpause(env, caller): Unpauses the contract. Requires Admin role only (Unauthorized). Reverts withNotPausedif not paused. EmitsContractUnpausedEvent.is_paused(env): Returns whether the contract is currently paused. Always available.- All state-changing calls listed on this page revert with
ContractPausedwhile the contract is paused.
Investor compliance is a five-state lifecycle — Unknown, Pending,
Approved, Revoked, Blocked — with an enforced transition matrix. See
docs/compliance-lifecycle.md for the full state
table, matrix, and authorization rules.
set_compliance_status(env, caller, user, new_status): Movesusertonew_status, validated against the transition matrix. Requires ComplianceOfficer, EmergencyOfficer, or Admin — except when the address is currentlyBlocked, where only the supreme admin may act (Unauthorized). Reverts withComplianceStatusUnchangedfor a no-op orInvalidComplianceTransitionfor an illegal transition. Blocked when paused (ContractPaused). EmitsComplianceStatusChangedEvent.whitelist_user(env, admin, user): Legacy alias for a transition toApproved. Requires ComplianceOfficer role (or Admin) (Unauthorized). Blocked when paused (ContractPaused). Reverts withInvalidComplianceTransitionifuserisBlocked. Idempotent when alreadyApproved. EmitsComplianceStatusChangedEvent(on a real transition) and alwaysUserWhitelistedEvent.revoke_whitelist(env, admin, user): Legacy alias for a transition toRevoked. Requires ComplianceOfficer role (or Admin) (Unauthorized). Blocked when paused (ContractPaused). A tolerated no-op forUnknownandBlockedaddresses. EmitsComplianceStatusChangedEvent(on a real transition) and alwaysWhitelistRevokedEvent.
Pure reads; never mutate state, require no authorization, and remain available before initialize and while paused.
get_compliance_status(env, user): Returns the address'sComplianceStatus(Unknownwhen no record exists).is_compliance_transition_allowed(env, from, to): Returns whetherfrom -> tois permitted by the matrix.get_allowed_transitions(env, from): Returns every state reachable fromfromin one transition.get_allowed_transitions_for(env, user): The same, foruser's current state.
-
mint_asset(env, admin, to, amount): Mintsamounttoto. Requires AssetManager role (or Admin) (Unauthorized). Reverts withInvalidAmountifamount <= 0, orAssetNotActiveif the asset lifecycle status is notActive. The receiver must beApprovedunder the compliance lifecycle — otherwise reverts withReceiverNotWhitelisted(Unknown/Revoked),ReceiverCompliancePending(Pending), orReceiverBlocked(Blocked). Blocked when paused (ContractPaused). EmitsAssetMintedEvent(includes the runningtotal_supply). -
transfer(env, from, to, amount): Movesamountbetween addresses. Requiresfromauth. Reverts withInvalidAmountifamount <= 0;AssetNotActiveif the asset is notActive;InsufficientBalanceiffromcannot coveramount. Both parties must beApproved— otherwise reverts withSenderNotWhitelisted/SenderCompliancePending/SenderBlockedor the corresponding receiver code. The sender is checked before the receiver. Blocked when paused (ContractPaused). EmitsTransferEventon success only — a compliance-blocked transfer reverts and emits nothing; seedocs/events.md. -
mint_asset(env, admin, to, amount): Mintsamounttoto. Requires AssetManager role (or Admin) (Unauthorized). Reverts withInvalidAmountifamount <= 0;SupplyCapExceeded(5002) if minting would exceed the active global supply cap;ReceiverNotWhitelistediftois not whitelisted. Blocked when paused (ContractPaused). EmitsAssetMintedEvent(includes the runningtotal_supply). -
transfer(env, from, to, amount): Movesamountbetween addresses. Requiresfromauth. Reverts withInvalidAmountifamount <= 0;SenderNotWhitelistedorReceiverNotWhitelistedif either party is not whitelisted;InsufficientBalance(5001) iffromcannot coveramount;HoldingCapExceeded(5003) if the receiver's balance would exceed the active holding cap. Blocked when paused (ContractPaused). EmitsTransferEventon success only — a compliance-blocked transfer reverts and emits nothing; seedocs/events.md. -
distribute_yield(env, admin, amount): Triggers a dividend yield event for off-chain indexing. Requires AssetManager role (or Admin) (Unauthorized). Reverts withInvalidAmountifamount <= 0. Blocked when paused (ContractPaused). EmitsYieldDistributedEvent.
get_supply_cap(env): Returns the active global supply cap (0= unbounded).get_pending_supply_cap(env): Returns the pending proposed cap (Noneif none).propose_supply_cap(env, admin, proposed_cap): Initiates a 2-step cap amendment (supply_cap_proposedevent). Only admin; blocked when paused. Rejects negative or no-op proposals.accept_supply_cap(env, admin): Activates the pending cap (supply_cap_amendedevent). Only admin; blocked when paused.cancel_supply_cap_proposal(env, admin): Discards a pending proposal. Only admin; blocked when paused.- Enforcement (
enforce_supply_cap):mint_assetcalls this before increasing total supply. Reverts withSupplyCapExceeded(5002) whentotal_supply + amount > cap. A cap of0means no cap enforced.
get_holding_cap(env): Returns the active per-investor holding cap (0= unrestricted).get_pending_holding_cap(env): Returns the pending proposed cap (Noneif none).propose_holding_cap(env, admin, proposed_cap): Initiates a 2-step cap amendment (holding_cap_proposedevent). Only admin; blocked when paused. Rejects negative or no-op proposals.accept_holding_cap(env, admin): Activates the pending cap (holding_cap_amendedevent). Only admin; blocked when paused.cancel_holding_cap_proposal(env, admin): Discards a pending proposal. Only admin; blocked when paused.- Enforcement (
enforce_holding_cap):mint_assetandtransfercall this before crediting the receiver. Reverts withHoldingCapExceeded(5003) whenbalance + incoming > cap. A cap of0means no restriction.
get_protocol_config(env): Returns the active globalProtocolConfig.get_pending_protocol_config(env): Returns the pending proposedProtocolConfig(Noneif none).propose_config(env, admin, proposed_config): Initiates a 2-step configuration amendment (config_proposedevent). Only admin; blocked when paused. Rejects malformed configurations (e.g., negative limits).accept_config(env, admin): Activates the pending configuration (config_amendedevent). Only admin; blocked when paused.cancel_config_proposal(env, admin): Discards a pending proposal. Only admin; blocked when paused.
These functions are always available, even when the contract is paused:
get_balance_of(env, address): Returns the token balance for an address (defaults to 0).get_total_supply(env): Returns the global total supply (defaults to 0).is_whitelisted(env, user): Returns whether an address is compliance-approved. Derived from the lifecycle —trueonly forComplianceStatus::Approved. Preferget_compliance_statusfor the full state.
Pure reads that compose the checks above into single-call answers for SDK and
dashboard consumers. Never mutate state; always available, even when paused.
See docs/investor-eligibility.md for field
semantics and SDK usage guidance.
get_investor_eligibility(env, investor): Returns anInvestorEligibilitystruct with the investor'scompliance_statusand derivedwhitelistedflag, the contract's pause state, current balance, active holding cap, remaining holding-cap capacity, and derivedcan_send/can_receiveflags.check_transfer_eligibility(env, from, to, amount): Returnstrueif a transfer ofamountfromfromtotowould currently pass every checktransfer()performs (pause, asset lifecycle status, compliance lifecycle status on both sides, holding cap, sender balance).
Pure reads that advertise which modules are enabled and which protocol
behaviours are supported, for SDK/dashboard feature gating. Never mutate
state, require no authorization, and — unlike every call above — remain
available before initialize as well as while paused. See
docs/capabilities.md for the full field reference, the
key registry, and versioning rules.
get_capabilities(env): Returns aContractCapabilitiesstruct describing compliance, minting, transfer, pause, metadata, and event support, pluscapability_version/contract_version. Each behaviour is aCapabilityStatus—Supported,Planned, orUnsupported— alongside runtime switches (paused,operations_enabled,supply_cap_enforced,holding_cap_enforced,metadata_configured,initialized).supports_capability(env, capability): Returns theCapabilityStatusfor a single capability key. Unknown keys returnUnsupportedinstead of reverting, so newer clients fail safe against older deployments.get_capability_keys(env): Returns every capability key understood by this contract version.check_interface_compatibility(env, client_schema_version, required_capabilities): Returns anInterfaceCompatibilityReport— whether every key inrequired_capabilitiesresolves toSupported, plus howclient_schema_versionrelates to this deployment's schema version. Seedocs/interface-compatibility.md.
A capability indicates the protocol implements a behaviour — not that the caller is authorized to perform it, nor that it will succeed against current state. Authorization remains governed by
docs/admin-roles.md.
get_investor_eligibility(env, investor): Returns anInvestorEligibilitystruct with the investor's whitelist status, the contract's pause state, current balance, active holding cap, remaining holding-cap capacity, and derivedcan_send/can_receiveflags.check_transfer_eligibility(env, from, to, amount): Returnstrueif a transfer ofamountfromfromtotowould currently pass every checktransfer()performs (pause, whitelist on both sides, holding cap, sender balance).