You use the Tokens SDK

Improve your project with the Tokens SDK

Reading Time: 3 min

Exercise summary

In your project, from the previous module, you created a fungible token, ostensibly to be used as an air-mile by the world's airlines. Now, oops, you are going to make use of the Tokens SDK and focus your efforts only on what you have to do on our own. So go ahead and do the following:

  1. Find the proper way to express your air-mile token type.
  2. Get rid of your TokenState and use FungibleToken instead.
  3. Get rid of your TokenContract and use the available contract instead.
  4. Update your contract unit tests so that they become learning tests about the token contract.
  5. Modify your IssueFlow to use one of the Tokens SDK issue flows.
  6. Modify your MoveFlow to use one of the Tokens SDK move flows.
  7. Modify your RedeemFlow to use one of the Tokens SDK redeem flows.
  8. Adjust your flow tests to confirm your flows work.

Additional help

Achieving these modest aims might not be as easy as the list above suggests. Moreover, if you want your flows to still take the same input types like List<StateAndRef<TokenState>> (you should), or whichever is applicable in the new stage, then you need to dig a bit. For example, it will be beneficial to clone the Tokens SDK repo and load it as a project into a separate IntelliJ window. Here is what we mean by digging a bit.

  1. IssueTokens:

  2. MoveFungibleTokens:

  3. Interestingly MoveTokensFlow:

    • also inherits from AbstractMoveTokensFlow
    • and takes inputs as List<StateAndRef<AbstractToken>>. Yeah!
  4. RedeemFungibleTokens:

  5. Interestingly RedeemTokensFlow:

    • also inherits from AbstractRedeemTokensFlow
    • and takes inputs as List<StateAndRef<AbstractToken>>. Boom.


Use those to review your higher-level flows. See if you can adapt them and their tests to use the SDK.

In the next chapter, we will disclose a modified example project using the SDK. No peeking.

support icon

Get 3 months access to the authors and experts who created this training.

  • Expert instructors will review your code and help you to refine it.
  • One-on-one support and mentoring from expert instructors.
  • Collaboration with fellow students in a dedicated Training Slack channel.
Discuss on Slack
Rate this Page
Would you like to add a message?
Thank you for your Feedback!