Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0efe4d5
Add aiken tooling and example
j-mueller Apr 20, 2025
5e05809
Generate blueprint from aiken, load blueprint in haskell
j-mueller Apr 20, 2025
13e1ed4
Add nix cache
j-mueller Apr 20, 2025
e1c742a
Scaffolding
j-mueller Apr 20, 2025
806d0d5
Deserialise; failing test
j-mueller Apr 21, 2025
c51cf1b
WIP registration
j-mueller Apr 25, 2025
a6ba9da
WIP build tx
j-mueller May 15, 2025
72585e2
Implement registration
j-mueller Jul 21, 2025
59df190
Add query function for registry node
j-mueller Jul 21, 2025
45e18ac
Use Query.registryNodes where possible
j-mueller Jul 21, 2025
64cb031
Move some testing functions to test-lib
j-mueller Jul 22, 2025
8eb9ae4
WIP testlib
j-mueller Jul 23, 2025
c3c8ed0
Update folder and module structure
j-mueller Jul 24, 2025
e1317ab
Move some modules to programmable-tokens-test and -offchain
j-mueller Jul 24, 2025
4cd151b
Move some functions to programmable-tokens-offchain
j-mueller Jul 25, 2025
c1f2b47
Separate blacklist logic from transfer logic
j-mueller Jul 27, 2025
94284bc
Move some queries to programmable-tokens-offchain
j-mueller Jul 27, 2025
fdf1d0f
Move more queries over
j-mueller Jul 27, 2025
4404ea6
Fix argument duplication in register tx
j-mueller Jul 29, 2025
eb7a46d
Move some code around
j-mueller Jul 29, 2025
11be33a
Updates
j-mueller Aug 4, 2025
77aeec5
Fix tests
j-mueller Aug 5, 2025
394c372
Move some tests over to programmable-token-tests
j-mueller Aug 5, 2025
1096e69
Clean up some testing code
j-mueller Aug 5, 2025
9dc052b
Always-succeeds test
j-mueller Aug 6, 2025
a115d3d
Address compiler warnings
j-mueller Aug 6, 2025
b75ef46
Aiken policy registration test passing
j-mueller Aug 7, 2025
e7406e1
Cleanup
j-mueller Aug 7, 2025
0310b91
Add transfer incl. redeemer
j-mueller Aug 7, 2025
4ebaf6f
Two different validators for withdrawing and minting
j-mueller Aug 7, 2025
49f9faf
Add CLI excetubale
j-mueller Aug 7, 2025
3d3f205
Preview network deployment
j-mueller Aug 8, 2025
19b7827
Implement register command
j-mueller Aug 9, 2025
154e00a
Implement issue endpoint
j-mueller Aug 9, 2025
eb44799
Fix tests
j-mueller Aug 9, 2025
702c208
Add a --dry-run flag
j-mueller Aug 9, 2025
01a1dd4
Add tx-vis script
j-mueller Aug 9, 2025
616d34a
Finishing touches
j-mueller Aug 10, 2025
6ed1e4b
Update README
j-mueller Aug 10, 2025
b795a99
Fix some compiler warnings
j-mueller Aug 10, 2025
02edd4f
Update generated files
j-mueller Aug 10, 2025
c2e31fe
Fix container
j-mueller Aug 10, 2025
89b5393
Fix CI command
j-mueller Aug 10, 2025
e71f8b5
accept flake config
j-mueller Aug 10, 2025
bb606d7
Build cip-143-cli container
j-mueller Aug 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci-compiled-scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:

- name: Install system dependencies
uses: input-output-hk/actions/base@latest

- name: Install nix
uses: cachix/install-nix-action@v27


- uses: haskell-actions/setup@v2
id: cabal-setup
Expand All @@ -39,13 +43,13 @@ jobs:
- name: build & test
run: |
cabal update
cabal build -j all --enable-tests
cabal test all
cabal build -j all
- name: check compiled scripts are consistent
# git diff --quiet implies --exit-code
run: |
cabal run export-smart-tokens ./generated/scripts/unapplied
cabal run export-smart-tokens ./generated/scripts/preview 08a8d0bb8717839931b0a594f7c28b0a3b7c78f6e9172e977e250eab7637d879.0 08a8d0bb8717839931b0a594f7c28b0a3b7c78f6e9172e977e250eab7637d879.0 '"addr_test1qq986m3uel86pl674mkzneqtycyg7csrdgdxj6uf7v7kd857kquweuh5kmrj28zs8czrwkl692jm67vna2rf7xtafhpqk3hecm"'
cabal run export-smart-tokens ./generated/scripts/mainnet b1977c1eb33590ca1311384ab68cd36209832213ad4483feb8a1b7cb64828946.0 b1977c1eb33590ca1311384ab68cd36209832213ad4483feb8a1b7cb64828946.0 '"addr_test1qq986m3uel86pl674mkzneqtycyg7csrdgdxj6uf7v7kd857kquweuh5kmrj28zs8czrwkl692jm67vna2rf7xtafhpqk3hecm"'
cabal run write-openapi-schema -- generated/openapi/schema.json
nix develop --accept-flake-config --command bash -c "aiken build src/examples/aiken/aiken --out ./src/examples/aiken/haskell/data/aiken-scripts.json"
git diff --quiet
8 changes: 6 additions & 2 deletions .github/workflows/ci-nix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ jobs:
# key: cabal-${{ hashFiles('cabal.project') }}

# We currently do not have a default target
- name: nix build wst-poc client application
run: nix build --accept-flake-config .#wst-poc-cli
- name: nix build command-line apps
run: |
nix build --accept-flake-config .#cip-143-cli
nix build --accept-flake-config .#regulated-stablecoin-cli
- name: nix flake check
run: nix flake --accept-flake-config check
- name: Check aiken
run: nix develop --accept-flake-config --command bash -c "cd src/examples/aiken/aiken && aiken build && aiken check"
2 changes: 1 addition & 1 deletion .github/workflows/ci-oci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
tests:
strategy:
matrix:
image: [wst]
image: [wst, cip-143-cli]
runs-on: ubuntu-latest
steps:

Expand Down
41 changes: 33 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
# CIP-0143 and programmable token POC
# CIP-143 reference implementation and examples

This is a proof-of-concept for _WST_, a programmable token with freeze and seize capabilities, based on [CIP-0143](https://github.com/colll78/CIPs/blob/patch-3/CIP-0143/README.md). The programmable logic of _WST_ checks whether the target address is blacklisted before allowing a transfer of the programmable token from one owner to another.
This repository contains a reference implementation of [CIP-143](https://github.com/colll78/CIPs/blob/patch-3/CIP-0143/README.md).
The CIP describes a registry of token standards around programmable assets, and some conventions for Cardano addresses that hold programmable assets.

## CLI

`cip-143-cli` is a tool for registering CIP-143 policies and for issuing and transfering tokens.

### CLI Commands

* `deploy` deploys a new instance of the CIP-143 registry
* `policy` offers a number of commands for managing CIP-143 policies. All sub-commands of `policy` require a blueprint JSON file with the minting and transfer scripts.
* `register` registers the stake scripts that are used by the policy
* `issue` mints a number of programmable assets
* `transfer` sends programmable assets to another account
* `info` prints some information on the policies

### Blueprint format

The `policy` command expectes a blueprint JSON file.
The blueprint should have two validators called `transfer.issue.withdraw` and `transfer.transfer.withdraw`.
The validators will be called as reward withdrawal validators.

## Freeze-and-seize stablecoin

There is a proof-of-concept for _WST_ a programmable token with freeze and seize capabilities, based on [CIP-0143](https://github.com/colll78/CIPs/blob/patch-3/CIP-0143/README.md). The programmable logic of _WST_ checks whether the target address is blacklisted before allowing a transfer of the programmable token from one owner to another.

![Screenshot of the UI showing the minting authority.](image-1.png)

Expand All @@ -18,18 +42,19 @@ See [doc/architecture.md](doc/architecture.md)

This repository contains
* Prototype implementation of CIP-0143 in Plutarch (see `src/programmable-tokens`)
* `cip-143-cli`, a command-line tool for deploying and managing CIP-143 compliant policies
* Prototype implementation of _WST_, a programmable token with freeze-and-seize capbilities, in Plutarch (see `src/regulated-stablecoin`)
* Transaction building code for initial deployment, minting programmable tokens, transferring programmable tokens, adding addresses to the blacklist (ie. freezing), and seizing funds from blacklisted addresses. Based on sc-tools and cardano-api.
* Emulator tests for the nominal cases (happy path) based on the actual ledger implementation and mainnet protocol parameters.
* A user interface that implements the use cases using browser-based wallets. Based on next.js and lucid.
* An OCI container image with the on-chain code, the off-chain code and the UI
* Transaction building code for initial deployment, minting programmable tokens, transferring programmable tokens, adding addresses to the blacklist (ie. freezing), and seizing funds from blacklisted addresses. Based on sc-tools and cardano-api.
* Emulator tests for the nominal cases (happy path) based on the actual ledger implementation and mainnet protocol parameters.
* A user interface that implements the use cases using browser-based wallets. Based on next.js and lucid.
* An OCI container image with the on-chain code, the off-chain code and the UI

### Using the Freeze-and-seize stablecoin example

With the container image it is possible to run the complete system locally with just a single command.
There is no need to install the build toolchain or to operate a cardano node or related infrastructure.
The image can even be used to interact with existing deployments of the POC.

# Usage

The easiest way to get started is by running the [wst](https://github.com/input-output-hk/wsc-poc/pkgs/container/wst) image locally:

```bash
Expand Down
10 changes: 6 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ allow-older:
-- TODO: Delete when plutarch is moving to 1.37
plutarch:plutus-core


with-compiler: ghc-9.6.6

packages:
src/programmable-tokens
src/regulated-stablecoin

src/programmable-tokens-onchain
src/programmable-tokens-offchain
src/programmable-tokens-test
src/examples/regulated-stablecoin
src/examples/aiken/haskell

source-repository-package
type: git
Expand All @@ -53,6 +54,7 @@ source-repository-package
src/base
src/node-client
src/blockfrost
src/tx-mod

source-repository-package
type: git
Expand Down
6 changes: 6 additions & 0 deletions deploy-registry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/bash

export CIP_143_BLOCKFROST_TOKEN=preview1F0TvMF5VAk70b5YPiR20njoEG9ByGjf

cabal run cip-143-cli -- deploy --signing-key-file=preview-network/operator.sk \
preview-network/preview_script_root.json
1 change: 0 additions & 1 deletion deployment-root.json

This file was deleted.

Loading
Loading