Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .phrase.prv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
receive company catalog screen erase shallow verb wool asthma bring north average side chunk bulk submit hip spend antique unaware purity right fat someone
Binary file removed cardano-address
Binary file not shown.
7 changes: 2 additions & 5 deletions deno_setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#! /bin/bash
set -euo pipefail

apt-get update
apt-get install unzip -y
curl -fsSL https://deno.land/install.sh | sh
root@codespaces-a48a05:/workspaces/cardano-developer-starter-kit# demo run --allow-all ./lucid1.ts
bash: demo: command not found

18 changes: 18 additions & 0 deletions hello-world/.github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -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.16
- run: aiken fmt --check
- run: aiken check -D
- run: aiken build
6 changes: 6 additions & 0 deletions hello-world/.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/
65 changes: 65 additions & 0 deletions hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# hello-world

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<Data>, _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).
15 changes: 15 additions & 0 deletions hello-world/aiken.lock
Original file line number Diff line number Diff line change
@@ -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.2.0"
source = "github"

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

[etags]
18 changes: 18 additions & 0 deletions hello-world/aiken.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name = "aiken-lang/hello-world"
version = "0.0.0"
compiler = "v1.1.16"
plutus = "v3"
license = "Apache-2.0"
description = "Aiken contracts for project 'aiken-lang/hello-world'"

[repository]
user = "aiken-lang"
project = "hello-world"
platform = "github"

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

[config]
101 changes: 101 additions & 0 deletions hello-world/plutus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"preamble": {
"title": "aiken-lang/hello-world",
"description": "Aiken contracts for project 'aiken-lang/hello-world'",
"version": "0.0.0",
"plutusVersion": "v3",
"compiler": {
"name": "Aiken",
"version": "v1.1.16+23061c0"
},
"license": "Apache-2.0"
},
"validators": [
{
"title": "placeholder.placeholder.mint",
"redeemer": {
"title": "_redeemer",
"schema": {
"$ref": "#/definitions/Data"
}
},
"compiledCode": "58d001010029800aba2aba1aab9eaab9dab9a48888966002646465300130053754003300700398038012444b30013370e9000001c4c98dd7180518049baa0048acc004cdc3a400400713233226300b001300b300c0013009375400915980099b874801000e264c601460126ea80122b30013370e9003001c4c8cc898dd698058009805980600098049baa0048acc004cdc3a40100071326300a3009375400913233226375a60160026016601800260126ea8011007200e401c80390070c018c01c004c018004c00cdd5003452689b2b20021",
"hash": "f2388d136606a27c4a531d0040c3e12e07eb95cd5011793c160707dc"
},
{
"title": "placeholder.placeholder.spend",
"datum": {
"title": "_datum",
"schema": {
"$ref": "#/definitions/Data"
}
},
"redeemer": {
"title": "_redeemer",
"schema": {
"$ref": "#/definitions/Data"
}
},
"compiledCode": "58d001010029800aba2aba1aab9eaab9dab9a48888966002646465300130053754003300700398038012444b30013370e9000001c4c98dd7180518049baa0048acc004cdc3a400400713233226300b001300b300c0013009375400915980099b874801000e264c601460126ea80122b30013370e9003001c4c8cc898dd698058009805980600098049baa0048acc004cdc3a40100071326300a3009375400913233226375a60160026016601800260126ea8011007200e401c80390070c018c01c004c018004c00cdd5003452689b2b20021",
"hash": "f2388d136606a27c4a531d0040c3e12e07eb95cd5011793c160707dc"
},
{
"title": "placeholder.placeholder.withdraw",
"redeemer": {
"title": "_redeemer",
"schema": {
"$ref": "#/definitions/Data"
}
},
"compiledCode": "58d001010029800aba2aba1aab9eaab9dab9a48888966002646465300130053754003300700398038012444b30013370e9000001c4c98dd7180518049baa0048acc004cdc3a400400713233226300b001300b300c0013009375400915980099b874801000e264c601460126ea80122b30013370e9003001c4c8cc898dd698058009805980600098049baa0048acc004cdc3a40100071326300a3009375400913233226375a60160026016601800260126ea8011007200e401c80390070c018c01c004c018004c00cdd5003452689b2b20021",
"hash": "f2388d136606a27c4a531d0040c3e12e07eb95cd5011793c160707dc"
},
{
"title": "placeholder.placeholder.publish",
"redeemer": {
"title": "_redeemer",
"schema": {
"$ref": "#/definitions/Data"
}
},
"compiledCode": "58d001010029800aba2aba1aab9eaab9dab9a48888966002646465300130053754003300700398038012444b30013370e9000001c4c98dd7180518049baa0048acc004cdc3a400400713233226300b001300b300c0013009375400915980099b874801000e264c601460126ea80122b30013370e9003001c4c8cc898dd698058009805980600098049baa0048acc004cdc3a40100071326300a3009375400913233226375a60160026016601800260126ea8011007200e401c80390070c018c01c004c018004c00cdd5003452689b2b20021",
"hash": "f2388d136606a27c4a531d0040c3e12e07eb95cd5011793c160707dc"
},
{
"title": "placeholder.placeholder.vote",
"redeemer": {
"title": "_redeemer",
"schema": {
"$ref": "#/definitions/Data"
}
},
"compiledCode": "58d001010029800aba2aba1aab9eaab9dab9a48888966002646465300130053754003300700398038012444b30013370e9000001c4c98dd7180518049baa0048acc004cdc3a400400713233226300b001300b300c0013009375400915980099b874801000e264c601460126ea80122b30013370e9003001c4c8cc898dd698058009805980600098049baa0048acc004cdc3a40100071326300a3009375400913233226375a60160026016601800260126ea8011007200e401c80390070c018c01c004c018004c00cdd5003452689b2b20021",
"hash": "f2388d136606a27c4a531d0040c3e12e07eb95cd5011793c160707dc"
},
{
"title": "placeholder.placeholder.propose",
"redeemer": {
"title": "_redeemer",
"schema": {
"$ref": "#/definitions/Data"
}
},
"compiledCode": "58d001010029800aba2aba1aab9eaab9dab9a48888966002646465300130053754003300700398038012444b30013370e9000001c4c98dd7180518049baa0048acc004cdc3a400400713233226300b001300b300c0013009375400915980099b874801000e264c601460126ea80122b30013370e9003001c4c8cc898dd698058009805980600098049baa0048acc004cdc3a40100071326300a3009375400913233226375a60160026016601800260126ea8011007200e401c80390070c018c01c004c018004c00cdd5003452689b2b20021",
"hash": "f2388d136606a27c4a531d0040c3e12e07eb95cd5011793c160707dc"
},
{
"title": "placeholder.placeholder.else",
"redeemer": {
"schema": {}
},
"compiledCode": "58d001010029800aba2aba1aab9eaab9dab9a48888966002646465300130053754003300700398038012444b30013370e9000001c4c98dd7180518049baa0048acc004cdc3a400400713233226300b001300b300c0013009375400915980099b874801000e264c601460126ea80122b30013370e9003001c4c8cc898dd698058009805980600098049baa0048acc004cdc3a40100071326300a3009375400913233226375a60160026016601800260126ea8011007200e401c80390070c018c01c004c018004c00cdd5003452689b2b20021",
"hash": "f2388d136606a27c4a531d0040c3e12e07eb95cd5011793c160707dc"
}
],
"definitions": {
"Data": {
"title": "Data",
"description": "Any Plutus data."
}
}
}
40 changes: 40 additions & 0 deletions hello-world/validators/placeholder.ak
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use cardano/address.{Credential}
use cardano/assets.{PolicyId}
use cardano/certificate.{Certificate}
use cardano/governance.{ProposalProcedure, Voter}
use cardano/transaction.{Transaction, OutputReference}

use aiken/primitive/string
use cardano/transaction.{OutputReference, Transaction}

pub type Redeemer {
msg: ByteArray,
}

validator alwayssuccess {
spend(
_datum: Option<Data>,
redeemer: Redeemer,
_utxo: OutputReference,
_self: Transaction,
) {
// ctx: ScriptContext,
trace @"redeemer": string.from_bytearray(redeemer.msg)
let a = True
a?
}

else(_) {
fail
}
}
// // If needs be, remove any of unneeded handlers above, and use:
//
// else(_ctx: ScriptContext) {
// todo @"fallback logic if none of the other purposes match"
// }
//
// // You will also need an additional import:
// //
// // use cardano/script_context.{ScriptContext}

2 changes: 1 addition & 1 deletion labs/lab01/keygen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cardano-cli key verification-key --signing-key-file stake.skey \
# cardano-address key hash < stake.xvk > stake.vkh
# cardano-address address delegation $(cat stake.vkh) < payment.addr > base.addr

cardano-cli address build --testnet-magic 2 \
cardano-cli conway address build --testnet-magic 2 \
--payment-verification-key-file payment.xvk \
--stake-verification-key-file stake.xvk \
--out-file base.addr
Expand Down
4 changes: 2 additions & 2 deletions labs/lab02/simple_tx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ cardano-cli query utxo $testnet --address $address

#chỉnh sửa lại giá trị các biến
BOB_ADDR="addr_test1qz8shh6wqssr83hurdmqx44js8v7tglg9lm3xh89auw007dd38kf3ymx9c2w225uc7yjmplr794wvc96n5lsy0wsm8fq9n5epq"
VALUE=1000000
VALUE=2000000

UTXO_IN=cccfd8642e237ea1d7465a42d3851d1a7902ba9abb9fab46b1b12b69df02ef4b#2
UTXO_IN=21dd41ec497ed5aee3712199d6abb2be8c438108768f69f355bdf72698eadc3e#5

# B1. Xây dựng giao dịch (Build Tx)

Expand Down
Loading