|
1 |
| -# staking |
2 |
| - |
3 |
| -Write validators in the `validators` folder, and supporting functions in the `lib` folder using `.ak` as a file extension. |
4 |
| - |
5 |
| -For example, as `validators/always_true.ak` |
6 |
| - |
7 |
| -```gleam |
8 |
| -validator { |
9 |
| - fn spend(_datum: Data, _redeemer: Data, _context: Data) -> Bool { |
10 |
| - True |
11 |
| - } |
12 |
| -} |
13 |
| -``` |
14 |
| - |
15 |
| -## Building |
16 |
| - |
17 |
| -```sh |
18 |
| -aiken build |
19 |
| -``` |
20 |
| - |
21 |
| -## Testing |
22 |
| - |
23 |
| -You can write tests in any module using the `test` keyword. For example: |
24 |
| - |
25 |
| -```gleam |
26 |
| -test foo() { |
27 |
| - 1 + 1 == 2 |
28 |
| -} |
29 |
| -``` |
30 |
| - |
31 |
| -To run all tests, simply do: |
32 |
| - |
33 |
| -```sh |
34 |
| -aiken check |
35 |
| -``` |
36 |
| - |
37 |
| -To run only tests matching the string `foo`, do: |
38 |
| - |
39 |
| -```sh |
40 |
| -aiken check -m foo |
41 |
| -``` |
42 |
| - |
43 |
| -## Documentation |
44 |
| - |
45 |
| -If you're writing a library, you might want to generate an HTML documentation for it. |
46 |
| - |
47 |
| -Use: |
48 |
| - |
49 |
| -```sh |
50 |
| -aiken docs |
51 |
| -``` |
52 |
| - |
53 |
| -## Resources |
54 |
| - |
55 |
| -Find more on the [Aiken's user manual](https://aiken-lang.org). |
| 1 | +# Staking |
| 2 | + |
| 3 | +This repository contains the `staker` stake validator. The validator supports |
| 4 | +the following actions: |
| 5 | + |
| 6 | +- `Initialize`: This action is used to initialize the staking process. This |
| 7 | + mints a one time NFT that has an empty token name to store with the staking |
| 8 | + state datum. This allows the minting of one receipt token. |
| 9 | +- `Delegate`: This action allows a user to delegate their stake to a validator. |
| 10 | + This requires spending the token created in initialize and satisfying the |
| 11 | + datum condition in addition to being the datum owner. This allows for the |
| 12 | + minting of one receipt token. |
| 13 | +- `Withdraw`: This action allows a user to withdraw their stake from a |
| 14 | + validator. The use can prove they are the owner either by spending the init |
| 15 | + NFT or referencing it and proving being the datum owner. |
| 16 | +- `Close`: This action is used to close the staking process. This requires |
| 17 | + spending the token created in initialize and satisfying the datum condition in |
| 18 | + addition to being the datum owner. |
| 19 | + |
| 20 | +This validator has no redeemers and uses the existence or lack of existence of |
| 21 | +mints, inputs, delegation, and withdraws to validate various actions. |
| 22 | + |
| 23 | +For more details on how these actions work, please refer to the `staker.ak` file |
| 24 | +in the `validators` directory. |
0 commit comments