Skip to content

Commit

Permalink
Token upgrade to 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutoshmeher-r3 committed Aug 29, 2023
1 parent 8f99d26 commit b31b60e
Show file tree
Hide file tree
Showing 45 changed files with 321 additions and 1,880 deletions.
38 changes: 19 additions & 19 deletions java-samples/shinny-tokens/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Tokens in Next-Gen Corda

Unlike Corda 4, we don’t have an SDK for tokens in Next-Gen Corda;
the token’s functionality is brought into the core C5 platform.
We have also introduced a new Token Selection API, which enables a flow to claim
Unlike Corda 4, we don’t have an SDK for tokens in Next-Gen Corda;
the token’s functionality is brought into the core C5 platform.
We have also introduced a new Token Selection API, which enables a flow to claim
tokens exclusively and provides a way to merge and return fungible tokens satisfying a given amount.

In this sample, I will show you how you can create a gold stablecoin,
a commodity backed enterprise-grade and regulatory-friendly stablecoin
In this sample, I will show you how you can create a gold stablecoin,
a commodity backed enterprise-grade and regulatory-friendly stablecoin
using Next-Gen Corda.

## Tokens app
Expand Down Expand Up @@ -37,7 +37,7 @@ Go to `POST /flow/{holdingidentityshorthash}`, enter the identity short hash(Ali
```
{
"clientRequestId": "mint-1",
"flowClassName": "com.r3.developers.csdetemplate.tokens.workflows.MintGoldTokensFlow",
"flowClassName": "com.r3.developers.samples.tokens.workflows.MintGoldTokensFlow",
"requestBody": {
"symbol":"GOLD",
"issuer":"CN=Bob, OU=Test Dept, O=R3, L=London, C=GB",
Expand All @@ -53,22 +53,22 @@ Go to `POST /flow/{holdingidentityshorthash}`, enter the identity short hash(Ali
```
{
"clientRequestId": "list-1",
"flowClassName": "com.r3.developers.csdetemplate.tokens.workflows.ListGoldTokens",
"flowClassName": "com.r3.developers.samples.tokens.workflows.ListGoldTokens",
"requestBody": {}
}
```
After trigger the ListGoldTokens flow, again, we need to hop to `GET /flow/{holdingidentityshorthash}/{clientrequestid}`
and check the result.
After trigger the ListGoldTokens flow, again, we need to hop to `GET /flow/{holdingidentityshorthash}/{clientrequestid}`
and check the result.
As the screenshot shows, in the response body, we will see a list of the gold state we created.

#### Step 3: Transfer the gold token with `TransferGoldTokenFlow`
In this step, we will Alice will transfer some tokens from his vault to Charlie.
Goto `POST /flow/{holdingidentityshorthash}`, enter the identity short hash and request body.
Use Alice's holdingidentityshorthash to fire this psot API.
In this step, Alice will transfer some tokens from his vault to Charlie.
Goto `POST /flow/{holdingidentityshorthash}`, enter the identity short hash and request body.
Use Alice's holdingidentityshorthash to fire this post API.
```
{
"clientRequestId": "transfer-1",
"flowClassName": "com.r3.developers.csdetemplate.tokens.workflows.TransferGoldTokenFlow",
"flowClassName": "com.r3.developers.samples.tokens.workflows.TransferGoldTokenFlow",
"requestBody": {
"symbol":"GOLD",
"issuer":"CN=Bob, OU=Test Dept, O=R3, L=London, C=GB",
Expand All @@ -83,25 +83,25 @@ And as for the result of this flow, go to `GET /flow/{holdingidentityshorthash}/
Go to `POST /flow/{holdingidentityshorthash}`, enter the identity short hash(Alice's hash) and request body:
```
{
"clientRequestId": "list-1",
"flowClassName": "com.r3.developers.csdetemplate.tokens.workflows.ListGoldTokens",
"clientRequestId": "list-2",
"flowClassName": "com.r3.developers.samples.tokens.workflows.ListGoldTokens",
"requestBody": {}
}
```
Go to `POST /flow/{holdingidentityshorthash}`, enter the identity short hash(Charlie's hash) and request body:
```
{
"clientRequestId": "list-1",
"flowClassName": "com.r3.developers.csdetemplate.tokens.workflows.ListGoldTokens",
"clientRequestId": "list-3",
"flowClassName": "com.r3.developers.samples.tokens.workflows.ListGoldTokens",
"requestBody": {}
}
```

And as for the result, you need to go to the Get API again and enter the short hash and client request ID.
Thus, we have concluded a full run through of the token app.
Thus, we have concluded a full run through of the token app.


# Additional Information

To read more about Token Selection API, you can visit the [docs](https://docs.r3.com/en/platform/corda/5.0-beta/developing/api/api-ledger-token-selection.html#tokens) and
To read more about Token Selection API, you can visit the [docs](https://docs.r3.com/en/platform/corda/5.0-beta/developing/api/api-ledger-token-selection.html#tokens) and
read [this](https://r3-cev.atlassian.net/wiki/spaces/DR/pages/4435017960/Shiny+tokens+in+Next-Gen+Corda) blog.
25 changes: 21 additions & 4 deletions java-samples/shinny-tokens/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'org.jetbrains.kotlin.plugin.jpa'
id 'java'
id 'maven-publish'
id 'csde'
id 'net.corda.plugins.csde'
}

allprojects {
Expand All @@ -15,6 +15,25 @@ allprojects {

def javaVersion = VERSION_11

// Configure the CSDE
csde {
cordaClusterURL = "https://localhost:8888"
networkConfigFile = "config/static-network-config.json"
r3RootCertFile = "config/r3-ca-key.pem"
corDappCpiName = "MyCorDapp"
notaryCpiName = "NotaryServer"
cordaRpcUser = "admin"
cordaRpcPasswd ="admin"
workflowsModuleName = workflowsModule
csdeWorkspaceDir = "workspace"
notaryVersion = cordaNotaryPluginsVersion
combinedWorkerVersion = combinedWorkerJarVersion
postgresJdbcVersion = "42.4.3"
cordaDbContainerName = "CSDEpostgresql"
cordaBinDir = "${System.getProperty("user.home")}/.corda/corda5"
cordaCliBinDir = "${System.getProperty("user.home")}/.corda/cli"
}

// Declare the set of Java compiler options we need to build a CorDapp.
tasks.withType(JavaCompile) {
// -parameters - Needed for reflection and serialization to work correctly.
Expand All @@ -25,10 +44,8 @@ allprojects {

repositories {
// All dependencies are held in Maven Central
mavenLocal()
mavenCentral()
maven {
url = "$artifactoryContextUrl/"
}
}

tasks.withType(Test).configureEach {
Expand Down
29 changes: 0 additions & 29 deletions java-samples/shinny-tokens/buildSrc/build.gradle

This file was deleted.

4 changes: 0 additions & 4 deletions java-samples/shinny-tokens/buildSrc/gradle.properties

This file was deleted.

1 change: 0 additions & 1 deletion java-samples/shinny-tokens/buildSrc/settings.gradle

This file was deleted.

Loading

0 comments on commit b31b60e

Please sign in to comment.