diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 8137d8c..42b8bbb 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -2,6 +2,9 @@ name: Setup Environment description: Setup Rust, Solana CLI, and Light CLI for testing inputs: + example: + description: "Example directory path" + required: true solana-cli-version: description: "Solana CLI version" required: false @@ -13,7 +16,15 @@ inputs: light-cli-version: description: "Light CLI version" required: false - default: "alpha" + default: "0.27.1-alpha.11" + photon-version: + description: "Photon indexer version" + required: false + default: "0.51.2" + photon-commit: + description: "Photon indexer commit hash" + required: false + default: "ac7df6c388db847b7693a7a1cb766a7c9d7809b5" runs: using: composite @@ -22,7 +33,7 @@ runs: uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: ${{ inputs.rust-toolchain }} - cache: false + cache-workspaces: ${{ inputs.example }} - name: Setup Node.js (for Light CLI) uses: actions/setup-node@v4 @@ -41,7 +52,7 @@ runs: path: | ~/.cache/solana/ ~/.local/share/solana/ - key: solana-cli-${{ runner.os }}-${{ inputs.solana-cli-version }} + key: solana-cli-${{ runner.os }}-build-${{ inputs.solana-cli-version }} - name: Install Solana CLI tools shell: bash @@ -49,6 +60,21 @@ runs: sh -c "$(curl -sSfL https://release.anza.xyz/v${{ inputs.solana-cli-version }}/install)" echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH + - name: Cache Photon indexer + id: cache-photon + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/photon + key: photon-${{ runner.os }}-${{ inputs.photon-version }}-${{ inputs.photon-commit }} + + - name: Install Photon indexer + if: steps.cache-photon.outputs.cache-hit != 'true' + shell: bash + run: | + echo "Installing Photon indexer ${{ inputs.photon-version }} (commit ${{ inputs.photon-commit }})..." + RUSTFLAGS="-A dead-code" cargo install --git https://github.com/helius-labs/photon.git --rev ${{ inputs.photon-commit }} --locked --force + echo "Photon installed successfully" + - name: Install Light CLI shell: bash run: npm install -g @lightprotocol/zk-compression-cli@${{ inputs.light-cli-version }} diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml new file mode 100644 index 0000000..d5aca00 --- /dev/null +++ b/.github/workflows/rust-tests.yml @@ -0,0 +1,51 @@ +name: Rust + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + SOLANA_CLI_VERSION: "2.3.11" + RUST_TOOLCHAIN: "1.90.0" + +jobs: + test-rust: + name: ${{ matrix.name }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - example: anchor + package: escrow + name: anchor/escrow + - example: anchor + package: light-token-minter + name: anchor/light-token-minter + steps: + - uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/setup + with: + example: ${{ matrix.example }} + solana-cli-version: ${{ env.SOLANA_CLI_VERSION }} + rust-toolchain: ${{ env.RUST_TOOLCHAIN }} + + - name: Build and test + working-directory: ${{ matrix.example }} + run: | + if [ -n "${{ matrix.package }}" ]; then + cargo test-sbf -p ${{ matrix.package }} + else + cargo test-sbf + fi diff --git a/.gitignore b/.gitignore index 1803e1d..c5e2925 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ **/test-ledger **/target cli/accounts/ +bugs.md diff --git a/anchor/Anchor.toml b/anchor/Anchor.toml new file mode 100644 index 0000000..b2f56ed --- /dev/null +++ b/anchor/Anchor.toml @@ -0,0 +1,19 @@ +[toolchain] + +[features] +resolution = true +skip-lint = false + +[programs.localnet] +escrow = "FKJs6rp6TXJtxzLiPtdYhqa9ExRuBXG2zwh4fda6WATN" +light_token_minter = "3EPJBoxM8Evtv3Wk7R2mSWsrSzUD7WSKAaYugLgpCitV" + +[registry] +url = "https://api.apr.dev" + +[provider] +cluster = "localnet" +wallet = "~/.config/solana/id.json" + +[scripts] +test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" diff --git a/anchor/Cargo.lock b/anchor/Cargo.lock new file mode 100644 index 0000000..d0deeef --- /dev/null +++ b/anchor/Cargo.lock @@ -0,0 +1,9080 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm-siv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae0784134ba9375416d469ec31e7c5f9fa94405049cf08c5ce5b4698be673e0d" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "polyval", + "subtle", + "zeroize", +] + +[[package]] +name = "agave-feature-set" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a2c365c0245cbb8959de725fc2b44c754b673fdf34c9a7f9d4a25c35a7bf1" +dependencies = [ + "ahash", + "solana-epoch-schedule", + "solana-hash", + "solana-pubkey", + "solana-sha256-hasher", + "solana-svm-feature-set", +] + +[[package]] +name = "agave-precompiles" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d60d73657792af7f2464e9181d13c3979e94bb09841d9ffa014eef4ef0492b77" +dependencies = [ + "agave-feature-set", + "bincode", + "digest 0.10.7", + "ed25519-dalek", + "libsecp256k1", + "openssl", + "sha3", + "solana-ed25519-program", + "solana-message", + "solana-precompile-error", + "solana-pubkey", + "solana-sdk-ids", + "solana-secp256k1-program", + "solana-secp256r1-program", +] + +[[package]] +name = "agave-reserved-account-keys" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8289c8a8a2ef5aa10ce49a070f360f4e035ee3410b8d8f3580fb39d8cf042581" +dependencies = [ + "agave-feature-set", + "solana-pubkey", + "solana-sdk-ids", +] + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "aligned-sized" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48a526ec4434d531d488af59fe866f36b310fe8906691c75dffa664450a3800a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "anchor-attribute-access-control" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f70fd141a4d18adf11253026b32504f885447048c7494faf5fa83b01af9c0cf" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715a261c57c7679581e06f07a74fa2af874ac30f86bd8ea07cca4a7e5388a064" +dependencies = [ + "anchor-syn", + "bs58", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "730d6df8ae120321c5c25e0779e61789e4b70dc8297102248902022f286102e4" +dependencies = [ + "anchor-syn", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27e6e449cc3a37b2880b74dcafb8e5a17b954c0e58e376432d7adc646fb333ef" +dependencies = [ + "anchor-syn", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7710e4c54adf485affcd9be9adec5ef8846d9c71d7f31e16ba86ff9fc1dd49f" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ecfd49b2aeadeb32f35262230db402abed76ce87e27562b34f61318b2ec83c" +dependencies = [ + "anchor-lang-idl", + "anchor-syn", + "anyhow", + "bs58", + "heck 0.3.3", + "proc-macro2", + "quote", + "serde_json", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be89d160793a88495af462a7010b3978e48e30a630c91de47ce2c1d3cb7a6149" +dependencies = [ + "anchor-syn", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-serde" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc6ee78acb7bfe0c2dd2abc677aaa4789c0281a0c0ef01dbf6fe85e0fd9e6e4" +dependencies = [ + "anchor-syn", + "borsh-derive-internal", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-space" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134a01c0703f6fd355a0e472c033f6f3e41fac1ef6e370b20c50f4c8d022cea7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-lang" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6bab117055905e930f762c196e08f861f8dfe7241b92cee46677a3b15561a0a" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-program", + "anchor-derive-accounts", + "anchor-derive-serde", + "anchor-derive-space", + "anchor-lang-idl", + "base64 0.21.7", + "bincode", + "borsh 0.10.4", + "bytemuck", + "solana-program", + "thiserror 1.0.69", +] + +[[package]] +name = "anchor-lang-idl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e8599d21995f68e296265aa5ab0c3cef582fd58afec014d01bd0bce18a4418" +dependencies = [ + "anchor-lang-idl-spec", + "anyhow", + "heck 0.3.3", + "regex", + "serde", + "serde_json", + "sha2 0.10.9", +] + +[[package]] +name = "anchor-lang-idl-spec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bdf143115440fe621bdac3a29a1f7472e09f6cd82b2aa569429a0c13f103838" +dependencies = [ + "anyhow", + "serde", +] + +[[package]] +name = "anchor-spl" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c08cb5d762c0694f74bd02c9a5b04ea53cefc496e2c27b3234acffca5cd076b" +dependencies = [ + "anchor-lang", + "mpl-token-metadata", + "spl-associated-token-account 6.0.0", + "spl-pod 0.5.1", + "spl-token 7.0.0", + "spl-token-2022 6.0.0", + "spl-token-group-interface 0.5.0", + "spl-token-metadata-interface 0.6.0", +] + +[[package]] +name = "anchor-syn" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dc7a6d90cc643df0ed2744862cdf180587d1e5d28936538c18fc8908489ed67" +dependencies = [ + "anyhow", + "bs58", + "cargo_toml", + "heck 0.3.3", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2 0.10.9", + "syn 1.0.109", + "thiserror 1.0.69", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec 0.4.2", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bn254" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" +dependencies = [ + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" +dependencies = [ + "ahash", + "ark-ff 0.5.0", + "ark-poly 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe 0.6.0", + "fnv", + "hashbrown 0.15.2", + "itertools 0.13.0", + "num-bigint 0.4.6", + "num-integer", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint 0.4.6", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +dependencies = [ + "ark-ff-asm 0.5.0", + "ark-ff-macros 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "arrayvec", + "digest 0.10.7", + "educe 0.6.0", + "itertools 0.13.0", + "num-bigint 0.4.6", + "num-traits", + "paste", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +dependencies = [ + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint 0.4.6", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +dependencies = [ + "num-bigint 0.4.6", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-poly" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" +dependencies = [ + "ahash", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe 0.6.0", + "fnv", + "hashbrown 0.15.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive 0.4.2", + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint 0.4.6", +] + +[[package]] +name = "ark-serialize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +dependencies = [ + "ark-serialize-derive 0.5.0", + "ark-std 0.5.0", + "arrayvec", + "digest 0.10.7", + "num-bigint 0.4.6", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "ark-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +dependencies = [ + "num-traits", + "rand 0.8.5", + "rayon", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "ascii" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" + +[[package]] +name = "async-compression" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d10e4f991a553474232bc0a31799f6d24b034a84c0971d80d2e2f78b2e576e40" +dependencies = [ + "compression-codecs", + "compression-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +dependencies = [ + "serde_core", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake3" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.7", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "borsh" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115e54d64eb62cdebad391c19efc9dce4981c690c85a33a12199d99bb9546fee" +dependencies = [ + "borsh-derive 0.10.4", + "hashbrown 0.13.2", +] + +[[package]] +name = "borsh" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" +dependencies = [ + "borsh-derive 1.6.0", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0686c856aa6aac0c4498f936d7d6a02df690f614c03e4d906d1018062b5c5e2c" +dependencies = [ + "once_cell", + "proc-macro-crate 3.4.0", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65d6ba50644c98714aa2a70d13d7df3cd75cd2b523a2b452bf010443800976b3" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276691d96f063427be83e6692b86148e488ebba9f48f77788724ca027ba3b6d4" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "brotli" +version = "8.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd8b9603c7aa97359dbd97ecf258968c95f3adddd6db2f7e7a5bef101c84560" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "bv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" +dependencies = [ + "feature-probe", + "serde", +] + +[[package]] +name = "bytecount" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" + +[[package]] +name = "bytemuck" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" + +[[package]] +name = "cargo_toml" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be" +dependencies = [ + "serde", + "toml 0.8.23", +] + +[[package]] +name = "cc" +version = "1.2.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "cfg_eval" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45565fc9416b9896014f5732ac776f810ee53a66730c17e4020c3ec064a8f88f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "chrono" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "combine" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" +dependencies = [ + "ascii", + "byteorder", + "either", + "memchr", + "unreachable", +] + +[[package]] +name = "compression-codecs" +version = "0.4.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00828ba6fd27b45a448e57dbfe84f1029d4c9f26b368157e9a448a5f49a2ec2a" +dependencies = [ + "brotli", + "compression-core", + "flate2", + "memchr", +] + +[[package]] +name = "compression-core" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75984efb6ed102a0d42db99afb6c1948f0380d1d91808d5529916e6c08b49d8d" + +[[package]] +name = "console" +version = "0.15.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" +dependencies = [ + "encode_unicode", + "libc", + "once_cell", + "unicode-width", + "windows-sys 0.59.0", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89f72f65e8501878b8a004d5a1afb780987e2ce2b4532c562e367a72c57499f" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "rand_core 0.6.4", + "rustc_version", + "serde", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.114", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "deranged" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "derivation-path" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0" + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "eager" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe71d579d1812060163dff96056261deb5bf6729b100fa2e36a68b9649ba3d3" + +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.2.0", + "ed25519", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-dalek-bip32" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d2be62a4061b872c8c0873ee4fc6f101ce7b889d039f019c5fa2af471a59908" +dependencies = [ + "derivation-path", + "ed25519-dalek", + "hmac 0.12.1", + "sha2 0.10.9", +] + +[[package]] +name = "educe" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0042ff8246a363dbe77d2ceedb073339e85a804b9a47636c6e016a9a32c05f" +dependencies = [ + "enum-ordinalize 3.1.15", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize 4.3.2", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enum-iterator" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fd242f399be1da0a5354aa462d57b4ab2b4ee0683cc552f7c007d2d12d36e94" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685adfa4d6f3d765a26bc5dbc936577de9abf756c1feeb3089b01dd395034842" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "enum-ordinalize" +version = "3.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" +dependencies = [ + "num-bigint 0.4.6", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "enum-ordinalize" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "escrow" +version = "0.1.0" +dependencies = [ + "anchor-lang", + "anchor-spl", + "blake3", + "light-anchor-spl", + "light-client", + "light-hasher", + "light-program-test", + "light-sdk", + "light-token", + "solana-account-info", + "solana-instruction", + "solana-keypair", + "solana-msg", + "solana-program", + "solana-program-error", + "solana-pubkey", + "solana-sdk", + "solana-signer", + "spl-pod 0.4.0", + "spl-token-2022 6.0.0", + "tokio", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "find-msvc-tools" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" + +[[package]] +name = "five8" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75b8549488b4715defcb0d8a8a1c1c76a80661b5fa106b4ca0e7fce59d7d875" +dependencies = [ + "five8_core", +] + +[[package]] +name = "five8_const" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26dec3da8bc3ef08f2c04f61eab298c3ab334523e55f076354d6d6f613799a7b" +dependencies = [ + "five8_core", +] + +[[package]] +name = "five8_core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2551bf44bc5f776c15044b9b94153a00198be06743e262afaaa61f11ac7523a5" + +[[package]] +name = "fixed" +version = "1.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc715d38bea7b5bf487fcd79bcf8c209f0b58014f3018a7a19c2b855f472048" +dependencies = [ + "az", + "bytemuck", + "half", + "typenum", +] + +[[package]] +name = "flate2" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fundraiser" +version = "0.1.0" +dependencies = [ + "anchor-lang", + "anchor-spl", + "blake3", + "light-anchor-spl", + "light-client", + "light-hasher", + "light-program-test", + "light-sdk", + "light-token", + "shared-test-utils", + "solana-account-info", + "solana-instruction", + "solana-keypair", + "solana-msg", + "solana-program", + "solana-program-error", + "solana-pubkey", + "solana-sdk", + "solana-signer", + "spl-pod 0.4.0", + "spl-token-2022 6.0.0", + "tokio", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gethostname" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "groth16-solana" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6d1ffb18dbf5cfc60b11bd7da88474c672870247c1e5b498619bcb6ba3d8f5" +dependencies = [ + "ark-bn254 0.5.0", + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "num-bigint 0.4.6", + "solana-bn254", + "thiserror 1.0.69", +] + +[[package]] +name = "h2" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.13.0", + "slab", + "tokio", + "tokio-util 0.7.18", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.4.0", + "indexmap 2.13.0", + "slab", + "tokio", + "tokio-util 0.7.18", + "tracing", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac 0.8.1", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.4.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http 1.4.0", + "http-body 1.0.1", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" + +[[package]] +name = "hyper" +version = "0.14.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.27", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.5.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2 0.4.13", + "http 1.4.0", + "http-body 1.0.1", + "httparse", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http 0.2.12", + "hyper 0.14.32", + "rustls 0.21.12", + "tokio", + "tokio-rustls 0.24.1", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http 1.4.0", + "hyper 1.8.1", + "hyper-util", + "rustls 0.23.36", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.4", + "tower-service", + "webpki-roots 1.0.5", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper 0.14.32", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.8.1", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http 1.4.0", + "http-body 1.0.1", + "hyper 1.8.1", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2 0.6.1", + "system-configuration 0.6.1", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "indicatif" +version = "0.17.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width", + "web-time", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "jsonrpc-core" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" +dependencies = [ + "futures", + "futures-executor", + "futures-util", + "log", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "kaigan" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba15de5aeb137f0f65aa3bf82187647f1285abfe5b20c80c2c37f7007ad519a" +dependencies = [ + "borsh 0.10.4", + "serde", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" + +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "light-account-checks" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f20b8640212dd450e18d452a247e28d8ba6fdce3c713fd8b69f1e95874d1b7ab" +dependencies = [ + "solana-account-info", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "solana-sysvar", + "thiserror 2.0.18", +] + +[[package]] +name = "light-anchor-spl" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c802e3de6de4bb03bc9e9bacbba8aa94823a083046aaf0ef275b1321984e3" +dependencies = [ + "anchor-lang", + "spl-associated-token-account 6.0.0", + "spl-pod 0.5.1", + "spl-token 7.0.0", + "spl-token-2022 6.0.0", + "spl-token-group-interface 0.5.0", + "spl-token-metadata-interface 0.6.0", +] + +[[package]] +name = "light-array-map" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bdd13b18028ac9d80d0a987551c0dad7fe81be8140e87cc9d568b80f3728203" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "light-batched-merkle-tree" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01e838c523b49371097f948cd5662bd9a89d9dca037fb61fd38001e99f485702" +dependencies = [ + "aligned-sized", + "borsh 0.10.4", + "light-account-checks", + "light-bloom-filter", + "light-compressed-account", + "light-hasher", + "light-macros", + "light-merkle-tree-metadata", + "light-verifier", + "light-zero-copy", + "solana-account-info", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "solana-sysvar", + "thiserror 2.0.18", + "zerocopy", +] + +[[package]] +name = "light-bloom-filter" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b8cf734ccf5fbc1f5fed8e5308b57ebde6774d9304c167bcb0de2854412d8" +dependencies = [ + "bitvec", + "num-bigint 0.4.6", + "solana-nostd-keccak", + "solana-program-error", + "thiserror 2.0.18", +] + +[[package]] +name = "light-bounded-vec" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58cfa375d028164719e3ffef93d2e5c27855cc8a5bb5bf257b868d17c12a3e66" +dependencies = [ + "bytemuck", + "memoffset", + "solana-program-error", + "thiserror 1.0.69", +] + +[[package]] +name = "light-client" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33203f596d48d28d1cb67dee5762b151e0073207a5e828c63ec68f9efb9a5ee8" +dependencies = [ + "anchor-lang", + "async-trait", + "base64 0.13.1", + "borsh 0.10.4", + "bs58", + "futures", + "lazy_static", + "light-compressed-account", + "light-compressible", + "light-concurrent-merkle-tree", + "light-event", + "light-hasher", + "light-indexed-merkle-tree", + "light-merkle-tree-metadata", + "light-prover-client", + "light-sdk", + "light-token", + "light-token-interface", + "litesvm", + "num-bigint 0.4.6", + "photon-api", + "rand 0.8.5", + "smallvec", + "solana-account", + "solana-account-decoder-client-types", + "solana-address-lookup-table-interface", + "solana-banks-client", + "solana-clock", + "solana-commitment-config", + "solana-compute-budget-interface", + "solana-hash", + "solana-instruction", + "solana-keypair", + "solana-message", + "solana-program-error", + "solana-pubkey", + "solana-rpc-client", + "solana-rpc-client-api", + "solana-signature", + "solana-transaction", + "solana-transaction-error", + "solana-transaction-status-client-types", + "spl-pod 0.5.1", + "spl-token-2022-interface", + "thiserror 2.0.18", + "tokio", + "tracing", +] + +[[package]] +name = "light-compressed-account" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c3537bbad9df133ca97fc191b164bba93dba1de4da01a92d979ef63f8ce106" +dependencies = [ + "anchor-lang", + "borsh 0.10.4", + "bytemuck", + "light-hasher", + "light-macros", + "light-poseidon 0.3.0", + "light-program-profiler", + "light-zero-copy", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "thiserror 2.0.18", + "tinyvec", + "zerocopy", +] + +[[package]] +name = "light-compressible" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d1dc14271907009f4ca23ae99c49279f7d2acc5a83f0f8d7362834b37e2e16" +dependencies = [ + "aligned-sized", + "anchor-lang", + "borsh 0.10.4", + "bytemuck", + "light-account-checks", + "light-compressed-account", + "light-hasher", + "light-macros", + "light-program-profiler", + "light-zero-copy", + "pinocchio-pubkey", + "solana-pubkey", + "solana-rent", + "thiserror 2.0.18", + "zerocopy", +] + +[[package]] +name = "light-concurrent-merkle-tree" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db96f47253a0907aaa46dac15cecb27b5510130e48da0b36690dcd2e99a6d558" +dependencies = [ + "borsh 0.10.4", + "light-bounded-vec", + "light-hasher", + "memoffset", + "solana-program-error", + "thiserror 2.0.18", +] + +[[package]] +name = "light-event" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4bae725ee1d4d944d442ac0bfdf2031b1b2379c04c7e39c475277aaaea08fb1" +dependencies = [ + "borsh 0.10.4", + "light-compressed-account", + "light-hasher", + "light-zero-copy", + "thiserror 2.0.18", +] + +[[package]] +name = "light-hasher" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c822662e6e109bac0e132a43fd52a4ef684811245a794e048cf9cda001e934c8" +dependencies = [ + "ark-bn254 0.5.0", + "ark-ff 0.5.0", + "borsh 0.10.4", + "light-poseidon 0.3.0", + "num-bigint 0.4.6", + "sha2 0.10.9", + "sha3", + "solana-program-error", + "thiserror 2.0.18", + "tinyvec", +] + +[[package]] +name = "light-indexed-array" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f14f984030d86b6f07bd8f5ae04e2c40fcd0c3bdfcc7a291fff1ed59c9e6554" +dependencies = [ + "light-hasher", + "num-bigint 0.4.6", + "num-traits", + "thiserror 2.0.18", +] + +[[package]] +name = "light-indexed-merkle-tree" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0824755289075f28de2820fc7d4ec4e6b9e99d404e033c07338b91cce8c71fb8" +dependencies = [ + "light-bounded-vec", + "light-concurrent-merkle-tree", + "light-hasher", + "light-merkle-tree-reference", + "num-bigint 0.4.6", + "num-traits", + "solana-program-error", + "thiserror 2.0.18", +] + +[[package]] +name = "light-instruction-decoder" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bd98e842f21b754ec28020a56de37cb0b1089952ef24340d21c2d5afd5c5" +dependencies = [ + "borsh 0.10.4", + "bs58", + "light-compressed-account", + "light-instruction-decoder-derive", + "light-sdk-types", + "light-token-interface", + "serde", + "solana-instruction", + "solana-pubkey", + "solana-signature", + "tabled", +] + +[[package]] +name = "light-instruction-decoder-derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2035d04a0a1590da05634efcac149a2ac852565e28c9a55bd07a6620c0e90bff" +dependencies = [ + "bs58", + "darling", + "heck 0.5.0", + "proc-macro2", + "quote", + "sha2 0.10.9", + "syn 2.0.114", +] + +[[package]] +name = "light-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "179ac51cadc1d0ca047b4d6265a7cc245ca3affc16a20a2749585aa6464d39c2" +dependencies = [ + "bs58", + "proc-macro2", + "quote", + "solana-pubkey", + "syn 2.0.114", +] + +[[package]] +name = "light-merkle-tree-metadata" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c2e63e8345dcfb80efac69136fdcc6c36a12354675aca6e3daf13ec40422d1" +dependencies = [ + "anchor-lang", + "borsh 0.10.4", + "bytemuck", + "light-compressed-account", + "solana-msg", + "solana-program-error", + "solana-sysvar", + "thiserror 2.0.18", + "zerocopy", +] + +[[package]] +name = "light-merkle-tree-reference" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8d480f62ca32b38a6231bbc5310d693f91d6b5bdcc18bb13c2d9aab7a1c90e8" +dependencies = [ + "light-hasher", + "light-indexed-array", + "num-bigint 0.4.6", + "num-traits", + "thiserror 2.0.18", +] + +[[package]] +name = "light-poseidon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" +dependencies = [ + "ark-bn254 0.4.0", + "ark-ff 0.4.2", + "num-bigint 0.4.6", + "thiserror 1.0.69", +] + +[[package]] +name = "light-poseidon" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3d87542063daaccbfecd78b60f988079b6ec4e089249658b9455075c78d42" +dependencies = [ + "ark-bn254 0.5.0", + "ark-ff 0.5.0", + "num-bigint 0.4.6", + "thiserror 1.0.69", +] + +[[package]] +name = "light-profiler-macro" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a8be18fe4de58a6f754caa74a3fbc6d8a758a26f1f3c24d5b0f5b55df5f5408" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "light-program-profiler" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1d345871581aebd8825868a3f08410290aa1cdddcb189ca7f7e588f61d79fcf" +dependencies = [ + "light-profiler-macro", +] + +[[package]] +name = "light-program-test" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e85916a9da34a44971e1a30badaf04cb75213fbfa9f61a139ea6ebd0f021bdde" +dependencies = [ + "anchor-lang", + "async-trait", + "base64 0.13.1", + "borsh 0.10.4", + "bs58", + "bytemuck", + "chrono", + "light-client", + "light-compressed-account", + "light-compressible", + "light-event", + "light-hasher", + "light-indexed-array", + "light-indexed-merkle-tree", + "light-instruction-decoder", + "light-merkle-tree-metadata", + "light-merkle-tree-reference", + "light-prover-client", + "light-sdk", + "light-sdk-types", + "light-token", + "light-token-interface", + "light-zero-copy", + "litesvm", + "log", + "num-bigint 0.4.6", + "num-traits", + "photon-api", + "rand 0.8.5", + "reqwest 0.12.28", + "serde", + "serde_json", + "solana-account", + "solana-banks-client", + "solana-compute-budget", + "solana-instruction", + "solana-pubkey", + "solana-rpc-client-api", + "solana-sdk", + "solana-transaction", + "solana-transaction-status", + "solana-transaction-status-client-types", + "spl-token-2022 7.0.0", + "tabled", + "tokio", +] + +[[package]] +name = "light-prover-client" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd2195f4573628a8aaca37504cde1b1903b8ed20e2706acbad875b7d41acbeab" +dependencies = [ + "ark-bn254 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "light-compressed-account", + "light-hasher", + "light-indexed-array", + "light-sparse-merkle-tree", + "num-bigint 0.4.6", + "num-traits", + "reqwest 0.11.27", + "serde", + "serde_json", + "solana-bn254", + "thiserror 2.0.18", + "tokio", + "tracing", +] + +[[package]] +name = "light-sdk" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f523c64a6fcdafe6df81d647560770529896f2707be8ffcf048d909b7e2b30" +dependencies = [ + "anchor-lang", + "bincode", + "borsh 0.10.4", + "light-account-checks", + "light-compressed-account", + "light-compressible", + "light-hasher", + "light-macros", + "light-sdk-macros", + "light-sdk-types", + "light-zero-copy", + "num-bigint 0.4.6", + "solana-account-info", + "solana-clock", + "solana-cpi", + "solana-instruction", + "solana-loader-v3-interface", + "solana-msg", + "solana-program", + "solana-program-error", + "solana-pubkey", + "solana-system-interface", + "solana-sysvar", + "thiserror 2.0.18", +] + +[[package]] +name = "light-sdk-macros" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3d12bb13b84df21a4871dc0837aafc0b48464d3e9b17e2773c0719b6cc724c5" +dependencies = [ + "darling", + "light-hasher", + "light-sdk-types", + "proc-macro2", + "quote", + "solana-pubkey", + "syn 2.0.114", +] + +[[package]] +name = "light-sdk-types" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8153b27d057ded7b2b6bbd78c643e3f20bd9a9718ca1a8d4183169ccd812c3" +dependencies = [ + "anchor-lang", + "borsh 0.10.4", + "light-account-checks", + "light-compressed-account", + "light-hasher", + "light-macros", + "solana-msg", + "thiserror 2.0.18", +] + +[[package]] +name = "light-sparse-merkle-tree" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4251e79b6c63f4946572dcfd7623680ad0f9e0efe1a761a944733333c5645063" +dependencies = [ + "light-hasher", + "light-indexed-array", + "num-bigint 0.4.6", + "num-traits", + "thiserror 2.0.18", +] + +[[package]] +name = "light-token" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71fd2e8ca6d7d70c77658010e1ae6ed6d4fe23e29054964b053f51e5c4676e49" +dependencies = [ + "anchor-lang", + "arrayvec", + "borsh 0.10.4", + "light-account-checks", + "light-batched-merkle-tree", + "light-compressed-account", + "light-compressible", + "light-macros", + "light-program-profiler", + "light-sdk", + "light-sdk-macros", + "light-sdk-types", + "light-token-interface", + "light-token-types", + "light-zero-copy", + "solana-account-info", + "solana-cpi", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-pod 0.5.1", + "thiserror 2.0.18", +] + +[[package]] +name = "light-token-interface" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46decebc2a13ec984e2ba7f1e691c0d46b9061875c6bdd12636b7c100a60e6c" +dependencies = [ + "aligned-sized", + "anchor-lang", + "borsh 0.10.4", + "bytemuck", + "light-array-map", + "light-compressed-account", + "light-compressible", + "light-hasher", + "light-macros", + "light-program-profiler", + "light-zero-copy", + "pinocchio", + "pinocchio-pubkey", + "solana-account-info", + "solana-pubkey", + "spl-pod 0.5.1", + "spl-token-2022 7.0.0", + "thiserror 2.0.18", + "tinyvec", + "zerocopy", +] + +[[package]] +name = "light-token-minter" +version = "0.1.0" +dependencies = [ + "anchor-lang", + "blake3", + "light-anchor-spl", + "light-client", + "light-hasher", + "light-program-test", + "light-sdk", + "light-token", + "solana-account-info", + "solana-instruction", + "solana-keypair", + "solana-msg", + "solana-program", + "solana-program-error", + "solana-pubkey", + "solana-sdk", + "solana-signer", + "spl-pod 0.4.0", + "spl-token 7.0.0", + "spl-token-2022 6.0.0", + "tokio", +] + +[[package]] +name = "light-token-types" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "411481fe2e04b1241235c2572480c153c5669507e227f5e3327057b0d2ba5734" +dependencies = [ + "anchor-lang", + "borsh 0.10.4", + "light-account-checks", + "light-compressed-account", + "light-macros", + "light-sdk-types", + "solana-msg", + "thiserror 2.0.18", +] + +[[package]] +name = "light-verifier" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecba4c14ac08b078a9d84033d628b12bb2577141f405140d506bacd392a830bc" +dependencies = [ + "groth16-solana", + "light-compressed-account", + "thiserror 2.0.18", +] + +[[package]] +name = "light-zero-copy" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5621fb515e14af46148699c0b65334aabe230a1d2cbd06736ccc7a408c8a4af" +dependencies = [ + "light-zero-copy-derive", + "solana-program-error", + "zerocopy", +] + +[[package]] +name = "light-zero-copy-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41c46425e5c7ab5203ff5c86ae2615b169cca55f9283f5f60f5dd74143be6934" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "litesvm" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bca37ac374948b348e29c74b324dc36f18bbbd1ccf80e2046d967521cbd143" +dependencies = [ + "agave-feature-set", + "agave-precompiles", + "agave-reserved-account-keys", + "ansi_term", + "bincode", + "indexmap 2.13.0", + "itertools 0.14.0", + "log", + "solana-account", + "solana-address-lookup-table-interface", + "solana-bpf-loader-program", + "solana-builtins", + "solana-clock", + "solana-compute-budget", + "solana-compute-budget-instruction", + "solana-epoch-rewards", + "solana-epoch-schedule", + "solana-fee", + "solana-fee-structure", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", + "solana-keypair", + "solana-last-restart-slot", + "solana-loader-v3-interface", + "solana-loader-v4-interface", + "solana-log-collector", + "solana-message", + "solana-native-token 3.0.0", + "solana-nonce", + "solana-nonce-account", + "solana-precompile-error", + "solana-program-error", + "solana-program-runtime", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-sha256-hasher", + "solana-signature", + "solana-signer", + "solana-slot-hashes", + "solana-slot-history", + "solana-stake-interface", + "solana-svm-callback", + "solana-svm-transaction", + "solana-system-interface", + "solana-system-program", + "solana-sysvar", + "solana-sysvar-id", + "solana-timings", + "solana-transaction", + "solana-transaction-context", + "solana-transaction-error", + "solana-vote-program", + "thiserror 2.0.18", +] + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.61.2", +] + +[[package]] +name = "mpl-token-metadata" +version = "5.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046f0779684ec348e2759661361c8798d79021707b1392cb49f3b5eb911340ff" +dependencies = [ + "borsh 0.10.4", + "num-derive 0.3.3", + "num-traits", + "solana-program", + "thiserror 1.0.69", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" +dependencies = [ + "num-bigint 0.2.6", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-complex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +dependencies = [ + "autocfg", + "num-bigint 0.2.6", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" +dependencies = [ + "proc-macro-crate 3.4.0", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "openssl" +version = "0.10.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-src" +version = "300.5.4+3.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507b3792995dae9b0df8a1c1e3771e8418b7c2d9f0baeba32e6fe8b06c7cb72" +dependencies = [ + "cc", +] + +[[package]] +name = "openssl-sys" +version = "0.9.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" +dependencies = [ + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "opentelemetry" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project", + "rand 0.8.5", + "thiserror 1.0.69", +] + +[[package]] +name = "papergrid" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6978128c8b51d8f4080631ceb2302ab51e32cc6e8615f735ee2f83fd269ae3f1" +dependencies = [ + "bytecount", + "fnv", + "unicode-width", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "percentage" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd23b938276f14057220b707937bcb42fa76dda7560e57a2da30cb52d557937" +dependencies = [ + "num", +] + +[[package]] +name = "photon-api" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e572dba0c255f5b8176f15b9e849330d915a8927804f7f9702d5bbbc70e4a1ad" +dependencies = [ + "reqwest 0.12.28", + "serde", + "serde_derive", + "serde_json", + "serde_with", + "url", + "uuid", +] + +[[package]] +name = "pin-project" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pinocchio" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b971851087bc3699b001954ad02389d50c41405ece3548cbcafc88b3e20017a" + +[[package]] +name = "pinocchio-pubkey" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0225638cadcbebae8932cb7f49cb5da7c15c21beb19f048f05a5ca7d93f065" +dependencies = [ + "five8_const", + "pinocchio", + "sha2-const-stable", +] + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml 0.5.11", +] + +[[package]] +name = "proc-macro-crate" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +dependencies = [ + "toml_edit 0.23.10+spec-1.0.0", +] + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "qstring" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "qualifier_attr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.36", + "socket2 0.6.1", + "thiserror 2.0.18", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls 0.23.36", + "rustls-pki-types", + "slab", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2 0.6.1", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.10.0", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "regex" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" + +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.27", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.32", + "hyper-rustls 0.24.2", + "hyper-tls 0.5.0", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.21.12", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration 0.5.1", + "tokio", + "tokio-native-tls", + "tokio-rustls 0.24.1", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.25.4", + "winreg", +] + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.4.13", + "http 1.4.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.8.1", + "hyper-rustls 0.27.7", + "hyper-tls 0.6.0", + "hyper-util", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls 0.23.36", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.2", + "tokio", + "tokio-native-tls", + "tokio-rustls 0.26.4", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 1.0.5", +] + +[[package]] +name = "reqwest-middleware" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57f17d28a6e6acfe1733fe24bcd30774d13bffa4b8a22535b4c8c98423088d4e" +dependencies = [ + "anyhow", + "async-trait", + "http 1.4.0", + "reqwest 0.12.28", + "serde", + "thiserror 1.0.69", + "tower-service", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring", + "rustls-webpki 0.101.7", + "sct", +] + +[[package]] +name = "rustls" +version = "0.23.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki 0.103.9", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" + +[[package]] +name = "schannel" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.10.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-big-array" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11fc7cc2c76d73e0f27ee52abbd64eec84d46f370c88371120433196934e4b7f" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_bytes" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fa237f2807440d238e0364a218270b98f767a00d3dada77b1c53ae88940e2e7" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.13.0", + "schemars 0.9.0", + "schemars 1.2.0", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha2-const-stable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9" + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shared-test-utils" +version = "0.1.0" +dependencies = [ + "anchor-lang", + "anchor-spl", + "light-client", + "light-hasher", + "light-program-test", + "light-sdk", + "light-token", + "light-token-minter", + "solana-instruction", + "solana-keypair", + "solana-pubkey", + "solana-sdk", + "solana-signer", + "spl-pod 0.4.0", + "spl-token-2022 6.0.0", + "tokio", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "simd-adler32" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "solana-account" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f949fe4edaeaea78c844023bfc1c898e0b1f5a100f8a8d2d0f85d0a7b090258" +dependencies = [ + "bincode", + "serde", + "serde_bytes", + "serde_derive", + "solana-account-info", + "solana-clock", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-sysvar", +] + +[[package]] +name = "solana-account-decoder" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba71c97fa4d85ce4a1e0e79044ad0406c419382be598c800202903a7688ce71a" +dependencies = [ + "Inflector", + "base64 0.22.1", + "bincode", + "bs58", + "bv", + "serde", + "serde_derive", + "serde_json", + "solana-account", + "solana-account-decoder-client-types", + "solana-address-lookup-table-interface", + "solana-clock", + "solana-config-program-client", + "solana-epoch-schedule", + "solana-fee-calculator", + "solana-instruction", + "solana-loader-v3-interface", + "solana-nonce", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-slot-hashes", + "solana-slot-history", + "solana-stake-interface", + "solana-sysvar", + "solana-vote-interface", + "spl-generic-token", + "spl-token 8.0.0", + "spl-token-2022 8.0.1", + "spl-token-group-interface 0.6.0", + "spl-token-metadata-interface 0.7.0", + "thiserror 2.0.18", + "zstd", +] + +[[package]] +name = "solana-account-decoder-client-types" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5519e8343325b707f17fbed54fcefb325131b692506d0af9e08a539d15e4f8cf" +dependencies = [ + "base64 0.22.1", + "bs58", + "serde", + "serde_derive", + "serde_json", + "solana-account", + "solana-pubkey", + "zstd", +] + +[[package]] +name = "solana-account-info" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8f5152a288ef1912300fc6efa6c2d1f9bb55d9398eb6c72326360b8063987da" +dependencies = [ + "bincode", + "serde", + "solana-program-error", + "solana-program-memory", + "solana-pubkey", +] + +[[package]] +name = "solana-address-lookup-table-interface" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1673f67efe870b64a65cb39e6194be5b26527691ce5922909939961a6e6b395" +dependencies = [ + "bincode", + "bytemuck", + "serde", + "serde_derive", + "solana-clock", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-slot-hashes", +] + +[[package]] +name = "solana-atomic-u64" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52e52720efe60465b052b9e7445a01c17550666beec855cce66f44766697bc2" +dependencies = [ + "parking_lot", +] + +[[package]] +name = "solana-banks-client" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68548570c38a021c724b5aa0112f45a54bdf7ff1b041a042848e034a95a96994" +dependencies = [ + "borsh 1.6.0", + "futures", + "solana-account", + "solana-banks-interface", + "solana-clock", + "solana-commitment-config", + "solana-hash", + "solana-message", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-signature", + "solana-sysvar", + "solana-transaction", + "solana-transaction-context", + "solana-transaction-error", + "tarpc", + "thiserror 2.0.18", + "tokio", + "tokio-serde", +] + +[[package]] +name = "solana-banks-interface" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6d90edc435bf488ef7abed4dcb1f94fa1970102cbabb25688f58417fd948286" +dependencies = [ + "serde", + "serde_derive", + "solana-account", + "solana-clock", + "solana-commitment-config", + "solana-hash", + "solana-message", + "solana-pubkey", + "solana-signature", + "solana-transaction", + "solana-transaction-context", + "solana-transaction-error", + "tarpc", +] + +[[package]] +name = "solana-big-mod-exp" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75db7f2bbac3e62cfd139065d15bcda9e2428883ba61fc8d27ccb251081e7567" +dependencies = [ + "num-bigint 0.4.6", + "num-traits", + "solana-define-syscall", +] + +[[package]] +name = "solana-bincode" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a3787b8cf9c9fe3dd360800e8b70982b9e5a8af9e11c354b6665dd4a003adc" +dependencies = [ + "bincode", + "serde", + "solana-instruction", +] + +[[package]] +name = "solana-blake3-hasher" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a0801e25a1b31a14494fc80882a036be0ffd290efc4c2d640bfcca120a4672" +dependencies = [ + "blake3", + "solana-define-syscall", + "solana-hash", + "solana-sanitize", +] + +[[package]] +name = "solana-bn254" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4420f125118732833f36facf96a27e7b78314b2d642ba07fa9ffdacd8d79e243" +dependencies = [ + "ark-bn254 0.4.0", + "ark-ec 0.4.2", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "bytemuck", + "solana-define-syscall", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-borsh" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718333bcd0a1a7aed6655aa66bef8d7fb047944922b2d3a18f49cbc13e73d004" +dependencies = [ + "borsh 0.10.4", + "borsh 1.6.0", +] + +[[package]] +name = "solana-bpf-loader-program" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5aec57dcd80d0f6879956cad28854a6eebaed6b346ce56908ea01a9f36ab259" +dependencies = [ + "bincode", + "libsecp256k1", + "num-traits", + "qualifier_attr", + "scopeguard", + "solana-account", + "solana-account-info", + "solana-big-mod-exp", + "solana-bincode", + "solana-blake3-hasher", + "solana-bn254", + "solana-clock", + "solana-cpi", + "solana-curve25519", + "solana-hash", + "solana-instruction", + "solana-keccak-hasher", + "solana-loader-v3-interface", + "solana-loader-v4-interface", + "solana-log-collector", + "solana-measure", + "solana-packet", + "solana-poseidon", + "solana-program-entrypoint", + "solana-program-runtime", + "solana-pubkey", + "solana-sbpf", + "solana-sdk-ids", + "solana-secp256k1-recover", + "solana-sha256-hasher", + "solana-stable-layout", + "solana-svm-feature-set", + "solana-system-interface", + "solana-sysvar", + "solana-sysvar-id", + "solana-timings", + "solana-transaction-context", + "solana-type-overrides", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-builtins" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d61a31b63b52b0d268cbcd56c76f50314867d7f8e07a0f2c62ee7c9886e07b2" +dependencies = [ + "agave-feature-set", + "solana-bpf-loader-program", + "solana-compute-budget-program", + "solana-hash", + "solana-loader-v4-program", + "solana-program-runtime", + "solana-pubkey", + "solana-sdk-ids", + "solana-stake-program", + "solana-system-program", + "solana-vote-program", + "solana-zk-elgamal-proof-program", + "solana-zk-token-proof-program", +] + +[[package]] +name = "solana-builtins-default-costs" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca69a299a6c969b18ea381a02b40c9e4dda04b2af0d15a007c1184c82163bbb" +dependencies = [ + "agave-feature-set", + "ahash", + "log", + "solana-bpf-loader-program", + "solana-compute-budget-program", + "solana-loader-v4-program", + "solana-pubkey", + "solana-sdk-ids", + "solana-stake-program", + "solana-system-program", + "solana-vote-program", +] + +[[package]] +name = "solana-client-traits" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83f0071874e629f29e0eb3dab8a863e98502ac7aba55b7e0df1803fc5cac72a7" +dependencies = [ + "solana-account", + "solana-commitment-config", + "solana-epoch-info", + "solana-hash", + "solana-instruction", + "solana-keypair", + "solana-message", + "solana-pubkey", + "solana-signature", + "solana-signer", + "solana-system-interface", + "solana-transaction", + "solana-transaction-error", +] + +[[package]] +name = "solana-clock" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bb482ab70fced82ad3d7d3d87be33d466a3498eb8aa856434ff3c0dfc2e2e31" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-cluster-type" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ace9fea2daa28354d107ea879cff107181d85cd4e0f78a2bedb10e1a428c97e" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", +] + +[[package]] +name = "solana-commitment-config" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac49c4dde3edfa832de1697e9bcdb7c3b3f7cb7a1981b7c62526c8bb6700fb73" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "solana-compute-budget" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f4fc63bc2276a1618ca0bfc609da7448534ecb43a1cb387cdf9eaa2dc7bc272" +dependencies = [ + "solana-fee-structure", + "solana-program-runtime", +] + +[[package]] +name = "solana-compute-budget-instruction" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "503d94430f6d3c5ac1e1fa6a342c1c714d5b03c800999e7b6cf235298f0b5341" +dependencies = [ + "agave-feature-set", + "log", + "solana-borsh", + "solana-builtins-default-costs", + "solana-compute-budget", + "solana-compute-budget-interface", + "solana-instruction", + "solana-packet", + "solana-pubkey", + "solana-sdk-ids", + "solana-svm-transaction", + "solana-transaction-error", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-compute-budget-interface" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8432d2c4c22d0499aa06d62e4f7e333f81777b3d7c96050ae9e5cb71a8c3aee4" +dependencies = [ + "borsh 1.6.0", + "serde", + "serde_derive", + "solana-instruction", + "solana-sdk-ids", +] + +[[package]] +name = "solana-compute-budget-program" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "072b02beed1862c6b7b7a8a699379594c4470a9371c711856a0a3c266dcf57e5" +dependencies = [ + "solana-program-runtime", +] + +[[package]] +name = "solana-config-program-client" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53aceac36f105fd4922e29b4f0c1f785b69d7b3e7e387e384b8985c8e0c3595e" +dependencies = [ + "bincode", + "borsh 0.10.4", + "kaigan", + "serde", + "solana-program", +] + +[[package]] +name = "solana-cpi" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc71126edddc2ba014622fc32d0f5e2e78ec6c5a1e0eb511b85618c09e9ea11" +dependencies = [ + "solana-account-info", + "solana-define-syscall", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-stable-layout", +] + +[[package]] +name = "solana-curve25519" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae4261b9a8613d10e77ac831a8fa60b6fa52b9b103df46d641deff9f9812a23" +dependencies = [ + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "solana-define-syscall", + "subtle", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-decode-error" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c781686a18db2f942e70913f7ca15dc120ec38dcab42ff7557db2c70c625a35" +dependencies = [ + "num-traits", +] + +[[package]] +name = "solana-define-syscall" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae3e2abcf541c8122eafe9a625d4d194b4023c20adde1e251f94e056bb1aee2" + +[[package]] +name = "solana-derivation-path" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "939756d798b25c5ec3cca10e06212bdca3b1443cb9bb740a38124f58b258737b" +dependencies = [ + "derivation-path", + "qstring", + "uriparse", +] + +[[package]] +name = "solana-ed25519-program" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1feafa1691ea3ae588f99056f4bdd1293212c7ece28243d7da257c443e84753" +dependencies = [ + "bytemuck", + "bytemuck_derive", + "ed25519-dalek", + "solana-feature-set", + "solana-instruction", + "solana-precompile-error", + "solana-sdk-ids", +] + +[[package]] +name = "solana-epoch-info" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ef6f0b449290b0b9f32973eefd95af35b01c5c0c34c569f936c34c5b20d77b" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "solana-epoch-rewards" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b575d3dd323b9ea10bb6fe89bf6bf93e249b215ba8ed7f68f1a3633f384db7" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-epoch-rewards-hasher" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c5fd2662ae7574810904585fd443545ed2b568dbd304b25a31e79ccc76e81b" +dependencies = [ + "siphasher", + "solana-hash", + "solana-pubkey", +] + +[[package]] +name = "solana-epoch-schedule" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fce071fbddecc55d727b1d7ed16a629afe4f6e4c217bc8d00af3b785f6f67ed" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-example-mocks" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84461d56cbb8bb8d539347151e0525b53910102e4bced875d49d5139708e39d3" +dependencies = [ + "serde", + "serde_derive", + "solana-address-lookup-table-interface", + "solana-clock", + "solana-hash", + "solana-instruction", + "solana-keccak-hasher", + "solana-message", + "solana-nonce", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-feature-gate-interface" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f5c5382b449e8e4e3016fb05e418c53d57782d8b5c30aa372fc265654b956d" +dependencies = [ + "bincode", + "serde", + "serde_derive", + "solana-account", + "solana-account-info", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-feature-set" +version = "2.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93b93971e289d6425f88e6e3cb6668c4b05df78b3c518c249be55ced8efd6b6d" +dependencies = [ + "ahash", + "lazy_static", + "solana-epoch-schedule", + "solana-hash", + "solana-pubkey", + "solana-sha256-hasher", +] + +[[package]] +name = "solana-fee" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16beda37597046b1edd1cea6fa7caaed033c091f99ec783fe59c82828bc2adb8" +dependencies = [ + "agave-feature-set", + "solana-fee-structure", + "solana-svm-transaction", +] + +[[package]] +name = "solana-fee-calculator" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89bc408da0fb3812bc3008189d148b4d3e08252c79ad810b245482a3f70cd8d" +dependencies = [ + "log", + "serde", + "serde_derive", +] + +[[package]] +name = "solana-fee-structure" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33adf673581c38e810bf618f745bf31b683a0a4a4377682e6aaac5d9a058dd4e" +dependencies = [ + "serde", + "serde_derive", + "solana-message", + "solana-native-token 2.3.0", +] + +[[package]] +name = "solana-genesis-config" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3725085d47b96d37fef07a29d78d2787fc89a0b9004c66eed7753d1e554989f" +dependencies = [ + "bincode", + "chrono", + "memmap2", + "serde", + "serde_derive", + "solana-account", + "solana-clock", + "solana-cluster-type", + "solana-epoch-schedule", + "solana-fee-calculator", + "solana-hash", + "solana-inflation", + "solana-keypair", + "solana-logger", + "solana-poh-config", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-sha256-hasher", + "solana-shred-version", + "solana-signer", + "solana-time-utils", +] + +[[package]] +name = "solana-hard-forks" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c28371f878e2ead55611d8ba1b5fb879847156d04edea13693700ad1a28baf" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "solana-hash" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b96e9f0300fa287b545613f007dfe20043d7812bee255f418c1eb649c93b63" +dependencies = [ + "borsh 1.6.0", + "bytemuck", + "bytemuck_derive", + "five8", + "js-sys", + "serde", + "serde_derive", + "solana-atomic-u64", + "solana-sanitize", + "wasm-bindgen", +] + +[[package]] +name = "solana-inflation" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23eef6a09eb8e568ce6839573e4966850e85e9ce71e6ae1a6c930c1c43947de3" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "solana-instruction" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab5682934bd1f65f8d2c16f21cb532526fcc1a09f796e2cacdb091eee5774ad" +dependencies = [ + "bincode", + "borsh 1.6.0", + "getrandom 0.2.17", + "js-sys", + "num-traits", + "serde", + "serde_derive", + "serde_json", + "solana-define-syscall", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-instructions-sysvar" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0e85a6fad5c2d0c4f5b91d34b8ca47118fc593af706e523cdbedf846a954f57" +dependencies = [ + "bitflags 2.10.0", + "solana-account-info", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-sanitize", + "solana-sdk-ids", + "solana-serialize-utils", + "solana-sysvar-id", +] + +[[package]] +name = "solana-keccak-hasher" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7aeb957fbd42a451b99235df4942d96db7ef678e8d5061ef34c9b34cae12f79" +dependencies = [ + "sha3", + "solana-define-syscall", + "solana-hash", + "solana-sanitize", +] + +[[package]] +name = "solana-keypair" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd3f04aa1a05c535e93e121a95f66e7dcccf57e007282e8255535d24bf1e98bb" +dependencies = [ + "ed25519-dalek", + "ed25519-dalek-bip32", + "five8", + "rand 0.7.3", + "solana-derivation-path", + "solana-pubkey", + "solana-seed-derivable", + "solana-seed-phrase", + "solana-signature", + "solana-signer", + "wasm-bindgen", +] + +[[package]] +name = "solana-last-restart-slot" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6360ac2fdc72e7463565cd256eedcf10d7ef0c28a1249d261ec168c1b55cdd" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-loader-v2-interface" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8ab08006dad78ae7cd30df8eea0539e207d08d91eaefb3e1d49a446e1c49654" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", +] + +[[package]] +name = "solana-loader-v3-interface" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f7162a05b8b0773156b443bccd674ea78bb9aa406325b467ea78c06c99a63a2" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-loader-v4-interface" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "706a777242f1f39a83e2a96a2a6cb034cb41169c6ecbee2cf09cb873d9659e7e" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-loader-v4-program" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ab01855d851fa2fb6034b0d48de33d77d5c5f5fb4b0353d8e4a934cc03d48a" +dependencies = [ + "log", + "qualifier_attr", + "solana-account", + "solana-bincode", + "solana-bpf-loader-program", + "solana-instruction", + "solana-loader-v3-interface", + "solana-loader-v4-interface", + "solana-log-collector", + "solana-measure", + "solana-packet", + "solana-program-runtime", + "solana-pubkey", + "solana-sbpf", + "solana-sdk-ids", + "solana-transaction-context", + "solana-type-overrides", +] + +[[package]] +name = "solana-log-collector" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d945b1cf5bf7cbd6f5b78795beda7376370c827640df43bb2a1c17b492dc106" +dependencies = [ + "log", +] + +[[package]] +name = "solana-logger" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8e777ec1afd733939b532a42492d888ec7c88d8b4127a5d867eb45c6eb5cd5" +dependencies = [ + "env_logger", + "lazy_static", + "libc", + "log", + "signal-hook", +] + +[[package]] +name = "solana-measure" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11dcd67cd2ae6065e494b64e861e0498d046d95a61cbbf1ae3d58be1ea0f42ed" + +[[package]] +name = "solana-message" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1796aabce376ff74bf89b78d268fa5e683d7d7a96a0a4e4813ec34de49d5314b" +dependencies = [ + "bincode", + "blake3", + "lazy_static", + "serde", + "serde_derive", + "solana-bincode", + "solana-hash", + "solana-instruction", + "solana-pubkey", + "solana-sanitize", + "solana-sdk-ids", + "solana-short-vec", + "solana-system-interface", + "solana-transaction-error", + "wasm-bindgen", +] + +[[package]] +name = "solana-metrics" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0375159d8460f423d39e5103dcff6e07796a5ec1850ee1fcfacfd2482a8f34b5" +dependencies = [ + "crossbeam-channel", + "gethostname", + "log", + "reqwest 0.12.28", + "solana-cluster-type", + "solana-sha256-hasher", + "solana-time-utils", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-msg" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36a1a14399afaabc2781a1db09cb14ee4cc4ee5c7a5a3cfcc601811379a8092" +dependencies = [ + "solana-define-syscall", +] + +[[package]] +name = "solana-native-token" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61515b880c36974053dd499c0510066783f0cc6ac17def0c7ef2a244874cf4a9" + +[[package]] +name = "solana-native-token" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8dd4c280dca9d046139eb5b7a5ac9ad10403fbd64964c7d7571214950d758f" + +[[package]] +name = "solana-nonce" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703e22eb185537e06204a5bd9d509b948f0066f2d1d814a6f475dafb3ddf1325" +dependencies = [ + "serde", + "serde_derive", + "solana-fee-calculator", + "solana-hash", + "solana-pubkey", + "solana-sha256-hasher", +] + +[[package]] +name = "solana-nonce-account" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde971a20b8dbf60144d6a84439dda86b5466e00e2843091fe731083cda614da" +dependencies = [ + "solana-account", + "solana-hash", + "solana-nonce", + "solana-sdk-ids", +] + +[[package]] +name = "solana-nostd-keccak" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8ced70920435b1baa58f76e6f84bbc1110ddd1d6161ec76b6d731ae8431e9c4" +dependencies = [ + "sha3", +] + +[[package]] +name = "solana-offchain-message" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b526398ade5dea37f1f147ce55dae49aa017a5d7326606359b0445ca8d946581" +dependencies = [ + "num_enum", + "solana-hash", + "solana-packet", + "solana-pubkey", + "solana-sanitize", + "solana-sha256-hasher", + "solana-signature", + "solana-signer", +] + +[[package]] +name = "solana-packet" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004f2d2daf407b3ec1a1ca5ec34b3ccdfd6866dd2d3c7d0715004a96e4b6d127" +dependencies = [ + "bincode", + "bitflags 2.10.0", + "cfg_eval", + "serde", + "serde_derive", + "serde_with", +] + +[[package]] +name = "solana-poh-config" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d650c3b4b9060082ac6b0efbbb66865089c58405bfb45de449f3f2b91eccee75" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "solana-poseidon" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbac4eb90016eeb1d37fa36e592d3a64421510c49666f81020736611c319faff" +dependencies = [ + "ark-bn254 0.4.0", + "light-poseidon 0.2.0", + "solana-define-syscall", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-precompile-error" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d87b2c1f5de77dfe2b175ee8dd318d196aaca4d0f66f02842f80c852811f9f8" +dependencies = [ + "num-traits", + "solana-decode-error", +] + +[[package]] +name = "solana-precompiles" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36e92768a57c652edb0f5d1b30a7d0bc64192139c517967c18600debe9ae3832" +dependencies = [ + "lazy_static", + "solana-ed25519-program", + "solana-feature-set", + "solana-message", + "solana-precompile-error", + "solana-pubkey", + "solana-sdk-ids", + "solana-secp256k1-program", + "solana-secp256r1-program", +] + +[[package]] +name = "solana-presigner" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81a57a24e6a4125fc69510b6774cd93402b943191b6cddad05de7281491c90fe" +dependencies = [ + "solana-pubkey", + "solana-signature", + "solana-signer", +] + +[[package]] +name = "solana-program" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98eca145bd3545e2fbb07166e895370576e47a00a7d824e325390d33bf467210" +dependencies = [ + "bincode", + "blake3", + "borsh 0.10.4", + "borsh 1.6.0", + "bs58", + "bytemuck", + "console_error_panic_hook", + "console_log", + "getrandom 0.2.17", + "lazy_static", + "log", + "memoffset", + "num-bigint 0.4.6", + "num-derive 0.4.2", + "num-traits", + "rand 0.8.5", + "serde", + "serde_bytes", + "serde_derive", + "solana-account-info", + "solana-address-lookup-table-interface", + "solana-atomic-u64", + "solana-big-mod-exp", + "solana-bincode", + "solana-blake3-hasher", + "solana-borsh", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-define-syscall", + "solana-epoch-rewards", + "solana-epoch-schedule", + "solana-example-mocks", + "solana-feature-gate-interface", + "solana-fee-calculator", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", + "solana-keccak-hasher", + "solana-last-restart-slot", + "solana-loader-v2-interface", + "solana-loader-v3-interface", + "solana-loader-v4-interface", + "solana-message", + "solana-msg", + "solana-native-token 2.3.0", + "solana-nonce", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sanitize", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-secp256k1-recover", + "solana-serde-varint", + "solana-serialize-utils", + "solana-sha256-hasher", + "solana-short-vec", + "solana-slot-hashes", + "solana-slot-history", + "solana-stable-layout", + "solana-stake-interface", + "solana-system-interface", + "solana-sysvar", + "solana-sysvar-id", + "solana-vote-interface", + "thiserror 2.0.18", + "wasm-bindgen", +] + +[[package]] +name = "solana-program-entrypoint" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32ce041b1a0ed275290a5008ee1a4a6c48f5054c8a3d78d313c08958a06aedbd" +dependencies = [ + "solana-account-info", + "solana-msg", + "solana-program-error", + "solana-pubkey", +] + +[[package]] +name = "solana-program-error" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee2e0217d642e2ea4bee237f37bd61bb02aec60da3647c48ff88f6556ade775" +dependencies = [ + "borsh 1.6.0", + "num-traits", + "serde", + "serde_derive", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-pubkey", +] + +[[package]] +name = "solana-program-memory" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a5426090c6f3fd6cfdc10685322fede9ca8e5af43cd6a59e98bfe4e91671712" +dependencies = [ + "solana-define-syscall", +] + +[[package]] +name = "solana-program-option" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc677a2e9bc616eda6dbdab834d463372b92848b2bfe4a1ed4e4b4adba3397d0" + +[[package]] +name = "solana-program-pack" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "319f0ef15e6e12dc37c597faccb7d62525a509fec5f6975ecb9419efddeb277b" +dependencies = [ + "solana-program-error", +] + +[[package]] +name = "solana-program-runtime" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5653001e07b657c9de6f0417cf9add1cf4325903732c480d415655e10cc86704" +dependencies = [ + "base64 0.22.1", + "bincode", + "enum-iterator", + "itertools 0.12.1", + "log", + "percentage", + "rand 0.8.5", + "serde", + "solana-account", + "solana-clock", + "solana-epoch-rewards", + "solana-epoch-schedule", + "solana-fee-structure", + "solana-hash", + "solana-instruction", + "solana-last-restart-slot", + "solana-log-collector", + "solana-measure", + "solana-metrics", + "solana-program-entrypoint", + "solana-pubkey", + "solana-rent", + "solana-sbpf", + "solana-sdk-ids", + "solana-slot-hashes", + "solana-stable-layout", + "solana-svm-callback", + "solana-svm-feature-set", + "solana-system-interface", + "solana-sysvar", + "solana-sysvar-id", + "solana-timings", + "solana-transaction-context", + "solana-type-overrides", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-pubkey" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b62adb9c3261a052ca1f999398c388f1daf558a1b492f60a6d9e64857db4ff1" +dependencies = [ + "borsh 0.10.4", + "borsh 1.6.0", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "five8", + "five8_const", + "getrandom 0.2.17", + "js-sys", + "num-traits", + "rand 0.8.5", + "serde", + "serde_derive", + "solana-atomic-u64", + "solana-decode-error", + "solana-define-syscall", + "solana-sanitize", + "solana-sha256-hasher", + "wasm-bindgen", +] + +[[package]] +name = "solana-quic-definitions" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf0d4d5b049eb1d0c35f7b18f305a27c8986fc5c0c9b383e97adaa35334379e" +dependencies = [ + "solana-keypair", +] + +[[package]] +name = "solana-rent" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1aea8fdea9de98ca6e8c2da5827707fb3842833521b528a713810ca685d2480" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-rent-collector" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "127e6dfa51e8c8ae3aa646d8b2672bc4ac901972a338a9e1cd249e030564fb9d" +dependencies = [ + "serde", + "serde_derive", + "solana-account", + "solana-clock", + "solana-epoch-schedule", + "solana-genesis-config", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", +] + +[[package]] +name = "solana-rent-debits" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f6f9113c6003492e74438d1288e30cffa8ccfdc2ef7b49b9e816d8034da18cd" +dependencies = [ + "solana-pubkey", + "solana-reward-info", +] + +[[package]] +name = "solana-reserved-account-keys" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4b22ea19ca2a3f28af7cd047c914abf833486bf7a7c4a10fc652fff09b385b1" +dependencies = [ + "lazy_static", + "solana-feature-set", + "solana-pubkey", + "solana-sdk-ids", +] + +[[package]] +name = "solana-reward-info" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18205b69139b1ae0ab8f6e11cdcb627328c0814422ad2482000fa2ca54ae4a2f" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "solana-rpc-client" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8d3161ac0918178e674c1f7f1bfac40de3e7ed0383bd65747d63113c156eaeb" +dependencies = [ + "async-trait", + "base64 0.22.1", + "bincode", + "bs58", + "futures", + "indicatif", + "log", + "reqwest 0.12.28", + "reqwest-middleware", + "semver", + "serde", + "serde_derive", + "serde_json", + "solana-account", + "solana-account-decoder-client-types", + "solana-clock", + "solana-commitment-config", + "solana-epoch-info", + "solana-epoch-schedule", + "solana-feature-gate-interface", + "solana-hash", + "solana-instruction", + "solana-message", + "solana-pubkey", + "solana-rpc-client-api", + "solana-signature", + "solana-transaction", + "solana-transaction-error", + "solana-transaction-status-client-types", + "solana-version", + "solana-vote-interface", + "tokio", +] + +[[package]] +name = "solana-rpc-client-api" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dbc138685c79d88a766a8fd825057a74ea7a21e1dd7f8de275ada899540fff7" +dependencies = [ + "anyhow", + "jsonrpc-core", + "reqwest 0.12.28", + "reqwest-middleware", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder-client-types", + "solana-clock", + "solana-rpc-client-types", + "solana-signer", + "solana-transaction-error", + "solana-transaction-status-client-types", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-rpc-client-types" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea428a81729255d895ea47fba9b30fd4dacbfe571a080448121bd0592751676" +dependencies = [ + "base64 0.22.1", + "bs58", + "semver", + "serde", + "serde_derive", + "serde_json", + "solana-account", + "solana-account-decoder-client-types", + "solana-clock", + "solana-commitment-config", + "solana-fee-calculator", + "solana-inflation", + "solana-pubkey", + "solana-transaction-error", + "solana-transaction-status-client-types", + "solana-version", + "spl-generic-token", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-sanitize" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f1bc1357b8188d9c4a3af3fc55276e56987265eb7ad073ae6f8180ee54cecf" + +[[package]] +name = "solana-sbpf" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "474a2d95dc819898ded08d24f29642d02189d3e1497bbb442a92a3997b7eb55f" +dependencies = [ + "byteorder", + "combine", + "hash32", + "libc", + "log", + "rand 0.8.5", + "rustc-demangle", + "thiserror 2.0.18", + "winapi", +] + +[[package]] +name = "solana-sdk" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cc0e4a7635b902791c44b6581bfb82f3ada32c5bc0929a64f39fe4bb384c86a" +dependencies = [ + "bincode", + "bs58", + "getrandom 0.1.16", + "js-sys", + "serde", + "serde_json", + "solana-account", + "solana-bn254", + "solana-client-traits", + "solana-cluster-type", + "solana-commitment-config", + "solana-compute-budget-interface", + "solana-decode-error", + "solana-derivation-path", + "solana-ed25519-program", + "solana-epoch-info", + "solana-epoch-rewards-hasher", + "solana-feature-set", + "solana-fee-structure", + "solana-genesis-config", + "solana-hard-forks", + "solana-inflation", + "solana-instruction", + "solana-keypair", + "solana-message", + "solana-native-token 2.3.0", + "solana-nonce-account", + "solana-offchain-message", + "solana-packet", + "solana-poh-config", + "solana-precompile-error", + "solana-precompiles", + "solana-presigner", + "solana-program", + "solana-program-memory", + "solana-pubkey", + "solana-quic-definitions", + "solana-rent-collector", + "solana-rent-debits", + "solana-reserved-account-keys", + "solana-reward-info", + "solana-sanitize", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-secp256k1-program", + "solana-secp256k1-recover", + "solana-secp256r1-program", + "solana-seed-derivable", + "solana-seed-phrase", + "solana-serde", + "solana-serde-varint", + "solana-short-vec", + "solana-shred-version", + "solana-signature", + "solana-signer", + "solana-system-transaction", + "solana-time-utils", + "solana-transaction", + "solana-transaction-context", + "solana-transaction-error", + "solana-validator-exit", + "thiserror 2.0.18", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-ids" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5d8b9cc68d5c88b062a33e23a6466722467dde0035152d8fb1afbcdf350a5f" +dependencies = [ + "solana-pubkey", +] + +[[package]] +name = "solana-sdk-macro" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86280da8b99d03560f6ab5aca9de2e38805681df34e0bb8f238e69b29433b9df" +dependencies = [ + "bs58", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "solana-secp256k1-program" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f19833e4bc21558fe9ec61f239553abe7d05224347b57d65c2218aeeb82d6149" +dependencies = [ + "bincode", + "digest 0.10.7", + "libsecp256k1", + "serde", + "serde_derive", + "sha3", + "solana-feature-set", + "solana-instruction", + "solana-precompile-error", + "solana-sdk-ids", + "solana-signature", +] + +[[package]] +name = "solana-secp256k1-recover" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa3120b6cdaa270f39444f5093a90a7b03d296d362878f7a6991d6de3bbe496" +dependencies = [ + "borsh 1.6.0", + "libsecp256k1", + "solana-define-syscall", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-secp256r1-program" +version = "2.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce0ae46da3071a900f02d367d99b2f3058fe2e90c5062ac50c4f20cfedad8f0f" +dependencies = [ + "bytemuck", + "openssl", + "solana-feature-set", + "solana-instruction", + "solana-precompile-error", + "solana-sdk-ids", +] + +[[package]] +name = "solana-security-txt" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "156bb61a96c605fa124e052d630dba2f6fb57e08c7d15b757e1e958b3ed7b3fe" +dependencies = [ + "hashbrown 0.15.2", +] + +[[package]] +name = "solana-seed-derivable" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beb82b5adb266c6ea90e5cf3967235644848eac476c5a1f2f9283a143b7c97f" +dependencies = [ + "solana-derivation-path", +] + +[[package]] +name = "solana-seed-phrase" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36187af2324f079f65a675ec22b31c24919cb4ac22c79472e85d819db9bbbc15" +dependencies = [ + "hmac 0.12.1", + "pbkdf2", + "sha2 0.10.9", +] + +[[package]] +name = "solana-serde" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1931484a408af466e14171556a47adaa215953c7f48b24e5f6b0282763818b04" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-serde-varint" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a7e155eba458ecfb0107b98236088c3764a09ddf0201ec29e52a0be40857113" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-serialize-utils" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "817a284b63197d2b27afdba829c5ab34231da4a9b4e763466a003c40ca4f535e" +dependencies = [ + "solana-instruction", + "solana-pubkey", + "solana-sanitize", +] + +[[package]] +name = "solana-sha256-hasher" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa3feb32c28765f6aa1ce8f3feac30936f16c5c3f7eb73d63a5b8f6f8ecdc44" +dependencies = [ + "sha2 0.10.9", + "solana-define-syscall", + "solana-hash", +] + +[[package]] +name = "solana-short-vec" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c54c66f19b9766a56fa0057d060de8378676cb64987533fa088861858fc5a69" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-shred-version" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afd3db0461089d1ad1a78d9ba3f15b563899ca2386351d38428faa5350c60a98" +dependencies = [ + "solana-hard-forks", + "solana-hash", + "solana-sha256-hasher", +] + +[[package]] +name = "solana-signature" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c8ec8e657aecfc187522fc67495142c12f35e55ddeca8698edbb738b8dbd8c" +dependencies = [ + "ed25519-dalek", + "five8", + "rand 0.8.5", + "serde", + "serde-big-array", + "serde_derive", + "solana-sanitize", +] + +[[package]] +name = "solana-signer" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c41991508a4b02f021c1342ba00bcfa098630b213726ceadc7cb032e051975b" +dependencies = [ + "solana-pubkey", + "solana-signature", + "solana-transaction-error", +] + +[[package]] +name = "solana-slot-hashes" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c8691982114513763e88d04094c9caa0376b867a29577939011331134c301ce" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", + "solana-sdk-ids", + "solana-sysvar-id", +] + +[[package]] +name = "solana-slot-history" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ccc1b2067ca22754d5283afb2b0126d61eae734fc616d23871b0943b0d935e" +dependencies = [ + "bv", + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sysvar-id", +] + +[[package]] +name = "solana-stable-layout" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f14f7d02af8f2bc1b5efeeae71bc1c2b7f0f65cd75bcc7d8180f2c762a57f54" +dependencies = [ + "solana-instruction", + "solana-pubkey", +] + +[[package]] +name = "solana-stake-interface" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5269e89fde216b4d7e1d1739cf5303f8398a1ff372a81232abbee80e554a838c" +dependencies = [ + "borsh 0.10.4", + "borsh 1.6.0", + "num-traits", + "serde", + "serde_derive", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-system-interface", + "solana-sysvar-id", +] + +[[package]] +name = "solana-stake-program" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500e9b9d11573f12de91e94f9c4459882cd5ffc692776af49b610d6fcc0b167f" +dependencies = [ + "agave-feature-set", + "bincode", + "log", + "solana-account", + "solana-bincode", + "solana-clock", + "solana-config-program-client", + "solana-genesis-config", + "solana-instruction", + "solana-log-collector", + "solana-native-token 2.3.0", + "solana-packet", + "solana-program-runtime", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-stake-interface", + "solana-sysvar", + "solana-transaction-context", + "solana-type-overrides", + "solana-vote-interface", +] + +[[package]] +name = "solana-svm-callback" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cef9f7d5cfb5d375081a6c8ad712a6f0e055a15890081f845acf55d8254a7a2" +dependencies = [ + "solana-account", + "solana-precompile-error", + "solana-pubkey", +] + +[[package]] +name = "solana-svm-feature-set" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f24b836eb4d74ec255217bdbe0f24f64a07adeac31aca61f334f91cd4a3b1d5" + +[[package]] +name = "solana-svm-transaction" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab717b9539375ebb088872c6c87d1d8832d19f30f154ecc530154d23f60a6f0c" +dependencies = [ + "solana-hash", + "solana-message", + "solana-pubkey", + "solana-sdk-ids", + "solana-signature", + "solana-transaction", +] + +[[package]] +name = "solana-system-interface" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94d7c18cb1a91c6be5f5a8ac9276a1d7c737e39a21beba9ea710ab4b9c63bc90" +dependencies = [ + "js-sys", + "num-traits", + "serde", + "serde_derive", + "solana-decode-error", + "solana-instruction", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-system-program" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ca36cef39aea7761be58d4108a56a2e27042fb1e913355fdb142a05fc7eab7" +dependencies = [ + "bincode", + "log", + "serde", + "serde_derive", + "solana-account", + "solana-bincode", + "solana-fee-calculator", + "solana-instruction", + "solana-log-collector", + "solana-nonce", + "solana-nonce-account", + "solana-packet", + "solana-program-runtime", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", + "solana-sysvar", + "solana-transaction-context", + "solana-type-overrides", +] + +[[package]] +name = "solana-system-transaction" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd98a25e5bcba8b6be8bcbb7b84b24c2a6a8178d7fb0e3077a916855ceba91a" +dependencies = [ + "solana-hash", + "solana-keypair", + "solana-message", + "solana-pubkey", + "solana-signer", + "solana-system-interface", + "solana-transaction", +] + +[[package]] +name = "solana-sysvar" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c3595f95069f3d90f275bb9bd235a1973c4d059028b0a7f81baca2703815db" +dependencies = [ + "base64 0.22.1", + "bincode", + "bytemuck", + "bytemuck_derive", + "lazy_static", + "serde", + "serde_derive", + "solana-account-info", + "solana-clock", + "solana-define-syscall", + "solana-epoch-rewards", + "solana-epoch-schedule", + "solana-fee-calculator", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", + "solana-last-restart-slot", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-pubkey", + "solana-rent", + "solana-sanitize", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-slot-hashes", + "solana-slot-history", + "solana-stake-interface", + "solana-sysvar-id", +] + +[[package]] +name = "solana-sysvar-id" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5762b273d3325b047cfda250787f8d796d781746860d5d0a746ee29f3e8812c1" +dependencies = [ + "solana-pubkey", + "solana-sdk-ids", +] + +[[package]] +name = "solana-time-utils" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af261afb0e8c39252a04d026e3ea9c405342b08c871a2ad8aa5448e068c784c" + +[[package]] +name = "solana-timings" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c49b842dfc53c1bf9007eaa6730296dea93b4fce73f457ce1080af43375c0d6" +dependencies = [ + "eager", + "enum-iterator", + "solana-pubkey", +] + +[[package]] +name = "solana-transaction" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80657d6088f721148f5d889c828ca60c7daeedac9a8679f9ec215e0c42bcbf41" +dependencies = [ + "bincode", + "serde", + "serde_derive", + "solana-bincode", + "solana-feature-set", + "solana-hash", + "solana-instruction", + "solana-keypair", + "solana-message", + "solana-precompiles", + "solana-pubkey", + "solana-sanitize", + "solana-sdk-ids", + "solana-short-vec", + "solana-signature", + "solana-signer", + "solana-system-interface", + "solana-transaction-error", + "wasm-bindgen", +] + +[[package]] +name = "solana-transaction-context" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a312304361987a85b2ef2293920558e6612876a639dd1309daf6d0d59ef2fe" +dependencies = [ + "bincode", + "serde", + "serde_derive", + "solana-account", + "solana-instruction", + "solana-instructions-sysvar", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", +] + +[[package]] +name = "solana-transaction-error" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a9dc8fdb61c6088baab34fc3a8b8473a03a7a5fd404ed8dd502fa79b67cb1" +dependencies = [ + "serde", + "serde_derive", + "solana-instruction", + "solana-sanitize", +] + +[[package]] +name = "solana-transaction-status" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135f92f4192cc68900c665becf97fc0a6500ae5a67ff347bf2cbc20ecfefa821" +dependencies = [ + "Inflector", + "agave-reserved-account-keys", + "base64 0.22.1", + "bincode", + "borsh 1.6.0", + "bs58", + "log", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder", + "solana-address-lookup-table-interface", + "solana-clock", + "solana-hash", + "solana-instruction", + "solana-loader-v2-interface", + "solana-loader-v3-interface", + "solana-message", + "solana-program-option", + "solana-pubkey", + "solana-reward-info", + "solana-sdk-ids", + "solana-signature", + "solana-stake-interface", + "solana-system-interface", + "solana-transaction", + "solana-transaction-error", + "solana-transaction-status-client-types", + "solana-vote-interface", + "spl-associated-token-account 7.0.0", + "spl-memo", + "spl-token 8.0.0", + "spl-token-2022 8.0.1", + "spl-token-group-interface 0.6.0", + "spl-token-metadata-interface 0.7.0", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-transaction-status-client-types" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f1d7c2387c35850848212244d2b225847666cb52d3bd59a5c409d2c300303d" +dependencies = [ + "base64 0.22.1", + "bincode", + "bs58", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder-client-types", + "solana-commitment-config", + "solana-message", + "solana-reward-info", + "solana-signature", + "solana-transaction", + "solana-transaction-context", + "solana-transaction-error", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-type-overrides" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d80c44761eb398a157d809a04840865c347e1831ae3859b6100c0ee457bc1a" +dependencies = [ + "rand 0.8.5", +] + +[[package]] +name = "solana-validator-exit" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bbf6d7a3c0b28dd5335c52c0e9eae49d0ae489a8f324917faf0ded65a812c1d" + +[[package]] +name = "solana-version" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3324d46c7f7b7f5d34bf7dc71a2883bdc072c7b28ca81d0b2167ecec4cf8da9f" +dependencies = [ + "agave-feature-set", + "rand 0.8.5", + "semver", + "serde", + "serde_derive", + "solana-sanitize", + "solana-serde-varint", +] + +[[package]] +name = "solana-vote-interface" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b80d57478d6599d30acc31cc5ae7f93ec2361a06aefe8ea79bc81739a08af4c3" +dependencies = [ + "bincode", + "num-derive 0.4.2", + "num-traits", + "serde", + "serde_derive", + "solana-clock", + "solana-decode-error", + "solana-hash", + "solana-instruction", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-serde-varint", + "solana-serialize-utils", + "solana-short-vec", + "solana-system-interface", +] + +[[package]] +name = "solana-vote-program" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "908d0e72c8b83e48762eb3e8c9114497cf4b1d66e506e360c46aba9308e71299" +dependencies = [ + "agave-feature-set", + "bincode", + "log", + "num-derive 0.4.2", + "num-traits", + "serde", + "serde_derive", + "solana-account", + "solana-bincode", + "solana-clock", + "solana-epoch-schedule", + "solana-hash", + "solana-instruction", + "solana-keypair", + "solana-metrics", + "solana-packet", + "solana-program-runtime", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-signer", + "solana-slot-hashes", + "solana-transaction", + "solana-transaction-context", + "solana-vote-interface", + "thiserror 2.0.18", +] + +[[package]] +name = "solana-zk-elgamal-proof-program" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70cea14481d8efede6b115a2581f27bc7c6fdfba0752c20398456c3ac1245fc4" +dependencies = [ + "agave-feature-set", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-instruction", + "solana-log-collector", + "solana-program-runtime", + "solana-sdk-ids", + "solana-zk-sdk", +] + +[[package]] +name = "solana-zk-sdk" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b9fc6ec37d16d0dccff708ed1dd6ea9ba61796700c3bb7c3b401973f10f63b" +dependencies = [ + "aes-gcm-siv", + "base64 0.22.1", + "bincode", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "itertools 0.12.1", + "js-sys", + "merlin", + "num-derive 0.4.2", + "num-traits", + "rand 0.8.5", + "serde", + "serde_derive", + "serde_json", + "sha3", + "solana-derivation-path", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-seed-derivable", + "solana-seed-phrase", + "solana-signature", + "solana-signer", + "subtle", + "thiserror 2.0.18", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "solana-zk-token-proof-program" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579752ad6ea2a671995f13c763bf28288c3c895cb857a518cc4ebab93c9a8dde" +dependencies = [ + "agave-feature-set", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-instruction", + "solana-log-collector", + "solana-program-runtime", + "solana-sdk-ids", + "solana-zk-token-sdk", +] + +[[package]] +name = "solana-zk-token-sdk" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5055e5df94abd5badf4f947681c893375bdb6f8f543c05d2a7ab9647a6a9d205" +dependencies = [ + "aes-gcm-siv", + "base64 0.22.1", + "bincode", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "itertools 0.12.1", + "merlin", + "num-derive 0.4.2", + "num-traits", + "rand 0.8.5", + "serde", + "serde_derive", + "serde_json", + "sha3", + "solana-curve25519", + "solana-derivation-path", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-seed-derivable", + "solana-seed-phrase", + "solana-signature", + "solana-signer", + "subtle", + "thiserror 2.0.18", + "zeroize", +] + +[[package]] +name = "spl-associated-token-account" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76fee7d65013667032d499adc3c895e286197a35a0d3a4643c80e7fd3e9969e3" +dependencies = [ + "borsh 1.6.0", + "num-derive 0.4.2", + "num-traits", + "solana-program", + "spl-associated-token-account-client", + "spl-token 7.0.0", + "spl-token-2022 6.0.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-associated-token-account" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae179d4a26b3c7a20c839898e6aed84cb4477adf108a366c95532f058aea041b" +dependencies = [ + "borsh 1.6.0", + "num-derive 0.4.2", + "num-traits", + "solana-program", + "spl-associated-token-account-client", + "spl-token 8.0.0", + "spl-token-2022 8.0.1", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-associated-token-account-client" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f8349dbcbe575f354f9a533a21f272f3eb3808a49e2fdc1c34393b88ba76cb" +dependencies = [ + "solana-instruction", + "solana-pubkey", +] + +[[package]] +name = "spl-discriminator" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7398da23554a31660f17718164e31d31900956054f54f52d5ec1be51cb4f4b3" +dependencies = [ + "bytemuck", + "solana-program-error", + "solana-sha256-hasher", + "spl-discriminator-derive", +] + +[[package]] +name = "spl-discriminator-derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9e8418ea6269dcfb01c712f0444d2c75542c04448b480e87de59d2865edc750" +dependencies = [ + "quote", + "spl-discriminator-syn", + "syn 2.0.114", +] + +[[package]] +name = "spl-discriminator-syn" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d1dbc82ab91422345b6df40a79e2b78c7bce1ebb366da323572dd60b7076b67" +dependencies = [ + "proc-macro2", + "quote", + "sha2 0.10.9", + "syn 2.0.114", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-elgamal-registry" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce0f668975d2b0536e8a8fd60e56a05c467f06021dae037f1d0cfed0de2e231d" +dependencies = [ + "bytemuck", + "solana-program", + "solana-zk-sdk", + "spl-pod 0.5.1", + "spl-token-confidential-transfer-proof-extraction 0.2.1", +] + +[[package]] +name = "spl-elgamal-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65edfeed09cd4231e595616aa96022214f9c9d2be02dea62c2b30d5695a6833a" +dependencies = [ + "bytemuck", + "solana-account-info", + "solana-cpi", + "solana-instruction", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-system-interface", + "solana-sysvar", + "solana-zk-sdk", + "spl-pod 0.5.1", + "spl-token-confidential-transfer-proof-extraction 0.3.0", +] + +[[package]] +name = "spl-generic-token" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "741a62a566d97c58d33f9ed32337ceedd4e35109a686e31b1866c5dfa56abddc" +dependencies = [ + "bytemuck", + "solana-pubkey", +] + +[[package]] +name = "spl-memo" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f09647c0974e33366efeb83b8e2daebb329f0420149e74d3a4bd2c08cf9f7cb" +dependencies = [ + "solana-account-info", + "solana-instruction", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-pubkey", +] + +[[package]] +name = "spl-pod" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00e38c99f09d58df06ca9a29fc0211786a4c34f4d099c1df27b1abaa206569a4" +dependencies = [ + "bytemuck", + "bytemuck_derive", + "solana-program", + "solana-zk-sdk", + "spl-program-error 0.5.0", +] + +[[package]] +name = "spl-pod" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d994afaf86b779104b4a95ba9ca75b8ced3fdb17ee934e38cb69e72afbe17799" +dependencies = [ + "borsh 1.6.0", + "bytemuck", + "bytemuck_derive", + "num-derive 0.4.2", + "num-traits", + "solana-decode-error", + "solana-msg", + "solana-program-error", + "solana-program-option", + "solana-pubkey", + "solana-zk-sdk", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-program-error" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7b28bed65356558133751cc32b48a7a5ddfc59ac4e941314630bbed1ac10532" +dependencies = [ + "num-derive 0.4.2", + "num-traits", + "solana-program", + "spl-program-error-derive 0.4.1", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-program-error" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d39b5186f42b2b50168029d81e58e800b690877ef0b30580d107659250da1d1" +dependencies = [ + "num-derive 0.4.2", + "num-traits", + "solana-program", + "spl-program-error-derive 0.4.1", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-program-error" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdebc8b42553070b75aa5106f071fef2eb798c64a7ec63375da4b1f058688c6" +dependencies = [ + "num-derive 0.4.2", + "num-traits", + "solana-decode-error", + "solana-msg", + "solana-program-error", + "spl-program-error-derive 0.5.0", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-program-error-derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d375dd76c517836353e093c2dbb490938ff72821ab568b545fd30ab3256b3e" +dependencies = [ + "proc-macro2", + "quote", + "sha2 0.10.9", + "syn 2.0.114", +] + +[[package]] +name = "spl-program-error-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2539e259c66910d78593475540e8072f0b10f0f61d7607bbf7593899ed52d0" +dependencies = [ + "proc-macro2", + "quote", + "sha2 0.10.9", + "syn 2.0.114", +] + +[[package]] +name = "spl-tlv-account-resolution" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd99ff1e9ed2ab86e3fd582850d47a739fec1be9f4661cba1782d3a0f26805f3" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator", + "spl-pod 0.5.1", + "spl-program-error 0.6.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-tlv-account-resolution" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1408e961215688715d5a1063cbdcf982de225c45f99c82b4f7d7e1dd22b998d7" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator", + "spl-pod 0.5.1", + "spl-program-error 0.7.0", + "spl-type-length-value 0.8.0", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed320a6c934128d4f7e54fe00e16b8aeaecf215799d060ae14f93378da6dc834" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "num_enum", + "solana-program", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-token" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053067c6a82c705004f91dae058b11b4780407e9ccd6799dc9e7d0fab5f242da" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "num_enum", + "solana-account-info", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-sysvar", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-2022" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b27f7405010ef816587c944536b0eafbcc35206ab6ba0f2ca79f1d28e488f4f" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "num_enum", + "solana-program", + "solana-security-txt", + "solana-zk-sdk", + "spl-elgamal-registry 0.1.1", + "spl-memo", + "spl-pod 0.5.1", + "spl-token 7.0.0", + "spl-token-confidential-transfer-ciphertext-arithmetic 0.2.1", + "spl-token-confidential-transfer-proof-extraction 0.2.1", + "spl-token-confidential-transfer-proof-generation 0.2.0", + "spl-token-group-interface 0.5.0", + "spl-token-metadata-interface 0.6.0", + "spl-transfer-hook-interface 0.9.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-token-2022" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9048b26b0df0290f929ff91317c83db28b3ef99af2b3493dd35baa146774924c" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "num_enum", + "solana-program", + "solana-security-txt", + "solana-zk-sdk", + "spl-elgamal-registry 0.1.1", + "spl-memo", + "spl-pod 0.5.1", + "spl-token 7.0.0", + "spl-token-confidential-transfer-ciphertext-arithmetic 0.2.1", + "spl-token-confidential-transfer-proof-extraction 0.2.1", + "spl-token-confidential-transfer-proof-generation 0.3.0", + "spl-token-group-interface 0.5.0", + "spl-token-metadata-interface 0.6.0", + "spl-transfer-hook-interface 0.9.0", + "spl-type-length-value 0.7.0", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-2022" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f0dfbb079eebaee55e793e92ca5f433744f4b71ee04880bfd6beefba5973e5" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "num_enum", + "solana-account-info", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-native-token 2.3.0", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-security-txt", + "solana-system-interface", + "solana-sysvar", + "solana-zk-sdk", + "spl-elgamal-registry 0.2.0", + "spl-memo", + "spl-pod 0.5.1", + "spl-token 8.0.0", + "spl-token-confidential-transfer-ciphertext-arithmetic 0.3.1", + "spl-token-confidential-transfer-proof-extraction 0.3.0", + "spl-token-confidential-transfer-proof-generation 0.4.1", + "spl-token-group-interface 0.6.0", + "spl-token-metadata-interface 0.7.0", + "spl-transfer-hook-interface 0.10.0", + "spl-type-length-value 0.8.0", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-2022-interface" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62d7ae2ee6b856f8ddcbdc3b3a9f4d2141582bbe150f93e5298ee97e0251fa04" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "num_enum", + "solana-account-info", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-sdk-ids", + "solana-zk-sdk", + "spl-pod 0.5.1", + "spl-token-confidential-transfer-proof-extraction 0.4.1", + "spl-token-confidential-transfer-proof-generation 0.4.1", + "spl-token-group-interface 0.6.0", + "spl-token-metadata-interface 0.7.0", + "spl-type-length-value 0.8.0", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-confidential-transfer-ciphertext-arithmetic" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170378693c5516090f6d37ae9bad2b9b6125069be68d9acd4865bbe9fc8499fd" +dependencies = [ + "base64 0.22.1", + "bytemuck", + "solana-curve25519", + "solana-zk-sdk", +] + +[[package]] +name = "spl-token-confidential-transfer-ciphertext-arithmetic" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cddd52bfc0f1c677b41493dafa3f2dbbb4b47cf0990f08905429e19dc8289b35" +dependencies = [ + "base64 0.22.1", + "bytemuck", + "solana-curve25519", + "solana-zk-sdk", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-extraction" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff2d6a445a147c9d6dd77b8301b1e116c8299601794b558eafa409b342faf96" +dependencies = [ + "bytemuck", + "solana-curve25519", + "solana-program", + "solana-zk-sdk", + "spl-pod 0.5.1", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-extraction" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe2629860ff04c17bafa9ba4bed8850a404ecac81074113e1f840dbd0ebb7bd6" +dependencies = [ + "bytemuck", + "solana-account-info", + "solana-curve25519", + "solana-instruction", + "solana-instructions-sysvar", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "solana-sdk-ids", + "solana-zk-sdk", + "spl-pod 0.5.1", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-extraction" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512c85bdbbb4cbcc2038849a9e164c958b16541f252b53ea1a3933191c0a4a1a" +dependencies = [ + "bytemuck", + "solana-account-info", + "solana-curve25519", + "solana-instruction", + "solana-instructions-sysvar", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "solana-sdk-ids", + "solana-zk-sdk", + "spl-pod 0.5.1", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-generation" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8627184782eec1894de8ea26129c61303f1f0adeed65c20e0b10bc584f09356d" +dependencies = [ + "curve25519-dalek 4.1.3", + "solana-zk-sdk", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-generation" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e3597628b0d2fe94e7900fd17cdb4cfbb31ee35c66f82809d27d86e44b2848b" +dependencies = [ + "curve25519-dalek 4.1.3", + "solana-zk-sdk", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-generation" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa27b9174bea869a7ebf31e0be6890bce90b1a4288bc2bbf24bd413f80ae3fde" +dependencies = [ + "curve25519-dalek 4.1.3", + "solana-zk-sdk", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-group-interface" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d595667ed72dbfed8c251708f406d7c2814a3fa6879893b323d56a10bedfc799" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator", + "spl-pod 0.5.1", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-token-group-interface" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5597b4cd76f85ce7cd206045b7dc22da8c25516573d42d267c8d1fd128db5129" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator", + "spl-pod 0.5.1", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-token-metadata-interface" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfb9c89dbc877abd735f05547dcf9e6e12c00c11d6d74d8817506cab4c99fdbb" +dependencies = [ + "borsh 1.6.0", + "num-derive 0.4.2", + "num-traits", + "solana-borsh", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator", + "spl-pod 0.5.1", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-token-metadata-interface" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "304d6e06f0de0c13a621464b1fd5d4b1bebf60d15ca71a44d3839958e0da16ee" +dependencies = [ + "borsh 1.6.0", + "num-derive 0.4.2", + "num-traits", + "solana-borsh", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator", + "spl-pod 0.5.1", + "spl-type-length-value 0.8.0", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-transfer-hook-interface" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aa7503d52107c33c88e845e1351565050362c2314036ddf19a36cd25137c043" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator", + "spl-pod 0.5.1", + "spl-program-error 0.6.0", + "spl-tlv-account-resolution 0.9.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-transfer-hook-interface" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7e905b849b6aba63bde8c4badac944ebb6c8e6e14817029cbe1bc16829133bd" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator", + "spl-pod 0.5.1", + "spl-program-error 0.7.0", + "spl-tlv-account-resolution 0.10.0", + "spl-type-length-value 0.8.0", + "thiserror 2.0.18", +] + +[[package]] +name = "spl-type-length-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba70ef09b13af616a4c987797870122863cba03acc4284f226a4473b043923f9" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-msg", + "solana-program-error", + "spl-discriminator", + "spl-pod 0.5.1", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-type-length-value" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d417eb548214fa822d93f84444024b4e57c13ed6719d4dcc68eec24fb481e9f5" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-msg", + "solana-program-error", + "spl-discriminator", + "spl-pod 0.5.1", + "thiserror 2.0.18", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "swap_example" +version = "0.1.0" +dependencies = [ + "anchor-lang", + "anchor-spl", + "az", + "blake3", + "fixed", + "light-anchor-spl", + "light-client", + "light-hasher", + "light-program-test", + "light-sdk", + "light-token", + "shared-test-utils", + "solana-account-info", + "solana-instruction", + "solana-keypair", + "solana-msg", + "solana-program", + "solana-program-error", + "solana-pubkey", + "solana-sdk", + "solana-signer", + "spl-pod 0.4.0", + "spl-token-2022 6.0.0", + "tokio", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys 0.5.0", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.10.0", + "core-foundation", + "system-configuration-sys 0.6.0", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tabled" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e39a2ee1fbcd360805a771e1b300f78cc88fec7b8d3e2f71cd37bbf23e725c7d" +dependencies = [ + "papergrid", + "tabled_derive", + "testing_table", +] + +[[package]] +name = "tabled_derive" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea5d1b13ca6cff1f9231ffd62f15eefd72543dab5e468735f1a456728a02846" +dependencies = [ + "heck 0.5.0", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tarpc" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38a012bed6fb9681d3bf71ffaa4f88f3b4b9ed3198cda6e4c8462d24d4bb80" +dependencies = [ + "anyhow", + "fnv", + "futures", + "humantime", + "opentelemetry", + "pin-project", + "rand 0.8.5", + "serde", + "static_assertions", + "tarpc-plugins", + "thiserror 1.0.69", + "tokio", + "tokio-serde", + "tokio-util 0.6.10", + "tracing", + "tracing-opentelemetry", +] + +[[package]] +name = "tarpc-plugins" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee42b4e559f17bce0385ebf511a7beb67d5cc33c12c96b7f4e9789919d9c10f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "testing_table" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f8daae29995a24f65619e19d8d31dea5b389f3d853d8bf297bbf607cd0014cc" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" + +[[package]] +name = "time-macros" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.6.1", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.12", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls 0.23.36", + "tokio", +] + +[[package]] +name = "tokio-serde" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "911a61637386b789af998ee23f50aa30d5fd7edcec8d6d3dedae5e5815205466" +dependencies = [ + "bincode", + "bytes", + "educe 0.4.23", + "futures-core", + "futures-sink", + "pin-project", + "serde", + "serde_json", +] + +[[package]] +name = "tokio-util" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "slab", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap 2.13.0", + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.23.10+spec-1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" +dependencies = [ + "indexmap 2.13.0", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 1.0.2", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "async-compression", + "bitflags 2.10.0", + "bytes", + "futures-core", + "futures-util", + "http 1.4.0", + "http-body 1.0.1", + "http-body-util", + "iri-string", + "pin-project-lite", + "tokio", + "tokio-util 0.7.18", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" +dependencies = [ + "once_cell", + "opentelemetry", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +dependencies = [ + "sharded-slab", + "thread_local", + "tracing-core", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +dependencies = [ + "void", +] + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "uriparse" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0200d0fc04d809396c2ad43f3c95da3582a2556eba8d453c1087f4120ee352ff" +dependencies = [ + "fnv", + "lazy_static", +] + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" +dependencies = [ + "getrandom 0.3.4", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" +dependencies = [ + "cfg-if", + "futures-util", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.114", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + +[[package]] +name = "webpki-roots" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "zmij" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65" + +[[package]] +name = "zstd" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.16+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/anchor/Cargo.toml b/anchor/Cargo.toml new file mode 100644 index 0000000..a628008 --- /dev/null +++ b/anchor/Cargo.toml @@ -0,0 +1,34 @@ +[workspace] +resolver = "2" +members = [ + "programs/escrow", + "programs/fundraiser", + "programs/light-token-minter", + "programs/token-swap", + "programs/shared-test-utils", +] + +[profile.release] +lto = "fat" +codegen-units = 1 +panic = "abort" +overflow-checks = true + +[profile.release.build-override] +opt-level = 3 +incremental = false +codegen-units = 1 + +[workspace.dependencies] +# Pin blake3 version for solana-program compatibility +blake3 = { version = "=1.8.2", default-features = false } + +# Light Protocol dependencies from crates.io +light-sdk = "0.19.0" +light-sdk-macros = "0.19.0" +light-hasher = "5.0.0" +light-token = "0.4.0" +light-program-test = "0.19.0" +light-client = "0.19.0" +light-anchor-spl = { version = "0.31.1", features = ["idl-build"] } +shared-test-utils = { path = "programs/shared-test-utils" } diff --git a/anchor/programs/escrow/Cargo.toml b/anchor/programs/escrow/Cargo.toml new file mode 100644 index 0000000..bb25a47 --- /dev/null +++ b/anchor/programs/escrow/Cargo.toml @@ -0,0 +1,52 @@ +[package] +name = "escrow" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib", "lib"] +name = "escrow" + +[features] +no-entrypoint = [] +no-log-ix-name = [] +no-idl = [] +cpi = ["no-entrypoint"] +default = [] +idl-build = ["anchor-lang/idl-build", "light-sdk/idl-build"] +test-sbf = [] + +[dependencies] +anchor-lang = { version = "=0.31.1", features = ["idl-build"] } +# Pin blake3 version for solana-program compatibility +blake3 = { workspace = true } + +light-sdk = { workspace = true, features = ["anchor", "anchor-discriminator", "idl-build", "cpi-context", "v2"] } +light-token = { workspace = true, features = ["anchor"] } +# Required by LightAccount derive macro +light-hasher = { workspace = true, features = ["solana"] } +light-anchor-spl = { workspace = true, features = ["idl-build"] } +solana-program = "2.2" +solana-pubkey = "2.2" +solana-account-info = "2.3" +solana-program-error = "2.2" +solana-msg = "2.2" + +[dev-dependencies] +light-program-test = { workspace = true } +light-client = { workspace = true, features = ["v2", "anchor"] } +anchor-spl = "0.31.1" +tokio = { version = "1", features = ["full"] } +solana-keypair = { version = "2.2" } +solana-signer = { version = "2.2" } +solana-instruction = { version = "2.2" } +solana-sdk = { version = "2.3" } +spl-token-2022 = "6.0.0" +spl-pod = "0.4.0" + +[lints.rust.unexpected_cfgs] +level = "allow" +check-cfg = [ + 'cfg(target_os, values("solana"))', + 'cfg(feature, values("frozen-abi", "no-entrypoint"))', +] diff --git a/anchor/programs/escrow/src/constants.rs b/anchor/programs/escrow/src/constants.rs new file mode 100644 index 0000000..57aafe5 --- /dev/null +++ b/anchor/programs/escrow/src/constants.rs @@ -0,0 +1,11 @@ +/// Seed for deriving the offer PDA. +pub const OFFER_SEED: &[u8] = b"offer"; + +/// Seed for deriving the vault PDA. +pub const VAULT_SEED: &[u8] = b"vault"; + +/// Seed for deriving the authority PDA. +pub const AUTH_SEED: &str = "authority"; + +/// Anchor discriminator size in bytes. +pub const ANCHOR_DISCRIMINATOR: usize = 8; diff --git a/anchor/programs/escrow/src/instructions/make_offer.rs b/anchor/programs/escrow/src/instructions/make_offer.rs new file mode 100644 index 0000000..787fb69 --- /dev/null +++ b/anchor/programs/escrow/src/instructions/make_offer.rs @@ -0,0 +1,133 @@ +use anchor_lang::prelude::*; +use light_anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; +use light_sdk::interface::CreateAccountsProof; +use light_token::anchor::LightAccounts; +use light_token::instruction::{COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR}; + +use crate::constants::{ANCHOR_DISCRIMINATOR, AUTH_SEED, OFFER_SEED, VAULT_SEED}; +use crate::instructions::transfer_tokens; +use crate::state::Offer; + +#[derive(AnchorSerialize, AnchorDeserialize, Clone)] +pub struct MakeOfferParams { + pub create_accounts_proof: CreateAccountsProof, + pub id: u64, + pub token_a_offered_amount: u64, + pub token_b_wanted_amount: u64, + /// Bump seed for the vault PDA (derived from [VAULT_SEED, offer.key()]) + pub vault_bump: u8, +} + +#[derive(Accounts, LightAccounts)] +#[instruction(params: MakeOfferParams)] +pub struct MakeOffer<'info> { + #[account(mut)] + pub fee_payer: Signer<'info>, + + /// CHECK: Authority PDA for the vault + #[account( + seeds = [AUTH_SEED.as_bytes()], + bump, + )] + pub authority: UncheckedAccount<'info>, + + /// CHECK: Compression config + pub compression_config: AccountInfo<'info>, + + /// The mint of the token being offered + #[account(mint::token_program = token_program)] + pub token_mint_a: InterfaceAccount<'info, Mint>, + + /// The mint of the token wanted in exchange + #[account(mint::token_program = token_program)] + pub token_mint_b: InterfaceAccount<'info, Mint>, + + /// The maker's token account for token A + #[account( + mut, + token::mint = token_mint_a, + token::authority = fee_payer, + )] + pub maker_token_account_a: InterfaceAccount<'info, TokenAccount>, + + #[account( + init, + payer = fee_payer, + space = ANCHOR_DISCRIMINATOR + Offer::INIT_SPACE, + seeds = [OFFER_SEED, fee_payer.key().as_ref(), params.id.to_le_bytes().as_ref()], + bump, + )] + #[light_account(init)] + pub offer: Account<'info, Offer>, + + /// The vault that holds the offered tokens - created by the light_account macro + #[account( + mut, + seeds = [VAULT_SEED, offer.key().as_ref()], + bump, + )] + #[light_account(init, + token::authority = [VAULT_SEED, self.offer.key()], + token::mint = token_mint_a, + token::owner = authority, + token::bump = params.vault_bump + )] + pub vault: UncheckedAccount<'info>, + + pub token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// Light token compressible config account + #[account(address = COMPRESSIBLE_CONFIG_V1)] + pub light_token_compressible_config: AccountInfo<'info>, + + /// Light token rent sponsor account + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: light-token CPI authority + pub light_token_cpi_authority: AccountInfo<'info>, +} + +/// Transfer tokens from maker to vault +pub fn send_offered_tokens_to_vault<'info>( + ctx: &Context<'_, '_, '_, 'info, MakeOffer<'info>>, + params: &MakeOfferParams, +) -> Result<()> { + let decimals = ctx.accounts.token_mint_a.decimals; + + transfer_tokens( + params.token_a_offered_amount, + decimals, + ctx.accounts.maker_token_account_a.to_account_info(), + ctx.accounts.vault.to_account_info(), + ctx.accounts.fee_payer.to_account_info(), + ctx.accounts.fee_payer.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + None, + ) +} + +/// Save the details of the offer to the offer account +pub fn save_offer<'info>( + ctx: &mut Context<'_, '_, '_, 'info, MakeOffer<'info>>, + params: &MakeOfferParams, +) -> Result<()> { + let offer = &mut ctx.accounts.offer; + offer.id = params.id; + offer.maker = ctx.accounts.fee_payer.key(); + offer.token_mint_a = ctx.accounts.token_mint_a.key(); + offer.token_mint_b = ctx.accounts.token_mint_b.key(); + offer.token_b_wanted_amount = params.token_b_wanted_amount; + offer.auth_bump = ctx.bumps.authority; + + msg!( + "Offer created: id={}, maker={}, offered={} token_a, wants={} token_b", + params.id, + ctx.accounts.fee_payer.key(), + params.token_a_offered_amount, + params.token_b_wanted_amount + ); + Ok(()) +} diff --git a/anchor/programs/escrow/src/instructions/mod.rs b/anchor/programs/escrow/src/instructions/mod.rs new file mode 100644 index 0000000..fa298ca --- /dev/null +++ b/anchor/programs/escrow/src/instructions/mod.rs @@ -0,0 +1,7 @@ +pub mod make_offer; +pub mod shared; +pub mod take_offer; + +pub use make_offer::*; +pub use shared::*; +pub use take_offer::*; diff --git a/anchor/programs/escrow/src/instructions/shared.rs b/anchor/programs/escrow/src/instructions/shared.rs new file mode 100644 index 0000000..417f167 --- /dev/null +++ b/anchor/programs/escrow/src/instructions/shared.rs @@ -0,0 +1,33 @@ +use anchor_lang::prelude::*; +use light_token::instruction::TransferInterfaceCpi; + +/// Transfer tokens between Light token accounts. +pub fn transfer_tokens<'info>( + amount: u64, + decimals: u8, + from: AccountInfo<'info>, + to: AccountInfo<'info>, + authority: AccountInfo<'info>, + payer: AccountInfo<'info>, + light_token_cpi_authority: AccountInfo<'info>, + system_program: AccountInfo<'info>, + signer_seeds: Option<&[&[u8]]>, +) -> Result<()> { + let cpi = TransferInterfaceCpi::new( + amount, + decimals, + from, + to, + authority, + payer, + light_token_cpi_authority, + system_program, + ); + + if let Some(seeds) = signer_seeds { + cpi.invoke_signed(&[seeds]) + } else { + cpi.invoke() + } + .map_err(|e| anchor_lang::prelude::ProgramError::from(e).into()) +} diff --git a/anchor/programs/escrow/src/instructions/take_offer.rs b/anchor/programs/escrow/src/instructions/take_offer.rs new file mode 100644 index 0000000..e72ee1d --- /dev/null +++ b/anchor/programs/escrow/src/instructions/take_offer.rs @@ -0,0 +1,159 @@ +use anchor_lang::prelude::*; +use light_anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; +use light_token::instruction::{CloseAccountCpi, RENT_SPONSOR}; +use light_token::utils::get_token_account_balance; + +use crate::constants::{AUTH_SEED, OFFER_SEED, VAULT_SEED}; +use crate::instructions::transfer_tokens; +use crate::state::Offer; + +#[derive(Accounts)] +pub struct TakeOffer<'info> { + #[account(mut)] + pub taker: Signer<'info>, + + /// The maker who created the offer + #[account(mut)] + pub maker: SystemAccount<'info>, + + /// CHECK: Authority PDA for the vault (mutable for close_vault write_top_up) + #[account( + mut, + seeds = [AUTH_SEED.as_bytes()], + bump, + )] + pub authority: UncheckedAccount<'info>, + + /// The mint of the token that was offered (token A) + pub token_mint_a: InterfaceAccount<'info, Mint>, + + /// The mint of the token wanted (token B) + pub token_mint_b: InterfaceAccount<'info, Mint>, + + /// The taker's token account for token A (receives offered tokens) + #[account( + mut, + token::mint = token_mint_a, + token::authority = taker, + )] + pub taker_token_account_a: InterfaceAccount<'info, TokenAccount>, + + /// The taker's token account for token B (sends wanted tokens) + #[account( + mut, + token::mint = token_mint_b, + token::authority = taker, + )] + pub taker_token_account_b: InterfaceAccount<'info, TokenAccount>, + + /// The maker's token account for token B (receives wanted tokens) + #[account( + mut, + token::mint = token_mint_b, + token::authority = maker, + )] + pub maker_token_account_b: InterfaceAccount<'info, TokenAccount>, + + /// The offer account + #[account( + mut, + close = maker, + has_one = maker, + has_one = token_mint_a, + has_one = token_mint_b, + seeds = [OFFER_SEED, maker.key().as_ref(), offer.id.to_le_bytes().as_ref()], + bump, + )] + pub offer: Account<'info, Offer>, + + /// The vault holding the offered tokens + #[account( + mut, + seeds = [VAULT_SEED, offer.key().as_ref()], + bump, + )] + pub vault: InterfaceAccount<'info, TokenAccount>, + + pub token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// CHECK: light-token CPI authority + pub light_token_cpi_authority: AccountInfo<'info>, + + /// CHECK: Light token rent sponsor for closing vault + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, +} + +/// Transfer token B from taker to maker +pub fn send_wanted_tokens_to_maker(ctx: &Context) -> Result<()> { + let decimals_b = ctx.accounts.token_mint_b.decimals; + let token_b_wanted_amount = ctx.accounts.offer.token_b_wanted_amount; + + transfer_tokens( + token_b_wanted_amount, + decimals_b, + ctx.accounts.taker_token_account_b.to_account_info(), + ctx.accounts.maker_token_account_b.to_account_info(), + ctx.accounts.taker.to_account_info(), + ctx.accounts.taker.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + None, + ) +} + +/// Withdraw all tokens from vault to taker +pub fn withdraw_from_vault(ctx: &Context) -> Result<()> { + let offer = &ctx.accounts.offer; + let offer_id = offer.id; + let token_b_wanted_amount = offer.token_b_wanted_amount; + let auth_bump = offer.auth_bump; + + // Build signer seeds for authority + let authority_seeds = &[AUTH_SEED.as_bytes(), &[auth_bump]]; + + // Get the vault balance + let vault_balance = get_token_account_balance(&ctx.accounts.vault.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + + let decimals_a = ctx.accounts.token_mint_a.decimals; + + transfer_tokens( + vault_balance, + decimals_a, + ctx.accounts.vault.to_account_info(), + ctx.accounts.taker_token_account_a.to_account_info(), + ctx.accounts.authority.to_account_info(), + ctx.accounts.taker.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + Some(authority_seeds), + )?; + + msg!( + "Offer taken: id={}, taker={}, transferred {} token_b to maker, received {} token_a", + offer_id, + ctx.accounts.taker.key(), + token_b_wanted_amount, + vault_balance + ); + + Ok(()) +} + +/// Close the vault after withdrawal, returning rent to taker +pub fn close_vault(ctx: &Context) -> Result<()> { + let auth_bump = ctx.accounts.offer.auth_bump; + let authority_seeds: &[&[u8]] = &[AUTH_SEED.as_bytes(), &[auth_bump]]; + + CloseAccountCpi { + token_program: ctx.accounts.token_program.to_account_info(), + account: ctx.accounts.vault.to_account_info(), + destination: ctx.accounts.taker.to_account_info(), + owner: ctx.accounts.authority.to_account_info(), + rent_sponsor: ctx.accounts.light_token_rent_sponsor.to_account_info(), + } + .invoke_signed(&[authority_seeds]) + .map_err(|e| anchor_lang::prelude::ProgramError::from(e).into()) +} diff --git a/anchor/programs/escrow/src/lib.rs b/anchor/programs/escrow/src/lib.rs new file mode 100644 index 0000000..a14e93c --- /dev/null +++ b/anchor/programs/escrow/src/lib.rs @@ -0,0 +1,38 @@ +#![allow(deprecated)] + +pub mod constants; +pub mod instructions; +pub mod state; + +use anchor_lang::prelude::*; +use light_token::anchor::{derive_light_cpi_signer, light_program, CpiSigner}; + +pub use constants::*; +pub use instructions::*; +pub use state::*; + +declare_id!("FKJs6rp6TXJtxzLiPtdYhqa9ExRuBXG2zwh4fda6WATN"); + +pub const LIGHT_CPI_SIGNER: CpiSigner = + derive_light_cpi_signer!("FKJs6rp6TXJtxzLiPtdYhqa9ExRuBXG2zwh4fda6WATN"); + +#[light_program] +#[program] +pub mod escrow { + use super::*; + + pub fn make_offer<'info>( + mut ctx: Context<'_, '_, '_, 'info, MakeOffer<'info>>, + params: MakeOfferParams, + ) -> Result<()> { + // Vault is created automatically by #[light_account(init, token::...)] macro + instructions::make_offer::send_offered_tokens_to_vault(&ctx, ¶ms)?; + instructions::make_offer::save_offer(&mut ctx, ¶ms) + } + + pub fn take_offer(ctx: Context) -> Result<()> { + instructions::take_offer::send_wanted_tokens_to_maker(&ctx)?; + instructions::take_offer::withdraw_from_vault(&ctx)?; + instructions::take_offer::close_vault(&ctx) + } +} diff --git a/anchor/programs/escrow/src/state/mod.rs b/anchor/programs/escrow/src/state/mod.rs new file mode 100644 index 0000000..cfaa08e --- /dev/null +++ b/anchor/programs/escrow/src/state/mod.rs @@ -0,0 +1,3 @@ +pub mod offer; + +pub use offer::*; diff --git a/anchor/programs/escrow/src/state/offer.rs b/anchor/programs/escrow/src/state/offer.rs new file mode 100644 index 0000000..7776a65 --- /dev/null +++ b/anchor/programs/escrow/src/state/offer.rs @@ -0,0 +1,23 @@ +use anchor_lang::prelude::*; +use light_sdk::LightDiscriminator; +use light_token::anchor::{CompressionInfo, LightAccount}; + +/// The Offer account stores details about a token swap offer. +#[derive(Default, Debug, InitSpace, LightAccount)] +#[account] +pub struct Offer { + /// Compression info for Light Protocol integration. + pub compression_info: Option, + /// Unique identifier for the offer. + pub id: u64, + /// The maker (creator) of this offer. + pub maker: Pubkey, + /// The mint of the token being offered. + pub token_mint_a: Pubkey, + /// The mint of the token wanted in exchange. + pub token_mint_b: Pubkey, + /// The amount of token_b the maker wants to receive. + pub token_b_wanted_amount: u64, + /// PDA bump seed for the authority. + pub auth_bump: u8, +} diff --git a/anchor/programs/escrow/tests/escrow_test.rs b/anchor/programs/escrow/tests/escrow_test.rs new file mode 100644 index 0000000..0becdaf --- /dev/null +++ b/anchor/programs/escrow/tests/escrow_test.rs @@ -0,0 +1,502 @@ +//! Integration tests for the escrow program with Light Token accounts. +//! +//! This test demonstrates a full escrow flow using: +//! - Light mints (token A and token B) - created via light_token::CreateMint +//! - Light Token accounts for maker and taker - created via CreateAssociatedTokenAccount +//! - Make offer: maker deposits token A into vault, creates offer +//! - Take offer: taker sends token B to maker, receives token A from vault + +use anchor_lang::{InstructionData, ToAccountMetas}; +use light_client::indexer::AddressWithTree; +use light_client::interface::{ + get_create_accounts_proof, CreateAccountsProofInput, InitializeRentFreeConfig, +}; +use light_program_test::{ + program_test::{setup_mock_program_data, LightProgramTest}, + Indexer, ProgramTestConfig, Rpc, +}; +use light_sdk::constants::LIGHT_TOKEN_PROGRAM_ID; +use light_token::constants::CPI_AUTHORITY_PDA; +use light_token::instruction::{ + derive_mint_compressed_address, derive_token_ata, find_mint_address, + CreateAssociatedTokenAccount, CreateMint, CreateMintParams, MintTo, COMPRESSIBLE_CONFIG_V1, + RENT_SPONSOR, +}; +use solana_instruction::Instruction; +use solana_keypair::Keypair; +use solana_pubkey::Pubkey; +use solana_signer::Signer; + +/// Create a Light mint using the light_token SDK. +async fn create_light_mint( + rpc: &mut R, + payer: &Keypair, + mint_authority: &Pubkey, + decimals: u8, +) -> (Pubkey, Keypair) { + let mint_seed = Keypair::new(); + let address_tree = rpc.get_address_tree_v2(); + let output_queue = rpc.get_random_state_tree_info().unwrap().queue; + + let compression_address = + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree.tree); + let (mint, bump) = find_mint_address(&mint_seed.pubkey()); + + let rpc_result = rpc + .get_validity_proof( + vec![], + vec![AddressWithTree { + address: compression_address, + tree: address_tree.tree, + }], + None, + ) + .await + .unwrap() + .value; + + let params = CreateMintParams { + decimals, + address_merkle_tree_root_index: rpc_result.addresses[0].root_index, + mint_authority: *mint_authority, + proof: rpc_result.proof.0.unwrap(), + compression_address, + mint, + bump, + freeze_authority: None, + extensions: None, + rent_payment: 16, + write_top_up: 766, + }; + + let instruction = CreateMint::new( + params, + mint_seed.pubkey(), + payer.pubkey(), + address_tree.tree, + output_queue, + ) + .instruction() + .unwrap(); + + rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[payer, &mint_seed]) + .await + .unwrap(); + + (mint, mint_seed) +} + +/// Create a Light Token ATA. +async fn create_light_token_ata( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + owner: &Pubkey, +) -> Pubkey { + let (ata, _) = derive_token_ata(owner, mint); + + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), *owner, *mint) + .instruction() + .unwrap(); + + rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[payer]) + .await + .unwrap(); + + ata +} + +/// Mint tokens to a Light Token account. +async fn mint_light_tokens( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + destination: &Pubkey, + mint_authority: &Keypair, + amount: u64, +) { + let instruction = MintTo { + fee_payer: Some(payer.pubkey()), + mint: *mint, + destination: *destination, + amount, + authority: mint_authority.pubkey(), + max_top_up: None, + } + .instruction() + .unwrap(); + + rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[payer, mint_authority]) + .await + .unwrap(); +} + +/// Verify Light Token account balance. +async fn verify_light_token_balance( + rpc: &mut R, + account: Pubkey, + expected: u64, + name: &str, +) { + use spl_token_2022::pod::PodAccount; + + let account_data = rpc.get_account(account).await.unwrap(); + + if let Some(data) = account_data { + // Light Token accounts have first 165 bytes as SPL-compatible token account data + if data.data.len() >= 165 { + let token_state = + spl_pod::bytemuck::pod_from_bytes::(&data.data[..165]).unwrap(); + let actual = u64::from(token_state.amount); + println!("{}: balance = {} (expected {})", name, actual, expected); + assert_eq!( + actual, expected, + "{} balance mismatch: expected {}, got {}", + name, expected, actual + ); + } else { + panic!( + "{}: account data too short: {} bytes", + name, + data.data.len() + ); + } + } else if expected == 0 { + println!("{}: account not found (expected 0 balance)", name); + } else { + panic!( + "{}: account not found but expected balance {}", + name, expected + ); + } +} + +/// Test the full escrow flow: make_offer and take_offer with Light Token accounts. +#[tokio::test] +async fn test_escrow_full_flow() { + let program_id = escrow::ID; + let mut config = ProgramTestConfig::new_v2(true, Some(vec![("escrow", program_id)])); + config = config.with_light_protocol_events(); + + let mut rpc = LightProgramTest::new(config).await.unwrap(); + let payer = rpc.get_payer().insecure_clone(); + + // Setup program data for rent-free config + let program_data_pda = setup_mock_program_data(&mut rpc, &payer, &program_id); + + // Initialize rent-free config + let (init_config_ix, config_pda) = InitializeRentFreeConfig::new( + &program_id, + &payer.pubkey(), + &program_data_pda, + RENT_SPONSOR, + payer.pubkey(), + ) + .build(); + + rpc.create_and_send_transaction(&[init_config_ix], &payer.pubkey(), &[&payer]) + .await + .expect("Initialize config should succeed"); + + println!("Rent-free config initialized at: {:?}", config_pda); + + // Create maker and taker keypairs (also serve as mint authorities for simplicity) + let maker = Keypair::new(); + let taker = Keypair::new(); + + // Airdrop lamports to maker and taker + rpc.airdrop_lamports(&maker.pubkey(), 2_000_000_000) + .await + .unwrap(); + rpc.airdrop_lamports(&taker.pubkey(), 2_000_000_000) + .await + .unwrap(); + + // Create Light mints for token A and token B + // Maker is mint authority for token A, taker is mint authority for token B + println!("\nCreating Light mints..."); + let (mint_a, _mint_seed_a) = create_light_mint(&mut rpc, &payer, &payer.pubkey(), 9).await; + let (mint_b, _mint_seed_b) = create_light_mint(&mut rpc, &payer, &payer.pubkey(), 9).await; + + println!("Created mint A: {:?}", mint_a); + println!("Created mint B: {:?}", mint_b); + + // Create Light Token ATAs for maker and taker + println!("\nCreating Light Token ATAs..."); + let maker_ata_a = create_light_token_ata(&mut rpc, &payer, &mint_a, &maker.pubkey()).await; + let maker_ata_b = create_light_token_ata(&mut rpc, &payer, &mint_b, &maker.pubkey()).await; + let taker_ata_a = create_light_token_ata(&mut rpc, &payer, &mint_a, &taker.pubkey()).await; + let taker_ata_b = create_light_token_ata(&mut rpc, &payer, &mint_b, &taker.pubkey()).await; + + println!("maker_ata_a: {:?}", maker_ata_a); + println!("maker_ata_b: {:?}", maker_ata_b); + println!("taker_ata_a: {:?}", taker_ata_a); + println!("taker_ata_b: {:?}", taker_ata_b); + + // Mint tokens + let token_a_amount = 1_000_000_000u64; // 1 token with 9 decimals + let token_b_amount = 500_000_000u64; // 0.5 tokens + + println!("\nMinting tokens..."); + mint_light_tokens( + &mut rpc, + &payer, + &mint_a, + &maker_ata_a, + &payer, + token_a_amount, + ) + .await; + println!("Minted {} token A to maker", token_a_amount); + + mint_light_tokens( + &mut rpc, + &payer, + &mint_b, + &taker_ata_b, + &payer, + token_b_amount, + ) + .await; + println!("Minted {} token B to taker", token_b_amount); + + // Verify balances before escrow + println!("\nVerifying initial balances..."); + verify_light_token_balance(&mut rpc, maker_ata_a, token_a_amount, "maker_ata_a").await; + verify_light_token_balance(&mut rpc, taker_ata_b, token_b_amount, "taker_ata_b").await; + verify_light_token_balance(&mut rpc, maker_ata_b, 0, "maker_ata_b").await; + verify_light_token_balance(&mut rpc, taker_ata_a, 0, "taker_ata_a").await; + + // === MAKE OFFER === + println!("\n=== Executing make_offer ==="); + + let offer_id = 1u64; + let token_a_offered_amount = token_a_amount; + let token_b_wanted_amount = token_b_amount; + + // Derive offer PDA + let (offer_pda, _offer_bump) = Pubkey::find_program_address( + &[ + escrow::OFFER_SEED, + maker.pubkey().as_ref(), + offer_id.to_le_bytes().as_ref(), + ], + &program_id, + ); + + // Derive vault PDA + let (vault_pda, vault_bump) = + Pubkey::find_program_address(&[escrow::VAULT_SEED, offer_pda.as_ref()], &program_id); + + // Derive authority PDA + let (authority_pda, _authority_bump) = + Pubkey::find_program_address(&[escrow::AUTH_SEED.as_bytes()], &program_id); + + println!("Offer PDA: {:?}", offer_pda); + println!("Vault PDA: {:?}", vault_pda); + println!("Authority PDA: {:?}", authority_pda); + + // Get proof for creating the offer account + let proof_result = get_create_accounts_proof( + &rpc, + &program_id, + vec![CreateAccountsProofInput::pda(offer_pda)], + ) + .await + .unwrap(); + + // Build make_offer instruction + let make_offer_accounts = escrow::accounts::MakeOffer { + fee_payer: maker.pubkey(), + authority: authority_pda, + compression_config: config_pda, + token_mint_a: mint_a, + token_mint_b: mint_b, + maker_token_account_a: maker_ata_a, + offer: offer_pda, + vault: vault_pda, + token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + system_program: solana_sdk::system_program::ID, + light_token_compressible_config: COMPRESSIBLE_CONFIG_V1, + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + }; + + let make_offer_data = escrow::instruction::MakeOffer { + params: escrow::MakeOfferParams { + create_accounts_proof: proof_result.create_accounts_proof, + id: offer_id, + token_a_offered_amount, + token_b_wanted_amount, + vault_bump, + }, + }; + + let make_offer_ix = Instruction { + program_id, + accounts: [ + make_offer_accounts.to_account_metas(None), + proof_result.remaining_accounts, + ] + .concat(), + data: make_offer_data.data(), + }; + + rpc.create_and_send_transaction(&[make_offer_ix], &maker.pubkey(), &[&maker]) + .await + .expect("make_offer should succeed"); + + println!("make_offer executed successfully!"); + + // Verify offer account was created + let offer_account = rpc + .get_account(offer_pda) + .await + .unwrap() + .expect("Offer account should exist"); + assert!( + !offer_account.data.is_empty(), + "Offer account should have data" + ); + println!( + "Offer account verified, size: {} bytes", + offer_account.data.len() + ); + + // === TAKE OFFER === + println!("\n=== Executing take_offer ==="); + + // Build take_offer instruction + let take_offer_accounts = escrow::accounts::TakeOffer { + taker: taker.pubkey(), + maker: maker.pubkey(), + authority: authority_pda, + token_mint_a: mint_a, + token_mint_b: mint_b, + taker_token_account_a: taker_ata_a, + taker_token_account_b: taker_ata_b, + maker_token_account_b: maker_ata_b, + offer: offer_pda, + vault: vault_pda, + token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + system_program: solana_sdk::system_program::ID, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + light_token_rent_sponsor: RENT_SPONSOR, + }; + + let take_offer_data = escrow::instruction::TakeOffer {}; + + let take_offer_ix = Instruction { + program_id, + accounts: take_offer_accounts.to_account_metas(None), + data: take_offer_data.data(), + }; + + rpc.create_and_send_transaction(&[take_offer_ix], &taker.pubkey(), &[&taker]) + .await + .expect("take_offer should succeed"); + + println!("take_offer executed successfully!"); + + // === VERIFY FINAL BALANCES === + println!("\n=== Verifying final balances ==="); + + // After escrow: + // - Maker should have 0 token A, token_b_wanted_amount token B + // - Taker should have token_a_offered_amount token A, 0 token B + // - Vault should be empty + + verify_light_token_balance(&mut rpc, maker_ata_a, 0, "maker_ata_a (should be 0)").await; + verify_light_token_balance( + &mut rpc, + maker_ata_b, + token_b_wanted_amount, + "maker_ata_b (received)", + ) + .await; + verify_light_token_balance( + &mut rpc, + taker_ata_a, + token_a_offered_amount, + "taker_ata_a (received)", + ) + .await; + verify_light_token_balance(&mut rpc, taker_ata_b, 0, "taker_ata_b (should be 0)").await; + + // Verify offer account was closed (rent returned to maker) + let offer_after = rpc.get_account(offer_pda).await.unwrap(); + assert!( + offer_after.is_none(), + "Offer account should be closed after take_offer" + ); + println!("Offer account closed successfully"); + + println!("\n=== Escrow test completed successfully! ==="); +} + +/// Test that verifies offer PDA derivation and basic setup +#[tokio::test] +async fn test_escrow_setup() { + let program_id = escrow::ID; + let mut config = ProgramTestConfig::new_v2(true, Some(vec![("escrow", program_id)])); + config = config.with_light_protocol_events(); + + let mut rpc = LightProgramTest::new(config).await.unwrap(); + let payer = rpc.get_payer().insecure_clone(); + + let program_data_pda = setup_mock_program_data(&mut rpc, &payer, &program_id); + + // Initialize rent-free config + let (init_config_ix, config_pda) = InitializeRentFreeConfig::new( + &program_id, + &payer.pubkey(), + &program_data_pda, + RENT_SPONSOR, + payer.pubkey(), + ) + .build(); + + rpc.create_and_send_transaction(&[init_config_ix], &payer.pubkey(), &[&payer]) + .await + .expect("Initialize config should succeed"); + + // Verify PDA derivations + let offer_id = 1u64; + let (offer_pda, _) = Pubkey::find_program_address( + &[ + escrow::OFFER_SEED, + payer.pubkey().as_ref(), + offer_id.to_le_bytes().as_ref(), + ], + &program_id, + ); + + let (vault_pda, _) = + Pubkey::find_program_address(&[escrow::VAULT_SEED, offer_pda.as_ref()], &program_id); + + let (authority_pda, _) = + Pubkey::find_program_address(&[escrow::AUTH_SEED.as_bytes()], &program_id); + + println!("Escrow setup test completed successfully"); + println!("Program ID: {:?}", program_id); + println!("Config PDA: {:?}", config_pda); + println!("Offer PDA: {:?}", offer_pda); + println!("Vault PDA: {:?}", vault_pda); + println!("Authority PDA: {:?}", authority_pda); + + // Get proof for creating accounts to verify proof system works + let proof_result = get_create_accounts_proof( + &rpc, + &program_id, + vec![CreateAccountsProofInput::pda(offer_pda)], + ) + .await + .unwrap(); + + assert!( + proof_result.create_accounts_proof.proof.0.is_some() + || !proof_result.remaining_accounts.is_empty(), + "Should have proof or remaining accounts" + ); + println!("Proof generation verified"); +} diff --git a/anchor/programs/fundraiser/Cargo.toml b/anchor/programs/fundraiser/Cargo.toml new file mode 100644 index 0000000..6d34048 --- /dev/null +++ b/anchor/programs/fundraiser/Cargo.toml @@ -0,0 +1,52 @@ +[package] +name = "fundraiser" +version = "0.1.0" +description = "Created with Anchor" +edition = "2021" + +[lib] +crate-type = ["cdylib", "lib"] +name = "fundraiser" + +[features] +default = [] +cpi = ["no-entrypoint"] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +idl-build = ["anchor-lang/idl-build", "light-sdk/idl-build"] +test-sbf = [] + +[dependencies] +anchor-lang = { version = "=0.31.1", features = ["init-if-needed", "idl-build"] } +blake3 = { workspace = true } + +light-sdk = { workspace = true, features = ["anchor", "anchor-discriminator", "idl-build", "cpi-context", "v2"] } +light-token = { workspace = true, features = ["anchor"] } +light-hasher = { workspace = true, features = ["solana"] } +light-anchor-spl = { workspace = true, features = ["idl-build"] } +solana-program = "2.2" +solana-pubkey = "2.2" +solana-account-info = "2.3" +solana-program-error = "2.2" +solana-msg = "2.2" + +[dev-dependencies] +light-program-test = { workspace = true } +light-client = { workspace = true, features = ["v2", "anchor"] } +anchor-spl = "0.31.1" +tokio = { version = "1", features = ["full"] } +solana-keypair = { version = "2.2" } +solana-signer = { version = "2.2" } +solana-instruction = { version = "2.2" } +solana-sdk = { version = "2.3" } +spl-token-2022 = "6.0.0" +spl-pod = "0.4.0" +shared-test-utils = { workspace = true } + +[lints.rust.unexpected_cfgs] +level = "allow" +check-cfg = [ + 'cfg(target_os, values("solana"))', + 'cfg(feature, values("frozen-abi", "no-entrypoint"))', +] diff --git a/anchor/programs/fundraiser/Xargo.toml b/anchor/programs/fundraiser/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/anchor/programs/fundraiser/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/anchor/programs/fundraiser/src/constants.rs b/anchor/programs/fundraiser/src/constants.rs new file mode 100644 index 0000000..678e5f4 --- /dev/null +++ b/anchor/programs/fundraiser/src/constants.rs @@ -0,0 +1,6 @@ +pub const ANCHOR_DISCRIMINATOR: usize = 8; +pub const MIN_AMOUNT_TO_RAISE: u64 = 3; +pub const SECONDS_TO_DAYS: i64 = 86400; +pub const MAX_CONTRIBUTION_PERCENTAGE: u64 = 10; +pub const PERCENTAGE_SCALER: u64 = 100; +pub const VAULT_SEED: &[u8] = b"vault"; diff --git a/anchor/programs/fundraiser/src/error.rs b/anchor/programs/fundraiser/src/error.rs new file mode 100644 index 0000000..a7dd6fd --- /dev/null +++ b/anchor/programs/fundraiser/src/error.rs @@ -0,0 +1,21 @@ +use anchor_lang::error_code; + +#[error_code] +pub enum FundraiserError { + #[msg("The amount to raise has not been met")] + TargetNotMet, + #[msg("The amount to raise has been achieved")] + TargetMet, + #[msg("The contribution is too big")] + ContributionTooBig, + #[msg("The contribution is too small")] + ContributionTooSmall, + #[msg("The maximum amount to contribute has been reached")] + MaximumContributionsReached, + #[msg("The fundraiser has not ended yet")] + FundraiserNotEnded, + #[msg("The fundraiser has ended")] + FundraiserEnded, + #[msg("Invalid total amount. i should be bigger than 3")] + InvalidAmount, +} diff --git a/anchor/programs/fundraiser/src/instructions/checker.rs b/anchor/programs/fundraiser/src/instructions/checker.rs new file mode 100644 index 0000000..1ade88f --- /dev/null +++ b/anchor/programs/fundraiser/src/instructions/checker.rs @@ -0,0 +1,116 @@ +use anchor_lang::prelude::*; +use light_anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; +use light_token::instruction::RENT_SPONSOR; +use light_token::spl_interface::find_spl_interface_pda; +use light_token::utils::get_token_account_balance; + +use crate::constants::VAULT_SEED; +use crate::instructions::{transfer_tokens, SplInterfaceConfig}; +use crate::state::Fundraiser; +use crate::FundraiserError; + +#[derive(Accounts)] +pub struct CheckContributions<'info> { + /// The maker who checks and claims the fundraiser (also the fee payer for Light Protocol) + #[account(mut)] + pub fee_payer: Signer<'info>, + + #[account(mint::token_program = token_program)] + pub mint_to_raise: InterfaceAccount<'info, Mint>, + + #[account( + mut, + has_one = mint_to_raise, + seeds = [b"fundraiser".as_ref(), fee_payer.key().as_ref()], + bump = fundraiser.bump, + close = fee_payer, + )] + pub fundraiser: Account<'info, Fundraiser>, + + /// CHECK: Vault token account (Light token account) + #[account( + mut, + seeds = [VAULT_SEED, fundraiser.key().as_ref()], + bump, + )] + pub vault: UncheckedAccount<'info>, + + /// Maker's SPL ATA - must be pre-created before calling this instruction + /// Receives funds from the Light vault via SPL interface + #[account( + mut, + token::mint = mint_to_raise, + token::authority = fee_payer, + )] + pub maker_ata: InterfaceAccount<'info, TokenAccount>, + + pub token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// Light token program for CPI calls + pub light_token_program: Interface<'info, TokenInterface>, + + /// Light token rent sponsor account + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: light-token CPI authority - must be writable for Light token CPI + #[account(mut)] + pub light_token_cpi_authority: AccountInfo<'info>, + + /// CHECK: SPL interface PDA for mint (token pool holding SPL tokens) + /// Derived by light-token program: ["pool", mint] + #[account(mut)] + pub spl_interface_pda: UncheckedAccount<'info>, +} + +impl<'info> CheckContributions<'info> { + pub fn check_contributions(&self, _bumps: &CheckContributionsBumps) -> Result<()> { + // Get the vault balance + let vault_balance = get_token_account_balance(&self.vault.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + + // Check if the target amount has been met + require!( + vault_balance >= self.fundraiser.amount_to_raise, + FundraiserError::TargetNotMet + ); + + // Build signer seeds for the fundraiser PDA (which is the vault's owner) + let fundraiser_seeds: &[&[u8]] = &[ + b"fundraiser".as_ref(), + self.fee_payer.to_account_info().key.as_ref(), + &[self.fundraiser.bump], + ]; + + // Get SPL interface PDA bump + let (_, spl_interface_bump) = find_spl_interface_pda(&self.mint_to_raise.key(), false); + + // Transfer all funds from vault to maker + // vault (Light) -> maker_ata (SPL ATA) - needs SPL interface for Light->SPL transfer + let decimals = self.mint_to_raise.decimals; + + let spl_interface = SplInterfaceConfig { + mint: self.mint_to_raise.to_account_info(), + spl_token_program: self.token_program.to_account_info(), + spl_interface_pda: self.spl_interface_pda.to_account_info(), + spl_interface_pda_bump: spl_interface_bump, + }; + + transfer_tokens( + vault_balance, + decimals, + self.vault.to_account_info(), + self.maker_ata.to_account_info(), + self.mint_to_raise.to_account_info(), + self.fundraiser.to_account_info(), + self.fee_payer.to_account_info(), + self.light_token_cpi_authority.to_account_info(), + self.system_program.to_account_info(), + Some(fundraiser_seeds), + Some(spl_interface), + )?; + + Ok(()) + } +} diff --git a/anchor/programs/fundraiser/src/instructions/contribute.rs b/anchor/programs/fundraiser/src/instructions/contribute.rs new file mode 100644 index 0000000..5ce1a96 --- /dev/null +++ b/anchor/programs/fundraiser/src/instructions/contribute.rs @@ -0,0 +1,139 @@ +use anchor_lang::prelude::*; +use light_anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; +use light_token::instruction::RENT_SPONSOR; +use light_token::spl_interface::find_spl_interface_pda; + +use crate::constants::{ANCHOR_DISCRIMINATOR, VAULT_SEED}; +use crate::instructions::{transfer_tokens, SplInterfaceConfig}; +use crate::state::{Contributor, Fundraiser}; +use crate::{FundraiserError, MAX_CONTRIBUTION_PERCENTAGE, PERCENTAGE_SCALER, SECONDS_TO_DAYS}; + +#[derive(Accounts)] +pub struct Contribute<'info> { + #[account(mut)] + pub contributor: Signer<'info>, + + #[account(mint::token_program = token_program)] + pub mint_to_raise: InterfaceAccount<'info, Mint>, + + #[account( + mut, + has_one = mint_to_raise, + seeds = [b"fundraiser".as_ref(), fundraiser.maker.as_ref()], + bump = fundraiser.bump, + )] + pub fundraiser: Account<'info, Fundraiser>, + + #[account( + init_if_needed, + payer = contributor, + seeds = [b"contributor", fundraiser.key().as_ref(), contributor.key().as_ref()], + bump, + space = ANCHOR_DISCRIMINATOR + Contributor::INIT_SPACE, + )] + pub contributor_account: Account<'info, Contributor>, + + #[account( + mut, + token::mint = mint_to_raise, + token::authority = contributor + )] + pub contributor_ata: InterfaceAccount<'info, TokenAccount>, + + /// CHECK: Vault token account + #[account( + mut, + seeds = [VAULT_SEED, fundraiser.key().as_ref()], + bump, + )] + pub vault: UncheckedAccount<'info>, + + pub token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// Light token program for CPI calls + pub light_token_program: Interface<'info, TokenInterface>, + + /// CHECK: Light token rent sponsor + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: light-token CPI authority - must be writable for Light token CPI + #[account(mut)] + pub light_token_cpi_authority: AccountInfo<'info>, + + /// CHECK: SPL interface PDA for mint (token pool holding SPL tokens) + /// Derived by light-token program: ["pool", mint] + #[account(mut)] + pub spl_interface_pda: UncheckedAccount<'info>, +} + +impl<'info> Contribute<'info> { + pub fn contribute(&mut self, amount: u64) -> Result<()> { + // Check if the amount to contribute meets the minimum amount required + require!( + amount >= 1_u64.pow(self.mint_to_raise.decimals as u32), + FundraiserError::ContributionTooSmall + ); + + // Check if the amount to contribute is less than the maximum allowed contribution + require!( + amount + <= (self.fundraiser.amount_to_raise * MAX_CONTRIBUTION_PERCENTAGE) + / PERCENTAGE_SCALER, + FundraiserError::ContributionTooBig + ); + + // Check if the fundraising duration has been reached + let current_time = Clock::get()?.unix_timestamp; + let elapsed_days = ((current_time - self.fundraiser.time_started) / SECONDS_TO_DAYS) as u16; + require!( + elapsed_days < self.fundraiser.duration, + FundraiserError::FundraiserEnded + ); + + // Check if the maximum contributions per contributor have been reached + require!( + (self.contributor_account.amount + <= (self.fundraiser.amount_to_raise * MAX_CONTRIBUTION_PERCENTAGE) + / PERCENTAGE_SCALER) + && (self.contributor_account.amount + amount + <= (self.fundraiser.amount_to_raise * MAX_CONTRIBUTION_PERCENTAGE) + / PERCENTAGE_SCALER), + FundraiserError::MaximumContributionsReached + ); + + // Get SPL interface PDA bump + let (_, spl_interface_bump) = find_spl_interface_pda(&self.mint_to_raise.key(), false); + + // Transfer tokens from contributor to vault using Light Protocol + let decimals = self.mint_to_raise.decimals; + + let spl_interface = SplInterfaceConfig { + mint: self.mint_to_raise.to_account_info(), + spl_token_program: self.token_program.to_account_info(), + spl_interface_pda: self.spl_interface_pda.to_account_info(), + spl_interface_pda_bump: spl_interface_bump, + }; + + transfer_tokens( + amount, + decimals, + self.contributor_ata.to_account_info(), + self.vault.to_account_info(), + self.mint_to_raise.to_account_info(), + self.contributor.to_account_info(), + self.contributor.to_account_info(), + self.light_token_cpi_authority.to_account_info(), + self.system_program.to_account_info(), + None, + Some(spl_interface), + )?; + + // Update the fundraiser and contributor accounts with the new amounts + self.fundraiser.current_amount += amount; + self.contributor_account.amount += amount; + + Ok(()) + } +} diff --git a/anchor/programs/fundraiser/src/instructions/initialize.rs b/anchor/programs/fundraiser/src/instructions/initialize.rs new file mode 100644 index 0000000..4552bdc --- /dev/null +++ b/anchor/programs/fundraiser/src/instructions/initialize.rs @@ -0,0 +1,91 @@ +use anchor_lang::prelude::*; +use light_anchor_spl::token_interface::{Mint, TokenInterface}; +use light_sdk::interface::CreateAccountsProof; +use light_token::anchor::LightAccounts; +use light_token::instruction::{COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR}; + +use crate::constants::{ANCHOR_DISCRIMINATOR, VAULT_SEED}; +use crate::state::Fundraiser; +use crate::{FundraiserError, MIN_AMOUNT_TO_RAISE}; + +#[derive(AnchorSerialize, AnchorDeserialize, Clone)] +pub struct InitializeParams { + pub create_accounts_proof: CreateAccountsProof, + pub amount: u64, + pub duration: u16, + pub vault_bump: u8, +} + +#[derive(Accounts, LightAccounts)] +#[instruction(params: InitializeParams)] +pub struct Initialize<'info> { + /// The maker who creates the fundraiser (also the fee payer for Light Protocol) + #[account(mut)] + pub fee_payer: Signer<'info>, + + #[account(mint::token_program = token_program)] + pub mint_to_raise: InterfaceAccount<'info, Mint>, + + #[account( + init, + payer = fee_payer, + space = ANCHOR_DISCRIMINATOR + Fundraiser::INIT_SPACE, + seeds = [b"fundraiser", fee_payer.key().as_ref()], + bump, + )] + pub fundraiser: Account<'info, Fundraiser>, + + /// The vault that holds the fundraiser tokens - created by the light_account macro + #[account( + mut, + seeds = [VAULT_SEED, fundraiser.key().as_ref()], + bump, + )] + #[light_account(init, + token::authority = [VAULT_SEED, self.fundraiser.key()], + token::mint = mint_to_raise, + token::owner = fundraiser, + token::bump = params.vault_bump + )] + pub vault: UncheckedAccount<'info>, + + pub token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// Light token program for CPI calls + pub light_token_program: Interface<'info, TokenInterface>, + + /// Light token compressible config account + #[account(address = COMPRESSIBLE_CONFIG_V1)] + pub light_token_compressible_config: AccountInfo<'info>, + + /// Light token rent sponsor account + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: light-token CPI authority + pub light_token_cpi_authority: AccountInfo<'info>, +} + +impl<'info> Initialize<'info> { + pub fn initialize(&mut self, params: &InitializeParams, bumps: &InitializeBumps) -> Result<()> { + // Check if the amount to raise meets the minimum amount required + require!( + params.amount >= MIN_AMOUNT_TO_RAISE.pow(self.mint_to_raise.decimals as u32), + FundraiserError::InvalidAmount + ); + + // Initialize the fundraiser account + self.fundraiser.set_inner(Fundraiser { + maker: self.fee_payer.key(), + mint_to_raise: self.mint_to_raise.key(), + amount_to_raise: params.amount, + current_amount: 0, + time_started: Clock::get()?.unix_timestamp, + duration: params.duration, + bump: bumps.fundraiser, + }); + + Ok(()) + } +} diff --git a/anchor/programs/fundraiser/src/instructions/mod.rs b/anchor/programs/fundraiser/src/instructions/mod.rs new file mode 100644 index 0000000..535fdbb --- /dev/null +++ b/anchor/programs/fundraiser/src/instructions/mod.rs @@ -0,0 +1,11 @@ +pub mod checker; +pub mod contribute; +pub mod initialize; +pub mod refund; +pub mod shared; + +pub use checker::*; +pub use contribute::*; +pub use initialize::*; +pub use refund::*; +pub use shared::*; diff --git a/anchor/programs/fundraiser/src/instructions/refund.rs b/anchor/programs/fundraiser/src/instructions/refund.rs new file mode 100644 index 0000000..abe2a16 --- /dev/null +++ b/anchor/programs/fundraiser/src/instructions/refund.rs @@ -0,0 +1,134 @@ +use anchor_lang::prelude::*; +use light_anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; +use light_token::instruction::RENT_SPONSOR; +use light_token::spl_interface::find_spl_interface_pda; +use light_token::utils::get_token_account_balance; + +use crate::constants::VAULT_SEED; +use crate::instructions::{transfer_tokens, SplInterfaceConfig}; +use crate::state::{Contributor, Fundraiser}; +use crate::{FundraiserError, SECONDS_TO_DAYS}; + +#[derive(Accounts)] +pub struct Refund<'info> { + #[account(mut)] + pub contributor: Signer<'info>, + + pub maker: SystemAccount<'info>, + + #[account(mint::token_program = token_program)] + pub mint_to_raise: InterfaceAccount<'info, Mint>, + + #[account( + mut, + has_one = mint_to_raise, + seeds = [b"fundraiser", maker.key().as_ref()], + bump = fundraiser.bump, + )] + pub fundraiser: Account<'info, Fundraiser>, + + #[account( + mut, + seeds = [b"contributor", fundraiser.key().as_ref(), contributor.key().as_ref()], + bump, + close = contributor, + )] + pub contributor_account: Account<'info, Contributor>, + + #[account( + mut, + token::mint = mint_to_raise, + token::authority = contributor + )] + pub contributor_ata: InterfaceAccount<'info, TokenAccount>, + + /// CHECK: Vault token account + #[account( + mut, + seeds = [VAULT_SEED, fundraiser.key().as_ref()], + bump, + )] + pub vault: UncheckedAccount<'info>, + + pub token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// Light token program for CPI calls + pub light_token_program: Interface<'info, TokenInterface>, + + /// CHECK: Light token rent sponsor + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: light-token CPI authority - must be writable for Light token CPI + #[account(mut)] + pub light_token_cpi_authority: AccountInfo<'info>, + + /// CHECK: SPL interface PDA for mint (token pool holding SPL tokens) + /// Derived by light-token program: ["pool", mint] + #[account(mut)] + pub spl_interface_pda: UncheckedAccount<'info>, +} + +impl<'info> Refund<'info> { + pub fn refund(&mut self, _bumps: &RefundBumps) -> Result<()> { + // Check if the fundraising duration has been reached + let current_time = Clock::get()?.unix_timestamp; + + require!( + self.fundraiser.duration + >= ((current_time - self.fundraiser.time_started) / SECONDS_TO_DAYS) as u16, + FundraiserError::FundraiserNotEnded + ); + + // Get the actual vault balance (matches original behavior) + let vault_balance = get_token_account_balance(&self.vault.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + + require!( + vault_balance < self.fundraiser.amount_to_raise, + FundraiserError::TargetMet + ); + + // Build signer seeds for the fundraiser PDA (which is the vault's owner) + let fundraiser_seeds: &[&[u8]] = &[ + b"fundraiser".as_ref(), + self.maker.to_account_info().key.as_ref(), + &[self.fundraiser.bump], + ]; + + // Get SPL interface PDA bump + let (_, spl_interface_bump) = find_spl_interface_pda(&self.mint_to_raise.key(), false); + + // Transfer the funds back to the contributor + // vault (Light) -> contributor_ata (SPL) - needs SPL interface + let decimals = self.mint_to_raise.decimals; + let refund_amount = self.contributor_account.amount; + + let spl_interface = SplInterfaceConfig { + mint: self.mint_to_raise.to_account_info(), + spl_token_program: self.token_program.to_account_info(), + spl_interface_pda: self.spl_interface_pda.to_account_info(), + spl_interface_pda_bump: spl_interface_bump, + }; + + transfer_tokens( + refund_amount, + decimals, + self.vault.to_account_info(), + self.contributor_ata.to_account_info(), + self.mint_to_raise.to_account_info(), + self.fundraiser.to_account_info(), + self.contributor.to_account_info(), + self.light_token_cpi_authority.to_account_info(), + self.system_program.to_account_info(), + Some(fundraiser_seeds), + Some(spl_interface), + )?; + + // Update the fundraiser state by reducing the amount contributed + self.fundraiser.current_amount -= refund_amount; + + Ok(()) + } +} diff --git a/anchor/programs/fundraiser/src/instructions/shared.rs b/anchor/programs/fundraiser/src/instructions/shared.rs new file mode 100644 index 0000000..91b3f9c --- /dev/null +++ b/anchor/programs/fundraiser/src/instructions/shared.rs @@ -0,0 +1,90 @@ +use anchor_lang::prelude::*; +use light_sdk::constants::LIGHT_TOKEN_PROGRAM_ID; +use light_token::instruction::{TransferCheckedCpi, TransferInterfaceCpi}; + +/// Configuration for SPL interface (required for SPL<->Light transfers) +pub struct SplInterfaceConfig<'info> { + pub mint: AccountInfo<'info>, + pub spl_token_program: AccountInfo<'info>, + pub spl_interface_pda: AccountInfo<'info>, + pub spl_interface_pda_bump: u8, +} + +/// Check if an account is a Light token account (owned by Light token program) +fn is_light_account(account: &AccountInfo) -> bool { + account.owner == &Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID) +} + +/// Transfer tokens between token accounts. +/// For Light-to-Light transfers, uses TransferCheckedCpi with mint validation. +/// For SPL<->Light transfers, uses TransferInterfaceCpi with spl_interface config. +pub fn transfer_tokens<'info>( + amount: u64, + decimals: u8, + from: AccountInfo<'info>, + to: AccountInfo<'info>, + mint: AccountInfo<'info>, + authority: AccountInfo<'info>, + payer: AccountInfo<'info>, + light_token_cpi_authority: AccountInfo<'info>, + system_program: AccountInfo<'info>, + signer_seeds: Option<&[&[u8]]>, + spl_interface: Option>, +) -> Result<()> { + // Check if this is a Light-to-Light transfer + let is_light_to_light = is_light_account(&from) && is_light_account(&to); + + if is_light_to_light { + // Use TransferCheckedCpi for Light-to-Light transfers + // fee_payer: Some ensures authority is readonly (required for PDA with account data) + let cpi = TransferCheckedCpi { + source: from, + mint, + destination: to, + amount, + decimals, + authority, + system_program, + max_top_up: Some(0), // Allow top-ups but with 0 limit + fee_payer: Some(payer), // Payer handles any rent, makes authority readonly + }; + + if let Some(seeds) = signer_seeds { + cpi.invoke_signed(&[seeds]) + } else { + cpi.invoke() + } + .map_err(|e| anchor_lang::prelude::ProgramError::from(e).into()) + } else { + // Use TransferInterfaceCpi for SPL<->Light transfers + let mut cpi = TransferInterfaceCpi::new( + amount, + decimals, + from, + to, + authority, + payer, + light_token_cpi_authority, + system_program, + ); + + // Add SPL interface if provided (required for SPL<->Light transfers) + if let Some(spl) = spl_interface { + cpi = cpi + .with_spl_interface( + Some(spl.mint), + Some(spl.spl_token_program), + Some(spl.spl_interface_pda), + Some(spl.spl_interface_pda_bump), + ) + .map_err(|e| anchor_lang::prelude::ProgramError::from(e))?; + } + + if let Some(seeds) = signer_seeds { + cpi.invoke_signed(&[seeds]) + } else { + cpi.invoke() + } + .map_err(|e| anchor_lang::prelude::ProgramError::from(e).into()) + } +} diff --git a/anchor/programs/fundraiser/src/lib.rs b/anchor/programs/fundraiser/src/lib.rs new file mode 100644 index 0000000..a27bc81 --- /dev/null +++ b/anchor/programs/fundraiser/src/lib.rs @@ -0,0 +1,43 @@ +#![allow(deprecated)] + +use anchor_lang::prelude::*; +use light_token::anchor::{derive_light_cpi_signer, light_program, CpiSigner}; + +declare_id!("Eoiuq1dXvHxh6dLx3wh9gj8kSAUpga11krTrbfF5XYsC"); + +pub const LIGHT_CPI_SIGNER: CpiSigner = + derive_light_cpi_signer!("Eoiuq1dXvHxh6dLx3wh9gj8kSAUpga11krTrbfF5XYsC"); + +mod constants; +mod error; +pub mod instructions; +mod state; + +pub use constants::*; +use error::*; +pub use instructions::*; + +#[light_program] +#[program] +pub mod fundraiser { + use super::*; + + pub fn initialize<'info>( + ctx: Context<'_, '_, '_, 'info, Initialize<'info>>, + params: InitializeParams, + ) -> Result<()> { + ctx.accounts.initialize(¶ms, &ctx.bumps) + } + + pub fn contribute(ctx: Context, amount: u64) -> Result<()> { + ctx.accounts.contribute(amount) + } + + pub fn check_contributions(ctx: Context) -> Result<()> { + ctx.accounts.check_contributions(&ctx.bumps) + } + + pub fn refund(ctx: Context) -> Result<()> { + ctx.accounts.refund(&ctx.bumps) + } +} diff --git a/anchor/programs/fundraiser/src/state/contributor.rs b/anchor/programs/fundraiser/src/state/contributor.rs new file mode 100644 index 0000000..ff83b0f --- /dev/null +++ b/anchor/programs/fundraiser/src/state/contributor.rs @@ -0,0 +1,7 @@ +use anchor_lang::prelude::*; + +#[account] +#[derive(InitSpace)] +pub struct Contributor { + pub amount: u64, +} diff --git a/anchor/programs/fundraiser/src/state/fundraiser.rs b/anchor/programs/fundraiser/src/state/fundraiser.rs new file mode 100644 index 0000000..ceaf9c2 --- /dev/null +++ b/anchor/programs/fundraiser/src/state/fundraiser.rs @@ -0,0 +1,13 @@ +use anchor_lang::prelude::*; + +#[account] +#[derive(InitSpace)] +pub struct Fundraiser { + pub maker: Pubkey, + pub mint_to_raise: Pubkey, + pub amount_to_raise: u64, + pub current_amount: u64, + pub time_started: i64, + pub duration: u16, + pub bump: u8, +} diff --git a/anchor/programs/fundraiser/src/state/mod.rs b/anchor/programs/fundraiser/src/state/mod.rs new file mode 100644 index 0000000..d4c1b82 --- /dev/null +++ b/anchor/programs/fundraiser/src/state/mod.rs @@ -0,0 +1,5 @@ +pub mod contributor; +pub mod fundraiser; + +pub use contributor::*; +pub use fundraiser::*; diff --git a/anchor/programs/fundraiser/tests/common/mod.rs b/anchor/programs/fundraiser/tests/common/mod.rs new file mode 100644 index 0000000..12fa022 --- /dev/null +++ b/anchor/programs/fundraiser/tests/common/mod.rs @@ -0,0 +1,634 @@ +//! Common test utilities for fundraiser tests. +//! +//! This module provides shared test helpers for different token type combinations: +//! - SPL mint + SPL ATAs +//! - T22 mint + T22 ATAs +//! - SPL mint + Light user accounts +//! - T22 mint + Light user accounts +//! - Light mint + Light user accounts + +use anchor_lang::{InstructionData, ToAccountMetas}; +use anchor_spl::token; +use shared_test_utils::{ + helpers::verify_light_token_balance, + light_tokens::{create_light_ata, create_light_mint, mint_light_tokens}, + setup::initialize_rent_free_config, + spl_interface::{create_spl_interface_pda, transfer_spl_to_light}, + spl_tokens::{create_spl_ata, create_spl_mint, mint_spl_tokens}, + t22_tokens::{create_t22_ata, create_t22_mint, mint_t22_tokens}, + CreateAccountsProofResult, Indexer, LightProgramTest, MintType, ProgramTestConfig, Rpc, + TestRpc, COMPRESSIBLE_CONFIG_V1, CPI_AUTHORITY_PDA, LIGHT_TOKEN_MINTER_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, RENT_SPONSOR, +}; +use solana_instruction::Instruction; +use solana_keypair::Keypair; +use solana_pubkey::Pubkey; +use solana_signer::Signer; +use spl_token_2022::pod::PodAccount; + +/// Token configuration for parameterized tests +#[allow(dead_code)] +#[derive(Clone, Copy, Debug)] +pub enum TokenConfig { + /// SPL mint + SPL ATAs + Spl, + /// T22 mint + T22 ATAs + Token2022, + /// SPL mint + Light user accounts (offchain SPL->Light conversion) + LightSpl, + /// T22 mint + Light user accounts (offchain T22->Light conversion) + LightT22, + /// Light mint + Light user accounts (pure Light-to-Light) + Light, +} + +impl TokenConfig { + pub fn mint_type(&self) -> MintType { + match self { + TokenConfig::Spl | TokenConfig::LightSpl => MintType::Spl, + TokenConfig::Token2022 | TokenConfig::LightT22 => MintType::Token2022, + TokenConfig::Light => MintType::Spl, // Light mints use SPL-compatible layout + } + } + + pub fn token_program_id(&self) -> Pubkey { + match self { + TokenConfig::Spl | TokenConfig::LightSpl => token::ID, + TokenConfig::Token2022 | TokenConfig::LightT22 => spl_token_2022::ID, + TokenConfig::Light => Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + } + } + + /// Returns true if mints are Light Protocol mints (not SPL/T22) + pub fn uses_light_mints(&self) -> bool { + matches!(self, TokenConfig::Light) + } +} + +/// Context for fundraiser tests containing all necessary accounts +#[allow(dead_code)] +pub struct FundraiserTestContext { + pub program_id: Pubkey, + pub payer: Keypair, + pub mint: Keypair, + /// For Light mints, stores the mint PDA + pub mint_pubkey: Pubkey, + pub maker: Keypair, + pub fundraiser_pda: Pubkey, + pub vault_pda: Pubkey, + pub vault_bump: u8, + pub spl_interface_pda: Pubkey, + pub spl_interface_bump: u8, + pub token_config: TokenConfig, + pub amount_to_raise: u64, + pub duration: u16, + /// Compression config PDA (needed for Light mint creation) + pub compression_config: Option, + /// Authority keypair for Light mint (if Light config) + pub light_mint_authority: Option, +} + +/// Create a new LightProgramTest instance for fundraiser tests +pub async fn create_test_rpc() -> LightProgramTest { + let program_id = fundraiser::ID; + let mut config = ProgramTestConfig::new_v2( + true, + Some(vec![ + ("fundraiser", program_id), + ("light_token_minter", LIGHT_TOKEN_MINTER_PROGRAM_ID), + ]), + ); + config = config.with_light_protocol_events(); + LightProgramTest::new(config).await.unwrap() +} + +/// Setup the fundraiser test environment based on token config +pub async fn setup_fundraiser_test( + rpc: &mut R, + config: TokenConfig, +) -> FundraiserTestContext { + let program_id = fundraiser::ID; + let payer = rpc.get_payer().insecure_clone(); + + // Initialize rent-free config (returns the config PDA) + let compression_config = initialize_rent_free_config(rpc, &payer, &program_id).await; + + // Create maker + let maker = Keypair::new(); + rpc.airdrop_lamports(&maker.pubkey(), 10_000_000_000) + .await + .unwrap(); + + // Amount to raise: 1000 tokens (with 9 decimals) + let amount_to_raise = 1_000_000_000_000u64; + let duration = 7u16; // 7 days + + // For Light mints, handle separately + if config.uses_light_mints() { + // ========== LIGHT MINT SETUP ========== + println!("\n=== Setting up Light mint ==="); + + // Create Light mint + let light_mint = create_light_mint( + rpc, + &payer, + 9, + "Fundraiser Token", + "FUND", + &compression_config, + ) + .await; + + let mint_pubkey = light_mint.mint; + println!("Light Mint: {:?}", mint_pubkey); + + // For pure Light-to-Light, we don't need SPL interface PDA + let spl_interface_pda = Pubkey::default(); + + // Derive fundraiser and vault PDAs + let (fundraiser_pda, _) = + Pubkey::find_program_address(&[b"fundraiser", maker.pubkey().as_ref()], &program_id); + + let (vault_pda, vault_bump) = Pubkey::find_program_address( + &[fundraiser::VAULT_SEED, fundraiser_pda.as_ref()], + &program_id, + ); + + println!("Fundraiser PDA: {:?}", fundraiser_pda); + println!("Vault PDA: {:?}", vault_pda); + + // Create dummy keypair for mint (not used for Light mints) + let dummy_keypair = Keypair::new(); + + return FundraiserTestContext { + program_id, + payer, + mint: dummy_keypair, + mint_pubkey, + maker, + fundraiser_pda, + vault_pda, + vault_bump, + spl_interface_pda, + spl_interface_bump: 0, + token_config: config, + amount_to_raise, + duration, + compression_config: Some(compression_config), + light_mint_authority: Some(light_mint.authority), + }; + } + + // ========== SPL/T22 MINT SETUP ========== + // Create mint based on config (SPL or T22 - Light user accounts still use SPL/T22 mints) + let mint = match config { + TokenConfig::Spl | TokenConfig::LightSpl => { + create_spl_mint(rpc, &payer, &payer.pubkey(), 9).await + } + TokenConfig::Token2022 | TokenConfig::LightT22 => { + create_t22_mint(rpc, &payer, &payer.pubkey(), 9).await + } + TokenConfig::Light => unreachable!("Light config handled above"), + }; + + let mint_pubkey = mint.pubkey(); + println!("Mint created: {:?}", mint_pubkey); + + // Create SPL interface PDA + println!("\n=== Creating SPL interface PDA ==="); + let spl_interface_result = + create_spl_interface_pda(rpc, &payer, &mint_pubkey, config.mint_type(), false).await; + + // Derive fundraiser and vault PDAs + let (fundraiser_pda, _) = + Pubkey::find_program_address(&[b"fundraiser", maker.pubkey().as_ref()], &program_id); + + let (vault_pda, vault_bump) = Pubkey::find_program_address( + &[fundraiser::VAULT_SEED, fundraiser_pda.as_ref()], + &program_id, + ); + + println!("Fundraiser PDA: {:?}", fundraiser_pda); + println!("Vault PDA: {:?}", vault_pda); + + FundraiserTestContext { + program_id, + payer, + mint, + mint_pubkey, + maker, + fundraiser_pda, + vault_pda, + vault_bump, + spl_interface_pda: spl_interface_result.pda, + spl_interface_bump: spl_interface_result.bump, + token_config: config, + amount_to_raise, + duration, + compression_config: Some(compression_config), + light_mint_authority: None, + } +} + +/// Initialize fundraiser +pub async fn initialize_fundraiser( + rpc: &mut R, + ctx: &FundraiserTestContext, + proof_result: CreateAccountsProofResult, +) { + println!("\n=== Initializing Fundraiser ==="); + + let token_program = ctx.token_config.token_program_id(); + + let initialize_accounts = fundraiser::accounts::Initialize { + fee_payer: ctx.maker.pubkey(), + mint_to_raise: ctx.mint_pubkey, + fundraiser: ctx.fundraiser_pda, + vault: ctx.vault_pda, + token_program, + system_program: solana_sdk::system_program::ID, + light_token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + light_token_compressible_config: COMPRESSIBLE_CONFIG_V1, + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + }; + + let initialize_data = fundraiser::instruction::Initialize { + params: fundraiser::instructions::InitializeParams { + create_accounts_proof: proof_result.create_accounts_proof, + amount: ctx.amount_to_raise, + duration: ctx.duration, + vault_bump: ctx.vault_bump, + }, + }; + + let initialize_ix = Instruction { + program_id: ctx.program_id, + accounts: [ + initialize_accounts.to_account_metas(None), + proof_result.remaining_accounts, + ] + .concat(), + data: initialize_data.data(), + }; + + rpc.create_and_send_transaction( + &[initialize_ix], + &ctx.payer.pubkey(), + &[&ctx.payer, &ctx.maker], + ) + .await + .expect("initialize should succeed"); + + println!("Fundraiser initialized!"); + println!( + " Amount to raise: {} tokens", + ctx.amount_to_raise / 1_000_000_000 + ); + println!(" Duration: {} days", ctx.duration); +} + +/// Create a contributor with ATA and funded tokens +pub async fn create_contributor( + rpc: &mut R, + ctx: &FundraiserTestContext, + funding_amount: u64, +) -> (Keypair, Pubkey) { + let contributor = Keypair::new(); + rpc.airdrop_lamports(&contributor.pubkey(), 5_000_000_000) + .await + .unwrap(); + + let contributor_ata = match ctx.token_config { + TokenConfig::Spl => { + let ata = + create_spl_ata(rpc, &ctx.payer, &ctx.mint_pubkey, &contributor.pubkey()).await; + mint_spl_tokens( + rpc, + &ctx.payer, + &ctx.mint_pubkey, + &ata, + &ctx.payer, + funding_amount, + ) + .await; + ata + } + TokenConfig::Token2022 => { + let ata = + create_t22_ata(rpc, &ctx.payer, &ctx.mint_pubkey, &contributor.pubkey()).await; + mint_t22_tokens( + rpc, + &ctx.payer, + &ctx.mint_pubkey, + &ata, + &ctx.payer, + funding_amount, + ) + .await; + ata + } + TokenConfig::LightSpl => { + // For Light user accounts with SPL mint: + // 1. Create temp SPL ATA, mint tokens + // 2. Create Light ATA + // 3. Transfer from SPL to Light (compress) + println!("Creating Light contributor account (SPL mint)"); + + let temp_ata = + create_spl_ata(rpc, &ctx.payer, &ctx.mint_pubkey, &contributor.pubkey()).await; + mint_spl_tokens( + rpc, + &ctx.payer, + &ctx.mint_pubkey, + &temp_ata, + &ctx.payer, + funding_amount, + ) + .await; + + // Create Light ATA + let light_ata = + create_light_ata(rpc, &ctx.payer, &ctx.mint_pubkey, &contributor.pubkey()).await; + + // Transfer from SPL to Light (compress) + transfer_spl_to_light( + rpc, + &ctx.payer, + &contributor, + &ctx.mint_pubkey, + 9, + &temp_ata, + &light_ata, + &ctx.spl_interface_pda, + ctx.spl_interface_bump, + funding_amount, + MintType::Spl, + ) + .await; + + light_ata + } + TokenConfig::LightT22 => { + // For Light user accounts with T22 mint: + println!("Creating Light contributor account (T22 mint)"); + + let temp_ata = + create_t22_ata(rpc, &ctx.payer, &ctx.mint_pubkey, &contributor.pubkey()).await; + mint_t22_tokens( + rpc, + &ctx.payer, + &ctx.mint_pubkey, + &temp_ata, + &ctx.payer, + funding_amount, + ) + .await; + + // Create Light ATA + let light_ata = + create_light_ata(rpc, &ctx.payer, &ctx.mint_pubkey, &contributor.pubkey()).await; + + // Transfer from T22 to Light (compress) + transfer_spl_to_light( + rpc, + &ctx.payer, + &contributor, + &ctx.mint_pubkey, + 9, + &temp_ata, + &light_ata, + &ctx.spl_interface_pda, + ctx.spl_interface_bump, + funding_amount, + MintType::Token2022, + ) + .await; + + light_ata + } + TokenConfig::Light => { + // For pure Light mints: + // Mint directly to contributor's Light ATA + println!("Creating Light contributor account (Light mint)"); + + let mint_authority = ctx + .light_mint_authority + .as_ref() + .expect("Light config should have mint authority"); + + // Mint tokens directly to contributor's Light ATA + let light_ata = mint_light_tokens( + rpc, + &ctx.payer, + mint_authority, + &ctx.mint_pubkey, + &contributor.pubkey(), + funding_amount, + ) + .await; + + light_ata + } + }; + + (contributor, contributor_ata) +} + +/// Contribute to fundraiser +pub async fn contribute( + rpc: &mut R, + ctx: &FundraiserTestContext, + contributor: &Keypair, + contributor_ata: Pubkey, + amount: u64, +) { + println!("\n=== Contributing ==="); + + let token_program = ctx.token_config.token_program_id(); + + // Derive contributor account PDA + let (contributor_account_pda, _) = Pubkey::find_program_address( + &[ + b"contributor", + ctx.fundraiser_pda.as_ref(), + contributor.pubkey().as_ref(), + ], + &ctx.program_id, + ); + + let contribute_accounts = fundraiser::accounts::Contribute { + contributor: contributor.pubkey(), + mint_to_raise: ctx.mint_pubkey, + fundraiser: ctx.fundraiser_pda, + contributor_account: contributor_account_pda, + contributor_ata, + vault: ctx.vault_pda, + token_program, + system_program: solana_sdk::system_program::ID, + light_token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + spl_interface_pda: ctx.spl_interface_pda, + }; + + let contribute_data = fundraiser::instruction::Contribute { amount }; + + let contribute_ix = Instruction { + program_id: ctx.program_id, + accounts: contribute_accounts.to_account_metas(None), + data: contribute_data.data(), + }; + + rpc.create_and_send_transaction( + &[contribute_ix], + &ctx.payer.pubkey(), + &[&ctx.payer, contributor], + ) + .await + .expect("contribute should succeed"); + + println!("Contributed {} tokens", amount / 1_000_000_000); +} + +/// Check contributions and claim funds (maker claims) +pub async fn check_contributions(rpc: &mut R, ctx: &FundraiserTestContext) -> Pubkey { + println!("\n=== Maker Claims Funds ==="); + + let token_program = ctx.token_config.token_program_id(); + + // Create maker's ATA (SPL/T22 receives from Light vault via SPL interface, Light receives directly) + let maker_ata = match ctx.token_config { + TokenConfig::Spl | TokenConfig::LightSpl => { + create_spl_ata(rpc, &ctx.payer, &ctx.mint_pubkey, &ctx.maker.pubkey()).await + } + TokenConfig::Token2022 | TokenConfig::LightT22 => { + create_t22_ata(rpc, &ctx.payer, &ctx.mint_pubkey, &ctx.maker.pubkey()).await + } + TokenConfig::Light => { + // For pure Light mints, maker receives to Light ATA + create_light_ata(rpc, &ctx.payer, &ctx.mint_pubkey, &ctx.maker.pubkey()).await + } + }; + + let check_contributions_accounts = fundraiser::accounts::CheckContributions { + fee_payer: ctx.maker.pubkey(), + mint_to_raise: ctx.mint_pubkey, + fundraiser: ctx.fundraiser_pda, + vault: ctx.vault_pda, + maker_ata, + token_program, + system_program: solana_sdk::system_program::ID, + light_token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + spl_interface_pda: ctx.spl_interface_pda, + }; + + let check_contributions_data = fundraiser::instruction::CheckContributions {}; + + let check_contributions_ix = Instruction { + program_id: ctx.program_id, + accounts: check_contributions_accounts.to_account_metas(None), + data: check_contributions_data.data(), + }; + + rpc.create_and_send_transaction( + &[check_contributions_ix], + &ctx.payer.pubkey(), + &[&ctx.payer, &ctx.maker], + ) + .await + .expect("check_contributions should succeed"); + + println!("Maker claimed funds!"); + maker_ata +} + +/// Get token balance from SPL/T22 account +pub async fn get_token_balance(rpc: &mut R, account: Pubkey) -> u64 { + let account_data = rpc + .get_account(account) + .await + .unwrap() + .expect("Token account should exist"); + + let token_state = + spl_pod::bytemuck::pod_from_bytes::(&account_data.data[..165]).unwrap(); + u64::from(token_state.amount) +} + +/// Run the full fundraiser flow test +pub async fn run_fundraiser_full_flow(rpc: &mut R, ctx: &FundraiserTestContext) { + use light_client::interface::{get_create_accounts_proof, CreateAccountsProofInput}; + + // Get proof for creating vault Light token account + let proof_result = get_create_accounts_proof( + rpc, + &ctx.program_id, + vec![CreateAccountsProofInput::pda(ctx.vault_pda)], + ) + .await + .unwrap(); + + // Initialize fundraiser + initialize_fundraiser(rpc, ctx, proof_result).await; + + // Verify vault was created with 0 balance + verify_light_token_balance(rpc, ctx.vault_pda, 0, "vault (initial)").await; + + // Contribution amount is 10% of target (max allowed per contributor) + let contribution_amount = ctx.amount_to_raise * 10 / 100; + + // We need 10 contributors to reach target (each contributes 10%) + let num_contributors = 10; + let contributor_funding = contribution_amount * 2; // Give them extra to be safe + + println!( + "\n=== Creating {} contributors (each contributing {} tokens) ===", + num_contributors, + contribution_amount / 1_000_000_000 + ); + + let mut total_contributed = 0u64; + for i in 0..num_contributors { + let (contributor, contributor_ata) = + create_contributor(rpc, ctx, contributor_funding).await; + contribute(rpc, ctx, &contributor, contributor_ata, contribution_amount).await; + total_contributed += contribution_amount; + println!( + "Contributor {} contributed, total: {} tokens", + i + 1, + total_contributed / 1_000_000_000 + ); + } + + // Verify vault has reached target + verify_light_token_balance( + rpc, + ctx.vault_pda, + ctx.amount_to_raise, + "vault (target reached)", + ) + .await; + + // Maker claims funds + let maker_ata = check_contributions(rpc, ctx).await; + + // Verify vault is empty + verify_light_token_balance(rpc, ctx.vault_pda, 0, "vault (after claim)").await; + + // Verify maker received funds + let maker_balance = get_token_balance(rpc, maker_ata).await; + assert_eq!( + maker_balance, ctx.amount_to_raise, + "Maker should have received all raised funds" + ); + println!("Maker received {} tokens", maker_balance / 1_000_000_000); + + // Verify fundraiser account was closed + let fundraiser_account = rpc.get_account(ctx.fundraiser_pda).await.unwrap(); + assert!(fundraiser_account.is_none(), "Fundraiser should be closed"); + + println!("\n=== Fundraiser full flow test completed successfully! ==="); +} diff --git a/anchor/programs/fundraiser/tests/light_spl_user_accounts.rs b/anchor/programs/fundraiser/tests/light_spl_user_accounts.rs new file mode 100644 index 0000000..cc05fd9 --- /dev/null +++ b/anchor/programs/fundraiser/tests/light_spl_user_accounts.rs @@ -0,0 +1,24 @@ +//! Integration tests for the fundraiser program with SPL mints and Light user accounts. +//! +//! Token Configuration: +//! - Mint Type: SPL (token::ID) +//! - User Accounts: Light token accounts (contributors with offchain SPL->Light conversion) +//! - Vault Account: Light Protocol token account +//! +//! ## Test Flow: +//! 1. Create SPL mint and temporary SPL ATA +//! 2. Mint tokens to temporary ATA +//! 3. Create Light token account for contributor +//! 4. Create SPL interface PDA +//! 5. Transfer from SPL ATA to Light account (offchain conversion using `transfer_spl_to_light`) +//! 6. Contributor has Light account with tokens - contribute using Light-to-Light + +mod common; +use common::{create_test_rpc, run_fundraiser_full_flow, setup_fundraiser_test, TokenConfig}; + +#[tokio::test] +async fn test_fundraiser_full_flow_light_spl() { + let mut rpc = create_test_rpc().await; + let ctx = setup_fundraiser_test(&mut rpc, TokenConfig::LightSpl).await; + run_fundraiser_full_flow(&mut rpc, &ctx).await; +} diff --git a/anchor/programs/fundraiser/tests/light_t22_user_accounts.rs b/anchor/programs/fundraiser/tests/light_t22_user_accounts.rs new file mode 100644 index 0000000..03e378a --- /dev/null +++ b/anchor/programs/fundraiser/tests/light_t22_user_accounts.rs @@ -0,0 +1,24 @@ +//! Integration tests for the fundraiser program with T22 mints and Light user accounts. +//! +//! Token Configuration: +//! - Mint Type: Token-2022 (spl_token_2022::ID) +//! - User Accounts: Light token accounts (contributors with offchain T22->Light conversion) +//! - Vault Account: Light Protocol token account +//! +//! ## Test Flow: +//! 1. Create T22 mint and temporary T22 ATA +//! 2. Mint tokens to temporary ATA +//! 3. Create Light token account for contributor +//! 4. Create SPL interface PDA +//! 5. Transfer from T22 ATA to Light account (offchain conversion using `transfer_spl_to_light`) +//! 6. Contributor has Light account with tokens - contribute using Light-to-Light + +mod common; +use common::{create_test_rpc, run_fundraiser_full_flow, setup_fundraiser_test, TokenConfig}; + +#[tokio::test] +async fn test_fundraiser_full_flow_light_t22() { + let mut rpc = create_test_rpc().await; + let ctx = setup_fundraiser_test(&mut rpc, TokenConfig::LightT22).await; + run_fundraiser_full_flow(&mut rpc, &ctx).await; +} diff --git a/anchor/programs/fundraiser/tests/light_user_accounts.rs b/anchor/programs/fundraiser/tests/light_user_accounts.rs new file mode 100644 index 0000000..0788b22 --- /dev/null +++ b/anchor/programs/fundraiser/tests/light_user_accounts.rs @@ -0,0 +1,48 @@ +//! Integration tests for the fundraiser program with Light mints and Light ATAs. +//! +//! Token Configuration: +//! - Mint Type: Light (via CreateMint instruction) +//! - User Accounts: Light token accounts (contributors) +//! - Vault Account: Light Protocol token account +//! +//! This is the pure Light-to-Light test where everything uses compressed tokens. + +mod common; + +use common::{create_test_rpc, run_fundraiser_full_flow, setup_fundraiser_test, TokenConfig}; + +/// Test the full fundraiser flow with Light tokens +#[tokio::test] +async fn test_fundraiser_full_flow_light() { + let mut rpc = create_test_rpc().await; + let ctx = setup_fundraiser_test(&mut rpc, TokenConfig::Light).await; + run_fundraiser_full_flow(&mut rpc, &ctx).await; +} + +/// Test fundraiser initialization with Light tokens +#[tokio::test] +async fn test_initialize_fundraiser_light() { + use common::initialize_fundraiser; + use light_client::interface::{get_create_accounts_proof, CreateAccountsProofInput}; + use shared_test_utils::helpers::verify_light_token_balance; + + let mut rpc = create_test_rpc().await; + let ctx = setup_fundraiser_test(&mut rpc, TokenConfig::Light).await; + + // Get proof for creating vault + let proof_result = get_create_accounts_proof( + &rpc, + &ctx.program_id, + vec![CreateAccountsProofInput::pda(ctx.vault_pda)], + ) + .await + .unwrap(); + + // Initialize fundraiser + initialize_fundraiser(&mut rpc, &ctx, proof_result).await; + + // Verify vault was created + verify_light_token_balance(&mut rpc, ctx.vault_pda, 0, "vault").await; + + println!("=== Initialize fundraiser test completed successfully! ==="); +} diff --git a/anchor/programs/fundraiser/tests/spl_user_accounts.rs b/anchor/programs/fundraiser/tests/spl_user_accounts.rs new file mode 100644 index 0000000..e590e5d --- /dev/null +++ b/anchor/programs/fundraiser/tests/spl_user_accounts.rs @@ -0,0 +1,46 @@ +//! Integration tests for the fundraiser program with SPL mints and SPL ATAs. +//! +//! Token Configuration: +//! - Mint Type: SPL (token::ID) +//! - User Accounts: SPL ATAs (contributors) +//! - Vault Account: Light Protocol token account + +mod common; + +use common::{create_test_rpc, run_fundraiser_full_flow, setup_fundraiser_test, TokenConfig}; + +/// Test the full fundraiser flow with SPL tokens +#[tokio::test] +async fn test_fundraiser_full_flow_spl() { + let mut rpc = create_test_rpc().await; + let ctx = setup_fundraiser_test(&mut rpc, TokenConfig::Spl).await; + run_fundraiser_full_flow(&mut rpc, &ctx).await; +} + +/// Test fundraiser initialization with SPL tokens +#[tokio::test] +async fn test_initialize_fundraiser_spl() { + use common::{initialize_fundraiser, setup_fundraiser_test}; + use light_client::interface::{get_create_accounts_proof, CreateAccountsProofInput}; + use shared_test_utils::helpers::verify_light_token_balance; + + let mut rpc = create_test_rpc().await; + let ctx = setup_fundraiser_test(&mut rpc, TokenConfig::Spl).await; + + // Get proof for creating vault + let proof_result = get_create_accounts_proof( + &rpc, + &ctx.program_id, + vec![CreateAccountsProofInput::pda(ctx.vault_pda)], + ) + .await + .unwrap(); + + // Initialize fundraiser + initialize_fundraiser(&mut rpc, &ctx, proof_result).await; + + // Verify vault was created + verify_light_token_balance(&mut rpc, ctx.vault_pda, 0, "vault").await; + + println!("=== Initialize fundraiser test completed successfully! ==="); +} diff --git a/anchor/programs/fundraiser/tests/t22_user_accounts.rs b/anchor/programs/fundraiser/tests/t22_user_accounts.rs new file mode 100644 index 0000000..540680a --- /dev/null +++ b/anchor/programs/fundraiser/tests/t22_user_accounts.rs @@ -0,0 +1,46 @@ +//! Integration tests for the fundraiser program with Token-2022 mints and T22 ATAs. +//! +//! Token Configuration: +//! - Mint Type: Token-2022 (spl_token_2022::ID) +//! - User Accounts: Token-2022 ATAs (contributors) +//! - Vault Account: Light Protocol token account + +mod common; + +use common::{create_test_rpc, run_fundraiser_full_flow, setup_fundraiser_test, TokenConfig}; + +/// Test the full fundraiser flow with Token-2022 tokens +#[tokio::test] +async fn test_fundraiser_full_flow_t22() { + let mut rpc = create_test_rpc().await; + let ctx = setup_fundraiser_test(&mut rpc, TokenConfig::Token2022).await; + run_fundraiser_full_flow(&mut rpc, &ctx).await; +} + +/// Test fundraiser initialization with Token-2022 tokens +#[tokio::test] +async fn test_initialize_fundraiser_t22() { + use common::{initialize_fundraiser, setup_fundraiser_test}; + use light_client::interface::{get_create_accounts_proof, CreateAccountsProofInput}; + use shared_test_utils::helpers::verify_light_token_balance; + + let mut rpc = create_test_rpc().await; + let ctx = setup_fundraiser_test(&mut rpc, TokenConfig::Token2022).await; + + // Get proof for creating vault + let proof_result = get_create_accounts_proof( + &rpc, + &ctx.program_id, + vec![CreateAccountsProofInput::pda(ctx.vault_pda)], + ) + .await + .unwrap(); + + // Initialize fundraiser + initialize_fundraiser(&mut rpc, &ctx, proof_result).await; + + // Verify vault was created + verify_light_token_balance(&mut rpc, ctx.vault_pda, 0, "vault").await; + + println!("=== Initialize fundraiser test completed successfully! ==="); +} diff --git a/anchor/programs/light-token-minter/Cargo.toml b/anchor/programs/light-token-minter/Cargo.toml new file mode 100644 index 0000000..56625d5 --- /dev/null +++ b/anchor/programs/light-token-minter/Cargo.toml @@ -0,0 +1,52 @@ +[package] +name = "light-token-minter" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib", "lib"] +name = "light_token_minter" + +[features] +no-entrypoint = [] +no-log-ix-name = [] +no-idl = [] +cpi = ["no-entrypoint"] +default = [] +idl-build = ["anchor-lang/idl-build", "light-sdk/idl-build", "light-token/idl-build", "light-anchor-spl/idl-build"] +test-sbf = [] + +[dependencies] +anchor-lang = { version = "=0.31.1", features = ["init-if-needed", "idl-build"] } +# Pin blake3 version for solana-program compatibility +blake3 = { workspace = true } + +light-sdk = { workspace = true, features = ["anchor", "anchor-discriminator", "idl-build", "cpi-context", "v2"] } +light-token = { workspace = true, features = ["anchor", "idl-build"] } +# Required by LightAccount derive macro +light-hasher = { workspace = true, features = ["solana"] } +light-anchor-spl = { workspace = true, features = ["idl-build"] } +solana-program = "2.2" +solana-pubkey = "2.2" +solana-account-info = "2.3" +solana-program-error = "2.2" +solana-msg = "2.2" + +[dev-dependencies] +light-program-test = { workspace = true } +light-client = { workspace = true, features = ["v2", "anchor"] } +tokio = { version = "1", features = ["full"] } +spl-token = "7.0.0" +solana-keypair = { version = "2.2" } +solana-signer = { version = "2.2" } +solana-instruction = { version = "2.2" } +solana-sdk = { version = "2.3" } +spl-token-2022 = "6.0.0" +spl-pod = "0.4.0" + +[lints.rust.unexpected_cfgs] +level = "allow" +check-cfg = [ + 'cfg(target_os, values("solana"))', + 'cfg(feature, values("frozen-abi", "no-entrypoint"))', +] diff --git a/anchor/programs/light-token-minter/src/instructions/create.rs b/anchor/programs/light-token-minter/src/instructions/create.rs new file mode 100644 index 0000000..222c469 --- /dev/null +++ b/anchor/programs/light-token-minter/src/instructions/create.rs @@ -0,0 +1,86 @@ +use anchor_lang::prelude::*; +use light_sdk::interface::CreateAccountsProof; +use light_token::anchor::LightAccounts; +use light_token::instruction::{COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR}; + +use crate::MINT_SIGNER_SEED; + +#[derive(AnchorSerialize, AnchorDeserialize, Clone)] +pub struct CreateMintParams { + pub create_accounts_proof: CreateAccountsProof, + pub decimals: u8, + pub mint_signer_bump: u8, + /// Token name (e.g., "My Token") + pub token_name: String, + /// Token symbol (e.g., "MTK") + pub token_symbol: String, + /// Token metadata URI (e.g., "https://example.com/metadata.json") + pub token_uri: String, +} + +#[derive(Accounts, LightAccounts)] +#[instruction(params: CreateMintParams)] +pub struct CreateMint<'info> { + #[account(mut)] + pub fee_payer: Signer<'info>, + + /// The mint authority + pub authority: Signer<'info>, + + /// CHECK: PDA derived from authority - used as mint signer seed + #[account( + seeds = [MINT_SIGNER_SEED, authority.key().as_ref()], + bump, + )] + pub mint_signer: UncheckedAccount<'info>, + + /// CHECK: Initialized by light_account macro + #[account(mut)] + #[light_account(init, + mint::signer = mint_signer, + mint::authority = authority, + mint::decimals = params.decimals, + mint::seeds = &[MINT_SIGNER_SEED, self.authority.to_account_info().key.as_ref()], + mint::bump = params.mint_signer_bump, + mint::name = params.token_name.clone().into_bytes(), + mint::symbol = params.token_symbol.clone().into_bytes(), + mint::uri = params.token_uri.clone().into_bytes(), + mint::update_authority = authority + )] + pub cmint: UncheckedAccount<'info>, + + /// CHECK: Compression config + pub compression_config: AccountInfo<'info>, + + /// CHECK: Light token compressible config + #[account(address = COMPRESSIBLE_CONFIG_V1)] + pub light_token_compressible_config: AccountInfo<'info>, + + /// CHECK: Light token rent sponsor + #[account(mut, address = RENT_SPONSOR)] + pub rent_sponsor: AccountInfo<'info>, + + /// CHECK: Light token program + pub light_token_program: AccountInfo<'info>, + + /// CHECK: Light token CPI authority + pub light_token_cpi_authority: AccountInfo<'info>, + + pub system_program: Program<'info, System>, +} + +/// Creates a new Light compressed token mint with metadata. +/// The mint is created automatically by the #[light_account(init, mint, ...)] macro. +#[allow(unused_variables)] +pub fn create_token<'info>( + ctx: &Context<'_, '_, '_, 'info, CreateMint<'info>>, + params: &CreateMintParams, +) -> Result<()> { + msg!("Light mint created with metadata"); + msg!("Name: {}", params.token_name); + msg!("Symbol: {}", params.token_symbol); + msg!("URI: {}", params.token_uri); + msg!("Mint signer: {}", ctx.accounts.mint_signer.key()); + msg!("Mint authority: {}", ctx.accounts.authority.key()); + Ok(()) +} diff --git a/anchor/programs/light-token-minter/src/instructions/mint.rs b/anchor/programs/light-token-minter/src/instructions/mint.rs new file mode 100644 index 0000000..6744ae4 --- /dev/null +++ b/anchor/programs/light-token-minter/src/instructions/mint.rs @@ -0,0 +1,83 @@ +use anchor_lang::prelude::*; +use light_sdk::interface::CreateAccountsProof; +use light_token::anchor::LightAccounts; +use light_token::instruction::{MintToCpi, COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR}; + +#[derive(AnchorSerialize, AnchorDeserialize, Clone)] +pub struct MintTokenParams { + pub amount: u64, + /// Proof for creating the ATA if needed + pub create_accounts_proof: CreateAccountsProof, + /// Bump for deriving the ATA address (from light_token::instruction::derive_token_ata) + pub ata_bump: u8, +} + +#[derive(Accounts, LightAccounts)] +#[instruction(params: MintTokenParams)] +pub struct MintTo<'info> { + #[account(mut)] + pub fee_payer: Signer<'info>, + + /// The mint authority (must be writable since light-token MintTo marks it as writable in CPI) + #[account(mut)] + pub mint_authority: Signer<'info>, + + /// CHECK: The Light mint account + #[account(mut)] + pub mint: AccountInfo<'info>, + + /// The recipient (owner of the ATA) + /// CHECK: This is the owner of the destination token account + pub recipient: AccountInfo<'info>, + + /// CHECK: The destination token account (ATA) - created by light_account macro if needed + #[account(mut)] + #[light_account(init, + associated_token::authority = recipient, + associated_token::mint = mint, + associated_token::bump = params.ata_bump + )] + pub destination: UncheckedAccount<'info>, + + /// CHECK: Light token program for CPI + pub light_token_program: AccountInfo<'info>, + + pub system_program: Program<'info, System>, + + /// CHECK: Light token compressible config + #[account(address = COMPRESSIBLE_CONFIG_V1)] + pub light_token_compressible_config: AccountInfo<'info>, + + /// CHECK: Light token rent sponsor + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: Light token CPI authority + pub light_token_cpi_authority: AccountInfo<'info>, +} + +/// Mints tokens to a destination token account, creating the ATA if needed. +/// The ATA is created automatically by the #[light_account(init, associated_token, ...)] macro. +pub fn mint_token<'info>( + ctx: &Context<'_, '_, '_, 'info, MintTo<'info>>, + params: &MintTokenParams, +) -> Result<()> { + MintToCpi { + mint: ctx.accounts.mint.to_account_info(), + destination: ctx.accounts.destination.to_account_info(), + amount: params.amount, + authority: ctx.accounts.mint_authority.to_account_info(), + system_program: ctx.accounts.system_program.to_account_info(), + max_top_up: None, + fee_payer: Some(ctx.accounts.fee_payer.to_account_info()), + } + .invoke()?; + + msg!( + "Minted {} tokens to {} (owner: {})", + params.amount, + ctx.accounts.destination.key(), + ctx.accounts.recipient.key() + ); + Ok(()) +} diff --git a/anchor/programs/light-token-minter/src/instructions/mod.rs b/anchor/programs/light-token-minter/src/instructions/mod.rs new file mode 100644 index 0000000..b5fc428 --- /dev/null +++ b/anchor/programs/light-token-minter/src/instructions/mod.rs @@ -0,0 +1,5 @@ +pub mod create; +pub mod mint; + +pub use create::*; +pub use mint::*; diff --git a/anchor/programs/light-token-minter/src/lib.rs b/anchor/programs/light-token-minter/src/lib.rs new file mode 100644 index 0000000..ab89bf5 --- /dev/null +++ b/anchor/programs/light-token-minter/src/lib.rs @@ -0,0 +1,36 @@ +#![allow(deprecated)] + +pub mod instructions; + +use anchor_lang::prelude::*; +use light_token::anchor::{derive_light_cpi_signer, light_program, CpiSigner}; + +pub use instructions::*; + +declare_id!("3EPJBoxM8Evtv3Wk7R2mSWsrSzUD7WSKAaYugLgpCitV"); + +pub const LIGHT_CPI_SIGNER: CpiSigner = + derive_light_cpi_signer!("3EPJBoxM8Evtv3Wk7R2mSWsrSzUD7WSKAaYugLgpCitV"); + +/// Seed for deriving the mint signer PDA +pub const MINT_SIGNER_SEED: &[u8] = b"mint_signer"; + +#[light_program] +#[program] +pub mod light_token_minter { + use super::*; + + pub fn create_mint<'info>( + ctx: Context<'_, '_, '_, 'info, CreateMint<'info>>, + params: CreateMintParams, + ) -> Result<()> { + instructions::create::create_token(&ctx, ¶ms) + } + + pub fn mint_to<'info>( + ctx: Context<'_, '_, '_, 'info, MintTo<'info>>, + params: MintTokenParams, + ) -> Result<()> { + instructions::mint::mint_token(&ctx, ¶ms) + } +} diff --git a/anchor/programs/light-token-minter/tests/minter_test.rs b/anchor/programs/light-token-minter/tests/minter_test.rs new file mode 100644 index 0000000..272effb --- /dev/null +++ b/anchor/programs/light-token-minter/tests/minter_test.rs @@ -0,0 +1,386 @@ +//! Integration tests for Light mint creation using #[light_account(init, mint)] macro. + +use anchor_lang::{InstructionData, ToAccountMetas}; +use light_client::interface::{ + get_create_accounts_proof, CreateAccountsProofInput, InitializeRentFreeConfig, +}; +use light_program_test::{ + program_test::{setup_mock_program_data, LightProgramTest}, + ProgramTestConfig, Rpc, +}; +use light_sdk::constants::LIGHT_TOKEN_PROGRAM_ID; +use light_token::instruction::{ + derive_token_ata, find_mint_address, COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR, +}; +use solana_instruction::Instruction; +use solana_keypair::Keypair; +use solana_pubkey::Pubkey; +use solana_signer::Signer; + +/// Test creating a Light mint using the #[light_account(init, mint)] macro. +#[tokio::test] +async fn test_create_light_mint() { + let program_id = light_token_minter::ID; + let mut config = + ProgramTestConfig::new_v2(true, Some(vec![("light_token_minter", program_id)])); + config = config.with_light_protocol_events(); + + let mut rpc = LightProgramTest::new(config).await.unwrap(); + let payer = rpc.get_payer().insecure_clone(); + + // Setup program data for rent-free config + let program_data_pda = setup_mock_program_data(&mut rpc, &payer, &program_id); + + // Initialize rent-free config + let (init_config_ix, config_pda) = InitializeRentFreeConfig::new( + &program_id, + &payer.pubkey(), + &program_data_pda, + RENT_SPONSOR, + payer.pubkey(), + ) + .build(); + + rpc.create_and_send_transaction(&[init_config_ix], &payer.pubkey(), &[&payer]) + .await + .expect("Initialize config should succeed"); + + // Authority keypair (mint authority) + let authority = Keypair::new(); + + // Derive mint signer PDA + let (mint_signer_pda, mint_signer_bump) = Pubkey::find_program_address( + &[ + light_token_minter::MINT_SIGNER_SEED, + authority.pubkey().as_ref(), + ], + &program_id, + ); + + // Derive mint PDA from mint signer + let (cmint_pda, _) = find_mint_address(&mint_signer_pda); + + // Get proof for the mint + let proof_result = get_create_accounts_proof( + &rpc, + &program_id, + vec![CreateAccountsProofInput::mint(mint_signer_pda)], + ) + .await + .unwrap(); + + println!("Light Mint test setup completed"); + println!("Program ID: {:?}", program_id); + println!( + "Mint Signer PDA: {:?} (bump: {})", + mint_signer_pda, mint_signer_bump + ); + println!("Light Mint PDA: {:?}", cmint_pda); + + // Build create_mint instruction + let accounts = light_token_minter::accounts::CreateMint { + fee_payer: payer.pubkey(), + authority: authority.pubkey(), + mint_signer: mint_signer_pda, + cmint: cmint_pda, + compression_config: config_pda, + light_token_compressible_config: COMPRESSIBLE_CONFIG_V1, + rent_sponsor: RENT_SPONSOR, + light_token_program: LIGHT_TOKEN_PROGRAM_ID.into(), + light_token_cpi_authority: light_token::constants::CPI_AUTHORITY_PDA.into(), + system_program: solana_sdk::system_program::ID, + }; + + let instruction_data = light_token_minter::instruction::CreateMint { + params: light_token_minter::CreateMintParams { + create_accounts_proof: proof_result.create_accounts_proof, + decimals: 9, + mint_signer_bump, + token_name: "Test Token".to_string(), + token_symbol: "TEST".to_string(), + token_uri: "https://example.com/metadata.json".to_string(), + }, + }; + + let instruction = Instruction { + program_id, + accounts: [ + accounts.to_account_metas(None), + proof_result.remaining_accounts, + ] + .concat(), + data: instruction_data.data(), + }; + + rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer, &authority]) + .await + .expect("CreateMint should succeed"); + + // Verify mint exists on-chain + let cmint_account = rpc + .get_account(cmint_pda) + .await + .unwrap() + .expect("Mint should exist on-chain"); + + // Verify the account has data (mint was created successfully) + assert!( + !cmint_account.data.is_empty(), + "Mint account should have data" + ); + + // The account should have significant size for a Light mint + assert!( + cmint_account.data.len() > 50, + "Mint account should have sufficient data for a Light mint" + ); + + println!("Light Mint created and verified successfully!"); + println!("Mint account size: {} bytes", cmint_account.data.len()); + println!("Mint PDA: {}", cmint_pda); +} + +/// Test basic mint signer PDA derivation without creating the mint. +#[tokio::test] +async fn test_mint_signer_derivation() { + let program_id = light_token_minter::ID; + let mut config = + ProgramTestConfig::new_v2(true, Some(vec![("light_token_minter", program_id)])); + config = config.with_light_protocol_events(); + + let rpc = LightProgramTest::new(config).await.unwrap(); + let payer = rpc.get_payer().insecure_clone(); + + // Derive mint signer PDA + let (mint_signer_pda, bump) = Pubkey::find_program_address( + &[ + light_token_minter::MINT_SIGNER_SEED, + payer.pubkey().as_ref(), + ], + &program_id, + ); + + // Derive mint PDA from mint signer + let (mint_pda, _) = find_mint_address(&mint_signer_pda); + + println!("Light Token Minter test setup completed"); + println!("Program ID: {:?}", program_id); + println!("Mint Signer PDA: {:?} (bump: {})", mint_signer_pda, bump); + println!("Compressed Mint PDA: {:?}", mint_pda); + println!("Payer: {:?}", payer.pubkey()); + + // Verify the PDA derivations are deterministic + let (verify_signer, verify_bump) = Pubkey::find_program_address( + &[ + light_token_minter::MINT_SIGNER_SEED, + payer.pubkey().as_ref(), + ], + &program_id, + ); + assert_eq!(mint_signer_pda, verify_signer); + assert_eq!(bump, verify_bump); +} + +/// Test the full flow: create Light mint, create token account, mint tokens. +#[tokio::test] +async fn test_mint_to() { + let program_id = light_token_minter::ID; + let mut config = + ProgramTestConfig::new_v2(true, Some(vec![("light_token_minter", program_id)])); + config = config.with_light_protocol_events(); + + let mut rpc = LightProgramTest::new(config).await.unwrap(); + let payer = rpc.get_payer().insecure_clone(); + + // Setup program data for rent-free config + let program_data_pda = setup_mock_program_data(&mut rpc, &payer, &program_id); + + // Initialize rent-free config + let (init_config_ix, config_pda) = InitializeRentFreeConfig::new( + &program_id, + &payer.pubkey(), + &program_data_pda, + RENT_SPONSOR, + payer.pubkey(), + ) + .build(); + + rpc.create_and_send_transaction(&[init_config_ix], &payer.pubkey(), &[&payer]) + .await + .expect("Initialize config should succeed"); + + println!("Rent-free config initialized at: {:?}", config_pda); + + // Authority keypair (mint authority) + let authority = Keypair::new(); + rpc.airdrop_lamports(&authority.pubkey(), 1_000_000_000) + .await + .unwrap(); + + // Derive mint signer PDA + let (mint_signer_pda, mint_signer_bump) = Pubkey::find_program_address( + &[ + light_token_minter::MINT_SIGNER_SEED, + authority.pubkey().as_ref(), + ], + &program_id, + ); + + // Derive mint PDA from mint signer + let (cmint_pda, _) = find_mint_address(&mint_signer_pda); + + println!("Mint Signer PDA: {:?}", mint_signer_pda); + println!("Light Mint PDA: {:?}", cmint_pda); + + // Get proof for the mint + let proof_result = get_create_accounts_proof( + &rpc, + &program_id, + vec![CreateAccountsProofInput::mint(mint_signer_pda)], + ) + .await + .unwrap(); + + // Build create_mint instruction + let create_mint_accounts = light_token_minter::accounts::CreateMint { + fee_payer: payer.pubkey(), + authority: authority.pubkey(), + mint_signer: mint_signer_pda, + cmint: cmint_pda, + compression_config: config_pda, + light_token_compressible_config: COMPRESSIBLE_CONFIG_V1, + rent_sponsor: RENT_SPONSOR, + light_token_program: LIGHT_TOKEN_PROGRAM_ID.into(), + light_token_cpi_authority: light_token::constants::CPI_AUTHORITY_PDA.into(), + system_program: solana_sdk::system_program::ID, + }; + + let create_mint_data = light_token_minter::instruction::CreateMint { + params: light_token_minter::CreateMintParams { + create_accounts_proof: proof_result.create_accounts_proof, + decimals: 9, + mint_signer_bump, + token_name: "Test Token".to_string(), + token_symbol: "TEST".to_string(), + token_uri: "https://example.com/metadata.json".to_string(), + }, + }; + + let create_mint_ix = Instruction { + program_id, + accounts: [ + create_mint_accounts.to_account_metas(None), + proof_result.remaining_accounts, + ] + .concat(), + data: create_mint_data.data(), + }; + + rpc.create_and_send_transaction(&[create_mint_ix], &payer.pubkey(), &[&payer, &authority]) + .await + .expect("CreateMint should succeed"); + + println!("Light mint created successfully!"); + + // Verify mint exists on-chain + let cmint_account = rpc + .get_account(cmint_pda) + .await + .unwrap() + .expect("Mint should exist on-chain"); + assert!( + !cmint_account.data.is_empty(), + "Mint account should have data" + ); + println!("Mint verified, size: {} bytes", cmint_account.data.len()); + + // Create a recipient + let recipient = Keypair::new(); + rpc.airdrop_lamports(&recipient.pubkey(), 1_000_000_000) + .await + .unwrap(); + + // Derive the ATA address (will be created by mint_to via the #[light_account(init, associated_token)] macro) + let (recipient_ata, ata_bump) = derive_token_ata(&recipient.pubkey(), &cmint_pda); + println!( + "Recipient ATA (to be created by mint_to): {:?}", + recipient_ata + ); + + // Get proof for creating the ATA + let mint_to_proof_result = get_create_accounts_proof( + &rpc, + &program_id, + vec![], // ATA creation via macro doesn't need special proof input + ) + .await + .unwrap(); + + // Mint tokens using the mint_to instruction (which creates the ATA via macro) + let mint_amount = 1_000_000_000u64; // 1 token with 9 decimals + + let mint_to_accounts = light_token_minter::accounts::MintTo { + fee_payer: payer.pubkey(), + mint_authority: authority.pubkey(), + mint: cmint_pda, + recipient: recipient.pubkey(), + destination: recipient_ata, + light_token_program: LIGHT_TOKEN_PROGRAM_ID.into(), + system_program: solana_sdk::system_program::ID, + light_token_compressible_config: COMPRESSIBLE_CONFIG_V1, + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: light_token::constants::CPI_AUTHORITY_PDA.into(), + }; + + let mint_to_data = light_token_minter::instruction::MintTo { + params: light_token_minter::MintTokenParams { + amount: mint_amount, + create_accounts_proof: mint_to_proof_result.create_accounts_proof, + ata_bump, + }, + }; + + let mint_to_ix = Instruction { + program_id, + accounts: [ + mint_to_accounts.to_account_metas(None), + mint_to_proof_result.remaining_accounts, + ] + .concat(), + data: mint_to_data.data(), + }; + + rpc.create_and_send_transaction(&[mint_to_ix], &payer.pubkey(), &[&payer, &authority]) + .await + .expect("MintTo should succeed"); + + println!("Minted {} tokens to recipient", mint_amount); + + // Verify token balance + let ata_account_after = rpc + .get_account(recipient_ata) + .await + .unwrap() + .expect("ATA should still exist"); + + // Light Token accounts have SPL-compatible data in first 165 bytes + use spl_token_2022::pod::PodAccount; + if ata_account_after.data.len() >= 165 { + let token_state = + spl_pod::bytemuck::pod_from_bytes::(&ata_account_after.data[..165]) + .unwrap(); + let balance = u64::from(token_state.amount); + println!("Final balance: {} (expected {})", balance, mint_amount); + assert_eq!( + balance, mint_amount, + "Token balance should match minted amount" + ); + } else { + panic!( + "ATA data too short: {} bytes (expected >= 165)", + ata_account_after.data.len() + ); + } + + println!("\n=== mint_to test completed successfully! ==="); +} diff --git a/anchor/programs/shared-test-utils/Cargo.toml b/anchor/programs/shared-test-utils/Cargo.toml new file mode 100644 index 0000000..74ae02c --- /dev/null +++ b/anchor/programs/shared-test-utils/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "shared-test-utils" +version = "0.1.0" +description = "Shared test utilities for Light Protocol example programs" +edition = "2021" + +[lib] +name = "shared_test_utils" + +[dependencies] +# Light Protocol dependencies (from workspace) +light-program-test.workspace = true +light-client = { workspace = true, features = ["v2", "anchor"] } +light-sdk.workspace = true +light-token = { workspace = true, features = ["anchor"] } +light-hasher = { workspace = true, features = ["solana"] } + +# Example program dependencies (for calling Light mint creation instructions) +light-token-minter = { path = "../light-token-minter" } + +# Anchor dependencies +anchor-lang = { version = "=0.31.1" } +anchor-spl = { version = "0.31.1" } + +# Solana dependencies +solana-keypair = { version = "2.2" } +solana-signer = { version = "2.2" } +solana-instruction = { version = "2.2" } +solana-sdk = { version = "2.3" } +solana-pubkey = { version = "2.2" } + +# SPL Token dependencies +spl-token-2022 = "6.0.0" +spl-pod = "0.4.0" + +# Async +tokio = { version = "1", features = ["full"] } + +[lints.rust.unexpected_cfgs] +level = "allow" +check-cfg = [ + 'cfg(target_os, values("solana"))', + 'cfg(feature, values("frozen-abi", "no-entrypoint"))', +] diff --git a/anchor/programs/shared-test-utils/src/lib.rs b/anchor/programs/shared-test-utils/src/lib.rs new file mode 100644 index 0000000..e65f7a9 --- /dev/null +++ b/anchor/programs/shared-test-utils/src/lib.rs @@ -0,0 +1,822 @@ +//! Shared test utilities for Light Protocol example programs. +//! +//! This crate provides helper functions for creating and managing: +//! - SPL mints and token accounts +//! - Token-2022 mints and token accounts +//! - Light Protocol token accounts +//! - SPL interface PDAs for SPL<->Light transfers +//! - Balance verification utilities + +use anchor_spl::token; +use light_token::spl_interface::{find_spl_interface_pda, CreateSplInterfacePda}; +use solana_keypair::Keypair; +use solana_pubkey::Pubkey; +use solana_signer::Signer; +use spl_token_2022::pod::PodAccount; + +// Re-exports for convenience - these are what consumers of this crate will use +pub use light_client::interface::{ + get_create_accounts_proof, CreateAccountsProofInput, CreateAccountsProofResult, + InitializeRentFreeConfig, +}; +pub use light_program_test::{ + program_test::{setup_mock_program_data, LightProgramTest, TestRpc}, + Indexer, ProgramTestConfig, Rpc, +}; +pub use light_sdk::constants::LIGHT_TOKEN_PROGRAM_ID; +pub use light_token::constants::CPI_AUTHORITY_PDA; +pub use light_token::instruction::{COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR}; + +// Re-export light-token-minter program ID for tests that need to create Light mints +pub use light_token_minter::ID as LIGHT_TOKEN_MINTER_PROGRAM_ID; + +/// Token type for mint creation +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum MintType { + /// Standard SPL Token (token::ID) + Spl, + /// Token-2022 (spl_token_2022::ID) + Token2022, +} + +impl MintType { + pub fn program_id(&self) -> Pubkey { + match self { + MintType::Spl => token::ID, + MintType::Token2022 => spl_token_2022::ID, + } + } +} + +/// Result of creating an SPL interface PDA +pub struct SplInterfaceResult { + pub pda: Pubkey, + pub bump: u8, +} + +// ============================================================================ +// Setup Module +// ============================================================================ + +pub mod setup { + use super::*; + + /// Initialize rent-free config for a program + pub async fn initialize_rent_free_config( + rpc: &mut R, + payer: &Keypair, + program_id: &Pubkey, + ) -> Pubkey { + // Setup program data for rent-free config + let program_data_pda = setup_mock_program_data(rpc, payer, program_id); + + // Initialize rent-free config + let (init_config_ix, config_pda) = InitializeRentFreeConfig::new( + program_id, + &payer.pubkey(), + &program_data_pda, + RENT_SPONSOR, + payer.pubkey(), + ) + .build(); + + rpc.create_and_send_transaction(&[init_config_ix], &payer.pubkey(), &[payer]) + .await + .expect("Initialize rent-free config should succeed"); + + println!("Rent-free config initialized at: {:?}", config_pda); + config_pda + } + + /// Create a new LightProgramTest instance with the given program + pub async fn create_program_test( + program_name: &'static str, + program_id: Pubkey, + ) -> (LightProgramTest, Keypair) { + let mut config = ProgramTestConfig::new_v2(true, Some(vec![(program_name, program_id)])); + config = config.with_light_protocol_events(); + + let rpc = LightProgramTest::new(config).await.unwrap(); + let payer = rpc.get_payer().insecure_clone(); + (rpc, payer) + } +} + +// ============================================================================ +// SPL Tokens Module +// ============================================================================ + +pub mod spl_tokens { + use super::*; + + /// Create an SPL mint with the given decimals + pub async fn create_spl_mint( + rpc: &mut R, + payer: &Keypair, + mint_authority: &Pubkey, + decimals: u8, + ) -> Keypair { + create_mint_internal(rpc, payer, mint_authority, decimals, MintType::Spl).await + } + + /// Create an SPL ATA for the given owner and mint + pub async fn create_spl_ata( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + owner: &Pubkey, + ) -> Pubkey { + create_ata_internal(rpc, payer, mint, owner, MintType::Spl).await + } + + /// Mint SPL tokens to an account + pub async fn mint_spl_tokens( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + destination: &Pubkey, + mint_authority: &Keypair, + amount: u64, + ) { + mint_tokens_internal( + rpc, + payer, + mint, + destination, + mint_authority, + amount, + MintType::Spl, + ) + .await + } +} + +// ============================================================================ +// Token-2022 Module +// ============================================================================ + +pub mod t22_tokens { + use super::*; + + /// Create a Token-2022 mint with the given decimals (no extensions) + pub async fn create_t22_mint( + rpc: &mut R, + payer: &Keypair, + mint_authority: &Pubkey, + decimals: u8, + ) -> Keypair { + create_mint_internal(rpc, payer, mint_authority, decimals, MintType::Token2022).await + } + + /// Create a Token-2022 ATA for the given owner and mint + pub async fn create_t22_ata( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + owner: &Pubkey, + ) -> Pubkey { + create_ata_internal(rpc, payer, mint, owner, MintType::Token2022).await + } + + /// Mint Token-2022 tokens to an account + pub async fn mint_t22_tokens( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + destination: &Pubkey, + mint_authority: &Keypair, + amount: u64, + ) { + mint_tokens_internal( + rpc, + payer, + mint, + destination, + mint_authority, + amount, + MintType::Token2022, + ) + .await + } +} + +// ============================================================================ +// Light Tokens Module +// ============================================================================ + +pub mod light_tokens { + use super::*; + use anchor_lang::{InstructionData, ToAccountMetas}; + use light_token::instruction::{ + derive_associated_token_account, derive_token_ata, find_mint_address, CompressibleParams, + CreateAssociatedTokenAccount, TokenDataVersion, + }; + use solana_instruction::Instruction; + + /// Result of creating a Light mint + pub struct LightMintResult { + /// The mint PDA + pub mint: Pubkey, + /// The mint signer PDA (derived from authority) + pub mint_signer: Pubkey, + /// The bump for the mint signer PDA + pub mint_signer_bump: u8, + /// The authority keypair (used as mint authority) + pub authority: Keypair, + } + + /// Create a Light mint using the light-token-minter program. + /// + /// This creates a new Light Protocol compressed mint with metadata. + /// Returns information about the created mint including the mint PDA, + /// mint signer PDA, and authority keypair. + /// + /// # Arguments + /// * `rpc` - RPC client (must implement Rpc + Indexer) + /// * `payer` - Transaction fee payer + /// * `decimals` - Token decimals + /// * `token_name` - Token name for metadata + /// * `token_symbol` - Token symbol for metadata + /// * `compression_config` - The compression config PDA (from initialize_rent_free_config) + /// + /// # Returns + /// * `LightMintResult` - Contains mint PDA, mint_signer PDA, bump, and authority keypair + pub async fn create_light_mint( + rpc: &mut R, + payer: &Keypair, + decimals: u8, + token_name: &str, + token_symbol: &str, + compression_config: &Pubkey, + ) -> LightMintResult { + let program_id = light_token_minter::ID; + + // Create a new authority keypair for this mint + let authority = Keypair::new(); + + // Derive mint signer PDA from authority + let (mint_signer_pda, mint_signer_bump) = Pubkey::find_program_address( + &[ + light_token_minter::MINT_SIGNER_SEED, + authority.pubkey().as_ref(), + ], + &program_id, + ); + + // Derive mint PDA from mint signer + let (mint_pda, _) = find_mint_address(&mint_signer_pda); + + // Get proof for creating the mint + let proof_result = get_create_accounts_proof( + rpc, + &program_id, + vec![CreateAccountsProofInput::mint(mint_signer_pda)], + ) + .await + .expect("Get create accounts proof should succeed"); + + // Build create_mint instruction + let accounts = light_token_minter::accounts::CreateMint { + fee_payer: payer.pubkey(), + authority: authority.pubkey(), + mint_signer: mint_signer_pda, + cmint: mint_pda, + compression_config: *compression_config, + light_token_compressible_config: COMPRESSIBLE_CONFIG_V1, + rent_sponsor: RENT_SPONSOR, + light_token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + light_token_cpi_authority: CPI_AUTHORITY_PDA, + system_program: solana_sdk::system_program::ID, + }; + + let instruction_data = light_token_minter::instruction::CreateMint { + params: light_token_minter::CreateMintParams { + create_accounts_proof: proof_result.create_accounts_proof, + decimals, + mint_signer_bump, + token_name: token_name.to_string(), + token_symbol: token_symbol.to_string(), + token_uri: format!("https://example.com/{}.json", token_symbol.to_lowercase()), + }, + }; + + let instruction = Instruction { + program_id, + accounts: [ + accounts.to_account_metas(None), + proof_result.remaining_accounts, + ] + .concat(), + data: instruction_data.data(), + }; + + rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[payer, &authority]) + .await + .expect("Create Light mint should succeed"); + + println!("Light mint created: {:?}", mint_pda); + println!(" Mint signer: {:?}", mint_signer_pda); + println!(" Authority: {:?}", authority.pubkey()); + println!(" Decimals: {}", decimals); + + LightMintResult { + mint: mint_pda, + mint_signer: mint_signer_pda, + mint_signer_bump, + authority, + } + } + + /// Mint Light tokens to a Light ATA, creating the ATA if needed. + /// + /// This mints tokens from a Light mint to a destination owner's Light ATA. + /// The ATA is created automatically if it doesn't exist. + /// + /// # Arguments + /// * `rpc` - RPC client (must implement Rpc + Indexer) + /// * `payer` - Transaction fee payer + /// * `mint_authority` - Keypair that is the mint authority + /// * `mint` - The Light mint PDA + /// * `destination_owner` - Owner of the destination ATA + /// * `amount` - Amount of tokens to mint + /// + /// # Returns + /// * `Pubkey` - The destination ATA address + pub async fn mint_light_tokens( + rpc: &mut R, + payer: &Keypair, + mint_authority: &Keypair, + mint: &Pubkey, + destination_owner: &Pubkey, + amount: u64, + ) -> Pubkey { + let program_id = light_token_minter::ID; + + // Derive the ATA address + let (destination_ata, ata_bump) = derive_token_ata(destination_owner, mint); + + // Get proof for creating the ATA (empty vec - ATA creation via macro) + let proof_result = get_create_accounts_proof(rpc, &program_id, vec![]) + .await + .expect("Get create accounts proof should succeed"); + + // Build mint_to instruction + let accounts = light_token_minter::accounts::MintTo { + fee_payer: payer.pubkey(), + mint_authority: mint_authority.pubkey(), + mint: *mint, + recipient: *destination_owner, + destination: destination_ata, + light_token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + system_program: solana_sdk::system_program::ID, + light_token_compressible_config: COMPRESSIBLE_CONFIG_V1, + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + }; + + let instruction_data = light_token_minter::instruction::MintTo { + params: light_token_minter::MintTokenParams { + amount, + create_accounts_proof: proof_result.create_accounts_proof, + ata_bump, + }, + }; + + let instruction = Instruction { + program_id, + accounts: [ + accounts.to_account_metas(None), + proof_result.remaining_accounts, + ] + .concat(), + data: instruction_data.data(), + }; + + // Sign with both payer and mint_authority + let signers: Vec<&Keypair> = if payer.pubkey() == mint_authority.pubkey() { + vec![payer] + } else { + vec![payer, mint_authority] + }; + + rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &signers) + .await + .expect("Mint Light tokens should succeed"); + + println!( + "Minted {} Light tokens to {:?} (owner: {:?})", + amount, destination_ata, destination_owner + ); + + destination_ata + } + + /// Create a Light token account (ATA) for the given owner and mint + /// + /// This creates a compressible Light Protocol token account that can hold + /// compressed tokens. + pub async fn create_light_ata( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + owner: &Pubkey, + ) -> Pubkey { + let compressible_params = CompressibleParams { + compressible_config: COMPRESSIBLE_CONFIG_V1, + rent_sponsor: RENT_SPONSOR, + pre_pay_num_epochs: 2, + lamports_per_write: Some(1000), + compress_to_account_pubkey: None, + token_account_version: TokenDataVersion::ShaFlat, + compression_only: true, + }; + + let create_ata_ix = CreateAssociatedTokenAccount::new(payer.pubkey(), *owner, *mint) + .with_compressible(compressible_params) + .idempotent() + .instruction() + .expect("Create Light ATA instruction should succeed"); + + rpc.create_and_send_transaction(&[create_ata_ix], &payer.pubkey(), &[payer]) + .await + .expect("Create Light ATA should succeed"); + + let (ata, _) = derive_associated_token_account(owner, mint); + println!("Light ATA created: {:?} for owner {:?}", ata, owner); + ata + } + + /// Derive the Light token account address for an owner and mint + pub fn derive_light_ata(owner: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) { + derive_associated_token_account(owner, mint) + } + + /// Derive the Light token ATA address using light_token::derive_token_ata + pub fn derive_light_token_ata(owner: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) { + derive_token_ata(owner, mint) + } +} + +// ============================================================================ +// SPL Interface Module +// ============================================================================ + +pub mod spl_interface { + use super::*; + use light_token::instruction::TransferFromSpl; + + /// Create an SPL interface PDA for the given mint + /// + /// # Arguments + /// * `rpc` - RPC client + /// * `payer` - Transaction fee payer + /// * `mint` - The mint public key + /// * `mint_type` - Whether this is SPL or Token-2022 + /// * `restricted` - Whether the mint has restricted T22 extensions + pub async fn create_spl_interface_pda( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + mint_type: MintType, + restricted: bool, + ) -> SplInterfaceResult { + let (pda, bump) = find_spl_interface_pda(mint, restricted); + + let create_ix = + CreateSplInterfacePda::new(payer.pubkey(), *mint, mint_type.program_id(), restricted) + .instruction(); + + rpc.create_and_send_transaction(&[create_ix], &payer.pubkey(), &[payer]) + .await + .expect("Create SPL interface PDA should succeed"); + + println!( + "SPL interface PDA created: {:?} (restricted={})", + pda, restricted + ); + SplInterfaceResult { pda, bump } + } + + /// Get the SPL interface PDA address without creating it + pub fn get_spl_interface_pda(mint: &Pubkey, restricted: bool) -> SplInterfaceResult { + let (pda, bump) = find_spl_interface_pda(mint, restricted); + SplInterfaceResult { pda, bump } + } + + /// Transfer tokens from an SPL/T22 token account to a Light token account (compress) + /// + /// This transfers SPL tokens from a standard SPL/T22 ATA to a Light Protocol + /// compressed token account, effectively "compressing" the tokens. + /// + /// # Arguments + /// * `rpc` - RPC client + /// * `payer` - Transaction fee payer + /// * `authority` - Authority for the source SPL account (must be signer) + /// * `mint` - The mint public key + /// * `decimals` - Token decimals + /// * `source_spl_ata` - Source SPL/T22 token account + /// * `destination_light_ata` - Destination Light token account + /// * `spl_interface_pda` - SPL interface PDA (created via create_spl_interface_pda) + /// * `spl_interface_bump` - Bump seed for the SPL interface PDA + /// * `amount` - Amount of tokens to transfer + /// * `mint_type` - Whether this is SPL or Token-2022 + pub async fn transfer_spl_to_light( + rpc: &mut R, + payer: &Keypair, + authority: &Keypair, + mint: &Pubkey, + decimals: u8, + source_spl_ata: &Pubkey, + destination_light_ata: &Pubkey, + spl_interface_pda: &Pubkey, + spl_interface_bump: u8, + amount: u64, + mint_type: MintType, + ) { + let transfer_ix = TransferFromSpl { + amount, + spl_interface_pda_bump: spl_interface_bump, + decimals, + source_spl_token_account: *source_spl_ata, + destination: *destination_light_ata, + authority: authority.pubkey(), + mint: *mint, + payer: payer.pubkey(), + spl_interface_pda: *spl_interface_pda, + spl_token_program: mint_type.program_id(), + } + .instruction() + .expect("TransferFromSpl instruction should succeed"); + + // Sign with both payer and authority if they're different + let signers: Vec<&Keypair> = if payer.pubkey() == authority.pubkey() { + vec![payer] + } else { + vec![payer, authority] + }; + + rpc.create_and_send_transaction(&[transfer_ix], &payer.pubkey(), &signers) + .await + .expect("Transfer SPL to Light should succeed"); + + println!( + "Transferred {} tokens from SPL {:?} to Light {:?}", + amount, source_spl_ata, destination_light_ata + ); + } +} + +// ============================================================================ +// Helpers Module +// ============================================================================ + +pub mod helpers { + use super::*; + + /// Verify Light Token account balance + pub async fn verify_light_token_balance( + rpc: &mut R, + account: Pubkey, + expected: u64, + name: &str, + ) { + let account_data = rpc.get_account(account).await.unwrap(); + + if let Some(data) = account_data { + // Light Token accounts have first 165 bytes as SPL-compatible token account data + if data.data.len() >= 165 { + let token_state = + spl_pod::bytemuck::pod_from_bytes::(&data.data[..165]).unwrap(); + let actual = u64::from(token_state.amount); + println!("{}: balance = {} (expected {})", name, actual, expected); + assert_eq!( + actual, expected, + "{} balance mismatch: expected {}, got {}", + name, expected, actual + ); + } else { + panic!( + "{}: account data too short: {} bytes", + name, + data.data.len() + ); + } + } else if expected == 0 { + println!("{}: account not found (expected 0 balance)", name); + } else { + panic!( + "{}: account not found but expected balance {}", + name, expected + ); + } + } + + /// Verify SPL/T22 token account balance + pub async fn verify_spl_token_balance( + rpc: &mut R, + account: Pubkey, + expected: u64, + name: &str, + ) { + let account_data = rpc + .get_account(account) + .await + .unwrap() + .unwrap_or_else(|| panic!("{} should exist", name)); + + let token_state = + spl_pod::bytemuck::pod_from_bytes::(&account_data.data[..165]).unwrap(); + let actual = u64::from(token_state.amount); + println!("{}: balance = {} (expected {})", name, actual, expected); + assert_eq!( + actual, expected, + "{} balance mismatch: expected {}, got {}", + name, expected, actual + ); + } + + /// Get proof for creating Light token accounts (PDAs) + pub async fn get_creation_proof( + rpc: &R, + program_id: &Pubkey, + accounts: Vec, + ) -> CreateAccountsProofResult { + let inputs: Vec = accounts + .into_iter() + .map(CreateAccountsProofInput::pda) + .collect(); + + get_create_accounts_proof(rpc, program_id, inputs) + .await + .expect("Get creation proof should succeed") + } + + /// Airdrop lamports to an account + pub async fn airdrop(rpc: &mut R, pubkey: &Pubkey, lamports: u64) { + rpc.airdrop_lamports(pubkey, lamports) + .await + .expect("Airdrop should succeed"); + } +} + +// ============================================================================ +// Internal Helper Functions +// ============================================================================ + +/// SPL mint account size (fixed at 82 bytes) +const SPL_MINT_SIZE: usize = 82; + +/// Token-2022 mint account size (base size without extensions) +const T22_MINT_SIZE: usize = 82; + +async fn create_mint_internal( + rpc: &mut R, + payer: &Keypair, + mint_authority: &Pubkey, + decimals: u8, + mint_type: MintType, +) -> Keypair { + let mint = Keypair::new(); + let program_id = mint_type.program_id(); + + // Get the mint account size based on token program + let mint_size = match mint_type { + MintType::Spl => SPL_MINT_SIZE, + MintType::Token2022 => T22_MINT_SIZE, + }; + + let rent = rpc + .get_minimum_balance_for_rent_exemption(mint_size) + .await + .unwrap(); + + let create_account_ix = solana_sdk::system_instruction::create_account( + &payer.pubkey(), + &mint.pubkey(), + rent, + mint_size as u64, + &program_id, + ); + + let init_mint_ix = match mint_type { + MintType::Spl => token::spl_token::instruction::initialize_mint( + &program_id, + &mint.pubkey(), + mint_authority, + None, + decimals, + ) + .unwrap(), + MintType::Token2022 => spl_token_2022::instruction::initialize_mint( + &program_id, + &mint.pubkey(), + mint_authority, + None, + decimals, + ) + .unwrap(), + }; + + rpc.create_and_send_transaction( + &[create_account_ix, init_mint_ix], + &payer.pubkey(), + &[payer, &mint], + ) + .await + .expect("Create mint should succeed"); + + println!("{:?} mint created: {:?}", mint_type, mint.pubkey()); + mint +} + +async fn create_ata_internal( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + owner: &Pubkey, + mint_type: MintType, +) -> Pubkey { + let program_id = mint_type.program_id(); + + let ata = anchor_spl::associated_token::spl_associated_token_account::get_associated_token_address_with_program_id( + owner, + mint, + &program_id, + ); + + let create_ata_ix = + anchor_spl::associated_token::spl_associated_token_account::instruction::create_associated_token_account( + &payer.pubkey(), + owner, + mint, + &program_id, + ); + + rpc.create_and_send_transaction(&[create_ata_ix], &payer.pubkey(), &[payer]) + .await + .expect("Create ATA should succeed"); + + println!( + "{:?} ATA created: {:?} for owner {:?}", + mint_type, ata, owner + ); + ata +} + +async fn mint_tokens_internal( + rpc: &mut R, + payer: &Keypair, + mint: &Pubkey, + destination: &Pubkey, + mint_authority: &Keypair, + amount: u64, + mint_type: MintType, +) { + let program_id = mint_type.program_id(); + + let mint_to_ix = match mint_type { + MintType::Spl => token::spl_token::instruction::mint_to( + &program_id, + mint, + destination, + &mint_authority.pubkey(), + &[], + amount, + ) + .unwrap(), + MintType::Token2022 => spl_token_2022::instruction::mint_to( + &program_id, + mint, + destination, + &mint_authority.pubkey(), + &[], + amount, + ) + .unwrap(), + }; + + // If payer is the same as mint_authority, only sign once + let signers: Vec<&Keypair> = if payer.pubkey() == mint_authority.pubkey() { + vec![payer] + } else { + vec![payer, mint_authority] + }; + + rpc.create_and_send_transaction(&[mint_to_ix], &payer.pubkey(), &signers) + .await + .expect("Mint tokens should succeed"); + + println!("Minted {} tokens to {:?}", amount, destination); +} + +/// Common test constants +pub mod constants { + /// Default decimals for test tokens + pub const DEFAULT_DECIMALS: u8 = 9; + + /// Default token amount (1000 tokens with 9 decimals) + pub const DEFAULT_TOKEN_AMOUNT: u64 = 1_000_000_000_000; + + /// Default airdrop amount (10 SOL) + pub const DEFAULT_AIRDROP: u64 = 10_000_000_000; +} diff --git a/anchor/programs/token-swap/Cargo.toml b/anchor/programs/token-swap/Cargo.toml new file mode 100644 index 0000000..d0c5e8a --- /dev/null +++ b/anchor/programs/token-swap/Cargo.toml @@ -0,0 +1,55 @@ +[package] +name = "swap_example" +version = "0.1.0" +description = "Created with Anchor" +edition = "2021" + +[lib] +crate-type = ["cdylib", "lib"] +name = "swap_example" + +[features] +default = [] +cpi = ["no-entrypoint"] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build", "light-sdk/idl-build", "light-anchor-spl/idl-build"] +test-sbf = [] + +[dependencies] +anchor-lang = { version = "=0.31.1", features = ["init-if-needed"] } +anchor-spl = { version = "0.31.1", features = ["metadata", "idl-build"] } +blake3 = { workspace = true } +fixed = "=1.27.0" +az = "=1.2.1" + +light-sdk = { workspace = true, features = ["anchor", "anchor-discriminator", "cpi-context", "v2"] } +light-token = { workspace = true, features = ["anchor"] } +light-hasher = { workspace = true, features = ["solana"] } +light-anchor-spl = { workspace = true } +solana-program = "2.2" +solana-pubkey = "2.2" +solana-account-info = "2.3" +solana-program-error = "2.2" +solana-msg = "2.2" + +[dev-dependencies] +light-program-test = { workspace = true } +light-client = { workspace = true, features = ["v2", "anchor"] } +anchor-spl = "0.31.1" +tokio = { version = "1", features = ["full"] } +solana-keypair = { version = "2.2" } +solana-signer = { version = "2.2" } +solana-instruction = { version = "2.2" } +solana-sdk = { version = "2.3" } +spl-token-2022 = "6.0.0" +spl-pod = "0.4.0" +shared-test-utils = { workspace = true } + +[lints.rust.unexpected_cfgs] +level = "allow" +check-cfg = [ + 'cfg(target_os, values("solana"))', + 'cfg(feature, values("frozen-abi", "no-entrypoint"))', +] diff --git a/anchor/programs/token-swap/Xargo.toml b/anchor/programs/token-swap/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/anchor/programs/token-swap/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/anchor/programs/token-swap/src/constants.rs b/anchor/programs/token-swap/src/constants.rs new file mode 100644 index 0000000..25d30e5 --- /dev/null +++ b/anchor/programs/token-swap/src/constants.rs @@ -0,0 +1,16 @@ +use anchor_lang::prelude::*; + +#[constant] +pub const MINIMUM_LIQUIDITY: u64 = 100; + +#[constant] +pub const AUTHORITY_SEED: &[u8] = b"authority"; + +#[constant] +pub const LIQUIDITY_SEED: &[u8] = b"liquidity"; + +#[constant] +pub const POOL_ACCOUNT_A_SEED: &[u8] = b"pool_a"; + +#[constant] +pub const POOL_ACCOUNT_B_SEED: &[u8] = b"pool_b"; diff --git a/anchor/programs/token-swap/src/errors.rs b/anchor/programs/token-swap/src/errors.rs new file mode 100644 index 0000000..39b5457 --- /dev/null +++ b/anchor/programs/token-swap/src/errors.rs @@ -0,0 +1,19 @@ +use anchor_lang::prelude::*; + +#[error_code] +pub enum TutorialError { + #[msg("Invalid fee value")] + InvalidFee, + + #[msg("Invalid mint for the pool")] + InvalidMint, + + #[msg("Depositing too little liquidity")] + DepositTooSmall, + + #[msg("Output is below the minimum expected")] + OutputTooSmall, + + #[msg("Invariant does not hold")] + InvariantViolated, +} diff --git a/anchor/programs/token-swap/src/instructions/create_amm.rs b/anchor/programs/token-swap/src/instructions/create_amm.rs new file mode 100644 index 0000000..94f89b0 --- /dev/null +++ b/anchor/programs/token-swap/src/instructions/create_amm.rs @@ -0,0 +1,39 @@ +use anchor_lang::prelude::*; + +use crate::{errors::*, state::Amm}; + +pub fn create_amm(ctx: Context, id: Pubkey, fee: u16) -> Result<()> { + let amm = &mut ctx.accounts.amm; + amm.id = id; + amm.admin = ctx.accounts.admin.key(); + amm.fee = fee; + + Ok(()) +} + +#[derive(Accounts)] +#[instruction(id: Pubkey, fee: u16)] +pub struct CreateAmm<'info> { + #[account( + init, + payer = payer, + space = Amm::LEN, + seeds = [ + id.as_ref() + ], + bump, + constraint = fee < 10000 @ TutorialError::InvalidFee, + )] + pub amm: Account<'info, Amm>, + + /// The admin of the AMM + /// CHECK: Read only, delegatable creation + pub admin: AccountInfo<'info>, + + /// The account paying for all rents + #[account(mut)] + pub payer: Signer<'info>, + + /// Solana ecosystem accounts + pub system_program: Program<'info, System>, +} diff --git a/anchor/programs/token-swap/src/instructions/create_pool.rs b/anchor/programs/token-swap/src/instructions/create_pool.rs new file mode 100644 index 0000000..ef289fb --- /dev/null +++ b/anchor/programs/token-swap/src/instructions/create_pool.rs @@ -0,0 +1,137 @@ +use anchor_lang::prelude::*; +use light_anchor_spl::token_interface::{Mint, TokenInterface}; +use light_sdk::interface::CreateAccountsProof; +use light_token::anchor::LightAccounts; +use light_token::instruction::{COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR}; + +use crate::{ + constants::{AUTHORITY_SEED, LIQUIDITY_SEED, POOL_ACCOUNT_A_SEED, POOL_ACCOUNT_B_SEED}, + state::{Amm, Pool}, +}; + +#[derive(AnchorSerialize, AnchorDeserialize, Clone)] +pub struct CreatePoolParams { + pub create_accounts_proof: CreateAccountsProof, + pub pool_account_a_bump: u8, + pub pool_account_b_bump: u8, +} + +pub fn create_pool(ctx: Context, _params: CreatePoolParams) -> Result<()> { + let pool = &mut ctx.accounts.pool; + pool.amm = ctx.accounts.amm.key(); + pool.mint_a = ctx.accounts.mint_a.key(); + pool.mint_b = ctx.accounts.mint_b.key(); + + Ok(()) +} + +#[derive(Accounts, LightAccounts)] +#[instruction(params: CreatePoolParams)] +pub struct CreatePool<'info> { + #[account( + seeds = [ + amm.id.as_ref() + ], + bump, + )] + pub amm: Box>, + + #[account( + init, + payer = fee_payer, + space = Pool::LEN, + seeds = [ + amm.key().as_ref(), + mint_a.key().as_ref(), + mint_b.key().as_ref(), + ], + bump, + )] + pub pool: Box>, + + /// CHECK: Read only authority + #[account( + seeds = [ + amm.key().as_ref(), + mint_a.key().as_ref(), + mint_b.key().as_ref(), + AUTHORITY_SEED, + ], + bump, + )] + pub pool_authority: AccountInfo<'info>, + + /// Liquidity mint - always SPL or T22 (not Light) since Anchor can't init Light mints + #[account( + init, + payer = fee_payer, + seeds = [ + amm.key().as_ref(), + mint_a.key().as_ref(), + mint_b.key().as_ref(), + LIQUIDITY_SEED, + ], + bump, + mint::decimals = 6, + mint::authority = pool_authority, + mint::token_program = liquidity_token_program, + )] + pub mint_liquidity: Box>, + + #[account(mint::token_program = token_program)] + pub mint_a: Box>, + + #[account(mint::token_program = token_program)] + pub mint_b: Box>, + + /// Pool token account A - created by light_account macro + #[account( + mut, + seeds = [POOL_ACCOUNT_A_SEED, pool.key().as_ref()], + bump, + )] + #[light_account(init, + token::authority = [POOL_ACCOUNT_A_SEED, self.pool.key()], + token::mint = mint_a, + token::owner = pool_authority, + token::bump = params.pool_account_a_bump + )] + pub pool_account_a: UncheckedAccount<'info>, + + /// Pool token account B - created by light_account macro + #[account( + mut, + seeds = [POOL_ACCOUNT_B_SEED, pool.key().as_ref()], + bump, + )] + #[light_account(init, + token::authority = [POOL_ACCOUNT_B_SEED, self.pool.key()], + token::mint = mint_b, + token::owner = pool_authority, + token::bump = params.pool_account_b_bump + )] + pub pool_account_b: UncheckedAccount<'info>, + + /// The account paying for all rents (also fee payer for Light Protocol) + #[account(mut)] + pub fee_payer: Signer<'info>, + + /// Token program for mint_a and mint_b (SPL, T22, or Light) + pub token_program: Interface<'info, TokenInterface>, + /// Token program for liquidity mint (must be SPL or T22, not Light - Anchor can't init Light mints) + pub liquidity_token_program: Interface<'info, TokenInterface>, + /// Light token program for CPI calls + pub light_token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// Light token compressible config account + #[account(address = COMPRESSIBLE_CONFIG_V1)] + pub light_token_compressible_config: AccountInfo<'info>, + + /// Light token rent sponsor account + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: light-token CPI authority + pub light_token_cpi_authority: AccountInfo<'info>, +} diff --git a/anchor/programs/token-swap/src/instructions/deposit_liquidity.rs b/anchor/programs/token-swap/src/instructions/deposit_liquidity.rs new file mode 100644 index 0000000..c2a384e --- /dev/null +++ b/anchor/programs/token-swap/src/instructions/deposit_liquidity.rs @@ -0,0 +1,283 @@ +use anchor_lang::prelude::*; +use fixed::types::I64F64; +use light_anchor_spl::token_interface::{Mint, MintTo, TokenAccount, TokenInterface}; +use light_token::instruction::RENT_SPONSOR; +use light_token::spl_interface::find_spl_interface_pda; +use light_token::utils::get_token_account_balance; + +use crate::{ + constants::{ + AUTHORITY_SEED, LIQUIDITY_SEED, MINIMUM_LIQUIDITY, POOL_ACCOUNT_A_SEED, POOL_ACCOUNT_B_SEED, + }, + errors::TutorialError, + instructions::{transfer_tokens, SplInterfaceConfig}, + state::Pool, +}; + +pub fn deposit_liquidity( + ctx: Context, + amount_a: u64, + amount_b: u64, +) -> Result<()> { + // Get pool balances using Light Protocol's get_token_account_balance + let pool_a_balance = get_token_account_balance(&ctx.accounts.pool_account_a.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + let pool_b_balance = get_token_account_balance(&ctx.accounts.pool_account_b.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + + // Prevent depositing assets the depositor does not own + let mut amount_a = if amount_a > ctx.accounts.depositor_account_a.amount { + ctx.accounts.depositor_account_a.amount + } else { + amount_a + }; + let mut amount_b = if amount_b > ctx.accounts.depositor_account_b.amount { + ctx.accounts.depositor_account_b.amount + } else { + amount_b + }; + + // Making sure they are provided in the same proportion as existing liquidity + // Defining pool creation like this allows attackers to frontrun pool creation with bad ratios + let pool_creation = pool_a_balance == 0 && pool_b_balance == 0; + (amount_a, amount_b) = if pool_creation { + // Add as is if there is no liquidity + (amount_a, amount_b) + } else { + let ratio = I64F64::from_num(pool_a_balance) + .checked_mul(I64F64::from_num(pool_b_balance)) + .unwrap(); + if pool_a_balance > pool_b_balance { + ( + I64F64::from_num(amount_b) + .checked_mul(ratio) + .unwrap() + .to_num::(), + amount_b, + ) + } else { + ( + amount_a, + I64F64::from_num(amount_a) + .checked_div(ratio) + .unwrap() + .to_num::(), + ) + } + }; + + // Computing the amount of liquidity about to be deposited + let mut liquidity = I64F64::from_num(amount_a) + .checked_mul(I64F64::from_num(amount_b)) + .unwrap() + .sqrt() + .to_num::(); + + // Lock some minimum liquidity on the first deposit + if pool_creation { + if liquidity < MINIMUM_LIQUIDITY { + return err!(TutorialError::DepositTooSmall); + } + + liquidity -= MINIMUM_LIQUIDITY; + } + + // Transfer tokens to the pool using Light Protocol + let decimals_a = ctx.accounts.mint_a.decimals; + let decimals_b = ctx.accounts.mint_b.decimals; + + // Get SPL interface PDA bumps (derived from light-token program, not our program) + let (_, spl_interface_bump_a) = find_spl_interface_pda(&ctx.accounts.mint_a.key(), false); + let (_, spl_interface_bump_b) = find_spl_interface_pda(&ctx.accounts.mint_b.key(), false); + + // SPL interface config for SPL->Light transfers + let spl_interface_a = SplInterfaceConfig { + mint: ctx.accounts.mint_a.to_account_info(), + spl_token_program: ctx.accounts.token_program.to_account_info(), + spl_interface_pda: ctx.accounts.spl_interface_pda_a.to_account_info(), + spl_interface_pda_bump: spl_interface_bump_a, + }; + + transfer_tokens( + amount_a, + decimals_a, + ctx.accounts.depositor_account_a.to_account_info(), + ctx.accounts.pool_account_a.to_account_info(), + ctx.accounts.mint_a.to_account_info(), + ctx.accounts.depositor.to_account_info(), + ctx.accounts.payer.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + None, + Some(spl_interface_a), + )?; + + let spl_interface_b = SplInterfaceConfig { + mint: ctx.accounts.mint_b.to_account_info(), + spl_token_program: ctx.accounts.token_program.to_account_info(), + spl_interface_pda: ctx.accounts.spl_interface_pda_b.to_account_info(), + spl_interface_pda_bump: spl_interface_bump_b, + }; + + transfer_tokens( + amount_b, + decimals_b, + ctx.accounts.depositor_account_b.to_account_info(), + ctx.accounts.pool_account_b.to_account_info(), + ctx.accounts.mint_b.to_account_info(), + ctx.accounts.depositor.to_account_info(), + ctx.accounts.payer.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + None, + Some(spl_interface_b), + )?; + + // Mint the liquidity to user (SPL or T22 token mint - never Light) + let authority_bump = ctx.bumps.pool_authority; + let authority_seeds = &[ + &ctx.accounts.pool.amm.to_bytes(), + &ctx.accounts.mint_a.key().to_bytes(), + &ctx.accounts.mint_b.key().to_bytes(), + AUTHORITY_SEED, + &[authority_bump], + ]; + let signer_seeds = &[&authority_seeds[..]]; + light_anchor_spl::token_interface::mint_to( + CpiContext::new_with_signer( + ctx.accounts.liquidity_token_program.to_account_info(), + MintTo { + mint: ctx.accounts.mint_liquidity.to_account_info(), + to: ctx.accounts.depositor_account_liquidity.to_account_info(), + authority: ctx.accounts.pool_authority.to_account_info(), + }, + signer_seeds, + ), + liquidity, + )?; + + Ok(()) +} + +#[derive(Accounts)] +pub struct DepositLiquidity<'info> { + #[account( + seeds = [ + pool.amm.as_ref(), + pool.mint_a.key().as_ref(), + pool.mint_b.key().as_ref(), + ], + bump, + has_one = mint_a, + has_one = mint_b, + )] + pub pool: Box>, + + /// CHECK: Read only authority + #[account( + seeds = [ + pool.amm.as_ref(), + mint_a.key().as_ref(), + mint_b.key().as_ref(), + AUTHORITY_SEED, + ], + bump, + )] + pub pool_authority: AccountInfo<'info>, + + /// The account paying for all rents + /// Must be writable for compressible token rent top-ups + #[account(mut)] + pub depositor: Signer<'info>, + + /// Liquidity mint - always SPL or T22 (not Light) + #[account( + mut, + seeds = [ + pool.amm.as_ref(), + mint_a.key().as_ref(), + mint_b.key().as_ref(), + LIQUIDITY_SEED, + ], + bump, + mint::token_program = liquidity_token_program, + )] + pub mint_liquidity: Box>, + + #[account(mint::token_program = token_program)] + pub mint_a: Box>, + + #[account(mint::token_program = token_program)] + pub mint_b: Box>, + + /// CHECK: Pool token account A (Light Protocol token account) + #[account( + mut, + seeds = [POOL_ACCOUNT_A_SEED, pool.key().as_ref()], + bump, + )] + pub pool_account_a: UncheckedAccount<'info>, + + /// CHECK: Pool token account B (Light Protocol token account) + #[account( + mut, + seeds = [POOL_ACCOUNT_B_SEED, pool.key().as_ref()], + bump, + )] + pub pool_account_b: UncheckedAccount<'info>, + + /// Depositor's liquidity token account (can be SPL, T22, or Light) + #[account( + mut, + token::mint = mint_liquidity, + token::authority = depositor, + )] + pub depositor_account_liquidity: Box>, + + /// Depositor's token account for mint A (can be SPL, T22, or Light) + #[account( + mut, + token::mint = mint_a, + token::authority = depositor, + )] + pub depositor_account_a: Box>, + + /// Depositor's token account for mint B (can be SPL, T22, or Light) + #[account( + mut, + token::mint = mint_b, + token::authority = depositor, + )] + pub depositor_account_b: Box>, + + /// The account paying for all rents + #[account(mut)] + pub payer: Signer<'info>, + + /// Token program for mint_a and mint_b (SPL, T22, or Light) + pub token_program: Interface<'info, TokenInterface>, + /// Token program for liquidity mint (must be SPL or T22, not Light) + pub liquidity_token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// Light token program for CPI calls + pub light_token_program: Interface<'info, TokenInterface>, + + /// CHECK: Light token rent sponsor + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: light-token CPI authority - must be writable for Light token CPI + #[account(mut)] + pub light_token_cpi_authority: AccountInfo<'info>, + + /// CHECK: SPL interface PDA for mint A (token pool holding SPL tokens) + /// Derived by light-token program: ["pool", mint_a] + #[account(mut)] + pub spl_interface_pda_a: UncheckedAccount<'info>, + + /// CHECK: SPL interface PDA for mint B (token pool holding SPL tokens) + /// Derived by light-token program: ["pool", mint_b] + #[account(mut)] + pub spl_interface_pda_b: UncheckedAccount<'info>, +} diff --git a/anchor/programs/token-swap/src/instructions/mod.rs b/anchor/programs/token-swap/src/instructions/mod.rs new file mode 100644 index 0000000..5b78b82 --- /dev/null +++ b/anchor/programs/token-swap/src/instructions/mod.rs @@ -0,0 +1,13 @@ +mod create_amm; +mod create_pool; +mod deposit_liquidity; +mod shared; +mod swap_exact_tokens_for_tokens; +mod withdraw_liquidity; + +pub use create_amm::*; +pub use create_pool::*; +pub use deposit_liquidity::*; +pub use shared::*; +pub use swap_exact_tokens_for_tokens::*; +pub use withdraw_liquidity::*; diff --git a/anchor/programs/token-swap/src/instructions/shared.rs b/anchor/programs/token-swap/src/instructions/shared.rs new file mode 100644 index 0000000..8af426f --- /dev/null +++ b/anchor/programs/token-swap/src/instructions/shared.rs @@ -0,0 +1,90 @@ +use anchor_lang::prelude::*; +use light_sdk::constants::LIGHT_TOKEN_PROGRAM_ID; +use light_token::instruction::{TransferCheckedCpi, TransferInterfaceCpi}; + +/// Configuration for SPL interface (required for SPL<->Light transfers) +pub struct SplInterfaceConfig<'info> { + pub mint: AccountInfo<'info>, + pub spl_token_program: AccountInfo<'info>, + pub spl_interface_pda: AccountInfo<'info>, + pub spl_interface_pda_bump: u8, +} + +/// Check if an account is a Light token account (owned by Light token program) +fn is_light_account(account: &AccountInfo) -> bool { + account.owner == &Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID) +} + +/// Transfer tokens between token accounts. +/// For Light-to-Light transfers, uses TransferCheckedCpi with mint validation. +/// For SPL<->Light transfers, uses TransferInterfaceCpi with spl_interface config. +pub fn transfer_tokens<'info>( + amount: u64, + decimals: u8, + from: AccountInfo<'info>, + to: AccountInfo<'info>, + mint: AccountInfo<'info>, + authority: AccountInfo<'info>, + payer: AccountInfo<'info>, + light_token_cpi_authority: AccountInfo<'info>, + system_program: AccountInfo<'info>, + signer_seeds: Option<&[&[u8]]>, + spl_interface: Option>, +) -> Result<()> { + // Check if this is a Light-to-Light transfer + let is_light_to_light = is_light_account(&from) && is_light_account(&to); + + if is_light_to_light { + // Use TransferCheckedCpi for Light-to-Light transfers + // fee_payer: Some ensures authority is readonly (required for PDA with account data) + let cpi = TransferCheckedCpi { + source: from, + mint, + destination: to, + amount, + decimals, + authority, + system_program, + max_top_up: Some(0), // Allow top-ups but with 0 limit + fee_payer: Some(payer), // Payer handles any rent, makes authority readonly + }; + + if let Some(seeds) = signer_seeds { + cpi.invoke_signed(&[seeds]) + } else { + cpi.invoke() + } + .map_err(|e| anchor_lang::prelude::ProgramError::from(e).into()) + } else { + // Use TransferInterfaceCpi for SPL<->Light transfers + let mut cpi = TransferInterfaceCpi::new( + amount, + decimals, + from, + to, + authority, + payer, + light_token_cpi_authority, + system_program, + ); + + // Add SPL interface for SPL<->Light transfers + if let Some(spl) = spl_interface { + cpi = cpi + .with_spl_interface( + Some(spl.mint), + Some(spl.spl_token_program), + Some(spl.spl_interface_pda), + Some(spl.spl_interface_pda_bump), + ) + .map_err(|e| anchor_lang::prelude::ProgramError::from(e))?; + } + + if let Some(seeds) = signer_seeds { + cpi.invoke_signed(&[seeds]) + } else { + cpi.invoke() + } + .map_err(|e| anchor_lang::prelude::ProgramError::from(e).into()) + } +} diff --git a/anchor/programs/token-swap/src/instructions/swap_exact_tokens_for_tokens.rs b/anchor/programs/token-swap/src/instructions/swap_exact_tokens_for_tokens.rs new file mode 100644 index 0000000..8fa9e27 --- /dev/null +++ b/anchor/programs/token-swap/src/instructions/swap_exact_tokens_for_tokens.rs @@ -0,0 +1,303 @@ +use anchor_lang::prelude::*; +use fixed::types::I64F64; +use light_anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; +use light_token::instruction::RENT_SPONSOR; +use light_token::spl_interface::find_spl_interface_pda; +use light_token::utils::get_token_account_balance; + +use crate::{ + constants::{AUTHORITY_SEED, POOL_ACCOUNT_A_SEED, POOL_ACCOUNT_B_SEED}, + errors::*, + instructions::{transfer_tokens, SplInterfaceConfig}, + state::{Amm, Pool}, +}; + +pub fn swap_exact_tokens_for_tokens( + ctx: Context, + swap_a: bool, + input_amount: u64, + min_output_amount: u64, +) -> Result<()> { + // Prevent depositing assets the depositor does not own + let input = if swap_a && input_amount > ctx.accounts.trader_account_a.amount { + ctx.accounts.trader_account_a.amount + } else if !swap_a && input_amount > ctx.accounts.trader_account_b.amount { + ctx.accounts.trader_account_b.amount + } else { + input_amount + }; + + // Get pool balances using Light Protocol's get_token_account_balance + let pool_a_balance = get_token_account_balance(&ctx.accounts.pool_account_a.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + let pool_b_balance = get_token_account_balance(&ctx.accounts.pool_account_b.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + + // Apply trading fee, used to compute the output + let amm = &ctx.accounts.amm; + let taxed_input = input - input * amm.fee as u64 / 10000; + + let output = if swap_a { + I64F64::from_num(taxed_input) + .checked_mul(I64F64::from_num(pool_b_balance)) + .unwrap() + .checked_div( + I64F64::from_num(pool_a_balance) + .checked_add(I64F64::from_num(taxed_input)) + .unwrap(), + ) + .unwrap() + } else { + I64F64::from_num(taxed_input) + .checked_mul(I64F64::from_num(pool_a_balance)) + .unwrap() + .checked_div( + I64F64::from_num(pool_b_balance) + .checked_add(I64F64::from_num(taxed_input)) + .unwrap(), + ) + .unwrap() + } + .to_num::(); + + if output < min_output_amount { + return err!(TutorialError::OutputTooSmall); + } + + // Compute the invariant before the trade + let invariant = pool_a_balance * pool_b_balance; + + // Transfer tokens to the pool + let authority_bump = ctx.bumps.pool_authority; + let mint_a_key = ctx.accounts.mint_a.key(); + let mint_b_key = ctx.accounts.mint_b.key(); + let authority_seeds: &[&[u8]] = &[ + ctx.accounts.pool.amm.as_ref(), + mint_a_key.as_ref(), + mint_b_key.as_ref(), + AUTHORITY_SEED, + &[authority_bump], + ]; + + let decimals_a = ctx.accounts.mint_a.decimals; + let decimals_b = ctx.accounts.mint_b.decimals; + + // Get SPL interface PDA bumps (derived from light-token program) + let (_, spl_interface_bump_a) = find_spl_interface_pda(&ctx.accounts.mint_a.key(), false); + let (_, spl_interface_bump_b) = find_spl_interface_pda(&ctx.accounts.mint_b.key(), false); + + if swap_a { + // Transfer token A from trader (SPL) to pool (Light) - needs SPL interface + let spl_interface_a = SplInterfaceConfig { + mint: ctx.accounts.mint_a.to_account_info(), + spl_token_program: ctx.accounts.token_program.to_account_info(), + spl_interface_pda: ctx.accounts.spl_interface_pda_a.to_account_info(), + spl_interface_pda_bump: spl_interface_bump_a, + }; + transfer_tokens( + input, + decimals_a, + ctx.accounts.trader_account_a.to_account_info(), + ctx.accounts.pool_account_a.to_account_info(), + ctx.accounts.mint_a.to_account_info(), + ctx.accounts.trader.to_account_info(), + ctx.accounts.payer.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + None, + Some(spl_interface_a), + )?; + // Transfer token B from pool (Light) to trader (SPL) - needs SPL interface + let spl_interface_b = SplInterfaceConfig { + mint: ctx.accounts.mint_b.to_account_info(), + spl_token_program: ctx.accounts.token_program.to_account_info(), + spl_interface_pda: ctx.accounts.spl_interface_pda_b.to_account_info(), + spl_interface_pda_bump: spl_interface_bump_b, + }; + transfer_tokens( + output, + decimals_b, + ctx.accounts.pool_account_b.to_account_info(), + ctx.accounts.trader_account_b.to_account_info(), + ctx.accounts.mint_b.to_account_info(), + ctx.accounts.pool_authority.to_account_info(), + ctx.accounts.payer.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + Some(authority_seeds), + Some(spl_interface_b), + )?; + } else { + // Transfer token B from trader (SPL) to pool (Light) - needs SPL interface + let spl_interface_b = SplInterfaceConfig { + mint: ctx.accounts.mint_b.to_account_info(), + spl_token_program: ctx.accounts.token_program.to_account_info(), + spl_interface_pda: ctx.accounts.spl_interface_pda_b.to_account_info(), + spl_interface_pda_bump: spl_interface_bump_b, + }; + transfer_tokens( + input, + decimals_b, + ctx.accounts.trader_account_b.to_account_info(), + ctx.accounts.pool_account_b.to_account_info(), + ctx.accounts.mint_b.to_account_info(), + ctx.accounts.trader.to_account_info(), + ctx.accounts.payer.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + None, + Some(spl_interface_b), + )?; + // Transfer token A from pool (Light) to trader (SPL) - needs SPL interface + let spl_interface_a = SplInterfaceConfig { + mint: ctx.accounts.mint_a.to_account_info(), + spl_token_program: ctx.accounts.token_program.to_account_info(), + spl_interface_pda: ctx.accounts.spl_interface_pda_a.to_account_info(), + spl_interface_pda_bump: spl_interface_bump_a, + }; + transfer_tokens( + output, + decimals_a, + ctx.accounts.pool_account_a.to_account_info(), + ctx.accounts.trader_account_a.to_account_info(), + ctx.accounts.mint_a.to_account_info(), + ctx.accounts.pool_authority.to_account_info(), + ctx.accounts.payer.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + Some(authority_seeds), + Some(spl_interface_a), + )?; + } + + msg!( + "Traded {} tokens ({} after fees) for {}", + input, + taxed_input, + output + ); + + // Verify the invariant still holds + // Reload accounts because of the CPIs + // We tolerate if the new invariant is higher because it means a rounding error for LPs + let new_pool_a_balance = + get_token_account_balance(&ctx.accounts.pool_account_a.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + let new_pool_b_balance = + get_token_account_balance(&ctx.accounts.pool_account_b.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + + if invariant > new_pool_a_balance * new_pool_b_balance { + return err!(TutorialError::InvariantViolated); + } + + Ok(()) +} + +#[derive(Accounts)] +pub struct SwapExactTokensForTokens<'info> { + #[account( + seeds = [ + amm.id.as_ref() + ], + bump, + )] + pub amm: Account<'info, Amm>, + + #[account( + seeds = [ + pool.amm.as_ref(), + pool.mint_a.key().as_ref(), + pool.mint_b.key().as_ref(), + ], + bump, + has_one = amm, + has_one = mint_a, + has_one = mint_b, + )] + pub pool: Account<'info, Pool>, + + /// CHECK: Pool authority PDA - signer for pool token transfers (readonly) + #[account( + seeds = [ + pool.amm.as_ref(), + mint_a.key().as_ref(), + mint_b.key().as_ref(), + AUTHORITY_SEED, + ], + bump, + )] + pub pool_authority: AccountInfo<'info>, + + /// The account doing the swap + /// Must be writable for compressible token rent top-ups + #[account(mut)] + pub trader: Signer<'info>, + + #[account(mint::token_program = token_program)] + pub mint_a: Box>, + + #[account(mint::token_program = token_program)] + pub mint_b: Box>, + + /// CHECK: Pool token account A (Light Protocol token account) + #[account( + mut, + seeds = [POOL_ACCOUNT_A_SEED, pool.key().as_ref()], + bump, + )] + pub pool_account_a: UncheckedAccount<'info>, + + /// CHECK: Pool token account B (Light Protocol token account) + #[account( + mut, + seeds = [POOL_ACCOUNT_B_SEED, pool.key().as_ref()], + bump, + )] + pub pool_account_b: UncheckedAccount<'info>, + + /// Trader's token account for mint A (can be SPL, T22, or Light) + #[account( + mut, + token::mint = mint_a, + token::authority = trader, + )] + pub trader_account_a: Box>, + + /// Trader's token account for mint B (can be SPL, T22, or Light) + #[account( + mut, + token::mint = mint_b, + token::authority = trader, + )] + pub trader_account_b: Box>, + + /// The account paying for all rents + #[account(mut)] + pub payer: Signer<'info>, + + /// Token program (SPL, T22, or Light) + pub token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// Light token program for CPI calls + pub light_token_program: Interface<'info, TokenInterface>, + + /// CHECK: Light token rent sponsor + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: light-token CPI authority - must be writable for Light token CPI + #[account(mut)] + pub light_token_cpi_authority: AccountInfo<'info>, + + /// CHECK: SPL interface PDA for mint A (token pool holding SPL tokens) + /// Derived by light-token program: ["pool", mint_a] + #[account(mut)] + pub spl_interface_pda_a: UncheckedAccount<'info>, + + /// CHECK: SPL interface PDA for mint B (token pool holding SPL tokens) + /// Derived by light-token program: ["pool", mint_b] + #[account(mut)] + pub spl_interface_pda_b: UncheckedAccount<'info>, +} diff --git a/anchor/programs/token-swap/src/instructions/withdraw_liquidity.rs b/anchor/programs/token-swap/src/instructions/withdraw_liquidity.rs new file mode 100644 index 0000000..0395dc4 --- /dev/null +++ b/anchor/programs/token-swap/src/instructions/withdraw_liquidity.rs @@ -0,0 +1,245 @@ +use anchor_lang::prelude::*; +use fixed::types::I64F64; +use light_anchor_spl::token_interface::{self, Burn, Mint, TokenAccount, TokenInterface}; +use light_token::instruction::RENT_SPONSOR; +use light_token::spl_interface::find_spl_interface_pda; +use light_token::utils::get_token_account_balance; + +use crate::{ + constants::{ + AUTHORITY_SEED, LIQUIDITY_SEED, MINIMUM_LIQUIDITY, POOL_ACCOUNT_A_SEED, POOL_ACCOUNT_B_SEED, + }, + instructions::{transfer_tokens, SplInterfaceConfig}, + state::{Amm, Pool}, +}; + +pub fn withdraw_liquidity(ctx: Context, amount: u64) -> Result<()> { + let authority_bump = ctx.bumps.pool_authority; + let mint_a_key = ctx.accounts.mint_a.key(); + let mint_b_key = ctx.accounts.mint_b.key(); + let authority_seeds: &[&[u8]] = &[ + ctx.accounts.pool.amm.as_ref(), + mint_a_key.as_ref(), + mint_b_key.as_ref(), + AUTHORITY_SEED, + &[authority_bump], + ]; + + // Get pool balances using Light Protocol's get_token_account_balance + let pool_a_balance = get_token_account_balance(&ctx.accounts.pool_account_a.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + let pool_b_balance = get_token_account_balance(&ctx.accounts.pool_account_b.to_account_info()) + .map_err(|_| anchor_lang::prelude::ProgramError::InvalidAccountData)?; + + // Transfer tokens from the pool + let amount_a = I64F64::from_num(amount) + .checked_mul(I64F64::from_num(pool_a_balance)) + .unwrap() + .checked_div(I64F64::from_num( + ctx.accounts.mint_liquidity.supply + MINIMUM_LIQUIDITY, + )) + .unwrap() + .floor() + .to_num::(); + + // Get SPL interface PDA bumps (derived from light-token program) + let (_, spl_interface_bump_a) = find_spl_interface_pda(&ctx.accounts.mint_a.key(), false); + let (_, spl_interface_bump_b) = find_spl_interface_pda(&ctx.accounts.mint_b.key(), false); + + let decimals_a = ctx.accounts.mint_a.decimals; + let spl_interface_a = SplInterfaceConfig { + mint: ctx.accounts.mint_a.to_account_info(), + spl_token_program: ctx.accounts.token_program.to_account_info(), + spl_interface_pda: ctx.accounts.spl_interface_pda_a.to_account_info(), + spl_interface_pda_bump: spl_interface_bump_a, + }; + transfer_tokens( + amount_a, + decimals_a, + ctx.accounts.pool_account_a.to_account_info(), + ctx.accounts.depositor_account_a.to_account_info(), + ctx.accounts.mint_a.to_account_info(), + ctx.accounts.pool_authority.to_account_info(), + ctx.accounts.payer.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + Some(authority_seeds), + Some(spl_interface_a), + )?; + + let amount_b = I64F64::from_num(amount) + .checked_mul(I64F64::from_num(pool_b_balance)) + .unwrap() + .checked_div(I64F64::from_num( + ctx.accounts.mint_liquidity.supply + MINIMUM_LIQUIDITY, + )) + .unwrap() + .floor() + .to_num::(); + + let decimals_b = ctx.accounts.mint_b.decimals; + let spl_interface_b = SplInterfaceConfig { + mint: ctx.accounts.mint_b.to_account_info(), + spl_token_program: ctx.accounts.token_program.to_account_info(), + spl_interface_pda: ctx.accounts.spl_interface_pda_b.to_account_info(), + spl_interface_pda_bump: spl_interface_bump_b, + }; + transfer_tokens( + amount_b, + decimals_b, + ctx.accounts.pool_account_b.to_account_info(), + ctx.accounts.depositor_account_b.to_account_info(), + ctx.accounts.mint_b.to_account_info(), + ctx.accounts.pool_authority.to_account_info(), + ctx.accounts.payer.to_account_info(), + ctx.accounts.light_token_cpi_authority.to_account_info(), + ctx.accounts.system_program.to_account_info(), + Some(authority_seeds), + Some(spl_interface_b), + )?; + + // Burn the liquidity tokens (SPL or T22 token burn - never Light) + // It will fail if the amount is invalid + token_interface::burn( + CpiContext::new( + ctx.accounts.liquidity_token_program.to_account_info(), + Burn { + mint: ctx.accounts.mint_liquidity.to_account_info(), + from: ctx.accounts.depositor_account_liquidity.to_account_info(), + authority: ctx.accounts.depositor.to_account_info(), + }, + ), + amount, + )?; + + Ok(()) +} + +#[derive(Accounts)] +pub struct WithdrawLiquidity<'info> { + #[account( + seeds = [ + amm.id.as_ref() + ], + bump, + )] + pub amm: Account<'info, Amm>, + + #[account( + seeds = [ + pool.amm.as_ref(), + pool.mint_a.key().as_ref(), + pool.mint_b.key().as_ref(), + ], + bump, + has_one = mint_a, + has_one = mint_b, + )] + pub pool: Account<'info, Pool>, + + /// CHECK: Pool authority PDA - signer for pool token transfers (readonly) + #[account( + seeds = [ + pool.amm.as_ref(), + mint_a.key().as_ref(), + mint_b.key().as_ref(), + AUTHORITY_SEED, + ], + bump, + )] + pub pool_authority: AccountInfo<'info>, + + /// The account paying for all rents + pub depositor: Signer<'info>, + + /// Liquidity mint - always SPL or T22 (not Light) + #[account( + mut, + seeds = [ + pool.amm.as_ref(), + mint_a.key().as_ref(), + mint_b.key().as_ref(), + LIQUIDITY_SEED, + ], + bump, + mint::token_program = liquidity_token_program, + )] + pub mint_liquidity: Box>, + + #[account(mut, mint::token_program = token_program)] + pub mint_a: Box>, + + #[account(mut, mint::token_program = token_program)] + pub mint_b: Box>, + + /// CHECK: Pool token account A (Light Protocol token account) + #[account( + mut, + seeds = [POOL_ACCOUNT_A_SEED, pool.key().as_ref()], + bump, + )] + pub pool_account_a: UncheckedAccount<'info>, + + /// CHECK: Pool token account B (Light Protocol token account) + #[account( + mut, + seeds = [POOL_ACCOUNT_B_SEED, pool.key().as_ref()], + bump, + )] + pub pool_account_b: UncheckedAccount<'info>, + + /// Depositor's liquidity token account (can be SPL, T22, or Light) + #[account( + mut, + token::mint = mint_liquidity, + token::authority = depositor, + )] + pub depositor_account_liquidity: Box>, + + /// Depositor's token account for mint A (can be SPL, T22, or Light) + #[account( + mut, + token::mint = mint_a, + token::authority = depositor, + )] + pub depositor_account_a: Box>, + + /// Depositor's token account for mint B (can be SPL, T22, or Light) + #[account( + mut, + token::mint = mint_b, + token::authority = depositor, + )] + pub depositor_account_b: Box>, + + /// The account paying for all rents + #[account(mut)] + pub payer: Signer<'info>, + + /// Token program for mint_a and mint_b (SPL, T22, or Light) + pub token_program: Interface<'info, TokenInterface>, + /// Token program for liquidity mint (must be SPL or T22, not Light) + pub liquidity_token_program: Interface<'info, TokenInterface>, + pub system_program: Program<'info, System>, + + /// Light token program for CPI calls + pub light_token_program: Interface<'info, TokenInterface>, + + /// CHECK: Light token rent sponsor + #[account(mut, address = RENT_SPONSOR)] + pub light_token_rent_sponsor: AccountInfo<'info>, + + /// CHECK: light-token CPI authority - must be writable for Light token CPI + #[account(mut)] + pub light_token_cpi_authority: AccountInfo<'info>, + + /// CHECK: SPL interface PDA for mint A (token pool holding SPL tokens) + /// Derived by light-token program: ["pool", mint_a] + #[account(mut)] + pub spl_interface_pda_a: UncheckedAccount<'info>, + + /// CHECK: SPL interface PDA for mint B (token pool holding SPL tokens) + /// Derived by light-token program: ["pool", mint_b] + #[account(mut)] + pub spl_interface_pda_b: UncheckedAccount<'info>, +} diff --git a/anchor/programs/token-swap/src/lib.rs b/anchor/programs/token-swap/src/lib.rs new file mode 100644 index 0000000..d9ea4de --- /dev/null +++ b/anchor/programs/token-swap/src/lib.rs @@ -0,0 +1,60 @@ +#![allow(clippy::result_large_err)] +#![allow(deprecated)] + +use anchor_lang::prelude::*; +use light_token::anchor::{derive_light_cpi_signer, light_program, CpiSigner}; + +mod constants; +mod errors; +mod instructions; +mod state; + +// Re-export constants needed by #[light_program] macro +pub use constants::{POOL_ACCOUNT_A_SEED, POOL_ACCOUNT_B_SEED}; +// Re-export params structs for tests +pub use instructions::CreatePoolParams; + +// Set the correct key here +declare_id!("AsGVFxWqEn8icRBFQApxJe68x3r9zvfSbmiEzYFATGYn"); + +pub const LIGHT_CPI_SIGNER: CpiSigner = + derive_light_cpi_signer!("AsGVFxWqEn8icRBFQApxJe68x3r9zvfSbmiEzYFATGYn"); + +#[light_program] +#[program] +pub mod swap_example { + pub use super::instructions::*; + use super::*; + + pub fn create_amm(ctx: Context, id: Pubkey, fee: u16) -> Result<()> { + instructions::create_amm(ctx, id, fee) + } + + pub fn create_pool<'info>( + ctx: Context<'_, '_, '_, 'info, CreatePool<'info>>, + params: CreatePoolParams, + ) -> Result<()> { + instructions::create_pool(ctx, params) + } + + pub fn deposit_liquidity( + ctx: Context, + amount_a: u64, + amount_b: u64, + ) -> Result<()> { + instructions::deposit_liquidity(ctx, amount_a, amount_b) + } + + pub fn withdraw_liquidity(ctx: Context, amount: u64) -> Result<()> { + instructions::withdraw_liquidity(ctx, amount) + } + + pub fn swap_exact_tokens_for_tokens( + ctx: Context, + swap_a: bool, + input_amount: u64, + min_output_amount: u64, + ) -> Result<()> { + instructions::swap_exact_tokens_for_tokens(ctx, swap_a, input_amount, min_output_amount) + } +} diff --git a/anchor/programs/token-swap/src/state.rs b/anchor/programs/token-swap/src/state.rs new file mode 100644 index 0000000..743cdcd --- /dev/null +++ b/anchor/programs/token-swap/src/state.rs @@ -0,0 +1,35 @@ +use anchor_lang::prelude::*; + +#[account] +#[derive(Default)] +pub struct Amm { + /// The primary key of the AMM + pub id: Pubkey, + + /// Account that has admin authority over the AMM + pub admin: Pubkey, + + /// The LP fee taken on each trade, in basis points + pub fee: u16, +} + +impl Amm { + pub const LEN: usize = 8 + 32 + 32 + 2; +} + +#[account] +#[derive(Default)] +pub struct Pool { + /// Primary key of the AMM + pub amm: Pubkey, + + /// Mint of token A + pub mint_a: Pubkey, + + /// Mint of token B + pub mint_b: Pubkey, +} + +impl Pool { + pub const LEN: usize = 8 + 32 + 32 + 32; +} diff --git a/anchor/programs/token-swap/tests/common/mod.rs b/anchor/programs/token-swap/tests/common/mod.rs new file mode 100644 index 0000000..02faa41 --- /dev/null +++ b/anchor/programs/token-swap/tests/common/mod.rs @@ -0,0 +1,1031 @@ +//! Common test utilities for token-swap AMM tests. +//! +//! This module provides shared test helpers for different token type combinations: +//! - SPL mint + SPL ATAs +//! - T22 mint + T22 ATAs +//! - SPL mint + Light user accounts +//! - T22 mint + Light user accounts +//! +//! Light mint + Light ATAs is not yet supported (requires Light mint creation). + +use anchor_lang::{InstructionData, ToAccountMetas}; +use anchor_spl::associated_token::get_associated_token_address_with_program_id; +use anchor_spl::token; +use shared_test_utils::{ + helpers::verify_light_token_balance, + light_tokens::{create_light_ata, create_light_mint, mint_light_tokens}, + setup::initialize_rent_free_config, + spl_interface::{create_spl_interface_pda, transfer_spl_to_light}, + spl_tokens::{create_spl_ata, create_spl_mint, mint_spl_tokens}, + t22_tokens::{create_t22_ata, create_t22_mint, mint_t22_tokens}, + CreateAccountsProofResult, Indexer, LightProgramTest, MintType, ProgramTestConfig, Rpc, + TestRpc, COMPRESSIBLE_CONFIG_V1, CPI_AUTHORITY_PDA, LIGHT_TOKEN_MINTER_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, RENT_SPONSOR, +}; +use solana_instruction::Instruction; +use solana_keypair::Keypair; +use solana_pubkey::Pubkey; +use solana_signer::Signer; +use spl_token_2022::pod::PodAccount; + +/// Token configuration for parameterized tests +#[allow(dead_code)] +#[derive(Clone, Copy, Debug)] +pub enum TokenConfig { + /// SPL mint + SPL ATAs + Spl, + /// T22 mint + T22 ATAs + Token2022, + /// SPL mint + Light user accounts (offchain SPL->Light conversion) + LightSpl, + /// T22 mint + Light user accounts (offchain T22->Light conversion) + LightT22, + /// Light mint + Light user accounts (pure Light-to-Light) + Light, +} + +impl TokenConfig { + pub fn mint_type(&self) -> MintType { + match self { + TokenConfig::Spl | TokenConfig::LightSpl => MintType::Spl, + TokenConfig::Token2022 | TokenConfig::LightT22 => MintType::Token2022, + TokenConfig::Light => MintType::Spl, // Light mints use SPL-compatible layout + } + } + + pub fn token_program_id(&self) -> Pubkey { + match self { + TokenConfig::Spl | TokenConfig::LightSpl => token::ID, + TokenConfig::Token2022 | TokenConfig::LightT22 => spl_token_2022::ID, + TokenConfig::Light => Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + } + } + + /// Returns true if user accounts are Light token accounts + pub fn uses_light_user_accounts(&self) -> bool { + matches!( + self, + TokenConfig::LightSpl | TokenConfig::LightT22 | TokenConfig::Light + ) + } + + /// Returns true if mints are Light Protocol mints (not SPL/T22) + pub fn uses_light_mints(&self) -> bool { + matches!(self, TokenConfig::Light) + } +} + +/// Context for AMM tests containing all necessary accounts +pub struct AmmTestContext { + pub program_id: Pubkey, + pub payer: Keypair, + pub mint_a_pubkey: Pubkey, + pub mint_b_pubkey: Pubkey, + pub amm_pda: Pubkey, + pub amm_id: Pubkey, + pub pool_pda: Pubkey, + pub pool_authority: Pubkey, + pub mint_liquidity: Pubkey, + pub pool_account_a: Pubkey, + pub pool_account_b: Pubkey, + pub pool_a_bump: u8, + pub pool_b_bump: u8, + pub spl_interface_pda_a: Pubkey, + pub spl_interface_pda_b: Pubkey, + pub spl_interface_bump_a: u8, + pub depositor: Keypair, + pub depositor_ata_a: Pubkey, + pub depositor_ata_b: Pubkey, + pub token_config: TokenConfig, + /// Authority keypair for Light mint A (if Light config) + pub light_mint_authority_a: Option, +} + +/// Create a new LightProgramTest instance for token-swap tests +pub async fn create_test_rpc() -> LightProgramTest { + let program_id = swap_example::ID; + let mut config = ProgramTestConfig::new_v2( + true, + Some(vec![ + ("swap_example", program_id), + ("light_token_minter", LIGHT_TOKEN_MINTER_PROGRAM_ID), + ]), + ); + config = config.with_light_protocol_events(); + LightProgramTest::new(config).await.unwrap() +} + +/// Setup the AMM test environment based on token config +pub async fn setup_amm_test( + rpc: &mut R, + config: TokenConfig, +) -> AmmTestContext { + let program_id = swap_example::ID; + let payer = rpc.get_payer().insecure_clone(); + + // Initialize rent-free config (returns the config PDA) + let compression_config = initialize_rent_free_config(rpc, &payer, &program_id).await; + + // Create depositor + let depositor = Keypair::new(); + rpc.airdrop_lamports(&depositor.pubkey(), 10_000_000_000) + .await + .unwrap(); + + // Token amount for depositor + let amount = 10_000_000_000_000u64; // 10,000 tokens with 9 decimals + + // For Light mints, we need to handle things differently + if config.uses_light_mints() { + // ========== LIGHT MINT SETUP ========== + println!("\n=== Setting up Light mints ==="); + + // Create Light mints + let light_mint_a = + create_light_mint(rpc, &payer, 9, "Token A", "TOKA", &compression_config).await; + let light_mint_b = + create_light_mint(rpc, &payer, 9, "Token B", "TOKB", &compression_config).await; + + let mint_a_pubkey = light_mint_a.mint; + let mint_b_pubkey = light_mint_b.mint; + + println!("Light Mint A: {:?}", mint_a_pubkey); + println!("Light Mint B: {:?}", mint_b_pubkey); + + // For pure Light-to-Light, we don't need SPL interface PDAs + // Use dummy pubkeys (these won't be used) + let spl_interface_pda_a = Pubkey::default(); + let spl_interface_pda_b = Pubkey::default(); + + // Mint Light tokens directly to depositor + println!("\n=== Minting Light tokens to depositor ==="); + let depositor_ata_a = mint_light_tokens( + rpc, + &payer, + &light_mint_a.authority, + &mint_a_pubkey, + &depositor.pubkey(), + amount, + ) + .await; + let depositor_ata_b = mint_light_tokens( + rpc, + &payer, + &light_mint_b.authority, + &mint_b_pubkey, + &depositor.pubkey(), + amount, + ) + .await; + + // Derive AMM PDA + let amm_id = Pubkey::new_unique(); + let (amm_pda, _) = Pubkey::find_program_address(&[amm_id.as_ref()], &program_id); + + // Derive pool PDAs using Light mint pubkeys + let (pool_pda, _) = Pubkey::find_program_address( + &[ + amm_pda.as_ref(), + mint_a_pubkey.as_ref(), + mint_b_pubkey.as_ref(), + ], + &program_id, + ); + + let (pool_authority, _) = Pubkey::find_program_address( + &[ + amm_pda.as_ref(), + mint_a_pubkey.as_ref(), + mint_b_pubkey.as_ref(), + b"authority", + ], + &program_id, + ); + + let (mint_liquidity, _) = Pubkey::find_program_address( + &[ + amm_pda.as_ref(), + mint_a_pubkey.as_ref(), + mint_b_pubkey.as_ref(), + b"liquidity", + ], + &program_id, + ); + + let (pool_account_a, pool_a_bump) = + Pubkey::find_program_address(&[b"pool_a", pool_pda.as_ref()], &program_id); + let (pool_account_b, pool_b_bump) = + Pubkey::find_program_address(&[b"pool_b", pool_pda.as_ref()], &program_id); + + return AmmTestContext { + program_id, + payer, + mint_a_pubkey, + mint_b_pubkey, + amm_pda, + amm_id, + pool_pda, + pool_authority, + mint_liquidity, + pool_account_a, + pool_account_b, + pool_a_bump, + pool_b_bump, + spl_interface_pda_a, + spl_interface_pda_b, + spl_interface_bump_a: 0, + depositor, + depositor_ata_a, + depositor_ata_b, + token_config: config, + light_mint_authority_a: Some(light_mint_a.authority), + }; + } + + // ========== SPL/T22 MINT SETUP ========== + // Create mints based on config (SPL or T22 - Light user accounts still use SPL/T22 mints) + let (mint_a, mint_b) = match config { + TokenConfig::Spl | TokenConfig::LightSpl => { + let mint_a = create_spl_mint(rpc, &payer, &payer.pubkey(), 9).await; + let mint_b = create_spl_mint(rpc, &payer, &payer.pubkey(), 9).await; + (mint_a, mint_b) + } + TokenConfig::Token2022 | TokenConfig::LightT22 => { + let mint_a = create_t22_mint(rpc, &payer, &payer.pubkey(), 9).await; + let mint_b = create_t22_mint(rpc, &payer, &payer.pubkey(), 9).await; + (mint_a, mint_b) + } + TokenConfig::Light => unreachable!("Light config handled above"), + }; + + let mint_a_pubkey = mint_a.pubkey(); + let mint_b_pubkey = mint_b.pubkey(); + + println!("Mint A: {:?}", mint_a_pubkey); + println!("Mint B: {:?}", mint_b_pubkey); + + // Create SPL interface PDAs for both mints + println!("\n=== Creating SPL interface PDAs ==="); + let spl_interface_result_a = + create_spl_interface_pda(rpc, &payer, &mint_a_pubkey, config.mint_type(), false).await; + let spl_interface_result_b = + create_spl_interface_pda(rpc, &payer, &mint_b_pubkey, config.mint_type(), false).await; + + // Create depositor ATAs and mint tokens based on config + let (depositor_ata_a, depositor_ata_b) = match config { + TokenConfig::Spl => { + let ata_a = create_spl_ata(rpc, &payer, &mint_a_pubkey, &depositor.pubkey()).await; + let ata_b = create_spl_ata(rpc, &payer, &mint_b_pubkey, &depositor.pubkey()).await; + mint_spl_tokens(rpc, &payer, &mint_a_pubkey, &ata_a, &payer, amount).await; + mint_spl_tokens(rpc, &payer, &mint_b_pubkey, &ata_b, &payer, amount).await; + (ata_a, ata_b) + } + TokenConfig::Token2022 => { + let ata_a = create_t22_ata(rpc, &payer, &mint_a_pubkey, &depositor.pubkey()).await; + let ata_b = create_t22_ata(rpc, &payer, &mint_b_pubkey, &depositor.pubkey()).await; + mint_t22_tokens(rpc, &payer, &mint_a_pubkey, &ata_a, &payer, amount).await; + mint_t22_tokens(rpc, &payer, &mint_b_pubkey, &ata_b, &payer, amount).await; + (ata_a, ata_b) + } + TokenConfig::LightSpl => { + // For Light user accounts with SPL mint: + // 1. Create temporary SPL ATAs + // 2. Mint tokens to temp ATAs + // 3. Create Light ATAs + // 4. Transfer from SPL to Light (compress) + println!("\n=== Setting up Light user accounts (SPL mint) ==="); + + let temp_ata_a = create_spl_ata(rpc, &payer, &mint_a_pubkey, &depositor.pubkey()).await; + let temp_ata_b = create_spl_ata(rpc, &payer, &mint_b_pubkey, &depositor.pubkey()).await; + mint_spl_tokens(rpc, &payer, &mint_a_pubkey, &temp_ata_a, &payer, amount).await; + mint_spl_tokens(rpc, &payer, &mint_b_pubkey, &temp_ata_b, &payer, amount).await; + + // Create Light ATAs + let light_ata_a = + create_light_ata(rpc, &payer, &mint_a_pubkey, &depositor.pubkey()).await; + let light_ata_b = + create_light_ata(rpc, &payer, &mint_b_pubkey, &depositor.pubkey()).await; + + // Transfer from SPL to Light (compress) + transfer_spl_to_light( + rpc, + &payer, + &depositor, + &mint_a_pubkey, + 9, + &temp_ata_a, + &light_ata_a, + &spl_interface_result_a.pda, + spl_interface_result_a.bump, + amount, + MintType::Spl, + ) + .await; + transfer_spl_to_light( + rpc, + &payer, + &depositor, + &mint_b_pubkey, + 9, + &temp_ata_b, + &light_ata_b, + &spl_interface_result_b.pda, + spl_interface_result_b.bump, + amount, + MintType::Spl, + ) + .await; + + (light_ata_a, light_ata_b) + } + TokenConfig::LightT22 => { + // For Light user accounts with T22 mint: + println!("\n=== Setting up Light user accounts (T22 mint) ==="); + + let temp_ata_a = create_t22_ata(rpc, &payer, &mint_a_pubkey, &depositor.pubkey()).await; + let temp_ata_b = create_t22_ata(rpc, &payer, &mint_b_pubkey, &depositor.pubkey()).await; + mint_t22_tokens(rpc, &payer, &mint_a_pubkey, &temp_ata_a, &payer, amount).await; + mint_t22_tokens(rpc, &payer, &mint_b_pubkey, &temp_ata_b, &payer, amount).await; + + // Create Light ATAs + let light_ata_a = + create_light_ata(rpc, &payer, &mint_a_pubkey, &depositor.pubkey()).await; + let light_ata_b = + create_light_ata(rpc, &payer, &mint_b_pubkey, &depositor.pubkey()).await; + + // Transfer from T22 to Light (compress) + transfer_spl_to_light( + rpc, + &payer, + &depositor, + &mint_a_pubkey, + 9, + &temp_ata_a, + &light_ata_a, + &spl_interface_result_a.pda, + spl_interface_result_a.bump, + amount, + MintType::Token2022, + ) + .await; + transfer_spl_to_light( + rpc, + &payer, + &depositor, + &mint_b_pubkey, + 9, + &temp_ata_b, + &light_ata_b, + &spl_interface_result_b.pda, + spl_interface_result_b.bump, + amount, + MintType::Token2022, + ) + .await; + + (light_ata_a, light_ata_b) + } + TokenConfig::Light => unreachable!("Light config handled above"), + }; + + // Derive AMM PDA + let amm_id = Pubkey::new_unique(); + let (amm_pda, _) = Pubkey::find_program_address(&[amm_id.as_ref()], &program_id); + + // Derive pool PDAs + let (pool_pda, _) = Pubkey::find_program_address( + &[ + amm_pda.as_ref(), + mint_a_pubkey.as_ref(), + mint_b_pubkey.as_ref(), + ], + &program_id, + ); + + let (pool_authority, _) = Pubkey::find_program_address( + &[ + amm_pda.as_ref(), + mint_a_pubkey.as_ref(), + mint_b_pubkey.as_ref(), + b"authority", + ], + &program_id, + ); + + let (mint_liquidity, _) = Pubkey::find_program_address( + &[ + amm_pda.as_ref(), + mint_a_pubkey.as_ref(), + mint_b_pubkey.as_ref(), + b"liquidity", + ], + &program_id, + ); + + let (pool_account_a, pool_a_bump) = + Pubkey::find_program_address(&[b"pool_a", pool_pda.as_ref()], &program_id); + let (pool_account_b, pool_b_bump) = + Pubkey::find_program_address(&[b"pool_b", pool_pda.as_ref()], &program_id); + + AmmTestContext { + program_id, + payer, + mint_a_pubkey, + mint_b_pubkey, + amm_pda, + amm_id, + pool_pda, + pool_authority, + mint_liquidity, + pool_account_a, + pool_account_b, + pool_a_bump, + pool_b_bump, + spl_interface_pda_a: spl_interface_result_a.pda, + spl_interface_pda_b: spl_interface_result_b.pda, + spl_interface_bump_a: spl_interface_result_a.bump, + depositor, + depositor_ata_a, + depositor_ata_b, + token_config: config, + light_mint_authority_a: None, + } +} + +/// Create AMM +pub async fn create_amm(rpc: &mut R, ctx: &AmmTestContext, fee: u16) { + println!("\n=== Creating AMM ==="); + + let create_amm_accounts = swap_example::accounts::CreateAmm { + amm: ctx.amm_pda, + admin: ctx.payer.pubkey(), + payer: ctx.payer.pubkey(), + system_program: solana_sdk::system_program::ID, + }; + + let create_amm_data = swap_example::instruction::CreateAmm { + id: ctx.amm_id, + fee, + }; + + let create_amm_ix = Instruction { + program_id: ctx.program_id, + accounts: create_amm_accounts.to_account_metas(None), + data: create_amm_data.data(), + }; + + rpc.create_and_send_transaction(&[create_amm_ix], &ctx.payer.pubkey(), &[&ctx.payer]) + .await + .expect("create_amm should succeed"); + + println!("AMM created at: {:?}", ctx.amm_pda); + println!("AMM Fee: {} basis points", fee); +} + +/// Create Pool with Light token accounts +pub async fn create_pool( + rpc: &mut R, + ctx: &AmmTestContext, + proof_result: CreateAccountsProofResult, +) { + println!("\n=== Creating Pool ==="); + + // For liquidity mint, use SPL for Light pools (can't init Light mints via Anchor) + // For SPL/T22 pools, use the same token program as the mints + let liquidity_token_program = match ctx.token_config { + TokenConfig::Light | TokenConfig::LightSpl => token::ID, + TokenConfig::Token2022 | TokenConfig::LightT22 => spl_token_2022::ID, + TokenConfig::Spl => token::ID, + }; + + let create_pool_accounts = swap_example::accounts::CreatePool { + amm: ctx.amm_pda, + pool: ctx.pool_pda, + pool_authority: ctx.pool_authority, + mint_liquidity: ctx.mint_liquidity, + mint_a: ctx.mint_a_pubkey, + mint_b: ctx.mint_b_pubkey, + pool_account_a: ctx.pool_account_a, + pool_account_b: ctx.pool_account_b, + fee_payer: ctx.payer.pubkey(), + token_program: ctx.token_config.token_program_id(), + liquidity_token_program, + light_token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + system_program: solana_sdk::system_program::ID, + light_token_compressible_config: COMPRESSIBLE_CONFIG_V1, + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + }; + + let create_pool_data = swap_example::instruction::CreatePool { + params: swap_example::CreatePoolParams { + create_accounts_proof: proof_result.create_accounts_proof, + pool_account_a_bump: ctx.pool_a_bump, + pool_account_b_bump: ctx.pool_b_bump, + }, + }; + + let create_pool_ix = Instruction { + program_id: ctx.program_id, + accounts: [ + create_pool_accounts.to_account_metas(None), + proof_result.remaining_accounts, + ] + .concat(), + data: create_pool_data.data(), + }; + + rpc.create_and_send_transaction(&[create_pool_ix], &ctx.payer.pubkey(), &[&ctx.payer]) + .await + .expect("create_pool should succeed"); + + println!("Pool created successfully!"); +} + +/// Deposit liquidity +pub async fn deposit_liquidity( + rpc: &mut R, + ctx: &AmmTestContext, + amount_a: u64, + amount_b: u64, +) -> Pubkey { + println!("\n=== Depositing Liquidity ==="); + + let token_program = ctx.token_config.token_program_id(); + + // Liquidity mint is SPL for Light/LightSpl pools, T22 for T22/LightT22 pools, SPL for Spl pools + let liquidity_token_program = match ctx.token_config { + TokenConfig::Light | TokenConfig::LightSpl | TokenConfig::Spl => token::ID, + TokenConfig::Token2022 | TokenConfig::LightT22 => spl_token_2022::ID, + }; + + // Create depositor's liquidity ATA (must use liquidity token program) + let depositor_liquidity_ata = get_associated_token_address_with_program_id( + &ctx.depositor.pubkey(), + &ctx.mint_liquidity, + &liquidity_token_program, + ); + + // Create the liquidity ATA first (since program no longer does init_if_needed) + // Liquidity mint is always SPL or T22 (not Light) - Anchor can't init Light mints + match ctx.token_config { + TokenConfig::Spl | TokenConfig::LightSpl | TokenConfig::Light => { + // SPL liquidity mint + create_spl_ata( + rpc, + &ctx.payer, + &ctx.mint_liquidity, + &ctx.depositor.pubkey(), + ) + .await; + } + TokenConfig::Token2022 | TokenConfig::LightT22 => { + // T22 liquidity mint + create_t22_ata( + rpc, + &ctx.payer, + &ctx.mint_liquidity, + &ctx.depositor.pubkey(), + ) + .await; + } + } + + let deposit_accounts = swap_example::accounts::DepositLiquidity { + pool: ctx.pool_pda, + pool_authority: ctx.pool_authority, + depositor: ctx.depositor.pubkey(), + mint_liquidity: ctx.mint_liquidity, + mint_a: ctx.mint_a_pubkey, + mint_b: ctx.mint_b_pubkey, + pool_account_a: ctx.pool_account_a, + pool_account_b: ctx.pool_account_b, + depositor_account_liquidity: depositor_liquidity_ata, + depositor_account_a: ctx.depositor_ata_a, + depositor_account_b: ctx.depositor_ata_b, + payer: ctx.payer.pubkey(), + token_program, + liquidity_token_program, + system_program: solana_sdk::system_program::ID, + light_token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + spl_interface_pda_a: ctx.spl_interface_pda_a, + spl_interface_pda_b: ctx.spl_interface_pda_b, + }; + + let deposit_data = swap_example::instruction::DepositLiquidity { amount_a, amount_b }; + + let deposit_ix = Instruction { + program_id: ctx.program_id, + accounts: deposit_accounts.to_account_metas(None), + data: deposit_data.data(), + }; + + rpc.create_and_send_transaction( + &[deposit_ix], + &ctx.payer.pubkey(), + &[&ctx.payer, &ctx.depositor], + ) + .await + .expect("deposit_liquidity should succeed"); + + println!("Deposited {} token A and {} token B", amount_a, amount_b); + + depositor_liquidity_ata +} + +/// Perform swap A->B or B->A +pub async fn swap( + rpc: &mut R, + ctx: &AmmTestContext, + trader: &Keypair, + trader_ata_a: Pubkey, + trader_ata_b: Pubkey, + swap_a: bool, + input_amount: u64, + min_output: u64, +) { + let direction = if swap_a { "A->B" } else { "B->A" }; + println!("\n=== Swapping {} ===", direction); + + let token_program = ctx.token_config.token_program_id(); + + let swap_accounts = swap_example::accounts::SwapExactTokensForTokens { + amm: ctx.amm_pda, + pool: ctx.pool_pda, + pool_authority: ctx.pool_authority, + trader: trader.pubkey(), + mint_a: ctx.mint_a_pubkey, + mint_b: ctx.mint_b_pubkey, + pool_account_a: ctx.pool_account_a, + pool_account_b: ctx.pool_account_b, + trader_account_a: trader_ata_a, + trader_account_b: trader_ata_b, + payer: ctx.payer.pubkey(), + token_program, + system_program: solana_sdk::system_program::ID, + light_token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + spl_interface_pda_a: ctx.spl_interface_pda_a, + spl_interface_pda_b: ctx.spl_interface_pda_b, + }; + + let swap_data = swap_example::instruction::SwapExactTokensForTokens { + swap_a, + input_amount, + min_output_amount: min_output, + }; + + let swap_ix = Instruction { + program_id: ctx.program_id, + accounts: swap_accounts.to_account_metas(None), + data: swap_data.data(), + }; + + rpc.create_and_send_transaction(&[swap_ix], &ctx.payer.pubkey(), &[&ctx.payer, trader]) + .await + .expect(&format!("swap {} should succeed", direction)); + + println!("Swapped {} of input token", input_amount); +} + +/// Withdraw liquidity +pub async fn withdraw_liquidity( + rpc: &mut R, + ctx: &AmmTestContext, + depositor_liquidity_ata: Pubkey, + amount: u64, +) { + println!("\n=== Withdrawing Liquidity ==="); + + let token_program = ctx.token_config.token_program_id(); + + // Liquidity mint is SPL for Light/LightSpl pools, T22 for T22/LightT22 pools, SPL for Spl pools + let liquidity_token_program = match ctx.token_config { + TokenConfig::Light | TokenConfig::LightSpl | TokenConfig::Spl => token::ID, + TokenConfig::Token2022 | TokenConfig::LightT22 => spl_token_2022::ID, + }; + + let withdraw_accounts = swap_example::accounts::WithdrawLiquidity { + amm: ctx.amm_pda, + pool: ctx.pool_pda, + pool_authority: ctx.pool_authority, + depositor: ctx.depositor.pubkey(), + mint_liquidity: ctx.mint_liquidity, + mint_a: ctx.mint_a_pubkey, + mint_b: ctx.mint_b_pubkey, + pool_account_a: ctx.pool_account_a, + pool_account_b: ctx.pool_account_b, + depositor_account_liquidity: depositor_liquidity_ata, + depositor_account_a: ctx.depositor_ata_a, + depositor_account_b: ctx.depositor_ata_b, + payer: ctx.payer.pubkey(), + token_program, + liquidity_token_program, + system_program: solana_sdk::system_program::ID, + light_token_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), + light_token_rent_sponsor: RENT_SPONSOR, + light_token_cpi_authority: CPI_AUTHORITY_PDA, + spl_interface_pda_a: ctx.spl_interface_pda_a, + spl_interface_pda_b: ctx.spl_interface_pda_b, + }; + + let withdraw_data = swap_example::instruction::WithdrawLiquidity { amount }; + + let withdraw_ix = Instruction { + program_id: ctx.program_id, + accounts: withdraw_accounts.to_account_metas(None), + data: withdraw_data.data(), + }; + + rpc.create_and_send_transaction( + &[withdraw_ix], + &ctx.payer.pubkey(), + &[&ctx.payer, &ctx.depositor], + ) + .await + .expect("withdraw_liquidity should succeed"); + + println!("Withdrew {} LP tokens", amount); +} + +/// Create a trader with token accounts and funded tokens +pub async fn create_trader( + rpc: &mut R, + ctx: &AmmTestContext, + initial_a: u64, +) -> (Keypair, Pubkey, Pubkey) { + let trader = Keypair::new(); + rpc.airdrop_lamports(&trader.pubkey(), 5_000_000_000) + .await + .unwrap(); + + let (trader_ata_a, trader_ata_b) = match ctx.token_config { + TokenConfig::Spl => { + let ata_a = create_spl_ata(rpc, &ctx.payer, &ctx.mint_a_pubkey, &trader.pubkey()).await; + let ata_b = create_spl_ata(rpc, &ctx.payer, &ctx.mint_b_pubkey, &trader.pubkey()).await; + // Mint initial token A to trader + mint_spl_tokens( + rpc, + &ctx.payer, + &ctx.mint_a_pubkey, + &ata_a, + &ctx.payer, + initial_a, + ) + .await; + (ata_a, ata_b) + } + TokenConfig::Token2022 => { + let ata_a = create_t22_ata(rpc, &ctx.payer, &ctx.mint_a_pubkey, &trader.pubkey()).await; + let ata_b = create_t22_ata(rpc, &ctx.payer, &ctx.mint_b_pubkey, &trader.pubkey()).await; + // Mint initial token A to trader + mint_t22_tokens( + rpc, + &ctx.payer, + &ctx.mint_a_pubkey, + &ata_a, + &ctx.payer, + initial_a, + ) + .await; + (ata_a, ata_b) + } + TokenConfig::LightSpl => { + // For Light user accounts with SPL mint: + // 1. Create temp SPL ATAs, mint, then transfer to Light ATAs + let temp_ata_a = + create_spl_ata(rpc, &ctx.payer, &ctx.mint_a_pubkey, &trader.pubkey()).await; + let _temp_ata_b = + create_spl_ata(rpc, &ctx.payer, &ctx.mint_b_pubkey, &trader.pubkey()).await; + + // Mint initial token A to trader temp ATA + mint_spl_tokens( + rpc, + &ctx.payer, + &ctx.mint_a_pubkey, + &temp_ata_a, + &ctx.payer, + initial_a, + ) + .await; + + // Create Light ATAs + let light_ata_a = + create_light_ata(rpc, &ctx.payer, &ctx.mint_a_pubkey, &trader.pubkey()).await; + let light_ata_b = + create_light_ata(rpc, &ctx.payer, &ctx.mint_b_pubkey, &trader.pubkey()).await; + + // Transfer from SPL to Light (compress) + transfer_spl_to_light( + rpc, + &ctx.payer, + &trader, + &ctx.mint_a_pubkey, + 9, + &temp_ata_a, + &light_ata_a, + &ctx.spl_interface_pda_a, + ctx.spl_interface_bump_a, + initial_a, + MintType::Spl, + ) + .await; + + (light_ata_a, light_ata_b) + } + TokenConfig::LightT22 => { + // For Light user accounts with T22 mint: + let temp_ata_a = + create_t22_ata(rpc, &ctx.payer, &ctx.mint_a_pubkey, &trader.pubkey()).await; + let _temp_ata_b = + create_t22_ata(rpc, &ctx.payer, &ctx.mint_b_pubkey, &trader.pubkey()).await; + + // Mint initial token A to trader temp ATA + mint_t22_tokens( + rpc, + &ctx.payer, + &ctx.mint_a_pubkey, + &temp_ata_a, + &ctx.payer, + initial_a, + ) + .await; + + // Create Light ATAs + let light_ata_a = + create_light_ata(rpc, &ctx.payer, &ctx.mint_a_pubkey, &trader.pubkey()).await; + let light_ata_b = + create_light_ata(rpc, &ctx.payer, &ctx.mint_b_pubkey, &trader.pubkey()).await; + + // Transfer from T22 to Light (compress) + transfer_spl_to_light( + rpc, + &ctx.payer, + &trader, + &ctx.mint_a_pubkey, + 9, + &temp_ata_a, + &light_ata_a, + &ctx.spl_interface_pda_a, + ctx.spl_interface_bump_a, + initial_a, + MintType::Token2022, + ) + .await; + + (light_ata_a, light_ata_b) + } + TokenConfig::Light => { + // For pure Light mints: + // Mint directly to trader's Light ATAs using the Light mint authority + let mint_authority_a = ctx + .light_mint_authority_a + .as_ref() + .expect("Light config should have mint authority A"); + + // Mint token A to trader + let light_ata_a = mint_light_tokens( + rpc, + &ctx.payer, + mint_authority_a, + &ctx.mint_a_pubkey, + &trader.pubkey(), + initial_a, + ) + .await; + + // Create Light ATA for token B (no minting needed initially) + let light_ata_b = + create_light_ata(rpc, &ctx.payer, &ctx.mint_b_pubkey, &trader.pubkey()).await; + + (light_ata_a, light_ata_b) + } + }; + + (trader, trader_ata_a, trader_ata_b) +} + +/// Get token balance from SPL/T22 account +pub async fn get_token_balance(rpc: &mut R, account: Pubkey) -> u64 { + let account_data = rpc + .get_account(account) + .await + .unwrap() + .expect("Token account should exist"); + + let token_state = + spl_pod::bytemuck::pod_from_bytes::(&account_data.data[..165]).unwrap(); + u64::from(token_state.amount) +} + +/// Run the full AMM flow test +pub async fn run_amm_full_flow(rpc: &mut R, ctx: &AmmTestContext) { + use light_client::interface::{get_create_accounts_proof, CreateAccountsProofInput}; + + // Create AMM + create_amm(rpc, ctx, 250).await; // 2.5% fee + + // Get proof for creating pool Light token accounts + let proof_result = get_create_accounts_proof( + rpc, + &ctx.program_id, + vec![ + CreateAccountsProofInput::pda(ctx.pool_account_a), + CreateAccountsProofInput::pda(ctx.pool_account_b), + ], + ) + .await + .unwrap(); + + // Create Pool + create_pool(rpc, ctx, proof_result).await; + + // Fund pool_authority for Light-to-Light transfers (rent top-ups) + // The pool_authority needs lamports to pay for rent top-ups when transferring + // from pool accounts to user accounts during swap/withdraw operations + if ctx.token_config.uses_light_user_accounts() { + rpc.airdrop_lamports(&ctx.pool_authority, 1_000_000_000) + .await + .expect("Fund pool_authority for rent top-ups"); + println!("Funded pool_authority with 1 SOL for rent top-ups"); + } + + // Verify initial pool balances + verify_light_token_balance(rpc, ctx.pool_account_a, 0, "pool_account_a (initial)").await; + verify_light_token_balance(rpc, ctx.pool_account_b, 0, "pool_account_b (initial)").await; + + // Deposit initial liquidity + let deposit_amount = 1_000_000_000u64; // 1 token + let depositor_liquidity_ata = deposit_liquidity(rpc, ctx, deposit_amount, deposit_amount).await; + + // Verify pool balances after deposit + verify_light_token_balance( + rpc, + ctx.pool_account_a, + deposit_amount, + "pool_account_a (after deposit)", + ) + .await; + verify_light_token_balance( + rpc, + ctx.pool_account_b, + deposit_amount, + "pool_account_b (after deposit)", + ) + .await; + + // Create trader and perform swaps + let trader_initial_a = 100_000_000u64; // 0.1 tokens + let (trader, trader_ata_a, trader_ata_b) = create_trader(rpc, ctx, trader_initial_a).await; + + // Swap A -> B + let swap_input = 10_000_000u64; // 0.01 tokens + swap( + rpc, + ctx, + &trader, + trader_ata_a, + trader_ata_b, + true, + swap_input, + 1, + ) + .await; + + // Verify trader got some token B + let trader_b_balance = get_token_balance(rpc, trader_ata_b).await; + assert!(trader_b_balance > 0, "Trader should have received token B"); + println!("Trader token B after swap: {}", trader_b_balance); + + // Swap B -> A (swap half back) + let swap_b_input = trader_b_balance / 2; + swap( + rpc, + ctx, + &trader, + trader_ata_a, + trader_ata_b, + false, + swap_b_input, + 1, + ) + .await; + + // Withdraw half of LP tokens + let lp_balance = get_token_balance(rpc, depositor_liquidity_ata).await; + let withdraw_amount = lp_balance / 2; + withdraw_liquidity(rpc, ctx, depositor_liquidity_ata, withdraw_amount).await; + + // Verify LP tokens were burned + let lp_balance_after = get_token_balance(rpc, depositor_liquidity_ata).await; + assert_eq!( + lp_balance_after, + lp_balance - withdraw_amount, + "LP tokens should be burned" + ); + + println!("\n=== AMM full flow test completed successfully! ==="); +} diff --git a/anchor/programs/token-swap/tests/light_spl_user_accounts.rs b/anchor/programs/token-swap/tests/light_spl_user_accounts.rs new file mode 100644 index 0000000..ecf6990 --- /dev/null +++ b/anchor/programs/token-swap/tests/light_spl_user_accounts.rs @@ -0,0 +1,25 @@ +//! Integration tests for the token-swap AMM program with SPL mints and Light user accounts. +//! +//! Token Configuration: +//! - Mint Type: SPL (token::ID) +//! - User Accounts: Light token accounts (offchain SPL->Light conversion before program interaction) +//! - Pool Accounts: Light Protocol token accounts +//! +//! Test Flow: +//! 1. Create SPL mint and temporary SPL ATA +//! 2. Mint tokens to temporary ATA +//! 3. Create Light token account for user +//! 4. Create SPL interface PDA +//! 5. Transfer from SPL ATA to Light account (offchain conversion using `transfer_spl_to_light`) +//! 6. User has Light account with tokens - interact with program using Light-to-Light + +mod common; + +use common::{create_test_rpc, run_amm_full_flow, setup_amm_test, TokenConfig}; + +#[tokio::test] +async fn test_amm_full_flow_light_spl() { + let mut rpc = create_test_rpc().await; + let ctx = setup_amm_test(&mut rpc, TokenConfig::LightSpl).await; + run_amm_full_flow(&mut rpc, &ctx).await; +} diff --git a/anchor/programs/token-swap/tests/light_t22_user_accounts.rs b/anchor/programs/token-swap/tests/light_t22_user_accounts.rs new file mode 100644 index 0000000..ed13969 --- /dev/null +++ b/anchor/programs/token-swap/tests/light_t22_user_accounts.rs @@ -0,0 +1,25 @@ +//! Integration tests for the token-swap AMM program with T22 mints and Light user accounts. +//! +//! Token Configuration: +//! - Mint Type: Token-2022 (spl_token_2022::ID) +//! - User Accounts: Light token accounts (offchain T22->Light conversion before program interaction) +//! - Pool Accounts: Light Protocol token accounts +//! +//! Test Flow: +//! 1. Create T22 mint and temporary T22 ATA +//! 2. Mint tokens to temporary ATA +//! 3. Create Light token account for user +//! 4. Create SPL interface PDA (works with T22) +//! 5. Transfer from T22 ATA to Light account (offchain conversion using `transfer_spl_to_light`) +//! 6. User has Light account with tokens - interact with program using Light-to-Light + +mod common; + +use common::{create_test_rpc, run_amm_full_flow, setup_amm_test, TokenConfig}; + +#[tokio::test] +async fn test_amm_full_flow_light_t22() { + let mut rpc = create_test_rpc().await; + let ctx = setup_amm_test(&mut rpc, TokenConfig::LightT22).await; + run_amm_full_flow(&mut rpc, &ctx).await; +} diff --git a/anchor/programs/token-swap/tests/light_user_accounts.rs b/anchor/programs/token-swap/tests/light_user_accounts.rs new file mode 100644 index 0000000..b773304 --- /dev/null +++ b/anchor/programs/token-swap/tests/light_user_accounts.rs @@ -0,0 +1,31 @@ +//! Integration tests for the token-swap AMM program with Light mints and Light ATAs. +//! +//! Token Configuration: +//! - Mint Type: Light (via CreateMint instruction) +//! - User Accounts: Light token accounts +//! - Pool Accounts: Light Protocol token accounts +//! +//! This is the pure Light-to-Light test where everything uses compressed tokens. + +mod common; + +use common::{create_amm, create_test_rpc, run_amm_full_flow, setup_amm_test, TokenConfig}; + +#[tokio::test] +async fn test_amm_full_flow_light() { + let mut rpc = create_test_rpc().await; + let ctx = setup_amm_test(&mut rpc, TokenConfig::Light).await; + run_amm_full_flow(&mut rpc, &ctx).await; +} + +#[tokio::test] +async fn test_create_amm_light() { + let mut rpc = create_test_rpc().await; + let ctx = setup_amm_test(&mut rpc, TokenConfig::Light).await; + + // Create AMM with 0% fee + create_amm(&mut rpc, &ctx, 0).await; + + println!("AMM with 0% fee created successfully"); + println!("=== Initialize AMM test completed successfully! ==="); +} diff --git a/anchor/programs/token-swap/tests/spl_user_accounts.rs b/anchor/programs/token-swap/tests/spl_user_accounts.rs new file mode 100644 index 0000000..7e5cdb3 --- /dev/null +++ b/anchor/programs/token-swap/tests/spl_user_accounts.rs @@ -0,0 +1,31 @@ +//! Integration tests for the token-swap AMM program with SPL mints and SPL ATAs. +//! +//! Token Configuration: +//! - Mint Type: SPL (token::ID) +//! - User Accounts: SPL ATAs +//! - Pool Accounts: Light Protocol token accounts + +mod common; + +use common::{create_test_rpc, run_amm_full_flow, setup_amm_test, TokenConfig}; + +/// Test the full AMM flow with SPL tokens +#[tokio::test] +async fn test_amm_full_flow_spl() { + let mut rpc = create_test_rpc().await; + let ctx = setup_amm_test(&mut rpc, TokenConfig::Spl).await; + run_amm_full_flow(&mut rpc, &ctx).await; +} + +/// Test AMM creation with various fee values using SPL tokens +#[tokio::test] +async fn test_create_amm_spl() { + use common::{create_amm, setup_amm_test}; + + let mut rpc = create_test_rpc().await; + let ctx = setup_amm_test(&mut rpc, TokenConfig::Spl).await; + + // Create AMM with 0% fee + create_amm(&mut rpc, &ctx, 0).await; + println!("AMM with 0% fee created successfully"); +} diff --git a/anchor/programs/token-swap/tests/t22_user_accounts.rs b/anchor/programs/token-swap/tests/t22_user_accounts.rs new file mode 100644 index 0000000..5b4448b --- /dev/null +++ b/anchor/programs/token-swap/tests/t22_user_accounts.rs @@ -0,0 +1,31 @@ +//! Integration tests for the token-swap AMM program with Token-2022 mints and T22 ATAs. +//! +//! Token Configuration: +//! - Mint Type: Token-2022 (spl_token_2022::ID) +//! - User Accounts: Token-2022 ATAs +//! - Pool Accounts: Light Protocol token accounts + +mod common; + +use common::{create_test_rpc, run_amm_full_flow, setup_amm_test, TokenConfig}; + +/// Test the full AMM flow with Token-2022 tokens +#[tokio::test] +async fn test_amm_full_flow_t22() { + let mut rpc = create_test_rpc().await; + let ctx = setup_amm_test(&mut rpc, TokenConfig::Token2022).await; + run_amm_full_flow(&mut rpc, &ctx).await; +} + +/// Test AMM creation with various fee values using Token-2022 tokens +#[tokio::test] +async fn test_create_amm_t22() { + use common::{create_amm, setup_amm_test}; + + let mut rpc = create_test_rpc().await; + let ctx = setup_amm_test(&mut rpc, TokenConfig::Token2022).await; + + // Create AMM with 2.5% fee + create_amm(&mut rpc, &ctx, 250).await; + println!("AMM with 2.5% fee created successfully"); +}