These instructions will show you how to build and deploy the Marketplace to the Daml Hub cloud service.
Ensure you have installed the dependencies as noted on the main README. Note that the build process currently only works on Unix-based operating systems, such as macOS and GNU/Linux.
Windows development is not fully supported yet. It may be possible to follow these steps through Windows Subsystem for Linux, though this is largely untested.
First, package a DIT from a clean slate if you haven't already.
make clean && make package
This will build the model, UI, and triggers, as well as package the project in a .dit
file which can be uploaded to Daml Hub.
Open https://hub.daml.com. Once you are logged in, click on "New Project":
Next, enter a name and a ledger name for this project:
Once the project is created, click on the ledger in the Workspace. This will take you to the ledger's details.
Under the deployments tab, click on "Upload File":
Upload the packaged da-marketplace-0.2.0-rc.5.dit
file.
Click "Launch" for both the UI and the Model:
Next, add the parties. Click on the "Identities" tab, and add the UserAdmin
party by clicking the "Plus" next to its name:
Add the following parties by clicking the "+ Add Party" button: Alice
, Bob
, Exchange
, Broker
, UsdtIssuer
, BtcIssuer
, Ccp
, and Custodian
:
Click the "Ledger Settings" tab, and download the participants.json
file:
In your marketplace repo:
# creates a ledger_parties.json file that maps the Daml Hub party IDs to party names
$ ./scripts/create_ledger_parties.py path/to/participants.json ledger_parties.json
# runs a Daml Script that adds all relevant information to the project ledger
$ daml script --participant-config participants.json --json-api --dar .daml/dist/da-marketplace-0.2.0.dar --script-name Setup:doSetup --input-file ledger-parties.json
If you would like to boostrap the marketplace with your own data, you can either change the doSetup
function in daml/Setup.daml
, or create your own setup function and change the --script-name
to MyModule:myFunction
.
If you have not bootstrapped the data, you must manually add a role contract for the UserAdmin
party.
On the "Live Data" tab, select the UserAdmin
party and click "Add Contract":
Then, select the Marketplace.Operator.Role:Role
template, fill in UserAdmin
for the Operator
, and click "Submit":
There are two ways to deploy automations. The recommended approach is to go through the Quick Setup page on the Marketplace app UI (accessible from ledgerid.projectdabl.com
after deployment). This automatically deploys Auto Approve triggers for all parties, and allows you to deploy other automations on a per party basis.
You can also deploy triggers through Daml Hub, in the Deployments tab.
Aside from auto approve triggers for all parties, launch and configure each trigger with the following parties:
Trigger | Party | Notes |
---|---|---|
SettlementInstructionTrigger |
Bank |
|
ClearingTrigger |
Ccp |
|
MatchingEngine |
Exchange |
Optional. Do this if you are not using the Exberry Integration. |
After uploading, add the first configuration (the human readable name has no bearing on the functionality of the bot), and click launch:
For the rest of the deployments, first click the deployed trigger:
Then "Configure New Deployment":
After all deployments are running, you can click the "View Site" button to visit the Marketplace UI:
The Party ID/Party JWTs to use to login with various parties can be found on the "Users" tab of the console:
If you would like to use the Exberry Matching Engine instead of the matching engine trigger, first add the integration to your project on the "Browse Integrations" tab:
Next, in deployments, click on the Integration and configure it with your Exberry credentials and click "Launch". It should run as the Exchange
party:
Finally, deploy an instance of da-marketplace-exberry-adapter-0.2.0.tar.gz
and launch the automation as Exchange
.
If you would like to change which SID
the Exberry adapter begins counting at for the orderId
calls to Exberry, create a Marketplace.Utils.ExberrySID
contract as the Exchange
party after launching the adapter.