refactor: move programs into programs and UIs into apps

This refactors the repository structure as it has grown over time.
This commit is contained in:
r4bbit
2026-05-26 14:05:52 +02:00
parent cdb53a4d0c
commit 3622016e6c
109 changed files with 97 additions and 65 deletions
+17
View File
@@ -0,0 +1,17 @@
[package]
name = "ata-methods"
version = "0.1.0"
edition = "2021"
[lints]
workspace = true
[build-dependencies]
risc0-build = "=3.0.5"
[dependencies]
risc0-zkvm = { version = "=3.0.5", features = ["std"] }
ata_core = { path = "../core" }
[package.metadata.risc0]
methods = ["guest"]
+3
View File
@@ -0,0 +1,3 @@
fn main() {
risc0_build::embed_methods();
}
File diff suppressed because it is too large Load Diff
+62
View File
@@ -0,0 +1,62 @@
[package]
name = "ata-guest"
version = "0.1.0"
edition = "2021"
[workspace]
[lints.rust]
rust_2018_idioms = { level = "deny", priority = -1 }
# deny (not forbid) so a targeted per-item #[allow] remains possible if ever needed
unsafe_code = "deny"
[lints.clippy]
# Deny only the groups where a new lint should always be a hard error.
# style/pedantic lints default to warn so toolchain upgrades don't break the
# build unexpectedly — they can be evaluated and addressed at our own pace.
correctness = { level = "deny", priority = -1 }
suspicious = { level = "deny", priority = -1 }
perf = { level = "deny", priority = -1 }
style = { level = "warn", priority = -1 }
# Generated-code / placeholder blockers.
dbg_macro = "deny"
todo = "deny"
unimplemented = "deny"
unwrap_used = "deny"
# Lint suppression hygiene.
allow_attributes = "warn"
allow_attributes_without_reason = "deny"
# Determinism, panic-safety, and arithmetic correctness.
arithmetic_side_effects = "deny"
indexing_slicing = "deny"
# Cast discipline.
as_conversions = "deny"
cast_possible_truncation = "deny"
cast_possible_wrap = "deny"
cast_sign_loss = "deny"
# API and enum evolution.
large_enum_variant = "deny"
wildcard_enum_match_arm = "deny"
# Too noisy for this codebase unless enforced selectively.
module_name_repetitions = "allow"
similar_names = "allow"
[[bin]]
name = "ata"
path = "src/bin/ata.rs"
[dependencies]
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
risc0-zkvm = { version = "=3.0.5", default-features = false }
ata_core = { path = "../../core" }
ata_program = { path = "../..", package = "ata_program" }
token_core = { path = "../../../token/core" }
serde = { version = "1.0", features = ["derive"] }
borsh = "1.5"
+89
View File
@@ -0,0 +1,89 @@
#![cfg_attr(not(test), no_main)]
use spel_framework::prelude::*;
use spel_framework::context::ProgramContext;
use nssa_core::{account::AccountWithMetadata, program::ProgramId};
#[cfg(not(test))]
risc0_zkvm::guest::entry!(main);
#[lez_program(instruction = "ata_core::Instruction")]
mod ata {
#[expect(
unused_imports,
reason = "SPEL instruction macro requires importing parent-scope handler types"
)]
use super::*;
/// Create the Associated Token Account for (token program, owner, definition).
/// Idempotent: no-op if the account already exists.
/// The token program is selected explicitly by `token_program_id`; the token definition and
/// any existing ATA occupant must be owned by that program.
#[instruction]
pub fn create(
ctx: ProgramContext,
owner: AccountWithMetadata,
token_definition: AccountWithMetadata,
ata_account: AccountWithMetadata,
token_program_id: ProgramId,
) -> SpelResult {
let (post_states, chained_calls) = ata_program::create::create_associated_token_account(
owner,
token_definition,
ata_account,
ctx.self_program_id,
token_program_id,
);
Ok(spel_framework::SpelOutput::execute(post_states, chained_calls))
}
/// Transfer tokens FROM owner's ATA to a recipient token holding account.
/// The token program is selected explicitly by `token_program_id`; the sender ATA and recipient
/// holding must be owned by that program.
/// The recipient holding must already be initialized, be owned by the same token program
/// as the sender ATA, and point at the same token definition as the sender.
#[instruction]
pub fn transfer(
ctx: ProgramContext,
owner: AccountWithMetadata,
sender_ata: AccountWithMetadata,
recipient: AccountWithMetadata,
token_program_id: ProgramId,
amount: u128,
) -> SpelResult {
let (post_states, chained_calls) =
ata_program::transfer::transfer_from_associated_token_account(
owner,
sender_ata,
recipient,
ctx.self_program_id,
token_program_id,
amount,
);
Ok(spel_framework::SpelOutput::execute(post_states, chained_calls))
}
/// Burn tokens FROM owner's ATA.
/// The token program is selected explicitly by `token_program_id`; the holder ATA and token
/// definition must be owned by that program.
#[instruction]
pub fn burn(
ctx: ProgramContext,
owner: AccountWithMetadata,
holder_ata: AccountWithMetadata,
token_definition: AccountWithMetadata,
token_program_id: ProgramId,
amount: u128,
) -> SpelResult {
let (post_states, chained_calls) =
ata_program::burn::burn_from_associated_token_account(
owner,
holder_ata,
token_definition,
ctx.self_program_id,
token_program_id,
amount,
);
Ok(spel_framework::SpelOutput::execute(post_states, chained_calls))
}
}
+1
View File
@@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/methods.rs"));