Real World Asset (RWA) Token
Real World Asset (RWA) tokens are security tokens that represent ownership or rights to real-world assets such as real estate, commodities, securities, or other regulated financial instruments. These tokens must comply with various regulatory requirements including KYC/AML verification, transfer restrictions, and compliance rules. The RWA suite provides a comprehensive framework based on the T-REX (Token for Regulated Exchanges) standard, which implements the ERC-3643 specification.
Overview
The RWA suite provides a complete implementation of regulated security tokens with built-in compliance, identity verification, and administrative controls. The suite is designed to be flexible and extensible, allowing integration with various identity registry and compliance frameworks.
The RWA token extends the standard fungible token functionality with regulatory features required for security tokens, including:
- Identity Management: Integration with identity registries for KYC/AML compliance
- Compliance Framework: Modular compliance rules and validation for transfers and minting
- Transfer Controls: Sophisticated transfer restrictions and validations
- Freezing Mechanisms: Address-level and partial token freezing capabilities
- Recovery System: Lost/old account recovery for verified investors
- Pausable Operations: Emergency pause that halts minting and transfers
- Role-Based Access Control (RBAC): Flexible privilege management for administrative functions
Architecture
The RWA suite follows a modular architecture that separates concerns and allows for flexible integration
Core Components
-
RWA Token Contract: The main token contract implementing the
RWATokentrait, which is built on the combination of theFungibleToken,FungibleTotalSupplyandPausabletraits, so the contract implements all four. -
Identity Verifier: A separate contract responsible for verifying user identities. The RWA token expects the following functions to be available:
fn verify_identity(e: &Env, account: &Address);fn recovery_target(e: &Env, old_account: &Address) -> Option<Address>;
-
Compliance Contract: A separate contract that validates transfers, minting, and burning operations. The RWA token expects the following functions to be available:
fn transferred(e: &Env, from: AccountSnapshot, to: AccountSnapshot, amount: i128, kind: TransferKind, token: Address);fn created(e: &Env, to: AccountSnapshot, amount: i128, token: Address);fn destroyed(e: &Env, from: AccountSnapshot, amount: i128, token: Address);
These hooks are called after the operation's state changes, within the same transaction. The compliance contract rejects an operation by panicking, which reverts it entirely. Each account is passed as an
AccountSnapshotholding itsbalanceandfrozenamount before the operation, so that compliance never needs to call back into the token.TransferKindtells whether the transfer is aStandardone, aDelegatedone (viatransfer_from), or a privilegedForcedorRecoveryone, so that compliance rules can exempt privileged operations while still keeping their records up to date.
This loose coupling between the RWA token and the modules allows the following:
- Share identity verifier and compliance contracts across multiple RWA tokens
- Implement custom identity verification approaches (Merkle trees, zero-knowledge proofs, claim-based, etc.)
- Create modular compliance rules that can be composed and reused
Supporting Modules
The module provides default implementations for common use cases:
- Claim Topics and Issuers: Manages trusted claim issuers and claim types (e.g., KYC=1, AML=2)
- Identity Claims: Integration with identity registries for cryptographic claim validation
- Identity Registry Storage: Registry for storing identity information and country relations
- Claim Issuer: Validates cryptographic claims with multiple signature schemes (Ed25519, Secp256k1, Secp256r1)
- Compliance: Modular compliance framework with hook-based architecture
Usage
We'll create a regulated security token for tokenized real estate shares. The token requires KYC verification, implements transfer restrictions, and provides administrative controls for compliance.
The RWA token uses the RWA contract type, which tracks the total supply, so it is selected with
Compose<(RWA, TotalSupply)> and the contract implements FungibleTotalSupply. The privileged functions of
RWAToken (minting, burning, freezing, forced transfers, recovery, and setting the compliance and identity verifier
contracts) have no default implementation: they take an operator argument, and each contract must implement them
and enforce its own access control on it. Similarly, pause and unpause from Pausable must be implemented.
Here's what a basic RWA token contract might look like (only the base token contract, not the modules):
use soroban_sdk::{
contract, contractimpl, symbol_short, Address, Env, MuxedAddress, String, Symbol, Vec,
};
use stellar_access::access_control::{self as access_control, AccessControl};
use stellar_contract_utils::pausable::{self as pausable, Pausable};
use stellar_macros::{only_admin, only_role};
use stellar_tokens::{
fungible::{
total_supply::{FungibleTotalSupply, TotalSupply},
Base, Compose, FungibleToken,
},
rwa::{RWAToken, RWA},
};
#[contract]
pub struct RealEstateToken;
#[contractimpl]
impl RealEstateToken {
pub fn __constructor(
e: &Env,
admin: Address,
manager: Address,
compliance: Address,
identity_verifier: Address,
initial_supply: i128,
) {
// Set token metadata
Base::set_metadata(
e,
18, // 18 decimals
String::from_str(e, "Real Estate Token"),
String::from_str(e, "REST"),
);
// Set compliance and identity verifier contracts
RWA::set_compliance(e, &compliance);
RWA::set_identity_verifier(e, &identity_verifier);
// Set up access control
access_control::set_admin(e, &admin);
// Create a "manager" role and grant it to the manager address
access_control::grant_role_no_auth(e, &manager, &symbol_short!("manager"), &admin);
// Mint initial supply to the admin (must be a verified identity)
<Self as FungibleToken>::ContractType::mint(e, &admin, initial_supply);
}
}
// Implement the FungibleToken trait with the RWA contract type
#[contractimpl(contracttrait)]
impl FungibleToken for RealEstateToken {
type ContractType = Compose<(RWA, TotalSupply)>;
}
#[contractimpl(contracttrait)]
impl FungibleTotalSupply for RealEstateToken {}
#[contractimpl(contracttrait)]
impl Pausable for RealEstateToken {
#[only_admin]
fn pause(e: &Env, _caller: Address) {
pausable::pause(e);
}
#[only_admin]
fn unpause(e: &Env, _caller: Address) {
pausable::unpause(e);
}
}
// Implement the RWAToken trait for regulatory features, restricting the
// privileged functions to the "manager" role
#[contractimpl(contracttrait)]
impl RWAToken for RealEstateToken {
#[only_role(operator, "manager")]
fn mint(e: &Env, to: Address, amount: i128, operator: Address) {
<Self as FungibleToken>::ContractType::mint(e, &to, amount);
}
#[only_role(operator, "manager")]
fn batch_mint(e: &Env, to_list: Vec<Address>, amounts: Vec<i128>, operator: Address) {
<Self as FungibleToken>::ContractType::batch_mint(e, &to_list, &amounts);
}
// Only minting differs between the RWA contract types (the capped one also checks
// the cap), so it goes through the contract type. Burning, forced transfers,
// freezing and recovery are the same for every RWA contract type, so they are
// called on `RWA` directly.
#[only_role(operator, "manager")]
fn burn(e: &Env, user_address: Address, amount: i128, operator: Address) {
RWA::burn(e, &user_address, amount);
}
#[only_role(operator, "manager")]
fn batch_burn(e: &Env, user_addresses: Vec<Address>, amounts: Vec<i128>, operator: Address) {
RWA::batch_burn(e, &user_addresses, &amounts);
}
#[only_role(operator, "manager")]
fn forced_transfer(e: &Env, from: Address, to: Address, amount: i128, operator: Address) {
RWA::forced_transfer(e, &from, &to, amount);
}
#[only_role(operator, "manager")]
fn batch_forced_transfer(
e: &Env,
from_list: Vec<Address>,
to_list: Vec<Address>,
amounts: Vec<i128>,
operator: Address,
) {
RWA::batch_forced_transfer(e, &from_list, &to_list, &amounts);
}
#[only_role(operator, "manager")]
fn recover_balance(
e: &Env,
old_account: Address,
new_account: Address,
operator: Address,
) -> bool {
RWA::recover_balance(e, &old_account, &new_account)
}
#[only_role(operator, "manager")]
fn set_address_frozen(e: &Env, user_address: Address, freeze: bool, operator: Address) {
RWA::set_address_frozen(e, &user_address, freeze);
}
#[only_role(operator, "manager")]
fn batch_set_address_frozen(
e: &Env,
user_addresses: Vec<Address>,
freeze_list: Vec<bool>,
operator: Address,
) {
RWA::batch_set_address_frozen(e, &user_addresses, &freeze_list);
}
#[only_role(operator, "manager")]
fn freeze_partial_tokens(e: &Env, user_address: Address, amount: i128, operator: Address) {
RWA::freeze_partial_tokens(e, &user_address, amount);
}
#[only_role(operator, "manager")]
fn batch_freeze_partial_tokens(
e: &Env,
user_addresses: Vec<Address>,
amounts: Vec<i128>,
operator: Address,
) {
RWA::batch_freeze_partial_tokens(e, &user_addresses, &amounts);
}
#[only_role(operator, "manager")]
fn unfreeze_partial_tokens(e: &Env, user_address: Address, amount: i128, operator: Address) {
RWA::unfreeze_partial_tokens(e, &user_address, amount);
}
#[only_role(operator, "manager")]
fn batch_unfreeze_partial_tokens(
e: &Env,
user_addresses: Vec<Address>,
amounts: Vec<i128>,
operator: Address,
) {
RWA::batch_unfreeze_partial_tokens(e, &user_addresses, &amounts);
}
#[only_role(operator, "manager")]
fn set_compliance(e: &Env, compliance: Address, operator: Address) {
RWA::set_compliance(e, &compliance);
}
#[only_role(operator, "manager")]
fn set_identity_verifier(e: &Env, identity_verifier: Address, operator: Address) {
RWA::set_identity_verifier(e, &identity_verifier);
}
}
// Implement AccessControl for role-based permissions
#[contractimpl(contracttrait)]
impl AccessControl for RealEstateToken {}Tokens are minted through the contract type, <Self as FungibleToken>::ContractType::mint. To cap the supply,
add Capped to the list, i.e. Compose<(RWA, Capped, TotalSupply)>, set the cap with Capped::set_cap in the
constructor and implement FungibleCapped. Minting through the contract type then enforces the cap, whereas
calling RWA::mint directly would bypass it.
Key Features
Identity Verification
Identity Verification is handled on a separate contract as a module.
All token recipients must have verified identities before receiving tokens. The RWA token integrates with an identity verifier contract that validates user identities against cryptographic claims.
Every token operation that involves receiving tokens (mint, transfer, recovery) automatically calls the identity verifier contract to ensure the recipient has a valid identity with the required claims (KYC, AML, etc.).
// Example: Minting tokens
// Internally calls: identity_verifier.verify_identity(&recipient)
// Then mints and calls: compliance.created(recipient_snapshot, amount, token),
// which reverts the mint if a compliance module rejects it
<Self as FungibleToken>::ContractType::mint(e, &recipient, amount);
// Example: Transferring tokens (`to` is a `MuxedAddress`, see Custodial Destinations below)
// Internally calls: identity_verifier.verify_identity(&from)
// Then calls: identity_verifier.verify_identity(&to)
// Then transfers and calls: compliance.transferred(from_snapshot, to_snapshot, amount, TransferKind::Standard, token),
// which reverts the transfer if a compliance module rejects it
RWA::transfer(e, &from, &to, amount);
// Example: Wallet recovery for lost/old accounts
// Internally calls: identity_verifier.verify_identity(&new_account)
// Then calls: identity_verifier.recovery_target(&old_account) to verify the new account
// is the authorized recovery target for the old account
// Transfers all tokens and preserves frozen status
RWA::recover_balance(e, &old_account, &new_account);Identity Verification Flow:
- The RWA token calls
identity_verifier.verify_identity(&address) - The identity verifier checks if the address has a registered identity
- The identity verifier validates that the identity has all required claims from trusted issuers
- If verification fails, the entire operation reverts with
IdentityVerificationFailederror
Compliance Validation
Compliance Validation is handled on a separate contract as a module.
The compliance framework allows you to implement custom transfer and minting rules through a modular hook system. Each hook is called after the token operation within the same transaction, so a hook can both validate the operation, rejecting it by panicking, and update its own state:
- Transferred: Called after a transfer
- Created: Called after a mint
- Destroyed: Called after a burn
Freezing Mechanisms
Freezing Mechanisms are handled on the RWA token contract.
RWA tokens support two types of freezing:
- Address-level freezing: Freeze an address, so that it can neither send tokens from its own balance nor
receive tokens. The freeze covers the address's own balance only: a frozen address can still act as the
spender in
transfer_from, within the allowances other accounts granted it. - Partial token freezing: Freeze a specific amount of tokens for an address
// Freeze an entire address (pass `false` to unfreeze it)
RWA::set_address_frozen(e, &user_address, true);
// Freeze a specific amount of tokens
RWA::freeze_partial_tokens(e, &user_address, amount);
// Unfreeze tokens
RWA::unfreeze_partial_tokens(e, &user_address, amount);These RWA functions, like the ones for recovery and forced transfers below, do not perform any authorization
checks. The corresponding RWAToken functions take an operator argument on which the contract must enforce access
control, as in the Usage example.
Burning bypasses freezing: when the amount exceeds the free (unfrozen) balance, RWA::burn unfreezes the difference
first. Tokens locked by a compliance module are not treated the same way, since the Destroyed hook has no notion of a
privileged burn. For example, with the initial_lockup_period module registered, a burn that reaches still-locked
tokens is rejected. Destroying a locked position takes a forced transfer to a treasury wallet, which consumes the locks,
followed by a burn from that treasury.
Recovery System
The recovery system allows authorized operators to transfer tokens from a lost/old account to a new account for the same verified investor:
Balance Recovery System is handled on the RWA token contract, whereas Identity Recovery System is handled on a separate contract as a module (may be a part of the Identity Registry contract).
// Recover tokens from old account to new account, returns whether any tokens were moved
let moved: bool = RWA::recover_balance(e, &old_account, &new_account);recover_balance moves the whole balance and carries both the address freeze and the partially frozen amount over to
the new account. Balances and freezes are stored per token, so after the identity has been recovered in the registry,
recover_balance must be called on each token separately. It is still needed on a token where the old account holds
nothing but is frozen, otherwise the freeze is not carried over to the new account.
recover_balance only checks that its destination is the account recorded as the old account's recovery target, so
that account has to stay with the same investor until every token has been recovered. The Identity Registry Storage
enforces this: while the old account still holds a balance in any linked token, remove_identity on the new account
and recover_identity from the new account to another one both fail with AccountHasBalance.
Forced Transfers
Forced Transfers are handled on the RWA token contract.
Authorized operators can force transfers for regulatory compliance, e.g. court-ordered seizures:
// Force a transfer for regulatory reasons
RWA::forced_transfer(e, &from, &to, amount);Only to must pass identity verification. from is deliberately not verified, so that tokens can still be pulled out
of accounts whose identity is no longer valid (sanctioned, revoked or compromised wallets). Forced transfers bypass the
freezing checks and unfreeze tokens of from as needed. Like burn and recover_balance, they also keep working
while the token is paused, whereas minting and transfers are halted.
Custodial (Muxed) Destinations
transfer accepts a muxed destination (MuxedAddress), which enables omnibus custody. The muxed address is narrowed to
its base address before any check runs, so identity verification, compliance and the balance update all operate on the
base address, and the muxed ID only appears in the transfer event, where it lets a custodian attribute the transfer to
one of its off-chain sub-accounts.
The muxed ID is supplied by the caller and is not verified on-chain, so a verified holder may be a custodian holding on
behalf of beneficiaries who have no on-chain identity of their own. An issuer that requires beneficial owners on the
on-chain register can refuse muxed destinations by overriding transfer:
#[contractimpl(contracttrait)]
impl FungibleToken for RealEstateToken {
type ContractType = Compose<(RWA, TotalSupply)>;
fn transfer(e: &Env, from: Address, to: MuxedAddress, amount: i128) {
if to.id().is_some() {
panic_with_error!(e, RWAError::IdentityVerificationFailed);
}
RWA::transfer(e, &from, &to, amount);
}
}Batch Operations
The operator-gated functions of RWAToken have batch_ siblings (batch_mint, batch_burn, batch_forced_transfer,
batch_set_address_frozen, batch_freeze_partial_tokens and batch_unfreeze_partial_tokens) that apply the same
operation to a list of accounts in a single invocation, mirroring the batch functions of ERC-3643. In addition,
RWAToken provides a default batch_transfer(from, recipients, amounts) entry point, which the sender authorizes once
and where the sender's identity is verified once for the whole batch.
A batch is atomic: an item that fails reverts the whole call, and every item emits the same event as its single-account
counterpart. The batch size is bounded by the per-transaction network limits
rather than by the library. Measured against a stack with two compliance modules and one required claim topic, the
limit is reached at roughly 35 accounts for batch_mint and batch_transfer, and 99 for the freezing functions. Every
additional compliance module or required claim topic lowers these numbers, so measure against your own configuration.
Modules
The RWA package includes several supporting modules that work together to provide comprehensive regulatory compliance:
- Compliance
This is a mandatory module, since RWA token contract expects the compliance checks and hooks to be available.
Provides a modular framework for implementing custom compliance rules through a hook-based architecture where multiple compliance modules can be registered to the Compliance Contract.
Compliance Validation Flow:
The compliance contract is designed to be shared across multiple RWA tokens, with each hook function accepting a
token parameter to identify the calling token.
- Compliance Modules
Individual compliance modules implement the ComplianceModule trait, which defines hooks that the compliance contract forwards to:
pub trait ComplianceModule {
fn on_transfer(
e: &Env,
from: AccountSnapshot,
to: AccountSnapshot,
amount: i128,
kind: TransferKind,
token: Address,
);
fn on_created(e: &Env, to: AccountSnapshot, amount: i128, token: Address);
fn on_destroyed(e: &Env, from: AccountSnapshot, amount: i128, token: Address);
fn name(e: &Env) -> String;
fn get_compliance_address(e: &Env, token: Address) -> Address;
fn set_compliance_address(e: &Env, token: Address, compliance: Address, operator: Address);
}Modules can be registered for specific hooks via the compliance contract. The ComplianceHook enum defines which hooks a module handles: Transferred, Created, Destroyed.
A module rejects an operation by panicking from the hook. Policy modules can use the TransferKind passed to
on_transfer to exempt privileged Forced and Recovery transfers, while bookkeeping modules update their state for
every kind of transfer.
Hook arguments, including token, can be forged, since any contract can call a module's hooks directly. Hooks that modify state should authenticate their caller, the compliance contract bound to token, e.g. with Self::get_compliance_address(e, token).require_auth(). Hooks that only validate and modify no state need no authentication.
The following ready-made modules are ports of the T-REX modular compliance modules. Each one has an example contract
under examples/rwa and must be
registered on the hooks listed:
| Module | Rule | Hooks |
|---|---|---|
country_allow | Only recipients whose identity has at least one country code on the allowlist can receive tokens | Transferred, Created |
country_restrict | Recipients whose identity has a country code on the restriction list cannot receive tokens | Transferred, Created |
transfer_allow | A transfer passes only when the sender or the recipient is on the address allowlist; mints and burns are not restricted | Transferred |
time_transfers_limits | Caps the outgoing volume of each sender identity within configurable time windows | Transferred |
max_balance | Caps the aggregate balance of each identity across all its wallets | Transferred, Created, Destroyed |
supply_limit | Caps the total supply through an internal counter | Created, Destroyed |
initial_lockup_period | Locks minted tokens for a configurable period; transfers and burns can only spend unlocked tokens | Transferred, Created, Destroyed |
max_balance and supply_limit track balances and supply on their own. When one of them is registered on a token that
already has holders or circulating supply, the operator must seed its state during the preset phase
(preset_id_balance or batch_preset_id_balances for max_balance, preset_supply_count for supply_limit) and then
close the phase with mark_preset_completed.
- Identity Verifier
This is a mandatory module, since RWA token contract expects verify_identity(e: &Env, account: &Address)
function to be available.
The Identity Verifier Module provides the interface for verifying user identities. It can also support possible custom implementation approaches:
- Claim-based: Cryptographic claims from trusted issuers (provided default implementation)
- Merkle Tree: Efficient verification using merkle proofs
- Zero-Knowledge: Privacy-preserving verification with custom ZK circuits
- Other custom approaches: Any implementation that satisfies the
verify_identityinterface
The diagram below illustrates how identity verification works in the claim-based identity stack:
- Claim Topics and Issuers
This module is an implementation detail. It is provided as the suggested implementation for the Claim-based approach.
Acts as the trust registry that defines which claim topics are required and which issuers are authorized to provide those claims.
Key features/responsibilities of the Claim Topics and Issuers Module are:
- Claim Topic Registry: Defines which types of claims are required for token participation (e.g., KYC=1, AML=2, Accredited Investor=3)
- Trusted Issuer Registry: Maintains a list of authorized claim issuers (e.g., KYC providers, compliance firms)
- Authorization Mapping: Maps each trusted issuer to the specific claim topics they are authorized to issue
- Example: Issuer A can issue KYC and AML claims, but not Accreditation claims
- Example: Issuer B can only issue Accreditation claims
- Multi-Token Support: Can be shared across multiple RWA tokens, reducing deployment costs
Configuration Example:
// Add claim topics
add_claim_topic(e, 1, operator); // KYC
add_claim_topic(e, 2, operator); // AML
add_claim_topic(e, 3, operator); // Accredited Investor
// Add trusted issuer with authorized topics
add_trusted_issuer(e, issuer_a, vec![1, 2], operator); // Can issue KYC and AML
add_trusted_issuer(e, issuer_b, vec![3], operator); // Can only issue AccreditationUnderstanding Claims
What is a Claim?
A claim is a cryptographically signed attestation made by a trusted authority (claim issuer) about a specific aspect of an identity. Think of it as a digital certificate that proves something about an investor.
Claim Structure:
Each claim contains:
- Topic: A numeric identifier for what the claim attests to (e.g., KYC=1, AML=2, Accredited Investor=3)
- Issuer: The address of the trusted authority that issued the claim
- Signature: Cryptographic proof that the issuer created this claim
- Data: The actual claim information (can include expiration dates, metadata)
- Scheme: The signature algorithm used (Ed25519, Secp256k1, Secp256r1)
- Uri: Optional URI for additional information
How Claims Work:
- Off-chain Verification: KYC Provider verifies investor's identity documents off-chain
- Off-chain Signing: KYC Provider signs the claim with their private key off-chain
- On-chain Storage: Signed claim is stored in the investor's Identity Contract
- Token Validation: When investor attempts to receive tokens, the RWA Token:
- Retrieves claims from the Identity Contract
- Calls the Claim Issuer Contract to validate signatures
- Checks for revocations (stored in Claim Issuer Contract)
- Verifies the issuer is trusted (via Claim Topics and Issuers registry)
Note: The KYC Provider and Claim Issuer are the same entity. Signing happens off-chain; only the signed claim and revocation data are stored on-chain.
- Identity Registry Storage
This module is an implementation detail. It is provided as the suggested implementation for the Claim-based approach.
Stores identity information for verified investors, including:
- Mapping of wallet addresses to onchain identity contracts
- Country information for regulatory compliance
- Support for both individual and organizational identities
- Recovery account mappings for lost wallet scenarios
remove_identity is rejected while the wallet still holds a balance in any linked token, and a wallet replaced through
recover_identity is permanently tombstoned and can never be registered again. A wallet that got its identity through
recover_identity can neither be removed nor recovered again while the old wallet still holds a balance in any linked
token, so that recover_balance can still move those tokens to it (see Recovery System).
There is no in-place identity swap: replacing a wallet's identity contract takes emptying the wallet first, through
regular or forced transfers, then remove_identity followed by add_identity with the new identity.
- Identity Claims
This module is an implementation detail. It is provided as the suggested implementation for the Claim-based approach.
Manages on-chain identity claims with cryptographic signatures.
This module can be used to extend or be embedded in identity systems.
This contract is under the control of the investors themselves, who are responsible for storing their claims and corresponding signatures. This gives investors ownership of their identity data.
Claims are issued by trusted authorities and contain:
- Claim topic (e.g., KYC, AML)
- Claim data (encrypted or hashed information)
- Cryptographic signature
- Issuer information
- Claim Issuer
This module is an implementation detail. It is provided as the suggested implementation for the Claim-based approach.
Validates cryptographic claims and provides comprehensive claim lifecycle management. The module includes:
Signature Verification:
- Ed25519 (Stellar native)
- Secp256k1 (Ethereum compatible)
- Secp256r1 (Enterprise PKI compatible)
Key Management:
- Topic-specific key authorization with registry tracking
- Each public key is tied to a signature scheme
- A signing key (public key + scheme) can be authorized to sign claims for specific topic and registry combinations
- The same signing key can be authorized across multiple topics and registries independently
Claim Invalidation Mechanisms:
- Passive Expiration: Helper functions to encode/decode expiration metadata (
created_atandvalid_untiltimestamps) within claim data, allowing claims to automatically expire without on-chain action - Per-claim Revocation: Fine-grained revocation of individual claims for precise control
- Signature Invalidation: Efficient bulk invalidation via nonce increment for revoking all claims signed by a specific key
Extensions
The following optional extensions are provided:
- Document Manager
This module is not mandatory.
The DocumentManager trait extends the RWAToken trait to provide document management capabilities following the
ERC-1643 standard. This extension allows contracts to:
- Attach documents with URI, hash, and timestamp
- Update existing document metadata
- Remove documents from the contract
- Retrieve individual or all documents
This is useful for attaching legal documents, prospectuses, or other regulatory disclosures to the token contract.
Utility Modules
- Token Binder
The TokenBinder trait provides a standardized interface for linking tokens to periphery contracts such as identity
registries and compliance contracts. This allows a single periphery contract to serve multiple RWA tokens.
Features:
- Bind/unbind tokens to periphery services
- Query all linked tokens
- All bound tokens are kept in a single storage entry, capped at 75 tokens per periphery contract
- Swap-remove pattern for compact storage (the list order is not stable across unbinds)
Architecture Overview
Now that we've covered each module individually, let's see how they work together. We'll walk through a transfer() operation to illustrate how the components interact:
Security Considerations
When implementing RWA tokens, consider the following security aspects:
- Authorization: All administrative functions expect RBAC checks to be enforced on the
operatorparameter - Identity Verification: Always verify identities before allowing token operations
- Compliance Validation: Ensure compliance rules are properly configured before enabling transfers
- Freezing: Use freezing mechanisms carefully as they lock user funds
- Recovery: There are two distinct recovery flows, both requiring strict authorization:
- Identity Recovery: Managed by the Identity Stack (Identity Registry Storage in Claim-Based approach), transfers the identity contract reference and profile (including country data) from old wallet to new wallet, and creates a recovery mapping
- Balance Recovery: Managed by the RWA Token, transfers tokens from old to new account after verifying the identity recovery mapping exists (via
recovery_target())
- Pausability: The pause mechanism should only be accessible to authorized administrators
- Contract Upgrades: Consider following a secure upgrade strategy for your contracts. See: Contract Upgrades