- Rebased the
workflows
to use the newconfidential-identities
module. You will need to add:TestCordapp.findCordapp("com.r3.corda.lib.ci")
to your tests.
-
Added an early version of in memory token selection independent from database backend. To learn more see documentation: InMemoryTokenSelection Notice that it still needs refining in the future release, but it's here to play with!
-
Split all the selection related code (both database and in memory) into the new module:
tokens-selection
to make it in later release type agnostic (now it works only forFungibleToken
s). This will require change in your tests and CorDapps code. You will need to add:TestCordapp.findCordapp("com.r3.corda.lib.tokens.selection")
to your tests andcordapp "com.r3.corda.lib.tokens:tokens-selection:$tokens_release_version"
to your gradle files. -
On top of that lots of exciting improvements and unexciting bug fixes!
- In memory token selection is still experimental due to the API change we need to make in coming 2.0 release. For further information see list of required changes
- The type of
TokenType.tokenClass
has been changed fromString
toClass<*>
. - The contracts module now builds against core-deterministic. The tokens
SDK is the FIRST project with a contracts JAR compiled against Corda
core-deterministic
. TokenType
is now a class instead of an interface. This makes it easier and more secure for CorDapp developers to create their own token types by simply just creating an instance ofTokenType
and supplying atokenIdentifier
string and a number offractionDigits
. The trade-off with using instances ofTokenType
as opposed to sub-types ofTokenType
is that type-safety is lost and you cannot define any custom properties. If type-safety is required or if you need to define custom properties on top of thetokenIdentifier
andfractionDigits
then it is still possible to create your ownTokenType
sub-type by sub-classingTokenType
.- The Type parameter
T : TokenType
fromFungibleToken
andNonFungibleToken
has been removed. Here we compromise on type-safety for a more simple implementation of these classes and the flows which use them. As a consequence the majority of the tokens flows now do not require the use of a type parameter. Furthermore, when querying tokens from the vault, one can only query of typeFungibleToken
orNonFungibleToken
. To specify the exact type, thetokenClass
andtokenIdentifier
must be specified. - Moved
IssuedTokenType._heldBy(owner: AbstractParty)
and the sister infix function to theworkflows
module as it requires the generation of aUniqueIdentifier
which is not deterministic. NonFungibleTokens
now must be passed aUniqueIdentifier
upon creation.- Changed the method signatures for
addIssueTokens
so that they now takeTransactionBuilder
as the first argument. Thanks to Ian Lloyd for the contribution. - Added tests for
NonFungibleTokens
. - Fixed a bug in the contract code whereby the
TokenType
was not "pinned" to aNonFungibleToken
orFungibleToken
state. TheAbstractTokenContract
now checks that an attachment that implements the intendedTokenType
is attached to a transaction involvingAbstractToken
s. TheTokenType
attachments are now pinned by storing the attachment hash in theAbstractToken
state. The hash is propagated to future versions of the state. The attachment cannot change during the life of the token, thus theTokenType
cannot change. However, the token can be redeemed and re-issued, thus allowing theTokenType
to be changed. - Deterministic compilation of
contracts
has been enalbed for versions of Corda > 4.1 (this is due to a bug in 4.0 and 4.1 whereStatePointer
was not annotatedKeepForDJVM
.
- Added in memory token selection implementation. It is not currently the default token selection method but in a future release CorDapp developers will be able to choose between database or in memory selection.
- Changes to how how change parties are generated and used:
- The issuance flows don't require any change outputs
- The non-confidential move and redeem token flows now default the change party to be the calling node's identity.
- The confidential redeem flow requires that the issuer request a new key from the redeeming party.
- The confidential move token flow requires that a change party is generated prior and passed into the confidential move tokens flow.
- The issue tokens flows now resolve the attachments implementing the
specified
TokenType
and ensure it is added to the issue transaction. - The
EvolvableTokenType
flows have been refactored to use the same design as the other tokens flows in that there is a set of inline flows as well as initiating andStartableByRPC
flows.
- Builds against Corda
5.0-SNAPSHOT
for this release. The final release will be built against Corda4.1
. - Changed module names from "contract", "workflow" to "contracts" and "workflows", so now inline with other CorDapps.
- Now don't publish an empty "modules" JAR.
- Changed package namespace to "com.r3.corda.lib" from "com.r3.corda.sdk".
- Changed artifact IDs to be prefixed with "tokens-".
- Changed release group to "com.r3.corda.lib" from "com.r3.tokens-sdk".
- Fixed various compiler warnings.
-
The
tokenClass
property which CorDapp developers were required to implement has been implemented inTokenType
, so there is now no need to implement it in your token type classes. -
The
defaultFractionDigits
property of typeBigInteger
has been removed in favour of afractionDigits
property of typeInt
, simplifying the way to create a token type. Example:-
RC02:
data class MyTokenType( override val tokenIdentifier: String, val fractionDigits: Int, override val tokenClass: String = javaClass.canonicalName override val defaultFractionDigits: BigDecimal = BigDecimal.ONE.scaleByPowerOfTen(-fractionDigits) ) : FixedTokenType()
-
RC03:
data class MyTokenType( override val tokenIdentifier: String, override val fractionDigits: Int = 0 ) : TokenType
-
-
Removed
FixedTokenType
as it was a spurious abstraction. All "fixed" tokens can instead implementTokenType
directly. RemovingFixedTokenType
removes a concept and therefore reduces the mental load of developers who are new to Corda and the token SDK.
- Added an integration test which uses a DvP flow to swap a
House
for someMoney
.
Release candidate 2 is available. Please see branch release/1.0-RC02
.
This release candidate is almost code complete.
NonFungibleToken
s are nowLinearState
s so they can be queried for byLinearId
.
- The redeem flows have been re-factored so that they are in-line with the design of the issue and move flows.
- Various bug fixes.
- Added progress trackers to more flows.
- Added @Suspendable annotations to more functions.
- Increase test coverage still required.
- In memory token selection to be merged into
master
and the addition of a config option which allows CorDapp developers to use in memory token selection or database token selection. - Docs and examples are still to come.
Token types
- Addition of the
TokenType
interface which allows developers to define their own token types. - Addition of a
IssuedTokenType
class which couples a token type with an issuingParty
. This type exists because identical token types with different issuers cannot usually be considered fungible. - Addition of two
TokenType
sub-types;FixedTokenType
for definitions which are not expected to evolve over time andTokenPointer
which points to thelinearId
of aLinearState
which contains the token type data that is expected to evolve. - Addition of an abstract
EvolvableTokenType
which will be pointed to by aTokenPointer
. It allows developers to define their own evolvable token types asLinearState
s. TheEvolvableTokenType
state comes with an abstract contract which defines common logic expected to be used in all evolvable token types. Evolvable token types can be converted toTokenPointer
s. - Addition of two command types
Create
andUpdate
for performing transactions on evolvable token types.
Tokens
- Addition of a
FungibleToken
state type which allows parties to hold some amount of anIssuedTokenType
. Amounts of fungible tokens can be split and merged, providing theIssuedTokenType
is the same type. - Addition of a
NonFungibleToken
state type which allows parties to hold a fungible token of anIssuedTokenType
. Non fungible tokens cannot be split and merged. It is expected that only one non fungible token of a particularIssuedTokenType
can be issued on the ledger at any one time, although there are currently no controls to prevent multiple non fungible tokens being issued. For the time being, these controls will be up to issuers to enforce. - Addition of contracts for
FungibleToken
andNonFungibleToken
which govern how fungible and non fungible tokens can be issued, moved and redeemed. - Addition of commands for performing transactions on fungible and non fungible tokens.
Schemas
- Addition of object relational mappers for
NonFungibleToken
andFungibleToken
so that they can be queried from the vault by the following properties: issuer, holder, amount (for fungible tokens) and token type.
Utilities
- Addition of kotlin utilities for creating amounts of a
TokenType
orIssuedTokenType
using the following syntax:10.TOKEN_TYPE
or10 of tokenType
. - Addition of kotlin utilities to create an
IssuedTokenType
from aTokenType
using the following syntaxtokenType issuedBy issuer
- Addition of kotlin utilities to sum amounts of
IssuedTokenType
andTokenType
. - Addition of kotlin utilities to create a
NonFungibleToken
orFungibleToken
from anIssuedTokenType
and aParty
using the following syntax:issuedTokenType heldBy party
- Addition of kotlin utilities to assign a notary to a
NonFungibleToken
orFungibleToken
using the following syntax:tokens withNotary notary
- Addition of utilities for summing lists of
FungibleToken
s.
- Addition of an abstract
Money
class, that sub-classesFixedTokenType
, from which all money-like token types should derive. - Addition of a
FiatCurrency
class which is a wrapper aroundjava.util.Currency
. - Addition of a
DigitalCurrency
class which behaves similarly toFiatCurrency
, it's registry has been populated with the following digital currencies: Bitcoin, Ethereum, Ripple and Dogecoin. - Addition of utilities for creating amounts of
Money
using the following syntax10.GBP
.
- Creation of an
internal
package to house parts of the API which may change. - Addition of flows to issue, move and redeem fungible tokens, called
IssueTokensFlow
,MoveTokensFlow
andRedeemTokensFlow
, respectively. All flows are intended to be used as in-line sub-flows.IssueTokenFlow
handles the issuance of fungible as well as non-fungible tokens. The move and redeem flows have variants for fungible tokens and variants for non-fungible tokens. - Added confidential variants of the above flows, which allow CorDapp developers to issue tokens to newly created public keys, move tokens to newly created public keys and redeem tokens, with change being assigned to a newly created public key.
- Initiating versions of the above flows have been added which can be easily invoked from the node shell (this is useful for testing and performing demos).
- Addition of flows to create new evolvable token types.
- Addition of a generic flow to update an evolvable token type.
- Addition of a set of flows to add parties to a distribution list for evolvable token updates. This flow exists in the absence of data distribution groups. When tokens with evolvable token types are newly issued, the recipient is added to a distribution list. When tokens with evolvable token types are moved, the recipient is added to the issuer's distribution list.
- Addition of query utilities to query fungible and non fungible tokens by type and issuer.
- Addition of query utilities to obtain sums by token type.
- Creation of an "observer aware" finality flow which allows transaction
observers to store a transaction with
StatesToRecord.ALL_VISIBLE
.
- Addition of a token selection utility which keeps in memory records of available tokens for spending. Multiple buckets can be created to cateogrise tokens by various criteria. For example, tokens for a particular account, tokens of a particular type, tokens with a particular issuer or notary.
- Redeem flows still require refactoring to bring in-line with issue and move flows.
- Some tests are ignored while we investigate why they are failing.
- Docs and examples are still to come.
- Increased test coverage required.