Fungible Token Framework Chaincode Package
The fungible token framework uses the extended Token Taxonomy Framework standard that is supported by Blockchain App Builder.
The deposit token sample illustrates the use of the fungible token generic framework, which is based on the extended Token Taxonomy Framework standard supported by Blockchain App Builder. The sample represents a system where deposit tokens represent fiat currency held at financial institutions and are issued and managed by regulated financial institutions. The sample specification file generates methods for initializing a deposit token, managing accounts, assigning roles, and performing operations such as minting, transferring, and burning tokens. It also provides notary accounts for approving minting and transfers, enforces compliance with account-level daily limits, and enables auditing procedures.
DepositToken.zip
, an archive file that contains the packaged chaincode for deployment.DepositToken.yaml
, a specification file that you can use with Blockchain App Builder to scaffold theDepositToken
chaincode.DepositToken_postman_collection.json
, a Postman collection that enables you to test the APIs in the chaincode.README.md
, a step-by-step guide for working with the chaincode.
To get the fungible token framework, in the Oracle Blockchain Platform Digital Assets console click the Digital Assets tab and then select Fungible Token Framework.
Specification File
The specification file that is used to generate the deposit token chaincode includes the events
attribute. The chaincode events function supports event callbacks in generated chaincodes to enable real-time notifications and trigger workflows. For more information about specification files and the parameters used in specification files, see Input Specification File for Fungible Tokens in Using Oracle Blockchain
Platform.
behavior: # Token behaviors
- divisible:
decimal: 2
- mintable:
mint_approval_required: true
- transferable
- burnable
- holdable
- roles:
minter_role_name: minter
notary_role_name: notary
mint_approver_role_name: notary
#
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
#
assets:
# This specification file is an example how to build any fungible token application.
# For a fungible token application, deposit token system has been used as an example.
# Deposit token is a digital representation of deposits held at commercial banks, enabling transactions on blockchain networks while maintaining the value and stability of traditional bank deposits.
- name: Deposit # Asset name
type: token # Asset type
standard: ttf+ # Token standard
events: true # Supports event code generation for non-GET methods
anatomy:
type: fungible # Token type
unit: fractional # Token unit
behavior: # Token behaviors
- divisible:
decimal: 2
- mintable:
mint_approval_required: true
- transferable
- holdable
- burnable
- roles:
minter_role_name: minter
notary_role_name: notary
mint_approver_role_name: notary
properties:
- name: Token_Name # Custom attribute to represent the deposit token name.
type: string
- name: Token_to_Currency_Ratio # Custom attribute to specify the token to currency ratio. This attribute is helpful for exchanging the tokens with fiat currency.
type: number
customMethods:
Endorser Details in Chaincode Methods
Oracle Blockchain
Platform Digital Assets Edition adds an endorsement parameter to the request payload for
all setter methods. The value of the parameter is either endorsers
or sameOrgEndorser
. If the sameOrgEndorser
parameter is true, transaction endorsements must be from the same organization as
the requester. The endorsers
parameter specifies a list of peers
that must endorse the transaction. For more information, see Endorsement Support in Postman Collections. The following table shows the endorser type for each method.
Method | Endorser Type |
---|---|
activateAccount |
endorsers |
addTokenAdmin |
sameOrgEndorser |
addTokenAuditor |
sameOrgEndorser |
addOrgAdmin |
sameOrgEndorser |
addOrgAuditor |
sameOrgEndorser |
addRole |
endorsers |
approveMint |
sameOrgEndorser |
executeHoldTokens |
endorsers |
associateTokenToAccount |
endorsers |
createAccount |
endorsers |
getAccount |
endorsers |
getAccountBalance |
endorsers |
getAccountsByUser |
endorsers |
getAccountTransactionHistory |
endorsers |
getAccountTransactionHistoryWithFiltersFromRichHistDB |
endorsers |
getNetTokens |
endorsers |
getOnHoldIds |
endorsers |
getTotalMintedTokens |
endorsers |
getUserByAccountId |
endorsers |
getUsersByRole |
endorsers |
holdTokens |
endorsers |
init |
endorsers |
initializeDepositToken |
sameOrgEndorser |
issueTokens |
sameOrgEndorser |
rejectMint |
sameOrgEndorser |
releaseHoldTokens |
endorsers |
removeTokenAdmin |
sameOrgEndorser |
removeTokenAuditor |
sameOrgEndorser |
removeOrgAdmin |
sameOrgEndorser |
removeOrgAuditor |
sameOrgEndorser |
removeRole |
endorsers |
requestMint |
sameOrgEndorser |
burnTokens |
sameOrgEndorser |
setMaxDailyAmount |
endorsers |
setMaxDailyTransactionCount |
endorsers |
suspendAccount |
endorsers |
transferTokens |
endorsers |
initializeExchangePoolUser |
sameOrgEndorser |
createExchangePoolAccounts |
sameOrgEndorser |
addConversionRate |
sameOrgEndorser |
updateConversionRate |
sameOrgEndorser |
mintWithFundingExchangePool |
sameOrgEndorser |
tokenConversion |
endorsers |
getConversionRate |
endorsers |
getConversionHistory |
endorsers |
getConversionRateHistory |
endorsers |
getExchangePoolUser |
endorsers |
getAccountOnHoldBalance |
endorsers |
getAccountStatus |
endorsers |
getAccountsByRole |
endorsers |