Skip to content

Commit 0ea289a

Browse files
upgrade to token 1.2
1 parent 78e1b53 commit 0ea289a

File tree

4 files changed

+23
-26
lines changed

4 files changed

+23
-26
lines changed

Tokens/fungiblehousetoken/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ buildscript {
1414
corda_platform_version = constants.getProperty("platformVersion")
1515
guava_version = constants.getProperty("guavaVersion")
1616
tokens_release_group = 'com.r3.corda.lib.tokens'
17-
tokens_release_version = '1.0'
17+
tokens_release_version = '1.2'
18+
19+
confidential_id_release_group = "com.r3.corda.lib.ci"
20+
confidential_id_release_version = "1.0"
1821
}
1922

2023
repositories {
@@ -103,7 +106,8 @@ dependencies {
103106
// Token SDK dependencies.
104107
cordapp "$tokens_release_group:tokens-contracts:$tokens_release_version"
105108
cordapp "$tokens_release_group:tokens-workflows:$tokens_release_version"
106-
cordapp "$tokens_release_group:tokens-money:$tokens_release_version"
109+
110+
cordapp "$confidential_id_release_group:ci-workflows:$confidential_id_release_version"
107111
}
108112

109113
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
@@ -113,7 +117,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
113117
}
114118
cordapp("$tokens_release_group:tokens-contracts:$tokens_release_version")
115119
cordapp("$tokens_release_group:tokens-workflows:$tokens_release_version")
116-
cordapp("$tokens_release_group:tokens-money:$tokens_release_version")
120+
cordapp("$confidential_id_release_group:ci-workflows:$confidential_id_release_version")
117121
cordapp project(':contracts')
118122
cordapp project(':workflows')
119123
}

Tokens/fungiblehousetoken/workflows/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ configurations {
4141
dependencies {
4242
// Corda dependencies.
4343
cordaCompile "$corda_release_group:corda-core:$corda_release_version"
44+
cordaCompile "$confidential_id_release_group:ci-workflows:$confidential_id_release_version"
45+
4446
cordaRuntime "$corda_release_group:corda:$corda_release_version"
4547

4648
// For testing.
@@ -51,7 +53,6 @@ dependencies {
5153
cordapp project(":contracts")
5254

5355
// Token SDK dependencies.
54-
cordaCompile "$tokens_release_group:tokens-money:$tokens_release_version"
5556
cordaCompile "$tokens_release_group:tokens-workflows:$tokens_release_version"
5657
}
5758

Tokens/fungiblehousetoken/workflows/src/main/java/net/corda/examples/tokenizedhouse/flows/QueryTokens.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import co.paralleluniverse.fibers.Suspendable;
44
import com.r3.corda.lib.tokens.contracts.types.TokenPointer;
55
import com.r3.corda.lib.tokens.contracts.types.TokenType;
6-
import com.r3.corda.lib.tokens.workflows.utilities.QueryUtilitiesKt;
6+
import com.r3.corda.lib.tokens.workflows.utilities.QueryUtilities;
77
import net.corda.examples.tokenizedhouse.states.FungibleHouseTokenState;
88
import net.corda.core.contracts.Amount;
99
import net.corda.core.contracts.StateAndRef;
@@ -46,7 +46,7 @@ public String call() throws FlowException {
4646
//get the pointer pointer to the house
4747
TokenPointer<FungibleHouseTokenState> tokenPointer = evolvableTokenType.toPointer(FungibleHouseTokenState.class);
4848

49-
Amount<TokenType> amount = QueryUtilitiesKt.tokenBalance(getServiceHub().getVaultService(), tokenPointer);
49+
Amount<TokenType> amount = QueryUtilities.tokenBalance(getServiceHub().getVaultService(), tokenPointer);
5050
return "\n You currently have "+ amount.getQuantity()+ " " +symbol + " Tokens\n";
5151
}
5252
}

Tokens/fungiblehousetoken/workflows/src/main/java/net/corda/examples/tokenizedhouse/flows/RealEstateEvolvableFungibleTokenFlow.java

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.r3.corda.lib.tokens.contracts.types.TokenType;
99
import com.r3.corda.lib.tokens.contracts.utilities.TransactionUtilitiesKt;
1010
import com.r3.corda.lib.tokens.workflows.flows.rpc.*;
11+
import com.r3.corda.lib.tokens.workflows.utilities.FungibleTokenBuilder;
1112
import net.corda.examples.tokenizedhouse.states.FungibleHouseTokenState;
1213
import kotlin.Unit;
1314
import net.corda.core.contracts.*;
@@ -52,7 +53,7 @@ public SignedTransaction call() throws FlowException {
5253
new UniqueIdentifier(), 0, this.symbol);
5354

5455
//wrap it with transaction state specifying the notary
55-
TransactionState transactionState = new TransactionState(evolvableTokenType, notary);
56+
TransactionState<FungibleHouseTokenState> transactionState = new TransactionState<>(evolvableTokenType, notary);
5657

5758
//call built in sub flow CreateEvolvableTokens. This can be called via rpc or in unit testing
5859
return subFlow(new CreateEvolvableTokens(transactionState));
@@ -86,17 +87,13 @@ public SignedTransaction call() throws FlowException {
8687
//get the RealEstateEvolvableTokenType object
8788
FungibleHouseTokenState evolvableTokenType = stateAndRef.getState().getData();
8889

89-
//get the pointer pointer to the house
90-
TokenPointer tokenPointer = evolvableTokenType.toPointer(evolvableTokenType.getClass());
91-
92-
//assign the issuer to the house type who will be issuing the tokens
93-
IssuedTokenType issuedTokenType = new IssuedTokenType(getOurIdentity(), tokenPointer);
94-
95-
//specify how much amount to issue to holder
96-
Amount<IssuedTokenType> amount = new Amount(quantity, issuedTokenType);
97-
98-
//create fungible amount specifying the new owner
99-
FungibleToken fungibleToken = new FungibleToken(amount, holder, TransactionUtilitiesKt.getAttachmentIdForGenericParam(tokenPointer));
90+
//create fungible token for the house token type
91+
FungibleToken fungibleToken = new FungibleTokenBuilder()
92+
.ofTokenType(evolvableTokenType.toPointer(FungibleHouseTokenState.class)) // get the token pointer
93+
.issuedBy(getOurIdentity())
94+
.heldBy(holder)
95+
.withAmount(quantity)
96+
.buildFungibleToken();
10097

10198
//use built in flow for issuing tokens on ledger
10299
return subFlow(new IssueTokens(ImmutableList.of(fungibleToken)));
@@ -131,11 +128,8 @@ public SignedTransaction call() throws FlowException {
131128
//get the RealEstateEvolvableTokenType object
132129
FungibleHouseTokenState tokenstate = stateAndRef.getState().getData();
133130

134-
//get the pointer pointer to the house
135-
TokenPointer<FungibleHouseTokenState> tokenPointer = tokenstate.toPointer(FungibleHouseTokenState.class);
136-
137131
//specify how much amount to transfer to which holder
138-
Amount<TokenType> amount = new Amount(quantity, tokenPointer);
132+
Amount<TokenType> amount = new Amount<>(quantity, tokenstate.toPointer(FungibleHouseTokenState.class));
139133
//PartyAndAmount partyAndAmount = new PartyAndAmount(holder, amount);
140134

141135
//use built in flow to move fungible tokens to holder
@@ -191,11 +185,9 @@ public Unit call() throws FlowException {
191185
// //get the RealEstateEvolvableTokenType object
192186
// FungibleHouseTokenState evolvableTokenType = stateAndRef.getState().getData();
193187
//
194-
// //get the pointer pointer to the house
195-
// TokenPointer tokenPointer = evolvableTokenType.toPointer(evolvableTokenType.getClass());
196-
//
197188
// //specify how much amount quantity of tokens of type token parameter
198-
// Amount amount = new Amount(quantity, tokenPointer);
189+
// Amount<TokenType> amount =
190+
// new Amount<>(quantity, evolvableTokenType.toPointer(FungibleHouseTokenState.class));
199191
//
200192
// //call built in redeem flow to redeem tokens with issuer
201193
// return subFlow(new RedeemFungibleTokens(amount, issuer));

0 commit comments

Comments
 (0)