Merged in rnicoll-commodity-cleanup (pull request #295)

Documentation cleanup
This commit is contained in:
Mike Hearn 2016-08-23 21:30:56 +02:00
commit 74e5e1bce8
4 changed files with 30 additions and 10 deletions

View File

@ -28,6 +28,9 @@ val COMMODITY_PROGRAM_ID = CommodityContract()
* differences are in representation of the underlying commodity. Issuer in this context means the party who has the
* commodity, or is otherwise responsible for delivering the commodity on demand, and the deposit reference is use for
* internal accounting by the issuer (it might be, for example, a warehouse and/or location within a warehouse).
*
* This is an early stage example contract used to illustrate non-cash fungible assets, and is likely to change significantly
* in future.
*/
// TODO: Need to think about expiry of commodities, how to require payment of storage costs, etc.
class CommodityContract : OnLedgerAsset<Commodity, CommodityContract.State>() {

View File

@ -423,16 +423,26 @@ enum class NetType {
PAYMENT
}
data class Commodity(val symbol: String,
/**
* Class representing a commodity, as an equivalent to the [Currency] class. This exists purely to enable the
* [CommodityContract] contract, and is likely to change in future.
*
* @param commodityCode a unique code for the commodity. No specific registry for these is currently defined, although
* this is likely to change in future.
* @param displayName human readable name for the commodity.
* @param defaultFractionDigits the number of digits normally after the decimal point when referring to quantities of
* this commodity.
*/
data class Commodity(val commodityCode: String,
val displayName: String,
val commodityCode: String = symbol,
val defaultFractionDigits: Int = 0) {
companion object {
private val registry = mapOf(
// Simple example commodity, as in http://www.investopedia.com/university/commodities/commodities14.asp
Pair("FCOJ", Commodity("FCOJ", "Frozen concentrated orange juice"))
)
fun getInstance(symbol: String): Commodity?
= registry[symbol]
fun getInstance(commodityCode: String): Commodity?
= registry[commodityCode]
}
}

View File

@ -19,6 +19,16 @@ objects of the correct value are received by the beneficiary as part of the sett
The cash contract supports issuing, moving and exiting (destroying) states. Note, however, that issuance cannot be part
of the same transaction as other cash commands, in order to minimise complexity in balance verification.
Cash shares a common superclass, ``OnChainAsset``, with the Commodity contract. This implements common behaviour of
assets which can be issued, moved and exited on chain, with the subclasses handling asset-specific data types and
behaviour.
Commodity
---------
The ``Commodity`` contract is an early stage example of a non-currency contract whose states implement the ``FungibleAsset``
interface. This is used as a proof of concept for non-cash obligations.
Commercial Paper
----------------

View File

@ -1,12 +1,9 @@
Networking and messaging
========================
Although the platform does not currently provide a network backend, some preliminary interfaces are defined along with
an in-memory implementation provided for use by unit tests and other exploratory code. An implementation based on Apache
Kafka is also being developed, which should be sufficient for real use cases to be implemented in the short run, even
though in the long run a fully peer to peer protocol will be required.
This article quickly explains the basic networking interfaces in the code.
The platform defines preliminary interfaces for the messaging layer along with an ArtemisMQ implementation, and an
in-memory implementation provided for use by unit tests and other exploratory code. This article quickly explains the
basic networking interfaces in the code.
Messaging vs networking
-----------------------