Stablecoin Internal Logic

The stablecoin sample implements logic for validating account policies, matching approval policies to hold transactions, and validating transaction approvals.

Account Policy Validation

Account policy validation validates KYC (Know Your Customer) and AML (Anti-Money Laundering) requirements and transfer restriction limits before tokens can be held or transferred. Account policy validation runs inside of the following methods: transferTokens, holdTokens, approveTransaction, and executeHoldTokens. The following diagram illustrates the validation logic for account policy validation.

Approval Policy Matching

Approval policy matching determines which approval policy applies to a transaction based on the hold amount and on whether approvals are required. Approval policy matching is triggered after a call to the holdTokens method. The following diagram illustrates the approval policy matching logic.

Transaction Approval Validation

Transaction approval validation confirms the approver identity, sequence order, duplicate approvals, and rechecks the account policy. Transaction approval validation runs inside of the approveTransaction method. The following diagram illustrates the transaction approval validation logic.