Skip to content

Commit

Permalink
feat: add token section
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Nov 12, 2024
1 parent a1d46aa commit 545df24
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion HelloWorld/juvix.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Do not edit this file manually.

version: 2
checksum: bf6d9cde1d381ef43acf3f7c3d7a7be76f6e3c51c741f9be1e465568c211bf5a
checksum: 7e1503c9e6c5f62bedadd6b6637bc55e25372a26fe9628bbf5f4026fd1ad34a5
dependencies:
- git:
name: anoma_juvix-stdlib
Expand Down
33 changes: 31 additions & 2 deletions Material/1_Learn-Anoma-Apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,25 @@ The [**Anoma Resource Machine** (ARM)](#resource-machine) is a virtual machine b
## Applications

Applications consist of application state and logic.

- State is modelled as resources and the data they contain
- Logic is modelled as resource logic functions expressing the predicates required for a resource to be created and consumed

Accordingly, resources and corresponding **resource logic functions** constitute the **application backend**.

Instead of creating and consuming resources and providing all data required in the transaction object directly and manually, users interact with an **application interface**.

<details><summary><b>Interface details</b></summary>

The interface consists of

- Transaction function (the application write interface)
- Outputs a transaction object
- Example: Transfer of a resource to a new owner.
- Projection functions (the application read interface)
- Outputs meanigful data projected from the state
- Outputs meaningful data projected from the state
- Example: The total quantity of resources of specific kind owned by an identity


```mermaid
flowchart TB
subgraph Application
Expand All @@ -225,3 +228,29 @@ flowchart TB
Backend --"read"--> Interface
Interface --"write"--> Backend
```

</details>

### Kudos Token

Accounting primitive for applications

#### Feature Set

- Identifiers (name, symbol, decimals)
- Orignator
- Can initially create new quantities of this kind/
- Supply
- Fixed: The total quantity of resources of this kind is fixed. Resources can still be split and merged.
- Capped: Upper bound on the total quantity. Originator cannot create more than this limit. Owners can burn tokens,
- Unbound: Originator can inflate the supply.
- Transferability
- Transferable: Your normal token (ERC-20, NFT)
- Non-transferable: Soulbound token (SBT)

#### `Token` Implementation

- Resource Label: [1](https://github.com/anoma/anoma-applib/blob/a6c4993f203d759051ef4a31c0c6c7fde0a9e9a2/Applib/Token/Label.juvix#L8-L16),[2](../HelloWorld/.juvix-build/0.6.8/deps/c4c0b1e74196bd1135c8ea27b48f6756d7ec7aa8f5388511e02d6401d1f1c407/Applib/Token/Label.juvix)
- Resource Logic Function: [1](https://github.com/anoma/anoma-applib/blob/a6c4993f203d759051ef4a31c0c6c7fde0a9e9a2/Applib/Token/Logic.juvix#L13-L23),[2](../HelloWorld/.juvix-build/0.6.8/deps/c4c0b1e74196bd1135c8ea27b48f6756d7ec7aa8f5388511e02d6401d1f1c407/Applib/Token/Logic.juvix)
- Transaction functions (write interface): [1](https://github.com/anoma/anoma-applib/blob/a6c4993f203d759051ef4a31c0c6c7fde0a9e9a2/Applib/Transaction),[2](../HelloWorld/.juvix-build/0.6.8/deps/c4c0b1e74196bd1135c8ea27b48f6756d7ec7aa8f5388511e02d6401d1f1c407/Applib/Transaction)
- Projection functions (read interface): [1](https://github.com/anoma/anoma-applib/blob/a6c4993f203d759051ef4a31c0c6c7fde0a9e9a2/Applib/Projection/TotalQuantity.juvix#L9-L12),[2](../HelloWorld/.juvix-build/0.6.8/deps/c4c0b1e74196bd1135c8ea27b48f6756d7ec7aa8f5388511e02d6401d1f1c407/Applib/Projection/TotalQuantity.juvix)

0 comments on commit 545df24

Please sign in to comment.