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
36 changes: 36 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ members = [
"programs/stablecoin/core",
"programs/stablecoin",
"programs/stablecoin/methods",
"programs/token_mint_authority/core",
"programs/token_mint_authority",
"programs/token_mint_authority/methods",
"programs/integration_tests",
"tools/idl-gen",
"tools/risc0-packager",
Expand All @@ -26,6 +29,7 @@ exclude = [
"programs/amm/methods/guest",
"programs/ata/methods/guest",
"programs/stablecoin/methods/guest",
"programs/token_mint_authority/methods/guest",
"programs/twap_oracle/methods/guest",
# Cycle benchmarks: standalone crate, kept out of --workspace builds/tests/CI. Run on demand
# with `cargo test --manifest-path programs/benchmark/Cargo.toml -- --ignored --nocapture`.
Expand All @@ -46,6 +50,8 @@ twap_oracle_core = { path = "programs/twap_oracle/core" }
twap_oracle_program = { path = "programs/twap_oracle" }
stablecoin_core = { path = "programs/stablecoin/core" }
stablecoin_program = { path = "programs/stablecoin" }
token_mint_authority_core = { path = "programs/token_mint_authority/core" }
token_mint_authority_program = { path = "programs/token_mint_authority" }
serde = { version = "1.0", features = ["derive"] }
borsh = { version = "1.5", features = ["derive"] }
risc0-zkvm = { version = "=3.0.5" }
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Essential programs for the **Logos Execution Zone (LEZ)** — a zkVM-based execu
| **ata** | Associated Token Account program — derives and initializes deterministic token holding accounts for a given owner and token definition |
| **stablecoin** | Collateral-backed position program — open collateral positions as a foundation for stablecoin debt issuance |
| **twap_oracle** | TWAP oracle — provides canonical on-chain price accounts consumed by other programs (e.g. stablecoin) |
| **token-mint-authority** | Testnet faucet mint authority — holds the mint authority for faucet token definitions and lets any account self-mint a fixed amount, rate-limited to once per day per account and token, via a chained call to the token program |

## Apps

Expand Down Expand Up @@ -76,7 +77,7 @@ make clippy
make fmt

# Run unit tests for all programs (no zkVM, no ZK proof generation)
RISC0_DEV_MODE=1 cargo test -p token_program -p amm_program -p ata_program -p stablecoin_program -p twap_oracle_program
RISC0_DEV_MODE=1 cargo test -p token_program -p amm_program -p ata_program -p stablecoin_program -p twap_oracle_program -p token_mint_authority_program

# Run integration tests (dev mode skips ZK proof generation)
RISC0_DEV_MODE=1 cargo test -p integration_tests
Expand All @@ -85,13 +86,15 @@ RISC0_DEV_MODE=1 cargo test -p integration_tests
make test
```

Integration tests live in `programs/integration_tests/tests/` and cover `token`, `amm`, and `ata` programs end-to-end through the zkVM using `RISC0_DEV_MODE=1` to skip proof generation. Each test file corresponds to a program:
Integration tests live in `programs/integration_tests/tests/` and cover `token`, `amm`, `ata`, `stablecoin`, and `token-mint-authority` programs end-to-end through the zkVM using `RISC0_DEV_MODE=1` to skip proof generation. Each test file corresponds to a program:

- `programs/integration_tests/tests/token.rs`
- `programs/integration_tests/tests/amm.rs`
- `programs/integration_tests/tests/ata.rs`
- `programs/integration_tests/tests/stablecoin.rs`
- `programs/integration_tests/tests/token_mint_authority.rs`

`stablecoin` and `twap_oracle` are tested via their own unit tests (`cargo test -p stablecoin_program -p twap_oracle_program`).
`twap_oracle` is tested via its own unit tests (`cargo test -p twap_oracle_program`).

## Compile Guest Binaries

Expand Down Expand Up @@ -119,6 +122,7 @@ wallet deploy-program programs/amm/methods/guest/target/riscv32im-risc0-zkvm-elf
wallet deploy-program programs/ata/methods/guest/target/riscv32im-risc0-zkvm-elf/docker/ata.bin
wallet deploy-program programs/stablecoin/methods/guest/target/riscv32im-risc0-zkvm-elf/docker/stablecoin.bin
wallet deploy-program programs/twap_oracle/methods/guest/target/riscv32im-risc0-zkvm-elf/docker/twap_oracle.bin
wallet deploy-program programs/token_mint_authority/methods/guest/target/riscv32im-risc0-zkvm-elf/docker/token_mint_authority.bin
```

To inspect the `ProgramId` of a built binary:
Expand Down Expand Up @@ -147,6 +151,7 @@ spel generate-idl programs/amm/methods/guest/src/bin/amm.rs > artifacts/amm-idl.
spel generate-idl programs/ata/methods/guest/src/bin/ata.rs > artifacts/ata-idl.json
spel generate-idl programs/stablecoin/methods/guest/src/bin/stablecoin.rs > artifacts/stablecoin-idl.json
spel generate-idl programs/twap_oracle/methods/guest/src/bin/twap_oracle.rs > artifacts/twap_oracle-idl.json
spel generate-idl programs/token_mint_authority/methods/guest/src/bin/token_mint_authority.rs > artifacts/token_mint_authority-idl.json
```

Generated IDL files are committed under `artifacts/`. CI will fail if a program's IDL is missing or out of date.
Expand All @@ -161,4 +166,5 @@ spel --idl artifacts/amm-idl.json <instruction> [args...]
spel --idl artifacts/ata-idl.json <instruction> [args...]
spel --idl artifacts/stablecoin-idl.json <instruction> [args...]
spel --idl artifacts/twap_oracle-idl.json <instruction> [args...]
spel --idl artifacts/token_mint_authority-idl.json <instruction> [args...]
```
71 changes: 71 additions & 0 deletions artifacts/token_mint_authority-idl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"version": "0.1.0",
"name": "token_mint_authority",
"instructions": [
{
"name": "faucet_mint",
"accounts": [
{
"name": "recipient",
"writable": false,
"signer": true,
"init": false
},
{
"name": "mint_allowance",
"writable": true,
"signer": false,
"init": false
},
{
"name": "user_holding",
"writable": true,
"signer": false,
"init": false
},
{
"name": "token_definition",
"writable": true,
"signer": false,
"init": false
},
{
"name": "mint_authority",
"writable": true,
"signer": false,
"init": false
},
{
"name": "clock",
"writable": false,
"signer": false,
"init": false
}
],
"args": []
}
],
"accounts": [
{
"name": "MintAllowance",
"type": {
"kind": "struct",
"fields": [
{
"name": "recipient_id",
"type": "account_id"
},
{
"name": "definition_id",
"type": "account_id"
},
{
"name": "last_mint_ms",
"type": "u64"
}
]
}
}
],
"instruction_type": "token_mint_authority_core::Instruction"
}
2 changes: 2 additions & 0 deletions programs/integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ token_core = { workspace = true }
ata_core = { workspace = true }
stablecoin_core = { workspace = true }
twap_oracle_core = { workspace = true }
token_mint_authority_core = { workspace = true }
token-methods = { path = "../token/methods" }
amm-methods = { path = "../amm/methods" }
ata-methods = { path = "../ata/methods" }
stablecoin-methods = { path = "../stablecoin/methods" }
twap-oracle-methods = { path = "../twap_oracle/methods" }
token-mint-authority-methods = { path = "../token_mint_authority/methods" }
Loading
Loading