Customize Stablecoin Chaincode

You can customize the stablecoin chaincode by adding assets to the specification file.

  1. Edit the Stablecoin specification file to add your custom changes.
    Do not remove or modify the default stablecoin assets, which are required for the core stablecoin life cycle and for system validation.
  2. In Blockchain App Builder, use your custom specification file to generate chaincode.
    For more information on generating chaincode, see Create a Chaincode Project with the Blockchain App Builder CLI and Create a Chaincode Project with the Blockchain App Builder Visual Studio Code Extension in Blockchain App Builder for Oracle Blockchain Platform.
  3. Extract the stablecoin.zip file in the downloaded stablecoin chaincode package.
  4. Navigate to the chaincode directory, and then copy the following files into the chaincode that you generated by using your custom specification file and Blockchain App Builder, overwriting the previous files.
    lib/constants.ts 
    lib/token-account.ts
  5. Update the controller file (src/Stablecoin.controller.ts ) and model file (src/Stablecoin.model.ts) to add the additional controller logic and enhanced autogenerated methods that are required for validation and authorization.
    1. Compare the files from the chaincode that you generated by using Blockchain App Builder to the files from the downloaded stablecoin package.
    2. Identify differences between the files, such as new methods, updated validation logic, and authorization checks.
    3. Apply updates as needed to the generated files. You can apply updates by copying the dowloaded versions and then adding your custom changes or by manually merging the differences.
    When updating the files, ensure that all required imports are included.
  6. If you used a chaincode name other than Stablecoin, update the imports in the files.
    The following example shows how to update the imports for a chaincode named MyCoin.
    import { AccountPolicyCheck } from "../model/MyCoin.model";
    import { ApprovalPolicyCheck } from "../model/MyCoin.model";