Skip to content

Commit

Permalink
migrate v3 and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jinglescode committed Sep 8, 2024
1 parent f4e3665 commit 314fab5
Show file tree
Hide file tree
Showing 42 changed files with 899 additions and 307 deletions.
2 changes: 2 additions & 0 deletions aiken-giftcard/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BLOCKFROST_API_KEY=preprodxxxxxxxx
MNEMONIC="solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution,solution"
2 changes: 2 additions & 0 deletions aiken-giftcard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Aiken Giftcard Example

6 changes: 6 additions & 0 deletions aiken-giftcard/aiken-workspace/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Aiken compilation artifacts
artifacts/
# Aiken's project working directory
build/
# Aiken's default documentation export
docs/
27 changes: 27 additions & 0 deletions aiken-giftcard/aiken-workspace/aiken.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file was generated by Aiken
# You typically do not need to edit this file

[[requirements]]
name = "aiken-lang/stdlib"
version = "v2"
source = "github"

[[requirements]]
name = "sidan-lab/vodka"
version = "0.1.0-beta"
source = "github"

[[packages]]
name = "aiken-lang/stdlib"
version = "v2"
requirements = []
source = "github"

[[packages]]
name = "sidan-lab/vodka"
version = "0.1.0-beta"
requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1725599208, nanos_since_epoch = 36586000 }, "d79382d2b6ecb3aee9b0755c31d8a5bbafe88a7b3706d7fb8a52fd4d05818501"]
23 changes: 23 additions & 0 deletions aiken-giftcard/aiken-workspace/aiken.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name = "meshjs/giftcard"
version = "0.0.0"
compiler = "v1.1.0"
plutus = "v3"
license = "Apache-2.0"
description = "Aiken contracts for project 'meshjs/giftcard'"

[repository]
user = "meshjs"
project = "giftcard"
platform = "github"

[[dependencies]]
name = "aiken-lang/stdlib"
version = "v2"
source = "github"

[[dependencies]]
name = "sidan-lab/vodka"
version = "0.1.0-beta"
source = "github"

[config]
159 changes: 159 additions & 0 deletions aiken-giftcard/aiken-workspace/plutus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"preamble": {
"title": "meshjs/giftcard",
"description": "Aiken contracts for project 'meshjs/giftcard'",
"version": "0.0.0",
"plutusVersion": "v3",
"compiler": {
"name": "Aiken",
"version": "v1.1.0+unknown"
},
"license": "Apache-2.0"
},
"validators": [
{
"title": "oneshot.gift_card.mint",
"redeemer": {
"title": "rdmr",
"schema": {
"$ref": "#/definitions/oneshot~1Action"
}
},
"parameters": [
{
"title": "token_name",
"schema": {
"$ref": "#/definitions/ByteArray"
}
},
{
"title": "utxo_ref",
"schema": {
"$ref": "#/definitions/cardano~1transaction~1OutputReference"
}
}
],
"compiledCode": "5901ae01010032323232323232232225333005323232323253323300b3001300c3754004264646464a66601e600a0022a66602460226ea801c540085854ccc03cc00c00454ccc048c044dd50038a8010b0b18079baa006132323232533301430170021323253330133009301437540162a666026601260286ea8c8cc004004018894ccc0600045300103d87a80001323253330173375e603860326ea80080504cdd2a40006603600497ae0133004004001301c002301a00115333013300700113371e00402229405854ccc04ccdc3800a4002266e3c0080445281bad3014002375c60240022c602a00264a666020600860226ea800452f5bded8c026eacc054c048dd500099198008009bab3015301630163016301600322533301400114c103d87a80001323232325333015337220140042a66602a66e3c0280084cdd2a4000660326e980052f5c02980103d87a80001330060060033756602c0066eb8c050008c060008c058004dd6180980098079baa007370e90011bae3010300d37540046e1d200016300e300f002300d001300d002300b0013007375400229309b2b1bae0015734aae7555cf2ab9f5740ae855d11",
"hash": "401c967008d42885400991f9225715e1c3a8e43757b1fd36a1328195"
},
{
"title": "oneshot.gift_card.else",
"parameters": [
{
"title": "token_name",
"schema": {
"$ref": "#/definitions/ByteArray"
}
},
{
"title": "utxo_ref",
"schema": {
"$ref": "#/definitions/cardano~1transaction~1OutputReference"
}
}
],
"compiledCode": "5901ae01010032323232323232232225333005323232323253323300b3001300c3754004264646464a66601e600a0022a66602460226ea801c540085854ccc03cc00c00454ccc048c044dd50038a8010b0b18079baa006132323232533301430170021323253330133009301437540162a666026601260286ea8c8cc004004018894ccc0600045300103d87a80001323253330173375e603860326ea80080504cdd2a40006603600497ae0133004004001301c002301a00115333013300700113371e00402229405854ccc04ccdc3800a4002266e3c0080445281bad3014002375c60240022c602a00264a666020600860226ea800452f5bded8c026eacc054c048dd500099198008009bab3015301630163016301600322533301400114c103d87a80001323232325333015337220140042a66602a66e3c0280084cdd2a4000660326e980052f5c02980103d87a80001330060060033756602c0066eb8c050008c060008c058004dd6180980098079baa007370e90011bae3010300d37540046e1d200016300e300f002300d001300d002300b0013007375400229309b2b1bae0015734aae7555cf2ab9f5740ae855d11",
"hash": "401c967008d42885400991f9225715e1c3a8e43757b1fd36a1328195"
},
{
"title": "oneshot.redeem.spend",
"datum": {
"title": "_d",
"schema": {
"$ref": "#/definitions/Data"
}
},
"redeemer": {
"title": "_r",
"schema": {
"$ref": "#/definitions/Data"
}
},
"parameters": [
{
"title": "token_name",
"schema": {
"$ref": "#/definitions/ByteArray"
}
},
{
"title": "policy_id",
"schema": {
"$ref": "#/definitions/ByteArray"
}
}
],
"compiledCode": "59011501010032323232323232232232253330063232323232533300b3370e900118061baa001132323232325333013301600213253330113370e6eb4c04c009200113371e00201e2940dd718088008b180a00099299980799b8748008c040dd50008a5eb7bdb1804dd5980a18089baa001323300100137566028602a602a602a602a60226ea8020894ccc04c004530103d87a80001323232325333014337220200042a66602866e3c0400084cdd2a4000660306e980052f5c02980103d87a80001330060060033756602a0066eb8c04c008c05c008c054004c048c04c008c044004c034dd50008b1807980800118070009807001180600098041baa00114984d958dd70009bae0015734aae7555cf2ab9f5740ae855d101",
"hash": "b2386630f1b210c58d0e46f132e931b362c3f373685118018e4d956f"
},
{
"title": "oneshot.redeem.else",
"parameters": [
{
"title": "token_name",
"schema": {
"$ref": "#/definitions/ByteArray"
}
},
{
"title": "policy_id",
"schema": {
"$ref": "#/definitions/ByteArray"
}
}
],
"compiledCode": "59011501010032323232323232232232253330063232323232533300b3370e900118061baa001132323232325333013301600213253330113370e6eb4c04c009200113371e00201e2940dd718088008b180a00099299980799b8748008c040dd50008a5eb7bdb1804dd5980a18089baa001323300100137566028602a602a602a602a60226ea8020894ccc04c004530103d87a80001323232325333014337220200042a66602866e3c0400084cdd2a4000660306e980052f5c02980103d87a80001330060060033756602a0066eb8c04c008c05c008c054004c048c04c008c044004c034dd50008b1807980800118070009807001180600098041baa00114984d958dd70009bae0015734aae7555cf2ab9f5740ae855d101",
"hash": "b2386630f1b210c58d0e46f132e931b362c3f373685118018e4d956f"
}
],
"definitions": {
"ByteArray": {
"dataType": "bytes"
},
"Data": {
"title": "Data",
"description": "Any Plutus data."
},
"Int": {
"dataType": "integer"
},
"cardano/transaction/OutputReference": {
"title": "OutputReference",
"description": "An `OutputReference` is a unique reference to an output on-chain. The `output_index`\n corresponds to the position in the output list of the transaction (identified by its id)\n that produced that output",
"anyOf": [
{
"title": "OutputReference",
"dataType": "constructor",
"index": 0,
"fields": [
{
"title": "transaction_id",
"$ref": "#/definitions/ByteArray"
},
{
"title": "output_index",
"$ref": "#/definitions/Int"
}
]
}
]
},
"oneshot/Action": {
"title": "Action",
"anyOf": [
{
"title": "Mint",
"dataType": "constructor",
"index": 0,
"fields": []
},
{
"title": "Burn",
"dataType": "constructor",
"index": 1,
"fields": []
}
]
}
}
}
55 changes: 55 additions & 0 deletions aiken-giftcard/aiken-workspace/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# giftcard

Write validators in the `validators` folder, and supporting functions in the `lib` folder using `.ak` as a file extension.

For example, as `validators/always_true.ak`

```gleam
validator {
fn spend(_datum: Data, _redeemer: Data, _context: Data) -> Bool {
True
}
}
```

## Building

```sh
aiken build
```

## Testing

You can write tests in any module using the `test` keyword. For example:

```gleam
test foo() {
1 + 1 == 2
}
```

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).
Loading

0 comments on commit 314fab5

Please sign in to comment.