Deploy and Test Wrapper APIs for Stablecoin

Deploying the Wrapper API Package

Before you can deploy the wrapper API package, you must update the required configuration variables. Some configuration variables have default values, but you must manually update any variable that contains a placeholder as its default value. Configuration variables are stored in the terraform.tfvars file in the wrapper API archive. For more information about deploying wrapper APIs and about configuration variables, see Wrapper APIs in Blockchain App Builder for Oracle Blockchain Platform. The following table lists the configuration variables and their defaults values for the stablecoin wrapper API package.

Variable name Default value Description
compartment_ocid <compartment_ocid> The OCID of the compartment in Oracle Cloud Infrastructure (OCI).
compartment_name <compartment_name> The name of the OCI compartment.
identity_domain <identity_domain> The identity domain to use.
blockchain_channel <blockchain_channel> The name of the Oracle Blockchain Platform channel where the chaincode is deployed.
blockchain_url <blockchain_url> The Oracle Blockchain Platform URL associated with the chaincode deployment.
blockchain_chaincode Stablecoin The name of the chaincode to generate wrapper APIs for.
blockchain_sync true The sync value to include in the payload for API calls.
blockchain_timeout 6000 The timeout value to include in the payload for API calls.
vcn_display_name Stablecoin The display name of the OCI virtual cloud network.
application_display_name Stablecoin The display name of the OCI application.
gateway_display_name Stablecoin The display name of API Gateway.
deployment_display_name Stablecoin The display name of the deployment in API Gateway.
deployment_path_prefix /Stablecoin The deployment path prefix in API Gateway, which specifies the path where routes are deployed. The deployment_path_prefix variable must begin with a slash (/).
ocir_repo_name Stablecoin The OCI Registry repository name. The ocir_repo_name variable must be all lowercase letters.
policy_name Stablecoin The name of the policy that enables controlled management and access to APIs through defined permissions for groups and compartments in the organization

Stablecoin Sample Process Flow

A typical process flow using the stablecoin wrapper APIs follows these basic steps.
  1. The token administrator uses the initializeStablecoinToken method to initialize a stablecoin with a fixed currencyName value (for example, USD) and a conversionRate value.
  2. The token administrator uses the createAccountand associateTokenToAccount methods to create token accounts for all users (multi-level approvers, minters, notaries, senders, and receivers).
  3. The token administrator uses the createStablecoinAccountPolicyCheck method to create account policies. Account policies are mandatory for all accounts that transfer or hold stablecoins. Each account policy includes three parameters: KYC, AML, and restrictionFlag.
    KYC (Know Your Customer)
    The transfer is allowed only when KYC values are true for both the sender and receiver accounts.
    AML (Anti-Money Laundering)
    The transfer is allowed only when AML values are true for both the sender and receiver accounts.
    restrictionFlag
    If the restriction flag is set to true for either the sender or receiver account, the transfer is allowed only in the lowest approval-policy bucket range, making an approval policy mandatory.
  4. The token administrator uses the createApprovalPolicyCheck to create an approval policy. Approval policies define transaction thresholds, required numbers of approvals, and approver details, and set the sequence for multi-level approvals. An approval policy is mandatory for a hold operation. Without an approval policy, users cannot hold or transfer tokens when restrictions apply.
  5. The token administrator uses the addRole method to assign the minter, burner, and notary roles to the appropriate accounts.
  6. The minter uses the requestMint method to submit a request to mint stablecoins.
  7. The notary uses the approveMint method to approve the minting request.
  8. The sender uses the holdTokens method to initiate a transfer. The system runs an account policy check for the sender and receiver. If KYC or AML compliance is not satisfied for either account, the transfer is not allowed. If the restriction flag is set to true for either account, only the amount in the lowest approval-policy threshold range can be placed on hold. The transfer amount is then matched against the approval policy thresholds, and the required approvers and their approval sequences are derived from the approval policy.
  9. Multi-level approvers use the approveTransaction method to review and authorize the transfer in the exact sequence defined in the approval policy. If the approval policy specifies zero approvers, the notary can use the executeHoldTokens method directly to complete the transaction. The system revalidates KYC and AML compliance and the restriction flag during every call to executeHoldTokens and approveTransaction. If any check fails. the transaction is blocked.
  10. After all approvals complete successfully, the assigned notary uses the executeHoldTokens method to complete the transfer to the receiver's account.
  11. The burner uses the requestBurn method to submit a request to burn stablecoins.
  12. The notary uses the approveBurn method to approve the burn request.
  13. Token administrators and auditors use the getStablecointAccountTransactionHistory and getStablecoinAccountTransactionHistoryWithFilters to track all token events, including minting, holding, multi-level approval flows, transfers, and burning.

Postman Collection

The Postman collection in the stablecoin wrapper API package includes additional attributes and methods that support the stablecoin chaincode. The following table shows the Postman collection variables that are specific to the stablecoin package.
Variable Description Default value
bc-instance-client-id The client ID of Oracle Blockchain Platform cloud service. bc-instance-client-id
bc-instance-client-secret The client secret of Oracle Blockchain Platform cloud service. bc-instance-client-secret
int-app-client-id The client ID of the Oracle Identity Cloud Service (IDCS) confidential application, which is used to create an IDCS user in the CreateIDCS user API. int-app-client-id
int-app-client-secret The client secret of the IDCS confidential application, which is used to create an IDCS user in the CreateIDCS user API. int-app-client-secret

For more information, see Wrapper API Package Components in Blockchain App Builder for Oracle Blockchain Platform.