diff --git a/Cargo.lock b/Cargo.lock index 9732e53..11882e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3200,12 +3200,17 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "token-ids" +version = "0.1.0" + [[package]] name = "token-methods" version = "0.1.0" dependencies = [ "risc0-build", "risc0-zkvm", + "token-ids", "token_core", ] diff --git a/Cargo.toml b/Cargo.toml index 7021e21..795e17d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = [ + "token/ids", "token/core", "token", "token/methods", diff --git a/ata/methods/guest/Cargo.lock b/ata/methods/guest/Cargo.lock index f119dd1..fb1ea9f 100644 --- a/ata/methods/guest/Cargo.lock +++ b/ata/methods/guest/Cargo.lock @@ -281,7 +281,7 @@ dependencies = [ "risc0-zkvm", "serde", "spel-framework", - "token-methods", + "token-ids", "token_core", ] @@ -3147,13 +3147,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] -name = "token-methods" +name = "token-ids" version = "0.1.0" -dependencies = [ - "risc0-build", - "risc0-zkvm", - "token_core", -] [[package]] name = "token_core" diff --git a/ata/methods/guest/Cargo.toml b/ata/methods/guest/Cargo.toml index ad7c2a2..b4abd09 100644 --- a/ata/methods/guest/Cargo.toml +++ b/ata/methods/guest/Cargo.toml @@ -15,7 +15,7 @@ nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.gi risc0-zkvm = { version = "=3.0.5", default-features = false } ata_core = { path = "../../core" } ata_program = { path = "../..", package = "ata_program" } -token-methods = { path = "../../../token/methods" } +token-ids = { path = "../../../token/ids" } token_core = { path = "../../../token/core" } serde = { version = "1.0", features = ["derive"] } borsh = "1.5" diff --git a/ata/methods/guest/src/bin/ata.rs b/ata/methods/guest/src/bin/ata.rs index 95efa38..0d35e9b 100644 --- a/ata/methods/guest/src/bin/ata.rs +++ b/ata/methods/guest/src/bin/ata.rs @@ -24,7 +24,7 @@ mod ata { token_definition, ata_account, ata_program_id, - token_methods::TOKEN_ID, + token_ids::TOKEN_ID, ); Ok(SpelOutput::with_chained_calls(post_states, chained_calls)) } @@ -45,7 +45,7 @@ mod ata { sender_ata, recipient, ata_program_id, - token_methods::TOKEN_ID, + token_ids::TOKEN_ID, amount, ); Ok(SpelOutput::with_chained_calls(post_states, chained_calls)) @@ -66,7 +66,7 @@ mod ata { holder_ata, token_definition, ata_program_id, - token_methods::TOKEN_ID, + token_ids::TOKEN_ID, amount, ); Ok(SpelOutput::with_chained_calls(post_states, chained_calls)) diff --git a/token/ids/Cargo.toml b/token/ids/Cargo.toml new file mode 100644 index 0000000..5ea6188 --- /dev/null +++ b/token/ids/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "token-ids" +version = "0.1.0" +edition = "2021" diff --git a/token/ids/src/lib.rs b/token/ids/src/lib.rs new file mode 100644 index 0000000..44f7186 --- /dev/null +++ b/token/ids/src/lib.rs @@ -0,0 +1,3 @@ +pub const TOKEN_ID: [u32; 8] = [ + 437848389, 692033004, 1799570421, 2462683779, 3620810328, 646372816, 1484372518, 2025744330, +]; diff --git a/token/methods/Cargo.toml b/token/methods/Cargo.toml index a4897fb..b4c629c 100644 --- a/token/methods/Cargo.toml +++ b/token/methods/Cargo.toml @@ -10,5 +10,8 @@ risc0-build = "=3.0.5" risc0-zkvm = { version = "=3.0.5", features = ["std"] } token_core = { path = "../core" } +[dev-dependencies] +token-ids = { path = "../ids" } + [package.metadata.risc0] methods = ["guest"] diff --git a/token/methods/src/lib.rs b/token/methods/src/lib.rs index 1bdb308..dcc0a06 100644 --- a/token/methods/src/lib.rs +++ b/token/methods/src/lib.rs @@ -1 +1,9 @@ include!(concat!(env!("OUT_DIR"), "/methods.rs")); + +#[cfg(test)] +mod tests { + #[test] + fn token_ids_match_generated_method_id() { + assert_eq!(token_ids::TOKEN_ID, super::TOKEN_ID); + } +}