diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..a4a2cd3 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,18 @@ +name: Continuous Integration + +on: + push: + branches: ["main"] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: aiken-lang/setup-aiken@v1 + with: + version: v1.1.5 + - run: aiken fmt --check + - run: aiken check -D + - run: aiken build diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff7811b --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# Aiken compilation artifacts +artifacts/ +# Aiken's project working directory +build/ +# Aiken's default documentation export +docs/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..9b89532 --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +# primitive-types + +Write validators in the `validators` folder, and supporting functions in the `lib` folder using `.ak` as a file extension. + +```aiken +validator my_first_validator { + spend(_datum: Option, _redeemer: Data, _output_reference: Data, _context: Data) { + True + } +} +``` + +## Building + +```sh +aiken build +``` + +## Configuring + +**aiken.toml** +```toml +[config.default] +network_id = 41 +``` + +Or, alternatively, write conditional environment modules under `env`. + +## Testing + +You can write tests in any module using the `test` keyword. For example: + +```aiken +use config + +test foo() { + config.network_id + 1 == 42 +} +``` + +To run all tests, simply do: + +```sh +aiken check +``` + +To run only tests matching the string `foo`, do: + +```sh +aiken check -m foo +``` + +## Documentation + +If you're writing a library, you might want to generate an HTML documentation for it. + +Use: + +```sh +aiken docs +``` + +## Resources + +Find more on the [Aiken's user manual](https://aiken-lang.org). diff --git a/aiken.lock b/aiken.lock new file mode 100644 index 0000000..21e7fb4 --- /dev/null +++ b/aiken.lock @@ -0,0 +1,15 @@ +# This file was generated by Aiken +# You typically do not need to edit this file + +[[requirements]] +name = "aiken-lang/stdlib" +version = "v2.1.0" +source = "github" + +[[packages]] +name = "aiken-lang/stdlib" +version = "v2.1.0" +requirements = [] +source = "github" + +[etags] diff --git a/aiken.toml b/aiken.toml new file mode 100644 index 0000000..7ef73fc --- /dev/null +++ b/aiken.toml @@ -0,0 +1,18 @@ +name = "maxalexweber1/primitive-types" +version = "0.0.0" +compiler = "v1.1.5" +plutus = "v3" +license = "Apache-2.0" +description = "Aiken contracts for project 'maxalexweber1/primitive-types'" + +[repository] +user = "maxalexweber1" +project = "primitive-types" +platform = "github" + +[[dependencies]] +name = "aiken-lang/stdlib" +version = "v2.1.0" +source = "github" + +[config] diff --git a/lib/primitives.ak b/lib/primitives.ak new file mode 100644 index 0000000..2389802 --- /dev/null +++ b/lib/primitives.ak @@ -0,0 +1,19 @@ +use cardano/assets.{Lovelace} + +test integer() { + let i: Int = 5 + let n = 6 + + let ada: Lovelace = 2_000_000 + + // 1 ADA = 1Mio Lovelance + let h = 0xff + + // + and { + i == 5, + n == 6, + ada == 2_000_000, + h == 0xff, + } +}