Git Product home page Git Product logo

contractsdk-recordplayers's Introduction

Contract SDK - Record Player Maintenance

If you're familiar with record players you probably know how difficult it is to make sure that they run in pristine condition, especially if it's a collectible.

This cordapp simulates how you could model the process of a limited edition record player (the cordagraf) that is manufactured and issued to specific dealers, and those dealers are the only entities that can service those record players after the fact and report stats back to the manufacturer about how the players are being used.

Record Players are issued as LinearStates and are updated by dealers, that act functionally as the only entity that can update the RecordPlayer state.

Using the Contract SDK

The contract sdk is a series of Annotations that you can use in your corda contracts. It's great for putting together cleaner contract code and writing it faster.

This repository demonstrates how you can configure and use it in your own projects.

Configuration is essentially three small steps:

  • adding maven { url 'https://software.r3.com/artifactory/corda-lib-dev' } to repositories.gradle
  • adding compile "com.r3.corda.lib.contracts:contract-sdk:0.9-SNAPSHOT" to the build.gradle file of your contract module in your cordapp
  • adding the annotations to your apps!

To show how convenient this can be, here's an example demonstrating how to configure a simple issuance command with one output and no inputs.

// note the annotations here from the Contracts SDK
@RequireNumberOfStatesOnInput(value = 0)
@RequireNumberOfStatesOnOutput(value = 1)
class Issue implements Commands {}

If you've written contracts before you might be used to outlining the verify method, applying a conditional for issuance commands and configuring a lot of the same verification for contract inputs. This removes the need for those tools.

Take a look at the small RecordPlayerContract sample in this repository to see how this works in practice.

Sources

If you're looking to find more information on record players specifically, I included some sources for how we modeled record players in the state class.

contractsdk-recordplayers's People

Contributors

davidawad avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.