Skip to content
This repository was archived by the owner on May 15, 2020. It is now read-only.

Commit 429854b

Browse files
authored
Revert "Repo split"
1 parent 5314cdc commit 429854b

File tree

1,556 files changed

+121211
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,556 files changed

+121211
-6
lines changed

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.DS_Store
2+
.gradle/
3+
.idea
4+
**/build/
5+
**/bin/
6+
*/.gradle/
7+
*/.idea/*
8+
*/.vscode/*
9+
**/out/
10+
**/logs/
11+
corda-nodeinfo/corda-nodeinfo.iml
12+
*~*

README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# CorDapps Samples
1+
# Cordapps Samples
22
<p align="center">
33
<img src="https://www.corda.net/wp-content/uploads/2016/11/fg005_corda_b.png" alt="Corda" width="500">
44
</p>
55

66
## Introduction
7-
The samples repository has now evolved into [samples-java](https://github.com/corda/samples-java) and [samples-kotlin](https://github.com/corda/samples-kotlin). Each repository consists of a copy of the existing CorDapp samples in the respective programing language. Furthermore, we reorganized our samples into different categories.
7+
The samples repository has now evolved into [samples-Java](https://github.com/corda/samples-java) and [samples-kotlin](https://github.com/corda/samples-kotlin). Each repository consists of a copy of the existing Cordapp samples in the respective programing language. Furthermore, we reorganized our samples into different categories.
88

99
We have:
1010
* Advanced: demonstrates multiple features of corda and normally it has sophisticated design. ([Java Version](https://github.com/corda/samples-java/tree/master/Advanced), [Kotlin Version](https://github.com/corda/samples-kotlin/tree/master/Advanced))
1111

12-
* Basic: demonstrates fundamental but useful techniques during CorDapp development. ([Java Version](https://github.com/corda/samples-java/tree/master/Basic), [Kotlin Version](https://github.com/corda/samples-kotlin/tree/master/Basic))
12+
* Basic: demonstrates fundamental but useful techniques during cordapp development. ([Java Version](https://github.com/corda/samples-java/tree/master/Basic), [Kotlin Version](https://github.com/corda/samples-kotlin/tree/master/Basic))
1313

1414
* Feature: demonstrates the general Corda functionalities. ([Java Version](https://github.com/corda/samples-java/tree/master/Features), [Kotlin Version](https://github.com/corda/samples-kotlin/tree/master/Features))
1515

@@ -46,6 +46,4 @@ Tokens
4646
├── fungiblehousetoken
4747
└── stockpaydivident
4848
```
49-
We look forward to continue providing useful Cordapps samples to the community!
50-
51-
Stay tuned on [Twitter](https://twitter.com/Cordablockchain), [Slack](http://slack.corda.net/), and [Corda.net](https://www.corda.net/).
49+
We look forward to continue providing useful Cordapps samples to the community! stay tuned with us on [Twitter](https://twitter.com/Cordablockchain), [Slack](http://slack.corda.net/), and [Corda.net](https://www.corda.net/).

auction-cordapp/.gitignore

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Eclipse, ctags, Mac metadata, log files
2+
.classpath
3+
.project
4+
tags
5+
.DS_Store
6+
*.log
7+
*.log.gz
8+
*.orig
9+
10+
.gradle
11+
12+
# General build files
13+
**/build/*
14+
!docs/build/*
15+
16+
lib/dokka.jar
17+
18+
### JetBrains template
19+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
20+
21+
*.iml
22+
23+
## Directory-based project format:
24+
#.idea
25+
26+
# if you remove the above rule, at least ignore the following:
27+
28+
# Specific files to avoid churn
29+
.idea/*.xml
30+
.idea/copyright
31+
.idea/jsLibraryMappings.xml
32+
33+
# User-specific stuff:
34+
.idea/tasks.xml
35+
.idea/dictionaries
36+
37+
# Sensitive or high-churn files:
38+
.idea/dataSources.ids
39+
.idea/dataSources.xml
40+
.idea/sqlDataSources.xml
41+
.idea/dynamic.xml
42+
.idea/uiDesigner.xml
43+
44+
# Gradle:
45+
.idea/libraries
46+
47+
# Mongo Explorer plugin:
48+
.idea/mongoSettings.xml
49+
50+
## File-based project format:
51+
*.ipr
52+
*.iws
53+
54+
## Plugin-specific files:
55+
56+
# IntelliJ
57+
/out/
58+
/workflows/out/
59+
/contracts/out/
60+
clients/out/
61+
62+
# mpeltonen/sbt-idea plugin
63+
.idea_modules/
64+
65+
# JIRA plugin
66+
atlassian-ide-plugin.xml
67+
68+
# Crashlytics plugin (for Android Studio and IntelliJ)
69+
com_crashlytics_export_strings.xml
70+
crashlytics.properties
71+
crashlytics-build.properties
72+
73+
# docs related
74+
docs/virtualenv/
75+
76+
# if you use the installQuasar task
77+
lib
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate

auction-cordapp/LICENCE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2016, R3 Limited.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

auction-cordapp/README.md

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Auction CorDapp
2+
3+
This CorDapp serves as a demo of building an auction application on Corda. It leverages
4+
different features of Corda like `SchedulableState`, `StatePointer` and `OwnableState`. It also demonstrate
5+
how to perform a DvP (Delivery vs Payment) transaction on Corda.
6+
7+
It has a full-functional client included and an angular UI to interact with the nodes.
8+
9+
## CorDapp Components
10+
11+
### States
12+
- `Asset`: It is an `OwnableState` that represents an asset that could be put on auction. The owner
13+
of the asset should be able to put this asset on an auction.
14+
- `AuctionState`: It represents the auction. It is designed as a `SchedulableState`, such that auction
15+
could be scheduled to be made inactive, once the auction deadline is reached.
16+
17+
### Contracts:
18+
- `AssetContract`: It is used to govern the evolution of the asset. In this case mostly change of
19+
ownership. Left black for simplicity. Has two commands, `CreateAsset` and `TransferAsset`.
20+
- `AuctionContract`: It governs the evolution of the auction. The has the following commands:
21+
- `CreateAuction`: Validation rules governing the creation of the auction.
22+
- `Bid`: Validation rules governing the bidding process of the auction.
23+
- `EndAuction`: Validation rules governing end of the auction i.e making the auction inactive
24+
once the auction bidding deadline has been reached.
25+
- `Settlement`: Validation rules for settlement of the auction i.e. transfer of asset to the
26+
highest bidder and the highest bid amount transfer to the auctioneer.
27+
- `Exit`: Rules governing the exit (consumption/deletion) of the auction state.
28+
29+
### Flows:
30+
- `CreateAssetFlow`: This flow is used create an asset.
31+
- `CreateAuctionFlow`: This flow is used to create an auction. Once an asset has been created using
32+
the`CreateAssetFlow`, this flow can be used to put the asset on auction. The `AuctionState`
33+
references to the `Asset` using a `StatePointer`.
34+
Refer here to learn more about StatePointer:
35+
https://medium.com/corda/linking-corda-states-using-statepointer-16e24e5e602
36+
- `BidFlow`: It is used to place a bid on an auction. Bids can be placed only till a predetermined
37+
deadline defined in the `AuctionState`.
38+
- `EndAuctionFlow`: This is a scheduled flow, which run automatically on auction deadline to mark
39+
the corresponding auction as inactive, so that it stop receiving bids.
40+
- `AuctionSettlementFlow`: It is used to settle an auction once the bidding deadline has passed. It
41+
internally triggers two flows:
42+
- `AuctionDvPFlow`: This flow takes care of the dvp operation for settlement of the auction. It
43+
transfers the asset on auction to the highest bidder and the highest bid amount is transferred to
44+
the auctioneer. It happens as an atomic transaction.
45+
- `AuctionExitFlow`: Once the auction us settled, this flow is used to exit the auction state. This
46+
flow can also be triggered to exit an auction which did not receive any bid till its deadline.
47+
48+
## Pre-requisites:
49+
See https://docs.corda.net/getting-set-up.html.
50+
51+
## Running the nodes:
52+
53+
See https://docs.corda.net/tutorial-cordapp.html#running-the-example-cordapp.
54+
55+
## Running the client:
56+
57+
The client can be run by executing the below command from the project root:
58+
59+
`./gradlew runAuctionClient`
60+
61+
Please make sure that the nodes are already running before starting the client.
62+
The client can be accessed at http://localhost:8085/
63+
64+
## Usage
65+
66+
1. Click on the "Setup Demo Data" button to create somde demo data to play with or you
67+
may use the skip button if you wish to setup the deata yourself.
68+
![Setup Data](./snaps/setup.png)
69+
70+
2. The demo data setup would have created some assets from each of the parties. The assets
71+
can be found under MyAssets Section. These assets could be put on auction. New assets can
72+
be create using the create asset button.
73+
The drop down at the top right corner can be used to toggle between parties.
74+
The balance next to it indicates the current active parties cash balance. Cash can be
75+
issued using the Issue Cash Button.
76+
![Landing Page](./snaps/landing.png)
77+
78+
3. Click on an asset to put it on auction. Input the `Base Price` and the `Auction Deadline`
79+
and click in the Create Auction button to Create the Auction.
80+
![Create Auction](./snaps/CreateAuction.png)
81+
82+
4. Once an auction is created it would be available in the `Active Auction` section. Its
83+
now ready to accept bids. Switch to PartyB and place a bid, by clicking on the auction
84+
available in the `Active Auction` section.
85+
![Place Bid](./snaps/Bid.png)
86+
87+
5. Place one more bid by switching to PartyC.
88+
89+
6. What for the auction to end.
90+
91+
7. Once the auction is ended its ready to be settled. Settlement can be initiated by the
92+
highest bidder. Considering PartyC is the highest bidder, switch to PartyC.
93+
94+
8. Issue cash equivalent or greater than the highest bid amount for PartyC to pay for
95+
the auction settlement.
96+
![Issue Cash](./snaps/CashIssue.png)
97+
98+
9. Now click on the auction and initiate the settlement using the `Pay and Settle` Button.
99+
![Pay and Settle](./snaps/Settle.png)
100+
101+
102+
Notice the below things that would happed on auction settlement:
103+
104+
- Auctioned Assets ownership would be transferred to the highest bidder. The asset would
105+
now appear in the auction winners asset list (My Assets section).
106+
- The auctioneers cash balance would be credited with amount equivalent to the highest bid.
107+
- The highest bidders (PartyC in this case) cash balance would also be debited with amount
108+
equivalent to the highest bid.
109+
- The AuctionState would be consumed and the auction would no longer be visible.

auction-cordapp/TRADEMARK

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Corda and the Corda logo are trademarks of R3CEV LLC and its affiliates. All rights reserved.
2+
3+
For R3CEV LLC's trademark and logo usage information, please consult our Trademark Usage Policy at
4+
https://www.r3.com/trademark-policy/.

0 commit comments

Comments
 (0)