Skip to content

Commit

Permalink
docs: standard specs boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
HinsonSIDAN committed Apr 4, 2024
1 parent f2b18e2 commit b4432ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 46 deletions.
63 changes: 18 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,28 @@
# aiken-poker-game

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

For example, as `validators/always_true.ak`
### Parameter

```gleam
validator {
fn spend(_datum: Data, _redeemer: Data, _context: Data) -> Bool {
True
}
}
```
- `xxxxxxxxxx`: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
- `xxxxxxxxxxxxxx`: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- `xxxxxxxxxxxxx`: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- `xxxxxxxx`: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

## Building
### Datum

```sh
aiken build
```
- `xxxxxxxxxx`: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
- `xxxxxxxxxxxxxx`: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- `xxxxxxxxxxxxx`: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- `xxxxxxxx`: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

## Testing
### User Action

You can write tests in any module using the `test` keyword. For example:
1. A player join the table - Redeemer `JoinTable`

```gleam
test foo() {
1 + 1 == 2
}
```
- Check 1
- Check 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).
2. A player leave the table - Redeemer `LeaveTable`
- Check 1
- Check 2
3 changes: 2 additions & 1 deletion validators/poker_game.ak
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ validator(fee_collector: Address) {
}
LeaveTable { player_to_remove } -> {
let is_player_removed = False
let is_money_returned = False

is_player_removed
is_player_removed && is_money_returned
}
}
}
Expand Down

0 comments on commit b4432ed

Please sign in to comment.