Bond Marketplace Model
The enhanced version of Blockchain App Builder includes a model attribute that generates additional methods for the bond marketplace scenario.
If you include the model: bond
parameter in the specification file for tokens that use the extended ERC-1155 standard, Blockchain App Builder application-specific chaincode, including the following additional methods for use with the bond marketplace application.
TypeScript Methods for Bond Marketplace
The bond marketplace chaincode includes all methods available in the generic ERC-1155 NFT chaincode. The following additional methods that are specific to the bond marketplace scenario are available.-
postToken
- This method can be called only by a token creator. The method submits the bond token for listing in the marketplace. When a token is created, its status is initially set to
created
. This method updates the status toposted
. Users can run thegetAllTokensWithFilter
method to retrieve all NFTs with aposted
status. -
purchaseToken
- This method can be called by any account holder to purchase a listed bond NFT. The purchase transfers the bond NFT from the creator's account to the caller's account, and transfers CBDC tokens from the caller's account to the creator's account. Because of this, the method must be run in the context of an atomic transaction. The method also verifies the transfer process, ensuring that the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the token creator, and the CBDC token transfer value must be equal to the face value of the bond token multiplied by the quantity being purchased. -
payInterest
- This method can be called only by the token creator or admin to pay the interest earned on the bond token. This method can be called only if the interest frequency of the token is monthly, quarterly, or annually. Interest cannot be paid if the interest frequency is at maturity. Interest is calculated by the chaincode based on the coupon rate of the token. The purchase operation transfers CBDC tokens from the caller's account to the bond owner’s account. Because of this, this method must be run in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the token owner, and the CBDC token transfer value must be equal to the interest calculated by the bond chaincode. -
requestTokenRedemption
- This method can be called only by the token owner to raise a request for the redemption of bond tokens after maturity. This method is also involved the calculation of the redemption price by the chaincode. Redemption requests can be raised only on the entire quantity of the bond token that the user owns. Users can raise multiple redemption requests based on different settlement IDs but only one can be approved by the token creator.
-
approveTokenRedemption
- This method can be called only by the token creator to approve a request for the redemption of bond tokens. The approval operation transfers the bond NFT from the owner’s account (the user who raised the request) to the creator’s account, and transfers CBDC tokens from the bond creator’s to the owner’s account. Because of this, this method must be executed in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the account of the token owner who raised the redemption request, and the CBDC token transfer value must be equal to the calculated redemption price that was calculated by the chaincode while raising the redemption request. -
rejectRedemption
- The token creator can call this method to reject the redemption request. Token owners can raise a redemption request again by using a different settlement ID.
-
getAllTokensWithFilters
- The admin can call this get method to fetch all the tokens filtered by status, either
CREATED
orPOSTED
. -
getTokenApprovalRequestByUser
- Any account holder can call this get method to get the details of all the token approval requests (redemption requests) they have made.
-
getTokenApprovalRequestForUserByStatus
- Any account holder can call this get method to get the details of all the token approval requests (redemption requests) they have made.
-
getAccountBondSummary
- Any account holder can call this get method to get an account summary that includes the details of purchased or redeemed tokens and the purchase price and redemption price.
-
getAccountBondSummaryWithPagination
- Any account holder can call this get method to get an account summary that includes details of purchased or redeemed tokens and the purchase price and redemption price. This method can return results with pagination based on pagesize and bookmark values, and also filtered by start time and end time.
Go Methods for Bond Marketplace
The bond marketplace chaincode includes all methods available in the generic ERC-1155 NFT chaincode. The following additional methods that are specific to the bond marketplace scenario are available.-
PostToken
- This method can be called only by a token creator. The method submits the bond token for listing in the marketplace. When a token is created, its status is initially set to
created
. This method updates the status toposted
. Users can run thegetAllTokensWithFilter
method to retrieve all NFTs with aposted
status. -
PurchaseToken
- This method can be called by any account holder to purchase a listed bond NFT. The purchase transfers the bond NFT from the creator's account to the caller's account, and transfers CBDC tokens from the caller's account to the creator's account. Because of this, the method must be run in the context of an atomic transaction. The method also verifies the transfer process, ensuring that the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the token creator, and the CBDC token transfer value must be equal to the face value of the bond token multiplied by the quantity being purchased. -
PayInterest
- This method can be called only by the token creator or admin to pay the interest earned on the bond token. This method can be called only if the interest frequency of the token is monthly, quarterly, or annually. Interest cannot be paid if the interest frequency is at maturity. Interest is calculated by the chaincode based on the coupon rate of the token. The purchase operation transfers CBDC tokens from the caller's account to the bond owner’s account. Because of this, this method must be run in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the token owner, and the CBDC token transfer value must be equal to the interest calculated by the bond chaincode. -
RequestTokenRedemption
- This method can be called only by the token owner to raise a request for the redemption of bond tokens after maturity. This method is also involved the calculation of the redemption price by the chaincode. Redemption requests can be raised only on the entire quantity of the bond token that the user owns. Users can raise multiple redemption requests based on different settlement IDs but only one can be approved by the token creator.
-
ApproveTokenRedemption
- This method can be called only by the token creator to approve a request for the redemption of bond tokens. The approval operation transfers the bond NFT from the owner’s account (the user who raised the request) to the creator’s account, and transfers CBDC tokens from the bond creator’s to the owner’s account. Because of this, this method must be executed in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the account of the token owner who raised the redemption request, and the CBDC token transfer value must be equal to the calculated redemption price that was calculated by the chaincode while raising the redemption request. -
RejectRedemption
- The token creator can call this method to reject the redemption request. Token owners can raise a redemption request again by using a different settlement ID.
-
GetAllTokensWithFilter
- The admin can call this get method to fetch all the tokens filtered by status, either
CREATED
orPOSTED
. -
GetTokenApprovalRequestByUser
- Any account holder can call this get method to get the details of all the token approval requests (redemption requests) they have made.
-
GetTokenApprovalRequestForUserByStatus
- Any account holder can call this get method to get the details of all the token approval requests (redemption requests) they have made.
-
GetAccountBondSummary
- Any account holder can call this get method to get an account summary that includes the details of purchased or redeemed tokens and the purchase price and redemption price.
-
GetAccountBondSummaryWithPagination
- Any account holder can call this get method to get an account summary that includes details of purchased or redeemed tokens and the purchase price and redemption price. This method can return results with pagination based on pagesize and bookmark values, and also filtered by start time and end time.
TypeScript SDK Methods for Bond Marketplace
-
payInterest
- The token creator or admin can call this method to pay the interest earned on a bond token. This method can be called only if the interest frequency of the token is monthly, quarterly, or annually. Interest cannot be paid if the interest frequency is at maturity. Interest is calculated by the chaincode itself based on the coupon rate of the token. The purchase operation transfers CBDC tokens from the caller's account to the bond owner’s account. Because of this, this method must be run in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the token owner, and the CBDC token transfer value must be equal to the interest that is calculated by the bond chaincode. -
requestTokenRedemption
- This method can be called only by the token owner to raise a request for the redemption of bond tokens after maturity. This method is also involved the calculation of the redemption price by the chaincode. Redemption requests can be raised only on the entire quantity of the bond token that the user owns. Users can raise multiple redemption requests based on different settlement IDs but only one can be approved by the token creator.
-
approveTokenRedemption
- This method can be called only by the token creator to approve a request for the redemption of bond tokens. The approval operation transfers the bond NFT from the owner’s account (the user who raised the request) to the creator’s account, and transfers CBDC tokens from the bond creator’s to the owner’s account. Because of this, this method must be executed in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the account of the token owner who raised the redemption request, and the CBDC token transfer value must be equal to the calculated redemption price that was calculated by the chaincode while raising the redemption request. -
rejectRedemption
- The token creator can call this method to reject the redemption request. Token owners can raise a redemption request again by using a different settlement ID.
-
getAllTokensWithFilter
- The admin can call this get method to fetch all the tokens filtered by status, either
CREATED
orPOSTED
. -
getTokenApprovalRequestByUser
- Any account holder can call this get method to get the details of all the token approval requests (redemption requests) they have made.
-
getTokenApprovalRequestForUserByStatus
- Any account holder can call this get method to get the details of all the token approval requests (redemption requests) they have made.
-
getAccountBondSummary
- Any account holder can call this get method to get an account summary that includes the details of purchased or redeemed tokens and the purchase price and redemption price.
-
getAccountBondSummaryWithPagination
- Any account holder can call this get method to get an account summary that includes details of purchased or redeemed tokens and the purchase price and redemption price. This method can return results with pagination based on pagesize and bookmark values, and also filtered by start time and end time.
Go SDK Methods for Bond Marketplace
-
PayInterest
- The token creator or admin can call this method to pay the interest earned on a bond token. This method can be called only if the interest frequency of the token is monthly, quarterly, or annually. Interest cannot be paid if the interest frequency is at maturity. Interest is calculated by the chaincode itself based on the coupon rate of the token. The purchase operation transfers CBDC tokens from the caller's account to the bond owner’s account. Because of this, this method must be run in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the token owner, and the CBDC token transfer value must be equal to the interest that is calculated by the bond chaincode. -
RequestTokenRedemption
- This method can be called only by the token owner to raise a request for the redemption of bond tokens after maturity. This method is also involved the calculation of the redemption price by the chaincode. Redemption requests can be raised only on the entire quantity of the bond token that the user owns. Users can raise multiple redemption requests based on different settlement IDs but only one can be approved by the token creator.
-
ApproveTokenRedemption
- This method can be called only by the token creator to approve a request for the redemption of bond tokens. The approval operation transfers the bond NFT from the owner’s account (the user who raised the request) to the creator’s account, and transfers CBDC tokens from the bond creator’s to the owner’s account. Because of this, this method must be executed in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
anduserId
for the transfer. TheorgId
anduserId
must correspond to the account of the token owner who raised the redemption request, and the CBDC token transfer value must be equal to the calculated redemption price that was calculated by the chaincode while raising the redemption request. -
RejectRedemption
- The token creator can call this method to reject the redemption request. Token owners can raise a redemption request again by using a different settlement ID.
-
GetAllTokensWithFilter
- The admin can call this get method to fetch all the tokens filtered by status, either
CREATED
orPOSTED
. -
GetTokenApprovalRequestByUser
- Any account holder can call this get method to get the details of all the token approval requests (redemption requests) they have made.
-
GetTokenApprovalRequestForUserByStatus
- Any account holder can call this get method to get the details of all the token approval requests (redemption requests) they have made.
-
GetAccountBondSummary
- Any account holder can call this get method to get an account summary that includes the details of purchased or redeemed tokens and the purchase price and redemption price.
-
GetAccountBondSummaryWithPagination
- Any account holder can call this get method to get an account summary that includes details of purchased or redeemed tokens and the purchase price and redemption price. This method can return results with pagination based on pagesize and bookmark values, and also filtered by start time and end time.