PBG Token contract validators for Cardano, written in Helios
This is a mono-repo which contains 3 packages:
- root package with Helios code
testpackage with Javascript unit teststest/contextpackage with context configuration needed by unit tests
Run npm install first.
Running npm run build in the root package creates a Javascript bundle with Typescript definitions in ./dist/.
The generated JS/TS bundle contains all the validators, and user-defined types and data-functions used by those validators. This makes it easy to interact with the smart contract from within JS/TS.
- use VSCode to look at the .hl files inside
./src - install the Helios IDE plugin through the VSCode Extensions tab
- search for "Helios"
- the description of the plugin should read "Helios language support for VS Code"
- run
npm installinside the repo so the IDE plugin can pick up the correct version of the compiler
The unit tests are placed in the ./test directory, and can be run with npm test.
The unit tests require another build step which applies parameters and creates a test context bundle.
The test context bundle is placed in ./test/context/dist and can be imported via the name "pbg-token-validators-test-context".
The test context bundle contains serialized UPLC programs for each validator and each user-defined function, as well as utility functions for converting JS/TS values into UplcData instances.
First make sure the JS/TS definitions of the DVP smart contract are built:
$ npm install
$ npm run buildThen build the test context, which will use dummy parameters to create final runable UPLC programs:
$ cd ./test/context
$ npm run buildThis could take a few minutes as UPLC programs for all smart contract functions are also generated.
You will find the serialized (CBOR hex) results in test/context/dist/index.mjs, by searching for "optimizedCborHex" and "unoptimizedCborHex".