diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..8bde414ee --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: weekly + # ignore: + # # these need to be updated together, so dependabot PRs + # # are just noise. So, ignore them: + # - dependency-name: sp-core + # - dependency-name: sp-keyring + # - dependency-name: sp-runtime + # - dependency-name: sp-core-hashing + # - dependency-name: sp-version + - package-ecosystem: github-actions + directory: '/' + schedule: + interval: weekly diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 000000000..38ac18a5f --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,64 @@ +# The name of your workflow. GitHub displays the names of your workflows on your repository's "Actions" tab +name: Rust + +# To automatically trigger the workflow +on: + # NB: this differs from the book's project! + # These settings allow us to run this specific CI pipeline for PRs against + # this specific branch (a.k.a. book chapter). + push: + branches: + - main + pull_request: + types: [ opened, synchronize, reopened ] + branches: + - main + +# A workflow run is made up of one or more jobs, which run in parallel by default +# Each job runs in a runner environment specified by runs-on +jobs: + # Unique identifier of our job (`job_id`) + test: + # Sets the name `Test` for the job, which is displayed in the GitHub UI + name: Test + # Containers must run in Linux based operating systems + runs-on: ubuntu-latest + steps: + # Downloads a copy of the code in your repository before running CI tests + - name: Check out repository code + # The uses keyword specifies that this step will run v3 of the actions/checkout action. + # This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code (such as build and test tools). + # You should use the checkout action any time your workflow will run against the repository's code. + uses: actions/checkout@v3 + + # This GitHub Action installs a Rust toolchain using rustup. It is designed for one-line concise usage and good defaults. + - name: Install the Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Run tests + run: cargo test + + # `fmt` container job + fmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + # Specific to dtolnay/rust-toolchain: Comma-separated string of additional components to install + components: rustfmt + - name: Enforce formatting + run: cargo fmt --check + + # `clippy` container job + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - name: Linting + run: cargo clippy -- -D warnings diff --git a/.gitignore b/.gitignore index 411036c5a..6fef52587 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ test-ledger/ **/*.rs.bk **/*/test-ledger **/*/yarn.lock + +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 000000000..29ecb6664 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,3517 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "account-data-anchor-program-example" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "account-data-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", +] + +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", + "opaque-debug", +] + +[[package]] +name = "aes-gcm-siv" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589c637f0e68c877bbd59a4599bbe849cac8e5f3e4b5a3ebae8f528cd218dcdc" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "polyval", + "subtle", + "zeroize", +] + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.10", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.10", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +dependencies = [ + "memchr", +] + +[[package]] +name = "amm-tutorial" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", + "anchor-spl", + "fixed", + "fixed-sqrt", + "half", + "solana-program", + "toml_datetime", + "winnow", +] + +[[package]] +name = "anchor-attribute-access-control" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf7d535e1381be3de2c0716c0a1c1e32ad9df1042cddcf7bc18d743569e53319" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-access-control" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faa5be5b72abea167f87c868379ba3c2be356bfca9e6f474fd055fa0f7eeb4f2" +dependencies = [ + "anchor-syn 0.28.0", + "anyhow", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3bcd731f21048a032be27c7791701120e44f3f6371358fc4261a7f716283d29" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f468970344c7c9f9d03b4da854fd7c54f21305059f53789d0045c1dd803f0018" +dependencies = [ + "anchor-syn 0.28.0", + "anyhow", + "bs58 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1be64a48e395fe00b8217287f226078be2cf32dae42fdf8a885b997945c3d28" +dependencies = [ + "anchor-syn 0.26.0", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59948e7f9ef8144c2aefb3f32a40c5fce2798baeec765ba038389e82301017ef" +dependencies = [ + "anchor-syn 0.28.0", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ea6713d1938c0da03656ff8a693b17dc0396da66d1ba320557f07e86eca0d4" +dependencies = [ + "anchor-syn 0.26.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc753c9d1c7981cb8948cf7e162fb0f64558999c0413058e2d43df1df5448086" +dependencies = [ + "anchor-syn 0.28.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d401f11efb3644285685f8339829a9786d43ed7490bb1699f33c478d04d5a582" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38b4e172ba1b52078f53fdc9f11e3dc0668ad27997838a0aad2d148afac8c97" +dependencies = [ + "anchor-syn 0.28.0", + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-interface" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6700a6f5c888a9c33fe8afc0c64fd8575fa28d05446037306d0f96102ae4480" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "heck", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ad769993b5266714e8939e47fbdede90e5c030333c7522d99a4d4748cf26712" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eebd21543606ab61e2d83d9da37d24d3886a49f390f9c43a1964735e8c0f0d5" +dependencies = [ + "anchor-syn 0.28.0", + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-state" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e677fae4a016a554acdd0e3b7f178d3acafaa7e7ffac6b8690cf4e171f1c116" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "340beef6809d1c3fcc7ae219153d981e95a8a277ff31985bd7050e32645dc9a8" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4720d899b3686396cced9508f23dab420f1308344456ec78ef76f98fda42af" +dependencies = [ + "anchor-syn 0.28.0", + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-space" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f495e85480bd96ddeb77b71d499247c7d4e8b501e75ecb234e9ef7ae7bd6552a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-lang" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "662ceafe667448ee4199a4be2ee83b6bb76da28566eee5cea05f96ab38255af8" +dependencies = [ + "anchor-attribute-access-control 0.26.0", + "anchor-attribute-account 0.26.0", + "anchor-attribute-constant 0.26.0", + "anchor-attribute-error 0.26.0", + "anchor-attribute-event 0.26.0", + "anchor-attribute-interface", + "anchor-attribute-program 0.26.0", + "anchor-attribute-state", + "anchor-derive-accounts 0.26.0", + "arrayref", + "base64 0.13.1", + "bincode", + "borsh 0.9.3", + "bytemuck", + "solana-program", + "thiserror", +] + +[[package]] +name = "anchor-lang" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d2d4b20100f1310a774aba3471ef268e5c4ba4d5c28c0bbe663c2658acbc414" +dependencies = [ + "anchor-attribute-access-control 0.28.0", + "anchor-attribute-account 0.28.0", + "anchor-attribute-constant 0.28.0", + "anchor-attribute-error 0.28.0", + "anchor-attribute-event 0.28.0", + "anchor-attribute-program 0.28.0", + "anchor-derive-accounts 0.28.0", + "anchor-derive-space", + "arrayref", + "base64 0.13.1", + "bincode", + "borsh 0.10.3", + "bytemuck", + "getrandom 0.2.10", + "solana-program", + "thiserror", +] + +[[package]] +name = "anchor-program-example" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "anchor-spl" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78f860599da1c2354e7234c768783049eb42e2f54509ecfc942d2e0076a2da7b" +dependencies = [ + "anchor-lang 0.28.0", + "solana-program", + "spl-associated-token-account 1.1.3", + "spl-token 3.5.0", + "spl-token-2022 0.6.1", +] + +[[package]] +name = "anchor-syn" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0418bcb5daac3b8cb1b60d8fdb1d468ca36f5509f31fb51179326fae1028fdcc" +dependencies = [ + "anyhow", + "bs58 0.3.1", + "heck", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "serde", + "serde_json", + "sha2 0.9.9", + "syn 1.0.109", + "thiserror", +] + +[[package]] +name = "anchor-syn" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a125e4b0cc046cfec58f5aa25038e34cf440151d58f0db3afc55308251fe936d" +dependencies = [ + "anyhow", + "bs58 0.5.0", + "heck", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2 0.10.7", + "syn 1.0.109", + "thiserror", +] + +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools", + "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", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "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-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.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", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[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-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 = "array-bytes" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ad284aeb45c13f2fb4f084de4a420ebf447423bdf9386c0540ce33cb3ef4b8c" + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[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.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" + +[[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 = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + +[[package]] +name = "blake3" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +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 = [ + "block-padding", + "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 = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive 0.9.3", + "hashbrown 0.11.2", +] + +[[package]] +name = "borsh" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" +dependencies = [ + "borsh-derive 0.10.3", + "hashbrown 0.13.2", +] + +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal 0.9.3", + "borsh-schema-derive-internal 0.9.3", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" +dependencies = [ + "borsh-derive-internal 0.10.3", + "borsh-schema-derive-internal 0.10.3", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[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 = "bytemuck" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "carnival" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "checking-accounts-anchor-program-example" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "checking-accounts-program" +version = "0.1.0" +dependencies = [ + "solana-program", +] + +[[package]] +name = "chrono" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array", +] + +[[package]] +name = "close-account-native-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", +] + +[[package]] +name = "close-account-program" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "cnft-vault" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.26.0", + "mpl-bubblegum", + "solana-program", + "spl-account-compression", +] + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + +[[package]] +name = "counter-mpl-stack" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "shank 0.0.8", + "solana-program", +] + +[[package]] +name = "counter-solana-native" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "solana-program", +] + +[[package]] +name = "counter_anchor" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "cpufeatures" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +dependencies = [ + "libc", +] + +[[package]] +name = "create-account-program" +version = "0.1.0" +dependencies = [ + "solana-program", +] + +[[package]] +name = "create-system-account" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "create-token" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", + "anchor-spl", + "mpl-token-metadata", +] + +[[package]] +name = "create-token-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "mpl-token-metadata", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token 4.0.0", +] + +[[package]] +name = "cross-program-invocatio-anchor-hand" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", + "cross-program-invocatio-anchor-lever", +] + +[[package]] +name = "cross-program-invocatio-anchor-lever" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "cross-program-invocatio-native-hand" +version = "0.1.0" +dependencies = [ + "borsh 0.10.3", + "borsh-derive 0.10.3", + "cross-program-invocatio-native-lever", + "solana-program", +] + +[[package]] +name = "cross-program-invocatio-native-lever" +version = "0.1.0" +dependencies = [ + "borsh 0.10.3", + "borsh-derive 0.10.3", + "solana-program", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "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.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "serde", + "subtle", + "zeroize", +] + +[[package]] +name = "cutils" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.26.0", + "getrandom 0.2.10", + "mpl-bubblegum", + "solana-program", + "spl-account-compression", + "toml_datetime", + "winnow", +] + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.29", +] + +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.29", +] + +[[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 = "dyn-clone" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" + +[[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", + "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.7", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[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 = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "fixed" +version = "1.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79386fdcec5e0fde91b1a6a5bcd89677d1f9304f7f986b154a1b9109038854d9" +dependencies = [ + "az", + "bytemuck", + "half", + "typenum", +] + +[[package]] +name = "fixed-sqrt" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af725dbdc8dd186b6914026b51e43d99b332e8e816d3b495b84bf8304ac17b73" +dependencies = [ + "fixed", + "integer-sqrt", + "typenum", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "serde", + "typenum", + "version_check", +] + +[[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.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "half" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.6", +] + +[[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 0.8.3", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hello-solana-anchor" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "hello-solana-program" +version = "0.1.0" +dependencies = [ + "solana-program", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[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 = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "rayon", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + +[[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", +] + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "jobserver" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[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 = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5486aed0026218e61b8a01d5fbd5a0a134649abb71a0e53b7bc088529dced86e" + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +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 = "mpl-bubblegum" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b751e0658d7414a801b2fee9802d884f508724fdc1d8645405f69e604d348bc1" +dependencies = [ + "anchor-lang 0.26.0", + "bytemuck", + "mpl-token-metadata", + "solana-program", + "spl-account-compression", + "spl-associated-token-account 1.1.3", + "spl-token 3.5.0", +] + +[[package]] +name = "mpl-token-auth-rules" +version = "1.4.3-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81a34d740606a10a9dac7507d0c9025d72e0ce311c68ae85b6634982cf69a9c6" +dependencies = [ + "borsh 0.9.3", + "bytemuck", + "mpl-token-metadata-context-derive 0.2.1", + "num-derive", + "num-traits", + "rmp-serde", + "serde", + "shank 0.0.11", + "solana-program", + "solana-zk-token-sdk", + "thiserror", +] + +[[package]] +name = "mpl-token-metadata" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "654976568c99887549e1291e7b7e55ae31a70732e56ebb25cb1cdfc08c018333" +dependencies = [ + "arrayref", + "borsh 0.9.3", + "mpl-token-auth-rules", + "mpl-token-metadata-context-derive 0.3.0", + "mpl-utils", + "num-derive", + "num-traits", + "shank 0.0.11", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token 4.0.0", + "thiserror", +] + +[[package]] +name = "mpl-token-metadata-context-derive" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12989bc45715b0ee91944855130131479f9c772e198a910c3eb0ea327d5bffc3" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "mpl-token-metadata-context-derive" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a739019e11d93661a64ef5fe108ab17c79b35961e944442ff6efdd460ad01a" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "mpl-utils" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2e4f92aec317d5853c0cc4c03c55f5178511c45bb3dbb441aea63117bf3dc9" +dependencies = [ + "arrayref", + "solana-program", + "spl-token-2022 0.6.1", +] + +[[package]] +name = "nft-minter" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", + "anchor-spl", + "mpl-token-metadata", + "spl-token 4.0.0", +] + +[[package]] +name = "nft-minter-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "mpl-token-metadata", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token 4.0.0", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[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-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.2", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive 0.6.1", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac", +] + +[[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 = "pda-mint-authority-anchor" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", + "anchor-spl", + "mpl-token-metadata", + "spl-token 4.0.0", +] + +[[package]] +name = "pda-mint-authority-native-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "mpl-token-metadata", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token 4.0.0", +] + +[[package]] +name = "pda-rent-payer" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "pda-rent-payer-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", + "yansi", +] + +[[package]] +name = "processing-instructions" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "processing-instructions-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", +] + +[[package]] +name = "program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", +] + +[[package]] +name = "program-derived-addresses-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", +] + +[[package]] +name = "pyth-sdk" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7aeef4d5f0a9c98ff5af2ddd84a8b89919c512188305b497a9eb9afa97a949" +dependencies = [ + "borsh 0.10.3", + "borsh-derive 0.10.3", + "getrandom 0.2.10", + "hex", + "schemars", + "serde", +] + +[[package]] +name = "pyth-sdk-solana" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa571ea6ea51102b8fc03303d0e6fea4f788f77bb4e0d65ae2d3c5e384e3187" +dependencies = [ + "borsh 0.10.3", + "borsh-derive 0.10.3", + "bytemuck", + "num-derive", + "num-traits", + "pyth-sdk", + "serde", + "solana-program", + "thiserror", +] + +[[package]] +name = "pythexample" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", + "pyth-sdk", + "pyth-sdk-solana", +] + +[[package]] +name = "qstring" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[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 = [ + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[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_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.10", +] + +[[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 = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + +[[package]] +name = "realloc-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "rent-example" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "repository-layout-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", +] + +[[package]] +name = "rmp" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" +dependencies = [ + "byteorder", + "rmp", + "serde", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "schemars" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763f8cd0d4c71ed8389c90cb8100cba87e763bd01a8e614d4f0af97bcd50a161" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0f696e21e10fa546b7ffb1c9672c6de8fbc7a81acf59524386d8639bf12737" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 1.0.109", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" + +[[package]] +name = "serde" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "serde_derive_internals" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "serde_json" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[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.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[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 = "shank" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2935c06d5a141ad2854622a014e30c5eeaa40096667df6bdd682dba9f8f81819" +dependencies = [ + "shank_macro 0.0.8", +] + +[[package]] +name = "shank" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63e565b5e95ad88ab38f312e89444c749360641c509ef2de0093b49f55974a5" +dependencies = [ + "shank_macro 0.0.11", +] + +[[package]] +name = "shank_macro" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab8a1eb550845e36c88007f4c00175eeeb436d2fc6c70d05207a338cba7519f" +dependencies = [ + "proc-macro2", + "quote", + "shank_macro_impl 0.0.8", + "syn 1.0.109", +] + +[[package]] +name = "shank_macro" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63927d22a1e8b74bda98cc6e151fcdf178b7abb0dc6c4f81e0bbf5ffe2fc4ec8" +dependencies = [ + "proc-macro2", + "quote", + "shank_macro_impl 0.0.11", + "syn 1.0.109", +] + +[[package]] +name = "shank_macro_impl" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ec51b35f2336faaeff44daf8952ddee4fe3e3693a313804ae7366f18a9967d" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "serde", + "syn 1.0.109", +] + +[[package]] +name = "shank_macro_impl" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ce03403df682f80f4dc1efafa87a4d0cb89b03726d0565e6364bdca5b9a441" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "serde", + "syn 1.0.109", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "solana-frozen-abi" +version = "1.16.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5bea7d4af435e9dea1399e89cb1318d733abae64a5d5982cff6391d9c486a5d" +dependencies = [ + "ahash 0.8.3", + "blake3", + "block-buffer 0.10.4", + "bs58 0.4.0", + "bv", + "byteorder", + "cc", + "either", + "generic-array", + "getrandom 0.1.16", + "im", + "lazy_static", + "log", + "memmap2", + "once_cell", + "rand_core 0.6.4", + "rustc_version", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "sha2 0.10.7", + "solana-frozen-abi-macro", + "subtle", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.16.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86c30e992a5ac91b85c07a64bfb5c70e7bf734cb6494289ca59963d03e788e7d" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.29", +] + +[[package]] +name = "solana-logger" +version = "1.16.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee8421b323150e02409c3588da5796a853bba131df17e9ec1073818158e278f" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-program" +version = "1.16.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad831bc4fa40b061daf6f189c8764e8b1e0e340ea16e189166ef8f6b530c3679" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "array-bytes", + "base64 0.21.3", + "bincode", + "bitflags", + "blake3", + "borsh 0.10.3", + "borsh 0.9.3", + "bs58 0.4.0", + "bv", + "bytemuck", + "cc", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.2.10", + "itertools", + "js-sys", + "lazy_static", + "libc", + "libsecp256k1", + "log", + "memoffset", + "num-bigint", + "num-derive", + "num-traits", + "parking_lot", + "rand 0.7.3", + "rand_chacha 0.2.2", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "sha2 0.10.7", + "sha3 0.10.8", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk-macro", + "thiserror", + "tiny-bip39", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "solana-sdk" +version = "1.16.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52dcc5c27c8bc49051ea413b75eb1a966e767a46988bd951eaf27552e9ca6e45" +dependencies = [ + "assert_matches", + "base64 0.21.3", + "bincode", + "bitflags", + "borsh 0.10.3", + "bs58 0.4.0", + "bytemuck", + "byteorder", + "chrono", + "derivation-path", + "digest 0.10.7", + "ed25519-dalek", + "ed25519-dalek-bip32", + "generic-array", + "hmac 0.12.1", + "itertools", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "memmap2", + "num-derive", + "num-traits", + "num_enum 0.6.1", + "pbkdf2 0.11.0", + "qstring", + "rand 0.7.3", + "rand_chacha 0.2.2", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "serde_with", + "sha2 0.10.7", + "sha3 0.10.8", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-program", + "solana-sdk-macro", + "thiserror", + "uriparse", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-macro" +version = "1.16.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "691874c5e3ca1cc172421b8266b1bf96bfdb6d7e2685543e7604aa4de2fd07f3" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.29", +] + +[[package]] +name = "solana-zk-token-sdk" +version = "1.16.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c69f98436696bc906c366a46394819c79f33731b1148d22080204a0b714c05b3" +dependencies = [ + "aes-gcm-siv", + "base64 0.21.3", + "bincode", + "bytemuck", + "byteorder", + "curve25519-dalek", + "getrandom 0.1.16", + "itertools", + "lazy_static", + "merlin", + "num-derive", + "num-traits", + "rand 0.7.3", + "serde", + "serde_json", + "sha3 0.9.1", + "solana-program", + "solana-sdk", + "subtle", + "thiserror", + "zeroize", +] + +[[package]] +name = "spl-account-compression" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7a5417eae3c924553b872de5f1bca5945334a235f8d94841bd44c6dd7c6358c" +dependencies = [ + "anchor-lang 0.26.0", + "bytemuck", + "spl-concurrent-merkle-tree", + "spl-noop", +] + +[[package]] +name = "spl-associated-token-account" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978dba3bcbe88d0c2c58366c254d9ea41c5f73357e72fc0bdee4d6b5fc99c8f4" +dependencies = [ + "assert_matches", + "borsh 0.9.3", + "num-derive", + "num-traits", + "solana-program", + "spl-token 3.5.0", + "spl-token-2022 0.6.1", + "thiserror", +] + +[[package]] +name = "spl-associated-token-account" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02693d7b36cea2b45318b87f22406909879226963296f31f4ebb0fc7f6e1aeb3" +dependencies = [ + "assert_matches", + "borsh 0.10.3", + "num-derive", + "num-traits", + "solana-program", + "spl-token 4.0.0", + "spl-token-2022 0.7.0", + "thiserror", +] + +[[package]] +name = "spl-concurrent-merkle-tree" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26dd605d33bdc8d2522a9f55207c3eac06737b2e8310f602e252b510e3db1210" +dependencies = [ + "bytemuck", + "solana-program", + "thiserror", +] + +[[package]] +name = "spl-discriminator" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator-derive", +] + +[[package]] +name = "spl-discriminator-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4fa8f409b5c5e0ac571df17c981ae1424b204743daa4428430627d38717caf5" +dependencies = [ + "quote", + "spl-discriminator-syn", + "syn 2.0.29", +] + +[[package]] +name = "spl-discriminator-syn" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21968d7da2f0a624c509f24580c3fee70b364a6886d90709e679e64f572eca2f" +dependencies = [ + "proc-macro2", + "quote", + "solana-program", + "syn 2.0.29", + "thiserror", +] + +[[package]] +name = "spl-memo" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325" +dependencies = [ + "solana-program", +] + +[[package]] +name = "spl-noop" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558536c75b5aed018113bfca39cddb414cd7ca77da7658d668e751d977830cda" +dependencies = [ + "solana-program", +] + +[[package]] +name = "spl-program-error" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af92f74cd3b0fdfda59fef4b571a92123e4df0f67cc43f73163975d31118ef82" +dependencies = [ + "num-derive", + "num-traits", + "solana-program", + "spl-program-error-derive", + "thiserror", +] + +[[package]] +name = "spl-program-error-derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173f3cc506847882189b3a5b67299f617fed2f9730f122dd197b82e1e213dee5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "spl-tlv-account-resolution" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82149a5a06b5f158d03904066375eaf0c8a2422557cc3d5a25d277260d9a3b16" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator", + "spl-program-error", + "spl-type-length-value", +] + +[[package]] +name = "spl-token" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e85e168a785e82564160dcb87b2a8e04cee9bfd1f4d488c729d53d6a4bd300d" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.5.11", + "solana-program", + "thiserror", +] + +[[package]] +name = "spl-token" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08459ba1b8f7c1020b4582c4edf0f5c7511a5e099a7a97570c9698d4f2337060" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.6.1", + "solana-program", + "thiserror", +] + +[[package]] +name = "spl-token-2022" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0043b590232c400bad5ee9eb983ced003d15163c4c5d56b090ac6d9a57457b47" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.5.11", + "solana-program", + "solana-zk-token-sdk", + "spl-memo", + "spl-token 3.5.0", + "thiserror", +] + +[[package]] +name = "spl-token-2022" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b24ac5786a3fefbf59f5606312c61abf87b23154e7a717e5d18216fbea4711db" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.6.1", + "solana-program", + "solana-zk-token-sdk", + "spl-memo", + "spl-token 4.0.0", + "spl-transfer-hook-interface", + "thiserror", +] + +[[package]] +name = "spl-token-minter" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", + "anchor-spl", + "mpl-token-metadata", +] + +[[package]] +name = "spl-token-minter-native-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "mpl-token-metadata", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token 4.0.0", +] + +[[package]] +name = "spl-transfer-hook-interface" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a2326852adf88716fbac7f54cd6ee2c8a0b5a14ede24db3b4519c4ff13df04b" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.6.1", + "solana-program", + "spl-discriminator", + "spl-tlv-account-resolution", + "spl-type-length-value", + "thiserror", +] + +[[package]] +name = "spl-type-length-value" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1d085f426b33b8365fb98383d1b8b3925e21bdfe579c851ceaa7f511dbec191" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator", + "spl-program-error", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[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.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +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 = "token-2022-basic-anchor" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", + "anchor-spl", + "spl-token 3.5.0", + "spl-token-2022 0.7.0", +] + +[[package]] +name = "token-2022-default-account-state-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token-2022 0.7.0", +] + +[[package]] +name = "token-2022-mint-close-authority-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token-2022 0.7.0", +] + +[[package]] +name = "token-2022-multiple-extensions-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token-2022 0.7.0", +] + +[[package]] +name = "token-2022-non-transferable-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token-2022 0.7.0", +] + +[[package]] +name = "token-2022-transfer-fees-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token-2022 0.7.0", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" + +[[package]] +name = "toml_edit" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "transfer-sol" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", +] + +[[package]] +name = "transfer-sol-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "solana-program", +] + +[[package]] +name = "transfer-tokens" +version = "0.1.0" +dependencies = [ + "anchor-lang 0.28.0", + "anchor-spl", + "mpl-token-metadata", +] + +[[package]] +name = "transfer-tokens-program" +version = "0.1.0" +dependencies = [ + "borsh 0.9.3", + "borsh-derive 0.9.3", + "mpl-token-metadata", + "solana-program", + "spl-associated-token-account 2.0.0", + "spl-token 4.0.0", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array", + "subtle", +] + +[[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 = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[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.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[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-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[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_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[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_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[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_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winnow" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +dependencies = [ + "memchr", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..b4ab542f2 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,59 @@ +[workspace] +members = [ + #basic + "basics/account-data/native/program", + "basics/account-data/anchor/programs/anchor-program-example", + "basics/checking-accounts/native/program", + "basics/checking-accounts/anchor/programs/anchor-program-example", + "basics/close-account/native/program", + "basics/close-account/anchor/programs/close-account", + "basics/counter/native", + "basics/counter/anchor/programs/counter_anchor", + "basics/counter/mpl-stack", + "basics/create-account/native/program", + "basics/create-account/anchor/programs/create-system-account", + "basics/cross-program-invocation/native/programs/*", + "basics/cross-program-invocation/anchor/programs/*", + "basics/hello-solana/native/program", + "basics/hello-solana/anchor/programs/*", + "basics/pda-rent-payer/native/program", + "basics/pda-rent-payer/anchor/programs/*", + "basics/processing-instructions/native/program", + "basics/processing-instructions/anchor/programs/*", + "basics/program-derived-addresses/native/program", + "basics/program-derived-addresses/anchor/programs/*", + "basics/realloc/native/program", + "basics/rent/native/program", + "basics/rent/anchor/programs/*", + "basics/repository-layout/native/program", + "basics/repository-layout/anchor/programs/*", + "basics/transfer-sol/native/program", + "basics/transfer-sol/anchor/programs/*", + # compression + "compression/cnft-vault/anchor/programs/*", + "compression/cutils/programs/*", + # oracles + "oracles/pyth/anchor/programs/*", + # tokens + "tokens/create-token/native/program", + "tokens/create-token/anchor/programs/*", + "tokens/nft-minter/native/program", + "tokens/nft-minter/anchor/programs/*", + "tokens/pda-mint-authority/native/program", + "tokens/pda-mint-authority/anchor/programs/*", + "tokens/spl-token-minter/native/program", + "tokens/spl-token-minter/anchor/programs/*", + "tokens/token-2022/basics/anchor/programs/*", + "tokens/token-2022/default-account-state/native/program", + "tokens/token-2022/mint-close-authority/native/program", + "tokens/token-2022/multiple-extensions/native/program", + "tokens/token-2022/non-transferable/native/program", + "tokens/token-2022/transfer-fees/native/program", + "tokens/token-swap/anchor/programs/*", + "tokens/transfer-tokens/native/program", + "tokens/transfer-tokens/anchor/programs/*", + # tools + # "tools/shank-and-solita/native/program", + +] +resolver = "2" diff --git a/basics/account-data/anchor/programs/anchor-program-example/Cargo.toml b/basics/account-data/anchor/programs/anchor-program-example/Cargo.toml index d061366c3..485fc84f9 100644 --- a/basics/account-data/anchor/programs/anchor-program-example/Cargo.toml +++ b/basics/account-data/anchor/programs/anchor-program-example/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "anchor-program-example" +name = "account-data-anchor-program-example" version = "0.1.0" description = "Created with Anchor" edition = "2021" @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/account-data/anchor/programs/anchor-program-example/src/instructions/create.rs b/basics/account-data/anchor/programs/anchor-program-example/src/instructions/create.rs index 83842766c..9f60da8b1 100644 --- a/basics/account-data/anchor/programs/anchor-program-example/src/instructions/create.rs +++ b/basics/account-data/anchor/programs/anchor-program-example/src/instructions/create.rs @@ -1,8 +1,9 @@ use anchor_lang::prelude::*; +use anchor_lang::system_program; use crate::state::AddressInfo; - +#[allow(clippy::result_large_err)] pub fn create_address_info( ctx: Context, name: String, @@ -10,13 +11,7 @@ pub fn create_address_info( street: String, city: String, ) -> Result<()> { - - let address_info = AddressInfo::new( - name, - house_number, - street, - city, - ); + let address_info = AddressInfo::new(name, house_number, street, city); let account_span = (address_info.try_to_vec()?).len(); let lamports_required = (Rent::get()?).minimum_balance(account_span); @@ -46,4 +41,4 @@ pub struct CreateAddressInfo<'info> { #[account(mut)] payer: Signer<'info>, system_program: Program<'info, System>, -} \ No newline at end of file +} diff --git a/basics/account-data/anchor/programs/anchor-program-example/src/instructions/mod.rs b/basics/account-data/anchor/programs/anchor-program-example/src/instructions/mod.rs index addd1017e..cb2f184f0 100644 --- a/basics/account-data/anchor/programs/anchor-program-example/src/instructions/mod.rs +++ b/basics/account-data/anchor/programs/anchor-program-example/src/instructions/mod.rs @@ -1,3 +1,3 @@ pub mod create; -pub use create::*; \ No newline at end of file +pub use create::*; diff --git a/basics/account-data/anchor/programs/anchor-program-example/src/lib.rs b/basics/account-data/anchor/programs/anchor-program-example/src/lib.rs index 73a6c58ec..b93cde2fe 100644 --- a/basics/account-data/anchor/programs/anchor-program-example/src/lib.rs +++ b/basics/account-data/anchor/programs/anchor-program-example/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; use instructions::*; @@ -5,14 +7,13 @@ use instructions::*; pub mod instructions; pub mod state; - declare_id!("FFKtnYFyzPj1qFjE9epkrfYHJwZMdh8CvJrB6XsKeFVz"); - #[program] pub mod anchor_program_example { use super::*; + #[allow(clippy::result_large_err)] pub fn create_address_info( ctx: Context, name: String, @@ -20,13 +21,6 @@ pub mod anchor_program_example { street: String, city: String, ) -> Result<()> { - - instructions::create::create_address_info( - ctx, - name, - house_number, - street, - city, - ) + instructions::create::create_address_info(ctx, name, house_number, street, city) } -} \ No newline at end of file +} diff --git a/basics/account-data/anchor/programs/anchor-program-example/src/state/address_info.rs b/basics/account-data/anchor/programs/anchor-program-example/src/state/address_info.rs index e2f7e3847..8561c8a28 100644 --- a/basics/account-data/anchor/programs/anchor-program-example/src/state/address_info.rs +++ b/basics/account-data/anchor/programs/anchor-program-example/src/state/address_info.rs @@ -1,6 +1,5 @@ use anchor_lang::prelude::*; - #[account] pub struct AddressInfo { pub name: String, @@ -10,13 +9,7 @@ pub struct AddressInfo { } impl AddressInfo { - - pub fn new( - name: String, - house_number: u8, - street: String, - city: String, - ) -> Self { + pub fn new(name: String, house_number: u8, street: String, city: String) -> Self { AddressInfo { name, house_number, @@ -24,4 +17,4 @@ impl AddressInfo { city, } } -} \ No newline at end of file +} diff --git a/basics/account-data/anchor/programs/anchor-program-example/src/state/mod.rs b/basics/account-data/anchor/programs/anchor-program-example/src/state/mod.rs index 7d524ee17..4cd006d5d 100644 --- a/basics/account-data/anchor/programs/anchor-program-example/src/state/mod.rs +++ b/basics/account-data/anchor/programs/anchor-program-example/src/state/mod.rs @@ -1,3 +1,3 @@ pub mod address_info; -pub use address_info::*; \ No newline at end of file +pub use address_info::*; diff --git a/basics/account-data/native/program/Cargo.toml b/basics/account-data/native/program/Cargo.toml index 70fb25441..4a698a115 100644 --- a/basics/account-data/native/program/Cargo.toml +++ b/basics/account-data/native/program/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "program" +name = "account-data-program" version = "0.1.0" edition = "2021" [dependencies] -solana-program = "1.10.12" +solana-program = "1.16.10" borsh = "0.9.3" borsh-derive = "0.9.1" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/account-data/native/program/src/instructions/create.rs b/basics/account-data/native/program/src/instructions/create.rs index 7685b0f93..aa4f2473e 100644 --- a/basics/account-data/native/program/src/instructions/create.rs +++ b/basics/account-data/native/program/src/instructions/create.rs @@ -1,24 +1,21 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; +use borsh::BorshSerialize; use solana_program::{ - account_info::{ AccountInfo, next_account_info }, - entrypoint::ProgramResult, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, program::invoke, pubkey::Pubkey, rent::Rent, system_instruction, - system_program, sysvar::Sysvar, }; use crate::state::AddressInfo; - pub fn create_address_info( program_id: &Pubkey, accounts: &[AccountInfo], address_info: AddressInfo, ) -> ProgramResult { - let accounts_iter = &mut accounts.iter(); let address_info_account = next_account_info(accounts_iter)?; let payer = next_account_info(accounts_iter)?; @@ -29,18 +26,19 @@ pub fn create_address_info( invoke( &system_instruction::create_account( - &payer.key, - &address_info_account.key, + payer.key, + address_info_account.key, lamports_required, account_span as u64, program_id, ), &[ - payer.clone(), address_info_account.clone(), system_program.clone() - ] + payer.clone(), + address_info_account.clone(), + system_program.clone(), + ], )?; - + address_info.serialize(&mut &mut address_info_account.data.borrow_mut()[..])?; Ok(()) } - diff --git a/basics/account-data/native/program/src/instructions/mod.rs b/basics/account-data/native/program/src/instructions/mod.rs index addd1017e..cb2f184f0 100644 --- a/basics/account-data/native/program/src/instructions/mod.rs +++ b/basics/account-data/native/program/src/instructions/mod.rs @@ -1,3 +1,3 @@ pub mod create; -pub use create::*; \ No newline at end of file +pub use create::*; diff --git a/basics/account-data/native/program/src/lib.rs b/basics/account-data/native/program/src/lib.rs index 42fed2707..1a7ee3d68 100644 --- a/basics/account-data/native/program/src/lib.rs +++ b/basics/account-data/native/program/src/lib.rs @@ -6,5 +6,4 @@ pub mod instructions; pub mod processor; pub mod state; - -entrypoint!(process_instruction); \ No newline at end of file +entrypoint!(process_instruction); diff --git a/basics/account-data/native/program/src/processor.rs b/basics/account-data/native/program/src/processor.rs index 300beca96..4a8c4315b 100644 --- a/basics/account-data/native/program/src/processor.rs +++ b/basics/account-data/native/program/src/processor.rs @@ -1,27 +1,20 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; +use borsh::BorshDeserialize; use solana_program::{ - account_info::AccountInfo, - entrypoint::ProgramResult, - program_error::ProgramError, + account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError, pubkey::Pubkey, }; use crate::instructions; use crate::state::AddressInfo; - pub fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - - match AddressInfo::try_from_slice(&instruction_data) { - Ok(address_info) => return instructions::create::create_address_info( - program_id, accounts, address_info - ), - Err(_) => {}, + if let Ok(address_info) = AddressInfo::try_from_slice(instruction_data) { + return instructions::create::create_address_info(program_id, accounts, address_info); }; Err(ProgramError::InvalidInstructionData) -} \ No newline at end of file +} diff --git a/basics/account-data/native/program/src/state/address_info.rs b/basics/account-data/native/program/src/state/address_info.rs index 27002cad6..1fd1aa2ea 100644 --- a/basics/account-data/native/program/src/state/address_info.rs +++ b/basics/account-data/native/program/src/state/address_info.rs @@ -1,5 +1,4 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; - +use borsh::{BorshDeserialize, BorshSerialize}; #[derive(BorshDeserialize, BorshSerialize, Debug)] pub struct AddressInfo { @@ -10,13 +9,7 @@ pub struct AddressInfo { } impl AddressInfo { - - pub fn new( - name: String, - house_number: u8, - street: String, - city: String, - ) -> Self { + pub fn new(name: String, house_number: u8, street: String, city: String) -> Self { AddressInfo { name, house_number, @@ -24,4 +17,4 @@ impl AddressInfo { city, } } -} \ No newline at end of file +} diff --git a/basics/account-data/native/program/src/state/mod.rs b/basics/account-data/native/program/src/state/mod.rs index 7d524ee17..4cd006d5d 100644 --- a/basics/account-data/native/program/src/state/mod.rs +++ b/basics/account-data/native/program/src/state/mod.rs @@ -1,3 +1,3 @@ pub mod address_info; -pub use address_info::*; \ No newline at end of file +pub use address_info::*; diff --git a/basics/checking-accounts/anchor/programs/anchor-program-example/Cargo.toml b/basics/checking-accounts/anchor/programs/anchor-program-example/Cargo.toml index d061366c3..4b24f9b28 100644 --- a/basics/checking-accounts/anchor/programs/anchor-program-example/Cargo.toml +++ b/basics/checking-accounts/anchor/programs/anchor-program-example/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "anchor-program-example" +name = "checking-accounts-anchor-program-example" version = "0.1.0" description = "Created with Anchor" edition = "2021" @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/checking-accounts/anchor/programs/anchor-program-example/src/lib.rs b/basics/checking-accounts/anchor/programs/anchor-program-example/src/lib.rs index 6c05f8160..25b091d17 100644 --- a/basics/checking-accounts/anchor/programs/anchor-program-example/src/lib.rs +++ b/basics/checking-accounts/anchor/programs/anchor-program-example/src/lib.rs @@ -1,15 +1,15 @@ -use anchor_lang::prelude::*; +#![allow(clippy::result_large_err)] +use anchor_lang::prelude::*; declare_id!("ECWPhR3rJbaPfyNFgphnjxSEexbTArc7vxD8fnW6tgKw"); - #[program] pub mod anchor_program_example { use super::*; + #[allow(clippy::result_large_err)] pub fn check_accounts(_ctx: Context) -> Result<()> { - Ok(()) } } diff --git a/basics/checking-accounts/native/program/Cargo.toml b/basics/checking-accounts/native/program/Cargo.toml index 23a922562..3f17cac1a 100644 --- a/basics/checking-accounts/native/program/Cargo.toml +++ b/basics/checking-accounts/native/program/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "program" +name = "checking-accounts-program" version = "0.1.0" edition = "2021" @@ -7,4 +7,4 @@ edition = "2021" solana-program = "1.10.12" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/checking-accounts/native/program/src/lib.rs b/basics/checking-accounts/native/program/src/lib.rs index 451633188..93461dc19 100644 --- a/basics/checking-accounts/native/program/src/lib.rs +++ b/basics/checking-accounts/native/program/src/lib.rs @@ -1,36 +1,33 @@ use solana_program::{ - account_info::{ AccountInfo, next_account_info }, - entrypoint, - entrypoint::ProgramResult, - msg, + account_info::{next_account_info, AccountInfo}, + entrypoint, + entrypoint::ProgramResult, + msg, program_error::ProgramError, pubkey::Pubkey, system_program, }; - entrypoint!(process_instruction); - fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], _instruction_data: &[u8], ) -> ProgramResult { - - // You can verify the program ID from the instruction is in fact + // You can verify the program ID from the instruction is in fact // the program ID of your program. if system_program::check_id(program_id) { - return Err(ProgramError::IncorrectProgramId) + return Err(ProgramError::IncorrectProgramId); }; - + // You can verify the list has the correct number of accounts. - // This error will get thrown by default if you + // This error will get thrown by default if you // try to reach past the end of the iter. if accounts.len() < 4 { msg!("This instruction requires 4 accounts:"); msg!(" payer, account_to_create, account_to_change, system_program"); - return Err(ProgramError::NotEnoughAccountKeys) + return Err(ProgramError::NotEnoughAccountKeys); }; // Accounts passed in a vector must be in the expected order. @@ -41,11 +38,11 @@ fn process_instruction( let system_program = next_account_info(accounts_iter)?; // You can make sure an account has NOT been initialized. - + msg!("New account: {}", account_to_create.key); if account_to_create.lamports() != 0 { msg!("The program expected the account to create to not yet be initialized."); - return Err(ProgramError::AccountAlreadyInitialized) + return Err(ProgramError::AccountAlreadyInitialized); }; // (Create account...) @@ -53,19 +50,19 @@ fn process_instruction( msg!("Account to change: {}", account_to_change.key); if account_to_change.lamports() == 0 { msg!("The program expected the account to change to be initialized."); - return Err(ProgramError::UninitializedAccount) + return Err(ProgramError::UninitializedAccount); }; // If we want to modify an account's data, it must be owned by our program. if account_to_change.owner != program_id { msg!("Account to change does not have the correct program id."); - return Err(ProgramError::IncorrectProgramId) + return Err(ProgramError::IncorrectProgramId); }; // You can also check pubkeys against constants. if system_program.key != &system_program::ID { - return Err(ProgramError::IncorrectProgramId) + return Err(ProgramError::IncorrectProgramId); }; Ok(()) -} \ No newline at end of file +} diff --git a/basics/close-account/anchor/programs/close-account/Cargo.toml b/basics/close-account/anchor/programs/close-account/Cargo.toml index 4b8f4471f..d4ab97c9f 100644 --- a/basics/close-account/anchor/programs/close-account/Cargo.toml +++ b/basics/close-account/anchor/programs/close-account/Cargo.toml @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.25.0" +anchor-lang = "0.28.0" diff --git a/basics/close-account/anchor/programs/close-account/src/instructions/close_user.rs b/basics/close-account/anchor/programs/close-account/src/instructions/close_user.rs index 1f8d21dab..2089198ad 100644 --- a/basics/close-account/anchor/programs/close-account/src/instructions/close_user.rs +++ b/basics/close-account/anchor/programs/close-account/src/instructions/close_user.rs @@ -8,7 +8,7 @@ pub struct CloseUserContext<'info> { #[account( mut, seeds = [ - User::PREFIX.as_bytes().as_ref(), + User::PREFIX.as_bytes(), user.key().as_ref(), ], has_one = user, diff --git a/basics/close-account/anchor/programs/close-account/src/instructions/create_user.rs b/basics/close-account/anchor/programs/close-account/src/instructions/create_user.rs index 9e204fb3b..27b3d91fa 100644 --- a/basics/close-account/anchor/programs/close-account/src/instructions/create_user.rs +++ b/basics/close-account/anchor/programs/close-account/src/instructions/create_user.rs @@ -15,7 +15,7 @@ pub struct CreateUserContext<'info> { space = User::SIZE, payer = payer, seeds = [ - User::PREFIX.as_bytes().as_ref(), + User::PREFIX.as_bytes(), payer.key().as_ref(), ], bump diff --git a/basics/close-account/anchor/programs/close-account/src/lib.rs b/basics/close-account/anchor/programs/close-account/src/lib.rs index a3628a54e..795133d4e 100644 --- a/basics/close-account/anchor/programs/close-account/src/lib.rs +++ b/basics/close-account/anchor/programs/close-account/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; mod instructions; diff --git a/basics/close-account/native/program/Cargo.toml b/basics/close-account/native/program/Cargo.toml index ea2b2fdb7..6dc2c2cf4 100644 --- a/basics/close-account/native/program/Cargo.toml +++ b/basics/close-account/native/program/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "program" +name = "close-account-native-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.12" +solana-program = "1.16.10" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/close-account/native/program/src/instructions/create_user.rs b/basics/close-account/native/program/src/instructions/create_user.rs index ec67b0823..dc03f53a1 100644 --- a/basics/close-account/native/program/src/instructions/create_user.rs +++ b/basics/close-account/native/program/src/instructions/create_user.rs @@ -27,8 +27,8 @@ pub fn create_user(program_id: &Pubkey, accounts: &[AccountInfo], data: User) -> invoke_signed( &system_instruction::create_account( - &payer.key, - &target_account.key, + payer.key, + target_account.key, lamports_required, account_span as u64, program_id, diff --git a/basics/close-account/native/program/src/lib.rs b/basics/close-account/native/program/src/lib.rs index 36340bf05..d3dc6c64f 100644 --- a/basics/close-account/native/program/src/lib.rs +++ b/basics/close-account/native/program/src/lib.rs @@ -1,11 +1,7 @@ - pub mod instructions; pub mod processor; pub mod state; -use { - solana_program::entrypoint, - crate::processor::process_instruction, -}; +use {crate::processor::process_instruction, solana_program::entrypoint}; -entrypoint!(process_instruction); \ No newline at end of file +entrypoint!(process_instruction); diff --git a/basics/close-account/native/program/src/processor.rs b/basics/close-account/native/program/src/processor.rs index e610b2fea..9d9a92471 100644 --- a/basics/close-account/native/program/src/processor.rs +++ b/basics/close-account/native/program/src/processor.rs @@ -15,7 +15,7 @@ pub fn process_instruction( accounts: &[AccountInfo], input: &[u8], ) -> ProgramResult { - let instruction = MyInstruction::try_from_slice(&input)?; + let instruction = MyInstruction::try_from_slice(input)?; match instruction { MyInstruction::CreateUser(data) => create_user(program_id, accounts, data), MyInstruction::CloseUser => close_user(accounts), diff --git a/basics/counter/anchor/programs/counter_anchor/Cargo.toml b/basics/counter/anchor/programs/counter_anchor/Cargo.toml index da7ed12d0..967533bf3 100644 --- a/basics/counter/anchor/programs/counter_anchor/Cargo.toml +++ b/basics/counter/anchor/programs/counter_anchor/Cargo.toml @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.25.0" +anchor-lang = "0.28.0" diff --git a/basics/counter/anchor/programs/counter_anchor/src/lib.rs b/basics/counter/anchor/programs/counter_anchor/src/lib.rs index ff7854613..93502f851 100644 --- a/basics/counter/anchor/programs/counter_anchor/src/lib.rs +++ b/basics/counter/anchor/programs/counter_anchor/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); @@ -6,7 +8,7 @@ declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); pub mod counter_anchor { use super::*; - pub fn initialize_counter(ctx: Context) -> Result<()> { + pub fn initialize_counter(_ctx: Context) -> Result<()> { Ok(()) } diff --git a/basics/counter/mpl-stack/Cargo.toml b/basics/counter/mpl-stack/Cargo.toml index aa4bda59a..af5e2a8b2 100644 --- a/basics/counter/mpl-stack/Cargo.toml +++ b/basics/counter/mpl-stack/Cargo.toml @@ -14,4 +14,4 @@ default = [] [dependencies] borsh = "0.9" shank = "0.0.8" -solana-program = "1.10.38" \ No newline at end of file +solana-program = "1.16.10" diff --git a/basics/counter/mpl-stack/src/lib.rs b/basics/counter/mpl-stack/src/lib.rs index b290ae363..4fd7da615 100644 --- a/basics/counter/mpl-stack/src/lib.rs +++ b/basics/counter/mpl-stack/src/lib.rs @@ -5,10 +5,8 @@ use solana_program::{ declare_id, entrypoint::ProgramResult, msg, - program::{invoke, invoke_signed}, program_error::ProgramError, pubkey::Pubkey, - system_instruction, }; mod state; @@ -48,7 +46,7 @@ pub fn process_instruction( pub fn process_increment_counter( accounts: &[AccountInfo], - instruction_data: &[u8], + _instruction_data: &[u8], ) -> Result<(), ProgramError> { let account_info_iter = &mut accounts.iter(); diff --git a/basics/counter/native/Cargo.toml b/basics/counter/native/Cargo.toml index 3f805885b..189208bcc 100644 --- a/basics/counter/native/Cargo.toml +++ b/basics/counter/native/Cargo.toml @@ -13,4 +13,4 @@ default = [] [dependencies] borsh = "0.9" -solana-program = "1.10.38" \ No newline at end of file +solana-program = "1.16.10" diff --git a/basics/counter/native/src/lib.rs b/basics/counter/native/src/lib.rs index 027bc306c..f1b557354 100644 --- a/basics/counter/native/src/lib.rs +++ b/basics/counter/native/src/lib.rs @@ -4,10 +4,8 @@ use solana_program::{ declare_id, entrypoint::ProgramResult, msg, - program::{invoke, invoke_signed}, program_error::ProgramError, pubkey::Pubkey, - system_instruction, }; mod state; @@ -41,7 +39,7 @@ pub fn process_instruction( pub fn process_increment_counter( accounts: &[AccountInfo], - instruction_data: &[u8], + _instruction_data: &[u8], ) -> Result<(), ProgramError> { let account_info_iter = &mut accounts.iter(); diff --git a/basics/create-account/anchor/programs/create-system-account/Cargo.toml b/basics/create-account/anchor/programs/create-system-account/Cargo.toml index 285e04ad7..f82b3e3d5 100644 --- a/basics/create-account/anchor/programs/create-system-account/Cargo.toml +++ b/basics/create-account/anchor/programs/create-system-account/Cargo.toml @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/create-account/anchor/programs/create-system-account/src/lib.rs b/basics/create-account/anchor/programs/create-system-account/src/lib.rs index d934123aa..9e5c7e379 100644 --- a/basics/create-account/anchor/programs/create-system-account/src/lib.rs +++ b/basics/create-account/anchor/programs/create-system-account/src/lib.rs @@ -1,7 +1,8 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; use anchor_lang::system_program; - declare_id!("6gUwvaZPvC8ZxKuC1h5aKz4mRd7pFyEfUZckiEsBZSbk"); const LAMPORTS_PER_SOL: u64 = 1000000000; @@ -11,21 +12,23 @@ pub mod create_system_account { use super::*; pub fn create_system_account(ctx: Context) -> Result<()> { - msg!("Program invoked. Creating a system account..."); - msg!(" New public key will be: {}", &ctx.accounts.new_account.key().to_string()); + msg!( + " New public key will be: {}", + &ctx.accounts.new_account.key().to_string() + ); system_program::create_account( CpiContext::new( ctx.accounts.system_program.to_account_info(), system_program::CreateAccount { - from: ctx.accounts.payer.to_account_info(), // From pubkey - to: ctx.accounts.new_account.to_account_info(), // To pubkey + from: ctx.accounts.payer.to_account_info(), // From pubkey + to: ctx.accounts.new_account.to_account_info(), // To pubkey }, ), - 1 * LAMPORTS_PER_SOL, // Lamports (1 SOL) - 0, // Space - &ctx.accounts.system_program.key(), // Owner + LAMPORTS_PER_SOL, // Lamports (1 SOL) + 0, // Space + &ctx.accounts.system_program.key(), // Owner )?; msg!("Account created succesfully."); @@ -40,4 +43,4 @@ pub struct CreateSystemAccount<'info> { #[account(mut)] pub new_account: Signer<'info>, pub system_program: Program<'info, System>, -} \ No newline at end of file +} diff --git a/basics/create-account/native/program/Cargo.toml b/basics/create-account/native/program/Cargo.toml index 23a922562..a2fd4dba4 100644 --- a/basics/create-account/native/program/Cargo.toml +++ b/basics/create-account/native/program/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "program" +name = "create-account-program" version = "0.1.0" edition = "2021" [dependencies] -solana-program = "1.10.12" +solana-program = "1.16.10" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/create-account/native/program/src/lib.rs b/basics/create-account/native/program/src/lib.rs index 385ea2e5e..5323de70b 100644 --- a/basics/create-account/native/program/src/lib.rs +++ b/basics/create-account/native/program/src/lib.rs @@ -1,46 +1,40 @@ use solana_program::{ - account_info::{AccountInfo, next_account_info}, - entrypoint, - entrypoint::ProgramResult, - msg, + account_info::{next_account_info, AccountInfo}, + entrypoint, + entrypoint::ProgramResult, + msg, native_token::LAMPORTS_PER_SOL, program::invoke, pubkey::Pubkey, - system_instruction, - system_program, + system_instruction, system_program, }; - entrypoint!(process_instruction); - fn process_instruction( _program_id: &Pubkey, accounts: &[AccountInfo], _instruction_data: &[u8], ) -> ProgramResult { - let accounts_iter = &mut accounts.iter(); let payer = next_account_info(accounts_iter)?; let new_account = next_account_info(accounts_iter)?; let system_program = next_account_info(accounts_iter)?; - + msg!("Program invoked. Creating a system account..."); msg!(" New public key will be: {}", &new_account.key.to_string()); - + invoke( &system_instruction::create_account( - &payer.key, - &new_account.key, - 1 * LAMPORTS_PER_SOL, + payer.key, + new_account.key, + LAMPORTS_PER_SOL, 0, &system_program::ID, ), - &[ - payer.clone(), new_account.clone(), system_program.clone() - ] + &[payer.clone(), new_account.clone(), system_program.clone()], )?; msg!("Account created succesfully."); Ok(()) -} \ No newline at end of file +} diff --git a/basics/cross-program-invocation/anchor/programs/hand/Cargo.toml b/basics/cross-program-invocation/anchor/programs/hand/Cargo.toml index 26a8cd9cf..a754d2c90 100644 --- a/basics/cross-program-invocation/anchor/programs/hand/Cargo.toml +++ b/basics/cross-program-invocation/anchor/programs/hand/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hand" +name = "cross-program-invocatio-anchor-hand" version = "0.1.0" description = "Created with Anchor" edition = "2021" @@ -16,5 +16,5 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" -lever = { path = "../lever", features = ["cpi"] } +anchor-lang = "0.28.0" +cross-program-invocatio-anchor-lever = { path = "../lever", features = ["cpi"] } diff --git a/basics/cross-program-invocation/anchor/programs/hand/src/lib.rs b/basics/cross-program-invocation/anchor/programs/hand/src/lib.rs index eb186a7ee..5abe2a493 100644 --- a/basics/cross-program-invocation/anchor/programs/hand/src/lib.rs +++ b/basics/cross-program-invocation/anchor/programs/hand/src/lib.rs @@ -1,39 +1,35 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; use lever::cpi::accounts::SetPowerStatus; use lever::program::Lever; use lever::{self, PowerStatus}; - declare_id!("ABoYG2GWbzLgnnGhK2pUGNupzKoYe7UGk2idrAXbstAS"); - #[program] mod hand { use super::*; pub fn pull_lever(ctx: Context, name: String) -> anchor_lang::Result<()> { - // Hitting the switch_power method on the lever program // lever::cpi::switch_power( CpiContext::new( - - ctx.accounts.lever_program.to_account_info(), - + ctx.accounts.lever_program.to_account_info(), // Using the accounts context struct from the lever program // - let cpi_accounts = SetPowerStatus { + SetPowerStatus { power: ctx.accounts.power.to_account_info(), - }; - ), - name + }, + ), + name, ) } } - #[derive(Accounts)] pub struct PullLever<'info> { #[account(mut)] pub power: Account<'info, PowerStatus>, pub lever_program: Program<'info, Lever>, -} \ No newline at end of file +} diff --git a/basics/cross-program-invocation/anchor/programs/lever/Cargo.toml b/basics/cross-program-invocation/anchor/programs/lever/Cargo.toml index d65fbc450..b98c6b5a1 100644 --- a/basics/cross-program-invocation/anchor/programs/lever/Cargo.toml +++ b/basics/cross-program-invocation/anchor/programs/lever/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "lever" +name = "cross-program-invocatio-anchor-lever" version = "0.1.0" description = "Created with Anchor" edition = "2021" @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/cross-program-invocation/anchor/programs/lever/src/lib.rs b/basics/cross-program-invocation/anchor/programs/lever/src/lib.rs index 25ea20b29..ad2ad2067 100644 --- a/basics/cross-program-invocation/anchor/programs/lever/src/lib.rs +++ b/basics/cross-program-invocation/anchor/programs/lever/src/lib.rs @@ -1,9 +1,9 @@ -use anchor_lang::prelude::*; +#![allow(clippy::result_large_err)] +use anchor_lang::prelude::*; declare_id!("EnjN3cm7xYqYHNUZbQfhJYj5S5RBrSU9tc5aHwQ6LqvT"); - #[program] pub mod lever { use super::*; @@ -12,7 +12,6 @@ pub mod lever { } pub fn switch_power(ctx: Context, name: String) -> Result<()> { - let power = &mut ctx.accounts.power; power.is_on = !power.is_on; @@ -27,7 +26,6 @@ pub mod lever { } } - #[derive(Accounts)] pub struct InitializeLever<'info> { #[account(init, payer = user, space = 8 + 8)] @@ -46,4 +44,4 @@ pub struct SetPowerStatus<'info> { #[account] pub struct PowerStatus { pub is_on: bool, -} \ No newline at end of file +} diff --git a/basics/cross-program-invocation/native/programs/hand/Cargo.toml b/basics/cross-program-invocation/native/programs/hand/Cargo.toml index 6b8dc1296..e90bf570d 100644 --- a/basics/cross-program-invocation/native/programs/hand/Cargo.toml +++ b/basics/cross-program-invocation/native/programs/hand/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hand" +name = "cross-program-invocatio-native-hand" version = "0.1.0" edition = "2021" @@ -8,10 +8,10 @@ no-entrypoint = [] cpi = ["no-entrypoint"] [dependencies] -borsh = "0.9.3" -borsh-derive = "0.9.1" -solana-program = "1.10.12" -lever = { path = "../lever", features = [ "cpi" ] } +borsh = "0.10" +borsh-derive = "0.10" +solana-program = "1.16.10" +cross-program-invocatio-native-lever = { path = "../lever", features = [ "cpi" ] } [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/cross-program-invocation/native/programs/hand/src/lib.rs b/basics/cross-program-invocation/native/programs/hand/src/lib.rs index 30b56d5c4..f614f2ce4 100644 --- a/basics/cross-program-invocation/native/programs/hand/src/lib.rs +++ b/basics/cross-program-invocation/native/programs/hand/src/lib.rs @@ -1,26 +1,21 @@ use borsh::BorshDeserialize; -use lever::SetPowerStatus; +use cross_program_invocatio_native_lever::SetPowerStatus; use solana_program::{ - account_info::{ - next_account_info, AccountInfo - }, - entrypoint, - entrypoint::ProgramResult, - instruction::{ AccountMeta, Instruction }, - pubkey::Pubkey, + account_info::{next_account_info, AccountInfo}, + entrypoint, + entrypoint::ProgramResult, + instruction::{AccountMeta, Instruction}, program::invoke, + pubkey::Pubkey, }; - entrypoint!(pull_lever); - fn pull_lever( _program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - let accounts_iter = &mut accounts.iter(); let power = next_account_info(accounts_iter)?; let lever_program = next_account_info(accounts_iter)?; @@ -28,9 +23,9 @@ fn pull_lever( let set_power_status_instruction = SetPowerStatus::try_from_slice(instruction_data)?; let ix = Instruction::new_with_borsh( - lever_program.key.clone(), // Our lever program's ID - &set_power_status_instruction, // Passing instructions through - vec![AccountMeta::new(power.key.clone(), false)], // Just the required account for the other program + *lever_program.key, // Our lever program's ID + &set_power_status_instruction, // Passing instructions through + vec![AccountMeta::new(*power.key, false)], // Just the required account for the other program ); invoke(&ix, &[power.clone()]) diff --git a/basics/cross-program-invocation/native/programs/lever/Cargo.toml b/basics/cross-program-invocation/native/programs/lever/Cargo.toml index 4920c3996..2c7aab55f 100644 --- a/basics/cross-program-invocation/native/programs/lever/Cargo.toml +++ b/basics/cross-program-invocation/native/programs/lever/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "lever" +name = "cross-program-invocatio-native-lever" version = "0.1.0" edition = "2021" @@ -8,9 +8,9 @@ no-entrypoint = [] cpi = ["no-entrypoint"] [dependencies] -borsh = "0.9.3" -borsh-derive = "0.9.1" -solana-program = "1.10.12" +borsh = "0.10" +borsh-derive = "0.10" +solana-program = "1.16.10" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/cross-program-invocation/native/programs/lever/src/lib.rs b/basics/cross-program-invocation/native/programs/lever/src/lib.rs index 76875fce4..982511548 100644 --- a/basics/cross-program-invocation/native/programs/lever/src/lib.rs +++ b/basics/cross-program-invocation/native/programs/lever/src/lib.rs @@ -1,11 +1,10 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; +use borsh::{BorshDeserialize, BorshSerialize}; +#[cfg(not(feature = "no-entrypoint"))] +use solana_program::entrypoint; use solana_program::{ - account_info::{ - next_account_info, AccountInfo - }, - entrypoint, - entrypoint::ProgramResult, - msg, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, + msg, program::invoke, program_error::ProgramError, pubkey::Pubkey, @@ -14,38 +13,30 @@ use solana_program::{ sysvar::Sysvar, }; - #[cfg(not(feature = "no-entrypoint"))] entrypoint!(process_instruction); - pub fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - - match PowerStatus::try_from_slice(&instruction_data) { - Ok(power_status) => return initialize(program_id, accounts, power_status), - Err(_) => {}, + if let Ok(power_status) = PowerStatus::try_from_slice(instruction_data) { + return initialize(program_id, accounts, power_status); } - match SetPowerStatus::try_from_slice(&instruction_data) { - Ok(set_power_status) => return switch_power(accounts, set_power_status.name), - Err(_) => {}, + if let Ok(set_power_status) = SetPowerStatus::try_from_slice(instruction_data) { + return switch_power(accounts, set_power_status.name); } Err(ProgramError::InvalidInstructionData) } - - pub fn initialize( program_id: &Pubkey, accounts: &[AccountInfo], power_status: PowerStatus, ) -> ProgramResult { - let accounts_iter = &mut accounts.iter(); let power = next_account_info(accounts_iter)?; let user = next_account_info(accounts_iter)?; @@ -56,15 +47,13 @@ pub fn initialize( invoke( &system_instruction::create_account( - &user.key, - &power.key, + user.key, + power.key, lamports_required, account_span as u64, program_id, ), - &[ - user.clone(), power.clone(), system_program.clone() - ] + &[user.clone(), power.clone(), system_program.clone()], )?; power_status.serialize(&mut &mut power.data.borrow_mut()[..])?; @@ -72,14 +61,10 @@ pub fn initialize( Ok(()) } -pub fn switch_power( - accounts: &[AccountInfo], - name: String, -) -> ProgramResult { - +pub fn switch_power(accounts: &[AccountInfo], name: String) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let power = next_account_info(accounts_iter)?; - + let mut power_status = PowerStatus::try_from_slice(&power.data.borrow())?; power_status.is_on = !power_status.is_on; power_status.serialize(&mut &mut power.data.borrow_mut()[..])?; @@ -94,7 +79,6 @@ pub fn switch_power( Ok(()) } - #[derive(BorshDeserialize, BorshSerialize, Debug)] pub struct SetPowerStatus { pub name: String, @@ -103,4 +87,4 @@ pub struct SetPowerStatus { #[derive(BorshDeserialize, BorshSerialize, Debug)] pub struct PowerStatus { pub is_on: bool, -} \ No newline at end of file +} diff --git a/basics/hello-solana/anchor/programs/hello-solana/Cargo.toml b/basics/hello-solana/anchor/programs/hello-solana/Cargo.toml index a8d673bfd..bf212ad20 100644 --- a/basics/hello-solana/anchor/programs/hello-solana/Cargo.toml +++ b/basics/hello-solana/anchor/programs/hello-solana/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hello-solana" +name = "hello-solana-anchor" version = "0.1.0" description = "Created with Anchor" edition = "2021" @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/hello-solana/anchor/programs/hello-solana/src/lib.rs b/basics/hello-solana/anchor/programs/hello-solana/src/lib.rs index f406f54ec..e72014db0 100644 --- a/basics/hello-solana/anchor/programs/hello-solana/src/lib.rs +++ b/basics/hello-solana/anchor/programs/hello-solana/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; declare_id!("2nYa9FRtxLnaGa5agENEE1ehy6Tr2HnyziwG7ynnyhPC"); @@ -6,12 +8,11 @@ declare_id!("2nYa9FRtxLnaGa5agENEE1ehy6Tr2HnyziwG7ynnyhPC"); pub mod hello_solana { use super::*; - pub fn hello(ctx: Context) -> Result<()> { - + pub fn hello(_ctx: Context) -> Result<()> { msg!("Hello, Solana!"); msg!("Our program's Program ID: {}", &id()); - + Ok(()) } } diff --git a/basics/hello-solana/native/program/Cargo.toml b/basics/hello-solana/native/program/Cargo.toml index 23a922562..5bfea9184 100644 --- a/basics/hello-solana/native/program/Cargo.toml +++ b/basics/hello-solana/native/program/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "program" +name = "hello-solana-program" version = "0.1.0" edition = "2021" [dependencies] -solana-program = "1.10.12" +solana-program = "1.16.10" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/hello-solana/native/program/src/lib.rs b/basics/hello-solana/native/program/src/lib.rs index 17d5246cc..f578ac9b3 100644 --- a/basics/hello-solana/native/program/src/lib.rs +++ b/basics/hello-solana/native/program/src/lib.rs @@ -1,31 +1,23 @@ use solana_program::{ - account_info::AccountInfo, - entrypoint, - entrypoint::ProgramResult, - msg, - pubkey::Pubkey, + account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey, }; - // Tells Solana that the entrypoint to this program // is the "process_instruction" function. // entrypoint!(process_instruction); - // Our entrypoint's parameters have to match the // anatomy of a transaction instruction (see README). // fn process_instruction( program_id: &Pubkey, - accounts: &[AccountInfo], - instruction_data: &[u8], + _accounts: &[AccountInfo], + _instruction_data: &[u8], ) -> ProgramResult { - - msg!("Hello, Solana!"); msg!("Our program's Program ID: {}", &program_id); Ok(()) -} \ No newline at end of file +} diff --git a/basics/pda-rent-payer/anchor/programs/anchor-program-example/Cargo.toml b/basics/pda-rent-payer/anchor/programs/anchor-program-example/Cargo.toml index 05bbc147a..60488f380 100644 --- a/basics/pda-rent-payer/anchor/programs/anchor-program-example/Cargo.toml +++ b/basics/pda-rent-payer/anchor/programs/anchor-program-example/Cargo.toml @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/create_new_account.rs b/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/create_new_account.rs index 4ef68326b..b3e37b174 100644 --- a/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/create_new_account.rs +++ b/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/create_new_account.rs @@ -31,7 +31,7 @@ pub struct CreateNewAccount<'info> { #[account( mut, seeds = [ - RentVault::SEED_PREFIX.as_bytes().as_ref(), + RentVault::SEED_PREFIX.as_bytes(), ], bump = rent_vault.bump, )] diff --git a/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/init_rent_vault.rs b/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/init_rent_vault.rs index 8db769a70..e0443d6ae 100644 --- a/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/init_rent_vault.rs +++ b/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/init_rent_vault.rs @@ -27,7 +27,7 @@ pub struct InitRentVault<'info> { space = RentVault::ACCOUNT_SPACE, payer = payer, seeds = [ - RentVault::SEED_PREFIX.as_bytes().as_ref(), + RentVault::SEED_PREFIX.as_bytes(), ], bump, )] diff --git a/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/lib.rs b/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/lib.rs index ac31a9d10..eab101fcb 100644 --- a/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/lib.rs +++ b/basics/pda-rent-payer/anchor/programs/anchor-program-example/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; use instructions::*; diff --git a/basics/pda-rent-payer/native/program/Cargo.toml b/basics/pda-rent-payer/native/program/Cargo.toml index 70fb25441..362afbd68 100644 --- a/basics/pda-rent-payer/native/program/Cargo.toml +++ b/basics/pda-rent-payer/native/program/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "program" +name = "pda-rent-payer-program" version = "0.1.0" edition = "2021" [dependencies] -solana-program = "1.10.12" +solana-program = "1.16.10" borsh = "0.9.3" borsh-derive = "0.9.1" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/pda-rent-payer/native/program/src/instructions/create_new_account.rs b/basics/pda-rent-payer/native/program/src/instructions/create_new_account.rs index 2376a08c9..071b8127e 100644 --- a/basics/pda-rent-payer/native/program/src/instructions/create_new_account.rs +++ b/basics/pda-rent-payer/native/program/src/instructions/create_new_account.rs @@ -1,10 +1,8 @@ use solana_program::{ account_info::{next_account_info, AccountInfo}, entrypoint::ProgramResult, - program::invoke_signed, pubkey::Pubkey, rent::Rent, - system_instruction, sysvar::Sysvar, }; @@ -14,10 +12,10 @@ pub fn create_new_account(program_id: &Pubkey, accounts: &[AccountInfo]) -> Prog let accounts_iter = &mut accounts.iter(); let new_account = next_account_info(accounts_iter)?; let rent_vault = next_account_info(accounts_iter)?; - let system_program = next_account_info(accounts_iter)?; + let _system_program = next_account_info(accounts_iter)?; - let (rent_vault_pda, rent_vault_bump) = - Pubkey::find_program_address(&[RentVault::SEED_PREFIX.as_bytes().as_ref()], program_id); + let (rent_vault_pda, _rent_vault_bump) = + Pubkey::find_program_address(&[RentVault::SEED_PREFIX.as_bytes()], program_id); assert!(rent_vault.key.eq(&rent_vault_pda)); // Assuming this account has no inner data (size 0) diff --git a/basics/pda-rent-payer/native/program/src/instructions/init_rent_vault.rs b/basics/pda-rent-payer/native/program/src/instructions/init_rent_vault.rs index 1002a8f51..02eb201ae 100644 --- a/basics/pda-rent-payer/native/program/src/instructions/init_rent_vault.rs +++ b/basics/pda-rent-payer/native/program/src/instructions/init_rent_vault.rs @@ -27,7 +27,7 @@ pub fn init_rent_vault( let system_program = next_account_info(accounts_iter)?; let (rent_vault_pda, rent_vault_bump) = - Pubkey::find_program_address(&[RentVault::SEED_PREFIX.as_bytes().as_ref()], program_id); + Pubkey::find_program_address(&[RentVault::SEED_PREFIX.as_bytes()], program_id); assert!(rent_vault.key.eq(&rent_vault_pda)); // Lamports for rent on the vault, plus the desired additional funding @@ -36,17 +36,14 @@ pub fn init_rent_vault( invoke_signed( &system_instruction::create_account( - &payer.key, - &rent_vault.key, + payer.key, + rent_vault.key, lamports_required, 0, program_id, ), &[payer.clone(), rent_vault.clone(), system_program.clone()], - &[&[ - RentVault::SEED_PREFIX.as_bytes().as_ref(), - &[rent_vault_bump], - ]], + &[&[RentVault::SEED_PREFIX.as_bytes(), &[rent_vault_bump]]], )?; Ok(()) diff --git a/basics/pda-rent-payer/native/program/src/lib.rs b/basics/pda-rent-payer/native/program/src/lib.rs index 42fed2707..1a7ee3d68 100644 --- a/basics/pda-rent-payer/native/program/src/lib.rs +++ b/basics/pda-rent-payer/native/program/src/lib.rs @@ -6,5 +6,4 @@ pub mod instructions; pub mod processor; pub mod state; - -entrypoint!(process_instruction); \ No newline at end of file +entrypoint!(process_instruction); diff --git a/basics/pda-rent-payer/native/program/src/processor.rs b/basics/pda-rent-payer/native/program/src/processor.rs index 74cb71cb9..7174f18f6 100644 --- a/basics/pda-rent-payer/native/program/src/processor.rs +++ b/basics/pda-rent-payer/native/program/src/processor.rs @@ -17,7 +17,7 @@ pub fn process_instruction( accounts: &[AccountInfo], input: &[u8], ) -> ProgramResult { - let instruction = MyInstruction::try_from_slice(&input)?; + let instruction = MyInstruction::try_from_slice(input)?; match instruction { MyInstruction::InitRentVault(args) => init_rent_vault(program_id, accounts, args), MyInstruction::CreateNewAccount => create_new_account(program_id, accounts), diff --git a/basics/processing-instructions/anchor/programs/processing-instructions/Cargo.toml b/basics/processing-instructions/anchor/programs/processing-instructions/Cargo.toml index e7edda05d..e85411aaf 100644 --- a/basics/processing-instructions/anchor/programs/processing-instructions/Cargo.toml +++ b/basics/processing-instructions/anchor/programs/processing-instructions/Cargo.toml @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/processing-instructions/anchor/programs/processing-instructions/src/lib.rs b/basics/processing-instructions/anchor/programs/processing-instructions/src/lib.rs index 58fb1effc..09ecf5315 100644 --- a/basics/processing-instructions/anchor/programs/processing-instructions/src/lib.rs +++ b/basics/processing-instructions/anchor/programs/processing-instructions/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; declare_id!("DgoL5J44aspizyUs9fcnpGEUJjWTLJRCfx8eYtUMYczf"); @@ -8,12 +10,7 @@ pub mod processing_instructions { // With Anchor, we just put instruction data in the function signature! // - pub fn go_to_park( - ctx: Context, - name: String, - height: u32, - ) -> Result<()> { - + pub fn go_to_park(_ctx: Context, name: String, height: u32) -> Result<()> { msg!("Welcome to the park, {}!", name); if height > 5 { msg!("You are tall enough to ride this ride. Congratulations."); diff --git a/basics/processing-instructions/native/program/Cargo.toml b/basics/processing-instructions/native/program/Cargo.toml index ea2b2fdb7..3440af364 100644 --- a/basics/processing-instructions/native/program/Cargo.toml +++ b/basics/processing-instructions/native/program/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "program" +name = "processing-instructions-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.12" +solana-program = "1.16.10" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/processing-instructions/native/program/src/lib.rs b/basics/processing-instructions/native/program/src/lib.rs index 118aced3d..def4dcce2 100644 --- a/basics/processing-instructions/native/program/src/lib.rs +++ b/basics/processing-instructions/native/program/src/lib.rs @@ -1,26 +1,19 @@ use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::{ - account_info::AccountInfo, - entrypoint, - entrypoint::ProgramResult, - msg, - pubkey::Pubkey, + account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey, }; - entrypoint!(process_instruction); - fn process_instruction( - program_id: &Pubkey, - accounts: &[AccountInfo], + _program_id: &Pubkey, + _accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - // Attempt to serialize the BPF format to our struct // using Borsh // - let instruction_data_object = InstructionData::try_from_slice(&instruction_data)?; + let instruction_data_object = InstructionData::try_from_slice(instruction_data)?; msg!("Welcome to the park, {}!", instruction_data_object.name); if instruction_data_object.height > 5 { @@ -36,4 +29,4 @@ fn process_instruction( pub struct InstructionData { name: String, height: u32, -} \ No newline at end of file +} diff --git a/basics/program-derived-addresses/anchor/programs/anchor-program-example/Cargo.toml b/basics/program-derived-addresses/anchor/programs/anchor-program-example/Cargo.toml index d061366c3..6b155f891 100644 --- a/basics/program-derived-addresses/anchor/programs/anchor-program-example/Cargo.toml +++ b/basics/program-derived-addresses/anchor/programs/anchor-program-example/Cargo.toml @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/create.rs b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/create.rs index 975a64e7d..a2726e3d1 100644 --- a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/create.rs +++ b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/create.rs @@ -2,17 +2,13 @@ use anchor_lang::prelude::*; use crate::state::PageVisits; - -pub fn create_page_visits( - ctx: Context -) -> Result<()> { - - ctx.accounts.page_visits.set_inner( - PageVisits::new( - 0, - *ctx.bumps.get(PageVisits::SEED_PREFIX).expect("Bump not found."), - ) - ); +pub fn create_page_visits(ctx: Context) -> Result<()> { + ctx.accounts.page_visits.set_inner(PageVisits::new( + 0, + *ctx.bumps + .get(PageVisits::SEED_PREFIX) + .expect("Bump not found."), + )); Ok(()) } @@ -23,7 +19,7 @@ pub struct CreatePageVisits<'info> { space = PageVisits::ACCOUNT_SPACE, payer = payer, seeds = [ - PageVisits::SEED_PREFIX.as_bytes().as_ref(), + PageVisits::SEED_PREFIX.as_bytes(), user.key().as_ref(), ], bump, @@ -33,4 +29,4 @@ pub struct CreatePageVisits<'info> { #[account(mut)] payer: Signer<'info>, system_program: Program<'info, System>, -} \ No newline at end of file +} diff --git a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/increment.rs b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/increment.rs index a0efda20d..cb06ba86e 100644 --- a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/increment.rs +++ b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/increment.rs @@ -2,11 +2,7 @@ use anchor_lang::prelude::*; use crate::state::PageVisits; - -pub fn increment_page_visits( - ctx: Context -) -> Result<()> { - +pub fn increment_page_visits(ctx: Context) -> Result<()> { let page_visits = &mut ctx.accounts.page_visits; page_visits.increment(); Ok(()) @@ -17,7 +13,7 @@ pub struct IncrementPageVisits<'info> { #[account( mut, seeds = [ - PageVisits::SEED_PREFIX.as_bytes().as_ref(), + PageVisits::SEED_PREFIX.as_bytes(), user.key().as_ref(), ], bump, @@ -27,4 +23,4 @@ pub struct IncrementPageVisits<'info> { #[account(mut)] payer: Signer<'info>, system_program: Program<'info, System>, -} \ No newline at end of file +} diff --git a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/mod.rs b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/mod.rs index adbd748a6..3f667875d 100644 --- a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/mod.rs +++ b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/mod.rs @@ -2,4 +2,4 @@ pub mod create; pub mod increment; pub use create::*; -pub use increment::*; \ No newline at end of file +pub use increment::*; diff --git a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/lib.rs b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/lib.rs index 6b21bc337..ce3059734 100644 --- a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/lib.rs +++ b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; use instructions::*; @@ -5,25 +7,17 @@ use instructions::*; pub mod instructions; pub mod state; - declare_id!("FFKtnYFyzPj1qFjE9epkrfYHJwZMdh8CvJrB6XsKeFVz"); - #[program] pub mod anchor_program_example { use super::*; - pub fn create_page_visits( - ctx: Context - ) -> Result<()> { - + pub fn create_page_visits(ctx: Context) -> Result<()> { instructions::create::create_page_visits(ctx) } - pub fn increment_page_visits( - ctx: Context - ) -> Result<()> { - + pub fn increment_page_visits(ctx: Context) -> Result<()> { instructions::increment::increment_page_visits(ctx) } -} \ No newline at end of file +} diff --git a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/state/mod.rs b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/state/mod.rs index e128c3fd7..391641172 100644 --- a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/state/mod.rs +++ b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/state/mod.rs @@ -1,3 +1,3 @@ pub mod page_visits; -pub use page_visits::*; \ No newline at end of file +pub use page_visits::*; diff --git a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/state/page_visits.rs b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/state/page_visits.rs index 9719e6dc2..30e51f49a 100644 --- a/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/state/page_visits.rs +++ b/basics/program-derived-addresses/anchor/programs/anchor-program-example/src/state/page_visits.rs @@ -1,6 +1,5 @@ use anchor_lang::prelude::*; - #[account] pub struct PageVisits { pub page_visits: u32, @@ -8,19 +7,15 @@ pub struct PageVisits { } impl PageVisits { - pub const ACCOUNT_SPACE: usize = 8 + 32; pub const SEED_PREFIX: &'static str = "page_visits"; pub fn new(page_visits: u32, bump: u8) -> Self { - PageVisits { - page_visits, - bump, - } + PageVisits { page_visits, bump } } pub fn increment(&mut self) { self.page_visits += 1; } -} \ No newline at end of file +} diff --git a/basics/program-derived-addresses/native/program/Cargo.toml b/basics/program-derived-addresses/native/program/Cargo.toml index 70fb25441..da014c458 100644 --- a/basics/program-derived-addresses/native/program/Cargo.toml +++ b/basics/program-derived-addresses/native/program/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "program" +name = "program-derived-addresses-program" version = "0.1.0" edition = "2021" [dependencies] -solana-program = "1.10.12" +solana-program = "1.16.10" borsh = "0.9.3" borsh-derive = "0.9.1" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/program-derived-addresses/native/program/src/instructions/create.rs b/basics/program-derived-addresses/native/program/src/instructions/create.rs index 3b5c352c8..445b0a08d 100644 --- a/basics/program-derived-addresses/native/program/src/instructions/create.rs +++ b/basics/program-derived-addresses/native/program/src/instructions/create.rs @@ -1,24 +1,21 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; +use borsh::BorshSerialize; use solana_program::{ - account_info::{ AccountInfo, next_account_info }, - entrypoint::ProgramResult, - program::{ invoke, invoke_signed }, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, + program::invoke_signed, pubkey::Pubkey, rent::Rent, system_instruction, - system_program, sysvar::Sysvar, }; use crate::state::PageVisits; - pub fn create_page_visits( program_id: &Pubkey, accounts: &[AccountInfo], page_visits: PageVisits, ) -> ProgramResult { - let accounts_iter = &mut accounts.iter(); let page_visits_account = next_account_info(accounts_iter)?; let user = next_account_info(accounts_iter)?; @@ -30,22 +27,23 @@ pub fn create_page_visits( invoke_signed( &system_instruction::create_account( - &payer.key, - &page_visits_account.key, + payer.key, + page_visits_account.key, lamports_required, account_span as u64, program_id, ), &[ - payer.clone(), page_visits_account.clone(), system_program.clone() + payer.clone(), + page_visits_account.clone(), + system_program.clone(), ], &[&[ - PageVisits::SEED_PREFIX.as_bytes().as_ref(), + PageVisits::SEED_PREFIX.as_bytes(), user.key.as_ref(), &[page_visits.bump], - ]] + ]], )?; Ok(()) } - diff --git a/basics/program-derived-addresses/native/program/src/instructions/increment.rs b/basics/program-derived-addresses/native/program/src/instructions/increment.rs index f9c1d6091..03c7f0242 100644 --- a/basics/program-derived-addresses/native/program/src/instructions/increment.rs +++ b/basics/program-derived-addresses/native/program/src/instructions/increment.rs @@ -1,16 +1,12 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::{ - account_info::{ AccountInfo, next_account_info }, - entrypoint::ProgramResult, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, }; use crate::state::PageVisits; - -pub fn increment_page_visits( - accounts: &[AccountInfo], -) -> ProgramResult { - +pub fn increment_page_visits(accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let page_visits_account = next_account_info(accounts_iter)?; @@ -18,4 +14,4 @@ pub fn increment_page_visits( page_visits.increment(); page_visits.serialize(&mut &mut page_visits_account.data.borrow_mut()[..])?; Ok(()) -} \ No newline at end of file +} diff --git a/basics/program-derived-addresses/native/program/src/instructions/mod.rs b/basics/program-derived-addresses/native/program/src/instructions/mod.rs index adbd748a6..3f667875d 100644 --- a/basics/program-derived-addresses/native/program/src/instructions/mod.rs +++ b/basics/program-derived-addresses/native/program/src/instructions/mod.rs @@ -2,4 +2,4 @@ pub mod create; pub mod increment; pub use create::*; -pub use increment::*; \ No newline at end of file +pub use increment::*; diff --git a/basics/program-derived-addresses/native/program/src/lib.rs b/basics/program-derived-addresses/native/program/src/lib.rs index 42fed2707..1a7ee3d68 100644 --- a/basics/program-derived-addresses/native/program/src/lib.rs +++ b/basics/program-derived-addresses/native/program/src/lib.rs @@ -6,5 +6,4 @@ pub mod instructions; pub mod processor; pub mod state; - -entrypoint!(process_instruction); \ No newline at end of file +entrypoint!(process_instruction); diff --git a/basics/program-derived-addresses/native/program/src/processor.rs b/basics/program-derived-addresses/native/program/src/processor.rs index f24691737..22fb95bc9 100644 --- a/basics/program-derived-addresses/native/program/src/processor.rs +++ b/basics/program-derived-addresses/native/program/src/processor.rs @@ -1,35 +1,25 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; +use borsh::BorshDeserialize; use solana_program::{ - account_info::AccountInfo, - entrypoint::ProgramResult, - program_error::ProgramError, + account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError, pubkey::Pubkey, }; use crate::instructions; -use crate::state::PageVisits; use crate::state::IncrementPageVisits; - +use crate::state::PageVisits; pub fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - - match PageVisits::try_from_slice(&instruction_data) { - Ok(page_visits) => return instructions::create::create_page_visits( - program_id, accounts, page_visits - ), - Err(_) => {}, + if let Ok(page_visits) = PageVisits::try_from_slice(instruction_data) { + return instructions::create::create_page_visits(program_id, accounts, page_visits); }; - match IncrementPageVisits::try_from_slice(&instruction_data) { - Ok(_) => return instructions::increment::increment_page_visits( - accounts - ), - Err(_) => {}, - }; + if IncrementPageVisits::try_from_slice(instruction_data).is_ok() { + return instructions::increment::increment_page_visits(accounts); + } Err(ProgramError::InvalidInstructionData) -} \ No newline at end of file +} diff --git a/basics/program-derived-addresses/native/program/src/state/mod.rs b/basics/program-derived-addresses/native/program/src/state/mod.rs index e128c3fd7..391641172 100644 --- a/basics/program-derived-addresses/native/program/src/state/mod.rs +++ b/basics/program-derived-addresses/native/program/src/state/mod.rs @@ -1,3 +1,3 @@ pub mod page_visits; -pub use page_visits::*; \ No newline at end of file +pub use page_visits::*; diff --git a/basics/program-derived-addresses/native/program/src/state/page_visits.rs b/basics/program-derived-addresses/native/program/src/state/page_visits.rs index 07e7c7dbf..00e8098c0 100644 --- a/basics/program-derived-addresses/native/program/src/state/page_visits.rs +++ b/basics/program-derived-addresses/native/program/src/state/page_visits.rs @@ -1,5 +1,4 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; - +use borsh::{BorshDeserialize, BorshSerialize}; #[derive(BorshDeserialize, BorshSerialize, Debug)] pub struct IncrementPageVisits {} @@ -11,19 +10,15 @@ pub struct PageVisits { } impl PageVisits { - pub const ACCOUNT_SPACE: usize = 8 + 32; pub const SEED_PREFIX: &'static str = "page_visits"; pub fn new(page_visits: u32, bump: u8) -> Self { - PageVisits { - page_visits, - bump, - } + PageVisits { page_visits, bump } } pub fn increment(&mut self) { self.page_visits += 1; } -} \ No newline at end of file +} diff --git a/basics/realloc/native/program/Cargo.toml b/basics/realloc/native/program/Cargo.toml index ea2b2fdb7..0b4f69c52 100644 --- a/basics/realloc/native/program/Cargo.toml +++ b/basics/realloc/native/program/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "program" +name = "realloc-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.12" +solana-program = "1.16.10" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/realloc/native/program/src/instructions/create.rs b/basics/realloc/native/program/src/instructions/create.rs index 33471e782..68dd08f08 100644 --- a/basics/realloc/native/program/src/instructions/create.rs +++ b/basics/realloc/native/program/src/instructions/create.rs @@ -1,7 +1,7 @@ use borsh::BorshSerialize; use solana_program::{ - account_info::{ AccountInfo, next_account_info }, - entrypoint::ProgramResult, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, program::invoke, pubkey::Pubkey, rent::Rent, @@ -11,13 +11,11 @@ use solana_program::{ use crate::state::AddressInfo; - pub fn create_address_info( program_id: &Pubkey, accounts: &[AccountInfo], data: AddressInfo, ) -> ProgramResult { - let accounts_iter = &mut accounts.iter(); let target_account = next_account_info(accounts_iter)?; let payer = next_account_info(accounts_iter)?; @@ -28,18 +26,19 @@ pub fn create_address_info( invoke( &system_instruction::create_account( - &payer.key, - &target_account.key, + payer.key, + target_account.key, lamports_required, account_span as u64, program_id, ), &[ - payer.clone(), target_account.clone(), system_program.clone() + payer.clone(), + target_account.clone(), + system_program.clone(), ], )?; - + data.serialize(&mut &mut target_account.data.borrow_mut()[..])?; Ok(()) } - diff --git a/basics/realloc/native/program/src/instructions/mod.rs b/basics/realloc/native/program/src/instructions/mod.rs index 795bb3206..164dc9851 100644 --- a/basics/realloc/native/program/src/instructions/mod.rs +++ b/basics/realloc/native/program/src/instructions/mod.rs @@ -2,4 +2,4 @@ pub mod create; pub mod reallocate; pub use create::*; -pub use reallocate::*; \ No newline at end of file +pub use reallocate::*; diff --git a/basics/realloc/native/program/src/instructions/reallocate.rs b/basics/realloc/native/program/src/instructions/reallocate.rs index 2d6ae9e22..c2bdfbace 100644 --- a/basics/realloc/native/program/src/instructions/reallocate.rs +++ b/basics/realloc/native/program/src/instructions/reallocate.rs @@ -1,60 +1,49 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::{ - account_info::{ AccountInfo, next_account_info }, - entrypoint::ProgramResult, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, program::invoke, rent::Rent, system_instruction, sysvar::Sysvar, }; -use crate::state::{ - AddressInfo, - EnhancedAddressInfo, - EnhancedAddressInfoExtender, - WorkInfo, -}; - +use crate::state::{AddressInfo, EnhancedAddressInfo, EnhancedAddressInfoExtender, WorkInfo}; pub fn reallocate_without_zero_init( accounts: &[AccountInfo], args: EnhancedAddressInfoExtender, ) -> ProgramResult { - let accounts_iter = &mut accounts.iter(); let target_account = next_account_info(accounts_iter)?; let payer = next_account_info(accounts_iter)?; let system_program = next_account_info(accounts_iter)?; let address_info_data = AddressInfo::try_from_slice(&target_account.data.borrow())?; - let enhanced_address_info_data = EnhancedAddressInfo::from_address_info( - address_info_data, - args.state, - args.zip, - ); - + let enhanced_address_info_data = + EnhancedAddressInfo::from_address_info(address_info_data, args.state, args.zip); + let account_span = (enhanced_address_info_data.try_to_vec()?).len(); let lamports_required = (Rent::get()?).minimum_balance(account_span); - + let diff = lamports_required - target_account.lamports(); invoke( &system_instruction::transfer(payer.key, target_account.key, diff), - &[payer.clone(), target_account.clone(), system_program.clone()], + &[ + payer.clone(), + target_account.clone(), + system_program.clone(), + ], )?; target_account.realloc(account_span, false)?; - + enhanced_address_info_data.serialize(&mut &mut target_account.data.borrow_mut()[..])?; - + Ok(()) } - -pub fn reallocate_zero_init( - accounts: &[AccountInfo], - data: WorkInfo, -) -> ProgramResult { - +pub fn reallocate_zero_init(accounts: &[AccountInfo], data: WorkInfo) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let target_account = next_account_info(accounts_iter)?; @@ -65,4 +54,4 @@ pub fn reallocate_zero_init( data.serialize(&mut &mut target_account.data.borrow_mut()[..])?; Ok(()) -} \ No newline at end of file +} diff --git a/basics/realloc/native/program/src/lib.rs b/basics/realloc/native/program/src/lib.rs index 36340bf05..d3dc6c64f 100644 --- a/basics/realloc/native/program/src/lib.rs +++ b/basics/realloc/native/program/src/lib.rs @@ -1,11 +1,7 @@ - pub mod instructions; pub mod processor; pub mod state; -use { - solana_program::entrypoint, - crate::processor::process_instruction, -}; +use {crate::processor::process_instruction, solana_program::entrypoint}; -entrypoint!(process_instruction); \ No newline at end of file +entrypoint!(process_instruction); diff --git a/basics/realloc/native/program/src/processor.rs b/basics/realloc/native/program/src/processor.rs index 2ceb076eb..66fbf4511 100644 --- a/basics/realloc/native/program/src/processor.rs +++ b/basics/realloc/native/program/src/processor.rs @@ -1,12 +1,7 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; -use solana_program::{ - account_info::AccountInfo, - entrypoint::ProgramResult, - pubkey::Pubkey, -}; use crate::instructions::*; use crate::state::*; - +use borsh::{BorshDeserialize, BorshSerialize}; +use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; #[derive(BorshSerialize, BorshDeserialize, Debug)] pub enum ReallocInstruction { @@ -15,20 +10,17 @@ pub enum ReallocInstruction { ReallocateZeroInit(WorkInfo), } - pub fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], input: &[u8], ) -> ProgramResult { - - let instruction = ReallocInstruction::try_from_slice(&input)?; + let instruction = ReallocInstruction::try_from_slice(input)?; match instruction { - ReallocInstruction::Create( - data) => create_address_info(program_id, accounts, data), - ReallocInstruction::ReallocateWithoutZeroInit( - data) => reallocate_without_zero_init(accounts, data), - ReallocInstruction::ReallocateZeroInit( - data) => reallocate_zero_init(accounts, data), + ReallocInstruction::Create(data) => create_address_info(program_id, accounts, data), + ReallocInstruction::ReallocateWithoutZeroInit(data) => { + reallocate_without_zero_init(accounts, data) + } + ReallocInstruction::ReallocateZeroInit(data) => reallocate_zero_init(accounts, data), } -} \ No newline at end of file +} diff --git a/basics/realloc/native/program/src/state/address_info.rs b/basics/realloc/native/program/src/state/address_info.rs index 3d74212de..1fd1aa2ea 100644 --- a/basics/realloc/native/program/src/state/address_info.rs +++ b/basics/realloc/native/program/src/state/address_info.rs @@ -1,5 +1,4 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; - +use borsh::{BorshDeserialize, BorshSerialize}; #[derive(BorshDeserialize, BorshSerialize, Debug)] pub struct AddressInfo { @@ -10,14 +9,7 @@ pub struct AddressInfo { } impl AddressInfo { - - pub fn new( - name: String, - house_number: u8, - street: String, - city: String, - ) -> Self { - + pub fn new(name: String, house_number: u8, street: String, city: String) -> Self { AddressInfo { name, house_number, @@ -25,4 +17,4 @@ impl AddressInfo { city, } } -} \ No newline at end of file +} diff --git a/basics/realloc/native/program/src/state/enhanced_address_info.rs b/basics/realloc/native/program/src/state/enhanced_address_info.rs index 7bf76a823..f0ff0dc37 100644 --- a/basics/realloc/native/program/src/state/enhanced_address_info.rs +++ b/basics/realloc/native/program/src/state/enhanced_address_info.rs @@ -1,8 +1,7 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; +use borsh::{BorshDeserialize, BorshSerialize}; use crate::state::AddressInfo; - #[derive(BorshDeserialize, BorshSerialize, Debug)] pub struct EnhancedAddressInfoExtender { pub state: String, @@ -20,13 +19,7 @@ pub struct EnhancedAddressInfo { } impl EnhancedAddressInfo { - - pub fn from_address_info( - address_info: AddressInfo, - state: String, - zip: u32, - ) -> Self { - + pub fn from_address_info(address_info: AddressInfo, state: String, zip: u32) -> Self { EnhancedAddressInfo { name: address_info.name, house_number: address_info.house_number, @@ -36,4 +29,4 @@ impl EnhancedAddressInfo { zip, } } -} \ No newline at end of file +} diff --git a/basics/realloc/native/program/src/state/mod.rs b/basics/realloc/native/program/src/state/mod.rs index abd3e4df5..0f3a6d519 100644 --- a/basics/realloc/native/program/src/state/mod.rs +++ b/basics/realloc/native/program/src/state/mod.rs @@ -4,4 +4,4 @@ pub mod work_info; pub use address_info::*; pub use enhanced_address_info::*; -pub use work_info::*; \ No newline at end of file +pub use work_info::*; diff --git a/basics/realloc/native/program/src/state/work_info.rs b/basics/realloc/native/program/src/state/work_info.rs index c673f8fbc..c805070be 100644 --- a/basics/realloc/native/program/src/state/work_info.rs +++ b/basics/realloc/native/program/src/state/work_info.rs @@ -1,5 +1,4 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; - +use borsh::{BorshDeserialize, BorshSerialize}; #[derive(BorshDeserialize, BorshSerialize, Debug)] pub struct WorkInfo { @@ -10,14 +9,7 @@ pub struct WorkInfo { } impl WorkInfo { - - pub fn new( - name: String, - position: String, - company: String, - years_employed: u8, - ) -> Self { - + pub fn new(name: String, position: String, company: String, years_employed: u8) -> Self { WorkInfo { name, position, @@ -25,4 +17,4 @@ impl WorkInfo { years_employed, } } -} \ No newline at end of file +} diff --git a/basics/rent/anchor/programs/rent-example/Cargo.toml b/basics/rent/anchor/programs/rent-example/Cargo.toml index 73d94ab27..57d903b99 100644 --- a/basics/rent/anchor/programs/rent-example/Cargo.toml +++ b/basics/rent/anchor/programs/rent-example/Cargo.toml @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/rent/anchor/programs/rent-example/src/lib.rs b/basics/rent/anchor/programs/rent-example/src/lib.rs index dc1c49689..36bc13158 100644 --- a/basics/rent/anchor/programs/rent-example/src/lib.rs +++ b/basics/rent/anchor/programs/rent-example/src/lib.rs @@ -1,18 +1,23 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; use anchor_lang::system_program; - declare_id!("ED6f4gweAE7hWPQPXMt4kWxzDJne8VQEm9zkb1tMpFNB"); - #[program] pub mod rent_example { use super::*; - pub fn create_system_account(ctx: Context, address_data: AddressData) -> Result<()> { - + pub fn create_system_account( + ctx: Context, + address_data: AddressData, + ) -> Result<()> { msg!("Program invoked. Creating a system account..."); - msg!(" New public key will be: {}", &ctx.accounts.new_account.key().to_string()); + msg!( + " New public key will be: {}", + &ctx.accounts.new_account.key().to_string() + ); // Determine the necessary minimum rent by calculating the account's size // @@ -53,4 +58,4 @@ pub struct CreateSystemAccount<'info> { pub struct AddressData { name: String, address: String, -} \ No newline at end of file +} diff --git a/basics/rent/native/program/Cargo.toml b/basics/rent/native/program/Cargo.toml index ea2b2fdb7..188b7dd09 100644 --- a/basics/rent/native/program/Cargo.toml +++ b/basics/rent/native/program/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.12" +solana-program = "1.16.10" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/rent/native/program/src/lib.rs b/basics/rent/native/program/src/lib.rs index 8f21571dd..3cb431dd2 100644 --- a/basics/rent/native/program/src/lib.rs +++ b/basics/rent/native/program/src/lib.rs @@ -1,32 +1,27 @@ -use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::{ - account_info::{AccountInfo, next_account_info}, - entrypoint, - entrypoint::ProgramResult, - msg, + account_info::{next_account_info, AccountInfo}, + entrypoint, + entrypoint::ProgramResult, + msg, program::invoke, pubkey::Pubkey, rent::Rent, - system_instruction, - system_program, + system_instruction, system_program, sysvar::Sysvar, }; - entrypoint!(process_instruction); - fn process_instruction( _program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - let accounts_iter = &mut accounts.iter(); let payer = next_account_info(accounts_iter)?; let new_account = next_account_info(accounts_iter)?; let system_program = next_account_info(accounts_iter)?; - + msg!("Program invoked. Creating a system account..."); msg!(" New public key will be: {}", &new_account.key.to_string()); @@ -37,20 +32,18 @@ fn process_instruction( msg!("Account span: {}", &account_span); msg!("Lamports required: {}", &lamports_required); - + invoke( &system_instruction::create_account( - &payer.key, - &new_account.key, + payer.key, + new_account.key, lamports_required, account_span as u64, &system_program::ID, ), - &[ - payer.clone(), new_account.clone(), system_program.clone() - ] + &[payer.clone(), new_account.clone(), system_program.clone()], )?; msg!("Account created succesfully."); Ok(()) -} \ No newline at end of file +} diff --git a/basics/repository-layout/anchor/programs/carnival/Cargo.toml b/basics/repository-layout/anchor/programs/carnival/Cargo.toml index a7487301a..5a9ae4ddd 100644 --- a/basics/repository-layout/anchor/programs/carnival/Cargo.toml +++ b/basics/repository-layout/anchor/programs/carnival/Cargo.toml @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/repository-layout/anchor/programs/carnival/src/error.rs b/basics/repository-layout/anchor/programs/carnival/src/error.rs index e448d054a..9db2fad45 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/error.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/error.rs @@ -1,2 +1 @@ - -// For any custom errors \ No newline at end of file +// For any custom errors diff --git a/basics/repository-layout/anchor/programs/carnival/src/instructions/eat_food.rs b/basics/repository-layout/anchor/programs/carnival/src/instructions/eat_food.rs index 3ab956478..833ca6647 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/instructions/eat_food.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/instructions/eat_food.rs @@ -2,36 +2,35 @@ use anchor_lang::prelude::*; use crate::state::food; - // Instruction Data - pub struct EatFoodInstructionData { pub eater_name: String, pub eater_ticket_count: u32, pub food_stand: String, } - pub fn eat_food(ix: EatFoodInstructionData) -> Result<()> { - let food_stands_list = food::get_food_stands(); - + for food_stand in food_stands_list.iter() { - if ix.food_stand.eq(&food_stand.name) { - msg!("Welcome to {}! What can I get you?", food_stand.name); if ix.eater_ticket_count < food_stand.tickets { - msg!(" Sorry {}, our {} is {} tickets!", ix.eater_name, food_stand.food_type, food_stand.tickets); + msg!( + " Sorry {}, our {} is {} tickets!", + ix.eater_name, + food_stand.food_type, + food_stand.tickets + ); } else { msg!(" Enjoy your {}!", food_stand.food_type); }; - return Ok(()) + return Ok(()); } - }; + } Err(ProgramError::InvalidInstructionData.into()) -} \ No newline at end of file +} diff --git a/basics/repository-layout/anchor/programs/carnival/src/instructions/get_on_ride.rs b/basics/repository-layout/anchor/programs/carnival/src/instructions/get_on_ride.rs index 1013aee9e..751fa6071 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/instructions/get_on_ride.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/instructions/get_on_ride.rs @@ -2,10 +2,8 @@ use anchor_lang::prelude::*; use crate::state::ride; - // Instruction Data - pub struct GetOnRideInstructionData { pub rider_name: String, pub rider_height: u32, @@ -13,25 +11,31 @@ pub struct GetOnRideInstructionData { pub ride: String, } - pub fn get_on_ride(ix: GetOnRideInstructionData) -> Result<()> { - let rides_list = ride::get_rides(); - + for ride in rides_list.iter() { - if ix.ride.eq(&ride.name) { - msg!("You're about to ride the {}!", ride.name); if ix.rider_ticket_count < ride.tickets { - msg!(" Sorry {}, you need {} tickets to ride the {}!", ix.rider_name, ride.tickets, ride.name); - return Ok(()) + msg!( + " Sorry {}, you need {} tickets to ride the {}!", + ix.rider_name, + ride.tickets, + ride.name + ); + return Ok(()); }; if ix.rider_height < ride.min_height { - msg!(" Sorry {}, you need to be {}\" tall to ride the {}!", ix.rider_name, ride.min_height, ride.name); - return Ok(()) + msg!( + " Sorry {}, you need to be {}\" tall to ride the {}!", + ix.rider_name, + ride.min_height, + ride.name + ); + return Ok(()); }; msg!(" Welcome aboard the {}!", ride.name); @@ -40,10 +44,9 @@ pub fn get_on_ride(ix: GetOnRideInstructionData) -> Result<()> { msg!(" Btw, this ride goes upside down. Hold on tight!"); }; - return Ok(()) + return Ok(()); } } Err(ProgramError::InvalidInstructionData.into()) } - diff --git a/basics/repository-layout/anchor/programs/carnival/src/instructions/mod.rs b/basics/repository-layout/anchor/programs/carnival/src/instructions/mod.rs index 906fad928..ee6ea6d1e 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/instructions/mod.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/instructions/mod.rs @@ -1,4 +1,3 @@ - pub mod eat_food; +pub mod get_on_ride; pub mod play_game; -pub mod get_on_ride; \ No newline at end of file diff --git a/basics/repository-layout/anchor/programs/carnival/src/instructions/play_game.rs b/basics/repository-layout/anchor/programs/carnival/src/instructions/play_game.rs index f8572838a..c8785fe52 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/instructions/play_game.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/instructions/play_game.rs @@ -2,37 +2,40 @@ use anchor_lang::prelude::*; use crate::state::game; - // Instruction Data - pub struct PlayGameInstructionData { pub gamer_name: String, pub gamer_ticket_count: u32, pub game: String, } - pub fn play_game(ix: PlayGameInstructionData) -> Result<()> { - let games_list = game::get_games(); - + for game in games_list.iter() { - if ix.game.eq(&game.name) { - msg!("You're about to play {}!", game.name); if ix.gamer_ticket_count < game.tickets { - msg!(" Sorry {}, you need {} tickets to play {}!", ix.gamer_name, game.tickets, game.name); + msg!( + " Sorry {}, you need {} tickets to play {}!", + ix.gamer_name, + game.tickets, + game.name + ); } else { msg!(" Let's see what you got!"); - msg!(" You get {} attempts and the prize is a {}!", game.tries, game.prize); + msg!( + " You get {} attempts and the prize is a {}!", + game.tries, + game.prize + ); }; - return Ok(()) + return Ok(()); } - }; + } Err(ProgramError::InvalidInstructionData.into()) -} \ No newline at end of file +} diff --git a/basics/repository-layout/anchor/programs/carnival/src/lib.rs b/basics/repository-layout/anchor/programs/carnival/src/lib.rs index d3f5413c8..bf0270ca9 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/lib.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/lib.rs @@ -1,22 +1,17 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; pub mod error; pub mod instructions; pub mod state; -use crate::instructions::{ - get_on_ride, - play_game, - eat_food, -}; - +use crate::instructions::{eat_food, get_on_ride, play_game}; // For setting up modules & configs - declare_id!("8t94SEJh9jVjDwV7cbiuT6BvEsHo4YHP9x9a5rYH1NpP"); - #[program] pub mod carnival { use super::*; @@ -28,7 +23,6 @@ pub mod carnival { ticket_count: u32, ride_name: String, ) -> Result<()> { - get_on_ride::get_on_ride(get_on_ride::GetOnRideInstructionData { rider_name: name, rider_height: height, @@ -43,7 +37,6 @@ pub mod carnival { ticket_count: u32, game_name: String, ) -> Result<()> { - play_game::play_game(play_game::PlayGameInstructionData { gamer_name: name, gamer_ticket_count: ticket_count, @@ -57,7 +50,6 @@ pub mod carnival { ticket_count: u32, food_stand_name: String, ) -> Result<()> { - eat_food::eat_food(eat_food::EatFoodInstructionData { eater_name: name, eater_ticket_count: ticket_count, @@ -70,4 +62,4 @@ pub mod carnival { pub struct CarnivalContext<'info> { #[account(mut)] pub payer: Signer<'info>, -} \ No newline at end of file +} diff --git a/basics/repository-layout/anchor/programs/carnival/src/state/food.rs b/basics/repository-layout/anchor/programs/carnival/src/state/food.rs index ed257d1f6..62b5e04d6 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/state/food.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/state/food.rs @@ -1,14 +1,12 @@ - - // Objects pub struct FoodStand { pub name: String, pub food_type: String, - pub tickets: u32 + pub tickets: u32, } -impl FoodStand { +impl FoodStand { pub fn new(name: String, food_type: String, tickets: u32) -> FoodStand { FoodStand { name, @@ -18,11 +16,10 @@ impl FoodStand { } } - pub fn get_food_stands() -> Vec { - return vec![ + vec![ FoodStand::new("Larry's Pizza".to_string(), "pizza".to_string(), 3), FoodStand::new("Taco Shack".to_string(), "taco".to_string(), 2), FoodStand::new("Dough Boy's".to_string(), "fried dough".to_string(), 1), ] -} \ No newline at end of file +} diff --git a/basics/repository-layout/anchor/programs/carnival/src/state/game.rs b/basics/repository-layout/anchor/programs/carnival/src/state/game.rs index 7b1e9e286..185547230 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/state/game.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/state/game.rs @@ -1,5 +1,3 @@ - - // Objects pub struct Game { @@ -11,7 +9,7 @@ pub struct Game { const DEFAULT_TICKETS_TO_PLAY: u32 = 3; -impl Game { +impl Game { pub fn new(name: String, tries: u32, prize: String) -> Game { Game { name, @@ -22,11 +20,10 @@ impl Game { } } - pub fn get_games() -> Vec { - return vec![ + vec![ Game::new("Ring Toss".to_string(), 5, "teddy bear".to_string()), Game::new("I Got It!".to_string(), 12, "goldfish".to_string()), Game::new("Ladder Climb".to_string(), 1, "popcorn bucket".to_string()), ] -} \ No newline at end of file +} diff --git a/basics/repository-layout/anchor/programs/carnival/src/state/mod.rs b/basics/repository-layout/anchor/programs/carnival/src/state/mod.rs index 6a129fee2..12a92a2cf 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/state/mod.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/state/mod.rs @@ -1,4 +1,3 @@ - pub mod food; pub mod game; -pub mod ride; \ No newline at end of file +pub mod ride; diff --git a/basics/repository-layout/anchor/programs/carnival/src/state/ride.rs b/basics/repository-layout/anchor/programs/carnival/src/state/ride.rs index 5fef5f0ad..a3af23969 100644 --- a/basics/repository-layout/anchor/programs/carnival/src/state/ride.rs +++ b/basics/repository-layout/anchor/programs/carnival/src/state/ride.rs @@ -1,5 +1,3 @@ - - // Objects pub struct Ride { @@ -9,7 +7,7 @@ pub struct Ride { pub min_height: u32, } -impl Ride { +impl Ride { pub fn new(name: String, upside_down: bool, tickets: u32, min_height: u32) -> Ride { Ride { name, @@ -20,12 +18,11 @@ impl Ride { } } - pub fn get_rides() -> Vec { - return vec![ + vec![ Ride::new("Tilt-a-Whirl".to_string(), false, 3, 48), Ride::new("Scrambler".to_string(), false, 3, 48), Ride::new("Ferris Wheel".to_string(), false, 5, 55), Ride::new("Zero Gravity".to_string(), true, 5, 60), ] -} \ No newline at end of file +} diff --git a/basics/repository-layout/native/program/Cargo.toml b/basics/repository-layout/native/program/Cargo.toml index ea2b2fdb7..fe3463238 100644 --- a/basics/repository-layout/native/program/Cargo.toml +++ b/basics/repository-layout/native/program/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "program" +name = "repository-layout-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.12" +solana-program = "1.16.10" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/repository-layout/native/program/src/error.rs b/basics/repository-layout/native/program/src/error.rs index e448d054a..9db2fad45 100644 --- a/basics/repository-layout/native/program/src/error.rs +++ b/basics/repository-layout/native/program/src/error.rs @@ -1,2 +1 @@ - -// For any custom errors \ No newline at end of file +// For any custom errors diff --git a/basics/repository-layout/native/program/src/instructions/eat_food.rs b/basics/repository-layout/native/program/src/instructions/eat_food.rs index 54f33c44b..b5b0cc2e5 100644 --- a/basics/repository-layout/native/program/src/instructions/eat_food.rs +++ b/basics/repository-layout/native/program/src/instructions/eat_food.rs @@ -1,41 +1,36 @@ -use solana_program::{ - entrypoint::ProgramResult, - msg, - program_error::ProgramError, -}; +use solana_program::{entrypoint::ProgramResult, msg, program_error::ProgramError}; use crate::state::food; - // InstructionData Data - pub struct EatFoodInstructionData { pub eater_name: String, pub eater_ticket_count: u32, pub food_stand: String, } - pub fn eat_food(ix: EatFoodInstructionData) -> ProgramResult { - let food_stands_list = food::get_food_stands(); - + for food_stand in food_stands_list.iter() { - if ix.food_stand.eq(&food_stand.name) { - msg!("Welcome to {}! What can I get you?", food_stand.name); if ix.eater_ticket_count < food_stand.tickets { - msg!(" Sorry {}, our {} is {} tickets!", ix.eater_name, food_stand.food_type, food_stand.tickets); + msg!( + " Sorry {}, our {} is {} tickets!", + ix.eater_name, + food_stand.food_type, + food_stand.tickets + ); } else { msg!(" Enjoy your {}!", food_stand.food_type); }; - return Ok(()) + return Ok(()); } - }; + } Err(ProgramError::InvalidInstructionData) -} \ No newline at end of file +} diff --git a/basics/repository-layout/native/program/src/instructions/get_on_ride.rs b/basics/repository-layout/native/program/src/instructions/get_on_ride.rs index cb2c73db6..638d5d294 100644 --- a/basics/repository-layout/native/program/src/instructions/get_on_ride.rs +++ b/basics/repository-layout/native/program/src/instructions/get_on_ride.rs @@ -1,15 +1,9 @@ -use solana_program::{ - entrypoint::ProgramResult, - msg, - program_error::ProgramError, -}; +use solana_program::{entrypoint::ProgramResult, msg, program_error::ProgramError}; use crate::state::ride; - // InstructionData Data - pub struct GetOnRideInstructionData { pub rider_name: String, pub rider_height: u32, @@ -17,25 +11,31 @@ pub struct GetOnRideInstructionData { pub ride: String, } - pub fn get_on_ride(ix: GetOnRideInstructionData) -> ProgramResult { - let rides_list = ride::get_rides(); - + for ride in rides_list.iter() { - if ix.ride.eq(&ride.name) { - msg!("You're about to ride the {}!", ride.name); if ix.rider_ticket_count < ride.tickets { - msg!(" Sorry {}, you need {} tickets to ride the {}!", ix.rider_name, ride.tickets, ride.name); - return Ok(()) + msg!( + " Sorry {}, you need {} tickets to ride the {}!", + ix.rider_name, + ride.tickets, + ride.name + ); + return Ok(()); }; if ix.rider_height < ride.min_height { - msg!(" Sorry {}, you need to be {}\" tall to ride the {}!", ix.rider_name, ride.min_height, ride.name); - return Ok(()) + msg!( + " Sorry {}, you need to be {}\" tall to ride the {}!", + ix.rider_name, + ride.min_height, + ride.name + ); + return Ok(()); }; msg!(" Welcome aboard the {}!", ride.name); @@ -44,10 +44,9 @@ pub fn get_on_ride(ix: GetOnRideInstructionData) -> ProgramResult { msg!(" Btw, this ride goes upside down. Hold on tight!"); }; - return Ok(()) + return Ok(()); } } Err(ProgramError::InvalidInstructionData) } - diff --git a/basics/repository-layout/native/program/src/instructions/mod.rs b/basics/repository-layout/native/program/src/instructions/mod.rs index 906fad928..ee6ea6d1e 100644 --- a/basics/repository-layout/native/program/src/instructions/mod.rs +++ b/basics/repository-layout/native/program/src/instructions/mod.rs @@ -1,4 +1,3 @@ - pub mod eat_food; +pub mod get_on_ride; pub mod play_game; -pub mod get_on_ride; \ No newline at end of file diff --git a/basics/repository-layout/native/program/src/instructions/play_game.rs b/basics/repository-layout/native/program/src/instructions/play_game.rs index f13914ee3..d78712bed 100644 --- a/basics/repository-layout/native/program/src/instructions/play_game.rs +++ b/basics/repository-layout/native/program/src/instructions/play_game.rs @@ -1,42 +1,41 @@ -use solana_program::{ - entrypoint::ProgramResult, - msg, - program_error::ProgramError, -}; +use solana_program::{entrypoint::ProgramResult, msg, program_error::ProgramError}; use crate::state::game; - // InstructionData Data - pub struct PlayGameInstructionData { pub gamer_name: String, pub gamer_ticket_count: u32, pub game: String, } - pub fn play_game(ix: PlayGameInstructionData) -> ProgramResult { - let games_list = game::get_games(); - + for game in games_list.iter() { - if ix.game.eq(&game.name) { - msg!("You're about to play {}!", game.name); if ix.gamer_ticket_count < game.tickets { - msg!(" Sorry {}, you need {} tickets to play {}!", ix.gamer_name, game.tickets, game.name); + msg!( + " Sorry {}, you need {} tickets to play {}!", + ix.gamer_name, + game.tickets, + game.name + ); } else { msg!(" Let's see what you got!"); - msg!(" You get {} attempts and the prize is a {}!", game.tries, game.prize); + msg!( + " You get {} attempts and the prize is a {}!", + game.tries, + game.prize + ); }; - return Ok(()) + return Ok(()); } - }; + } Err(ProgramError::InvalidInstructionData) -} \ No newline at end of file +} diff --git a/basics/repository-layout/native/program/src/lib.rs b/basics/repository-layout/native/program/src/lib.rs index 9687dee78..f01f0620e 100644 --- a/basics/repository-layout/native/program/src/lib.rs +++ b/basics/repository-layout/native/program/src/lib.rs @@ -1,7 +1,6 @@ - // For setting up modules & configs pub mod error; pub mod instructions; pub mod processor; -pub mod state; \ No newline at end of file +pub mod state; diff --git a/basics/repository-layout/native/program/src/processor.rs b/basics/repository-layout/native/program/src/processor.rs index 104d5254c..ae36137b4 100644 --- a/basics/repository-layout/native/program/src/processor.rs +++ b/basics/repository-layout/native/program/src/processor.rs @@ -1,26 +1,15 @@ use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::{ - account_info::AccountInfo, - entrypoint, - entrypoint::ProgramResult, - msg, - program_error::ProgramError, - pubkey::Pubkey, -}; - -use crate::instructions::{ - get_on_ride, - play_game, - eat_food, + account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, + program_error::ProgramError, pubkey::Pubkey, }; +use crate::instructions::{eat_food, get_on_ride, play_game}; // For processing everything at the entrypoint - entrypoint!(process_instruction); - #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct CarnivalInstructionData { pub name: String, @@ -30,19 +19,16 @@ pub struct CarnivalInstructionData { pub attraction_name: String, } - pub fn process_instruction( _program_id: &Pubkey, _accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - - let ix_data_object = CarnivalInstructionData::try_from_slice(&instruction_data)?; + let ix_data_object = CarnivalInstructionData::try_from_slice(instruction_data)?; msg!("Welcome to the carnival, {}!", ix_data_object.name); - - match ix_data_object.attraction.as_str() { + match ix_data_object.attraction.as_str() { "ride" => get_on_ride::get_on_ride(get_on_ride::GetOnRideInstructionData { rider_name: ix_data_object.name, rider_height: ix_data_object.height, @@ -61,4 +47,4 @@ pub fn process_instruction( }), _ => Err(ProgramError::InvalidInstructionData), } -} \ No newline at end of file +} diff --git a/basics/repository-layout/native/program/src/state/food.rs b/basics/repository-layout/native/program/src/state/food.rs index ed257d1f6..62b5e04d6 100644 --- a/basics/repository-layout/native/program/src/state/food.rs +++ b/basics/repository-layout/native/program/src/state/food.rs @@ -1,14 +1,12 @@ - - // Objects pub struct FoodStand { pub name: String, pub food_type: String, - pub tickets: u32 + pub tickets: u32, } -impl FoodStand { +impl FoodStand { pub fn new(name: String, food_type: String, tickets: u32) -> FoodStand { FoodStand { name, @@ -18,11 +16,10 @@ impl FoodStand { } } - pub fn get_food_stands() -> Vec { - return vec![ + vec![ FoodStand::new("Larry's Pizza".to_string(), "pizza".to_string(), 3), FoodStand::new("Taco Shack".to_string(), "taco".to_string(), 2), FoodStand::new("Dough Boy's".to_string(), "fried dough".to_string(), 1), ] -} \ No newline at end of file +} diff --git a/basics/repository-layout/native/program/src/state/game.rs b/basics/repository-layout/native/program/src/state/game.rs index 7b1e9e286..185547230 100644 --- a/basics/repository-layout/native/program/src/state/game.rs +++ b/basics/repository-layout/native/program/src/state/game.rs @@ -1,5 +1,3 @@ - - // Objects pub struct Game { @@ -11,7 +9,7 @@ pub struct Game { const DEFAULT_TICKETS_TO_PLAY: u32 = 3; -impl Game { +impl Game { pub fn new(name: String, tries: u32, prize: String) -> Game { Game { name, @@ -22,11 +20,10 @@ impl Game { } } - pub fn get_games() -> Vec { - return vec![ + vec![ Game::new("Ring Toss".to_string(), 5, "teddy bear".to_string()), Game::new("I Got It!".to_string(), 12, "goldfish".to_string()), Game::new("Ladder Climb".to_string(), 1, "popcorn bucket".to_string()), ] -} \ No newline at end of file +} diff --git a/basics/repository-layout/native/program/src/state/mod.rs b/basics/repository-layout/native/program/src/state/mod.rs index 6a129fee2..12a92a2cf 100644 --- a/basics/repository-layout/native/program/src/state/mod.rs +++ b/basics/repository-layout/native/program/src/state/mod.rs @@ -1,4 +1,3 @@ - pub mod food; pub mod game; -pub mod ride; \ No newline at end of file +pub mod ride; diff --git a/basics/repository-layout/native/program/src/state/ride.rs b/basics/repository-layout/native/program/src/state/ride.rs index 5fef5f0ad..a3af23969 100644 --- a/basics/repository-layout/native/program/src/state/ride.rs +++ b/basics/repository-layout/native/program/src/state/ride.rs @@ -1,5 +1,3 @@ - - // Objects pub struct Ride { @@ -9,7 +7,7 @@ pub struct Ride { pub min_height: u32, } -impl Ride { +impl Ride { pub fn new(name: String, upside_down: bool, tickets: u32, min_height: u32) -> Ride { Ride { name, @@ -20,12 +18,11 @@ impl Ride { } } - pub fn get_rides() -> Vec { - return vec![ + vec![ Ride::new("Tilt-a-Whirl".to_string(), false, 3, 48), Ride::new("Scrambler".to_string(), false, 3, 48), Ride::new("Ferris Wheel".to_string(), false, 5, 55), Ride::new("Zero Gravity".to_string(), true, 5, 60), ] -} \ No newline at end of file +} diff --git a/basics/transfer-sol/anchor/programs/transfer-sol/Cargo.toml b/basics/transfer-sol/anchor/programs/transfer-sol/Cargo.toml index 9da1aa9ed..398e6e89b 100644 --- a/basics/transfer-sol/anchor/programs/transfer-sol/Cargo.toml +++ b/basics/transfer-sol/anchor/programs/transfer-sol/Cargo.toml @@ -16,4 +16,4 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" +anchor-lang = "0.28.0" diff --git a/basics/transfer-sol/anchor/programs/transfer-sol/src/lib.rs b/basics/transfer-sol/anchor/programs/transfer-sol/src/lib.rs index 7fca4bedb..36658b7d6 100644 --- a/basics/transfer-sol/anchor/programs/transfer-sol/src/lib.rs +++ b/basics/transfer-sol/anchor/programs/transfer-sol/src/lib.rs @@ -1,19 +1,15 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; use anchor_lang::system_program; - declare_id!("4fQVnLWKKKYxtxgGn7Haw8v2g2Hzbu8K61JvWKvqAi7W"); - #[program] pub mod transfer_sol { use super::*; - pub fn transfer_sol_with_cpi( - ctx: Context, - amount: u64 - ) -> Result<()> { - + pub fn transfer_sol_with_cpi(ctx: Context, amount: u64) -> Result<()> { system_program::transfer( CpiContext::new( ctx.accounts.system_program.to_account_info(), @@ -29,17 +25,20 @@ pub mod transfer_sol { } pub fn transfer_sol_with_program( - ctx: Context, - amount: u64 + ctx: Context, + amount: u64, ) -> Result<()> { - - **ctx.accounts.payer + **ctx + .accounts + .payer .to_account_info() .try_borrow_mut_lamports()? -= amount; - **ctx.accounts.recipient + **ctx + .accounts + .recipient .to_account_info() .try_borrow_mut_lamports()? += amount; - + Ok(()) } } diff --git a/basics/transfer-sol/native/program/Cargo.toml b/basics/transfer-sol/native/program/Cargo.toml index ea2b2fdb7..f10a1470f 100644 --- a/basics/transfer-sol/native/program/Cargo.toml +++ b/basics/transfer-sol/native/program/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "program" +name = "transfer-sol-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.12" +solana-program = "1.16.10" [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/basics/transfer-sol/native/program/src/instruction.rs b/basics/transfer-sol/native/program/src/instruction.rs index 3a04fd371..54f130f9f 100644 --- a/basics/transfer-sol/native/program/src/instruction.rs +++ b/basics/transfer-sol/native/program/src/instruction.rs @@ -1,17 +1,12 @@ use solana_program::{ - account_info::{ AccountInfo, next_account_info }, - entrypoint::ProgramResult, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, program::invoke, pubkey::Pubkey, system_instruction, }; - -pub fn transfer_sol_with_cpi( - accounts: &[AccountInfo], - amount: u64, -) -> ProgramResult { - +pub fn transfer_sol_with_cpi(accounts: &[AccountInfo], amount: u64) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let payer = next_account_info(accounts_iter)?; let recipient = next_account_info(accounts_iter)?; @@ -21,22 +16,21 @@ pub fn transfer_sol_with_cpi( &system_instruction::transfer(payer.key, recipient.key, amount), &[payer.clone(), recipient.clone(), system_program.clone()], )?; - + Ok(()) } pub fn transfer_sol_with_program( - program_id: &Pubkey, + _program_id: &Pubkey, accounts: &[AccountInfo], amount: u64, ) -> ProgramResult { - let accounts_iter = &mut accounts.iter(); let payer = next_account_info(accounts_iter)?; let recipient = next_account_info(accounts_iter)?; **payer.try_borrow_mut_lamports()? -= amount; **recipient.try_borrow_mut_lamports()? += amount; - + Ok(()) -} \ No newline at end of file +} diff --git a/basics/transfer-sol/native/program/src/lib.rs b/basics/transfer-sol/native/program/src/lib.rs index 4dab308a2..e7fe2eadd 100644 --- a/basics/transfer-sol/native/program/src/lib.rs +++ b/basics/transfer-sol/native/program/src/lib.rs @@ -1,10 +1,6 @@ - pub mod instruction; pub mod processor; -use { - solana_program::entrypoint, - crate::processor::process_instruction, -}; +use {crate::processor::process_instruction, solana_program::entrypoint}; -entrypoint!(process_instruction); \ No newline at end of file +entrypoint!(process_instruction); diff --git a/basics/transfer-sol/native/program/src/processor.rs b/basics/transfer-sol/native/program/src/processor.rs index 1c299dccc..20f673e9a 100644 --- a/basics/transfer-sol/native/program/src/processor.rs +++ b/basics/transfer-sol/native/program/src/processor.rs @@ -1,32 +1,25 @@ -use borsh::{ BorshDeserialize, BorshSerialize }; -use solana_program::{ - account_info::AccountInfo, - entrypoint::ProgramResult, - pubkey::Pubkey, -}; +use borsh::{BorshDeserialize, BorshSerialize}; +use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; use crate::instruction::transfer_sol_with_cpi; use crate::instruction::transfer_sol_with_program; - #[derive(BorshSerialize, BorshDeserialize, Debug)] pub enum TransferInstruction { CpiTransfer(u64), ProgramTransfer(u64), } - pub fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], input: &[u8], ) -> ProgramResult { - - let instruction = TransferInstruction::try_from_slice(&input)?; + let instruction = TransferInstruction::try_from_slice(input)?; match instruction { - TransferInstruction::CpiTransfer( - args) => transfer_sol_with_cpi(accounts, args), - TransferInstruction::ProgramTransfer( - args) => transfer_sol_with_program(program_id, accounts, args), + TransferInstruction::CpiTransfer(args) => transfer_sol_with_cpi(accounts, args), + TransferInstruction::ProgramTransfer(args) => { + transfer_sol_with_program(program_id, accounts, args) + } } -} \ No newline at end of file +} diff --git a/compression/cnft-vault/anchor/programs/cnft-vault/Cargo.toml b/compression/cnft-vault/anchor/programs/cnft-vault/Cargo.toml index a77ae4159..efda79cf7 100644 --- a/compression/cnft-vault/anchor/programs/cnft-vault/Cargo.toml +++ b/compression/cnft-vault/anchor/programs/cnft-vault/Cargo.toml @@ -17,6 +17,6 @@ default = [] [dependencies] anchor-lang = "0.26.0" -solana-program = "*" +solana-program = "1.14" spl-account-compression = { version="0.1.8", features = ["cpi"] } -mpl-bubblegum = { version = "0.7.0", features = ["no-entrypoint", "cpi"] } +mpl-bubblegum = { version = "0.7.0", features = ["no-entrypoint", "cpi"] } diff --git a/compression/cnft-vault/anchor/programs/cnft-vault/src/lib.rs b/compression/cnft-vault/anchor/programs/cnft-vault/src/lib.rs index f6d5954eb..dbdc18510 100644 --- a/compression/cnft-vault/anchor/programs/cnft-vault/src/lib.rs +++ b/compression/cnft-vault/anchor/programs/cnft-vault/src/lib.rs @@ -1,9 +1,9 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; -use solana_program::{pubkey::Pubkey}; -use spl_account_compression::{ - program::SplAccountCompression, Noop, -}; -use mpl_bubblegum::{state::TreeConfig}; +use mpl_bubblegum::state::TreeConfig; +use solana_program::pubkey::Pubkey; +use spl_account_compression::{program::SplAccountCompression, Noop}; declare_id!("CNftyK7T8udPwYRzZUMWzbh79rKrz9a5GwV2wv7iEHpk"); @@ -16,24 +16,29 @@ impl anchor_lang::Id for MplBubblegum { } } -// first 8 bytes of SHA256("global:transfer") -const TRANSFER_DISCRIMINATOR: &'static [u8;8] = &[163, 52, 200, 231, 140, 3, 69, 186]; - +// first 8 bytes of SHA256("global:transfer") +const TRANSFER_DISCRIMINATOR: &[u8; 8] = &[163, 52, 200, 231, 140, 3, 69, 186]; #[program] pub mod cnft_vault { use super::*; - pub fn withdraw_cnft<'info>(ctx: Context<'_, '_, '_, 'info, Withdraw<'info>>, + pub fn withdraw_cnft<'info>( + ctx: Context<'_, '_, '_, 'info, Withdraw<'info>>, root: [u8; 32], data_hash: [u8; 32], creator_hash: [u8; 32], nonce: u64, - index: u32,) -> Result<()> { - msg!("attempting to send nft {} from tree {}", index, ctx.accounts.merkle_tree.key()); + index: u32, + ) -> Result<()> { + msg!( + "attempting to send nft {} from tree {}", + index, + ctx.accounts.merkle_tree.key() + ); - let mut accounts: Vec = vec![ + let mut accounts: Vec = vec![ AccountMeta::new_readonly(ctx.accounts.tree_authority.key(), false), AccountMeta::new_readonly(ctx.accounts.leaf_owner.key(), true), AccountMeta::new_readonly(ctx.accounts.leaf_owner.key(), false), @@ -43,7 +48,7 @@ pub mod cnft_vault { AccountMeta::new_readonly(ctx.accounts.compression_program.key(), false), AccountMeta::new_readonly(ctx.accounts.system_program.key(), false), ]; - + let mut data: Vec = vec![]; data.extend(TRANSFER_DISCRIMINATOR); data.extend(root); @@ -62,7 +67,7 @@ pub mod cnft_vault { ctx.accounts.compression_program.to_account_info(), ctx.accounts.system_program.to_account_info(), ]; - + // add "accounts" (hashes) that make up the merkle proof for acc in ctx.remaining_accounts.iter() { accounts.push(AccountMeta::new_readonly(acc.key(), false)); @@ -71,18 +76,20 @@ pub mod cnft_vault { msg!("manual cpi call"); solana_program::program::invoke_signed( - & solana_program::instruction::Instruction { - program_id: ctx.accounts.bubblegum_program.key(), - accounts: accounts, - data: data, - }, - &account_infos[..], - &[&[b"cNFT-vault", &[*ctx.bumps.get("leaf_owner").unwrap()]]]) + &solana_program::instruction::Instruction { + program_id: ctx.accounts.bubblegum_program.key(), + accounts, + data, + }, + &account_infos[..], + &[&[b"cNFT-vault", &[*ctx.bumps.get("leaf_owner").unwrap()]]], + ) .map_err(Into::into) - } - pub fn withdraw_two_cnfts<'info>(ctx: Context<'_, '_, '_, 'info, WithdrawTwo<'info>>, + #[allow(clippy::too_many_arguments)] + pub fn withdraw_two_cnfts<'info>( + ctx: Context<'_, '_, '_, 'info, WithdrawTwo<'info>>, root1: [u8; 32], data_hash1: [u8; 32], creator_hash1: [u8; 32], @@ -94,17 +101,20 @@ pub mod cnft_vault { creator_hash2: [u8; 32], nonce2: u64, index2: u32, - _proof_2_length: u8 // we don't actually need this (proof_2_length = remaining_accounts_len - proof_1_length) + _proof_2_length: u8, // we don't actually need this (proof_2_length = remaining_accounts_len - proof_1_length) ) -> Result<()> { let merkle_tree1 = ctx.accounts.merkle_tree1.key(); let merkle_tree2 = ctx.accounts.merkle_tree2.key(); - msg!("attempting to send nfts from trees {} and {}", merkle_tree1, merkle_tree2); - - + msg!( + "attempting to send nfts from trees {} and {}", + merkle_tree1, + merkle_tree2 + ); + // Note: in this example anyone can withdraw any NFT from the vault // in productions you should check if nft transfers are valid (correct NFT, correct authority) - let mut accounts1: Vec = vec![ + let mut accounts1: Vec = vec![ AccountMeta::new_readonly(ctx.accounts.tree_authority1.key(), false), AccountMeta::new_readonly(ctx.accounts.leaf_owner.key(), true), AccountMeta::new_readonly(ctx.accounts.leaf_owner.key(), false), @@ -114,8 +124,8 @@ pub mod cnft_vault { AccountMeta::new_readonly(ctx.accounts.compression_program.key(), false), AccountMeta::new_readonly(ctx.accounts.system_program.key(), false), ]; - - let mut accounts2: Vec = vec![ + + let mut accounts2: Vec = vec![ AccountMeta::new_readonly(ctx.accounts.tree_authority2.key(), false), AccountMeta::new_readonly(ctx.accounts.leaf_owner.key(), true), AccountMeta::new_readonly(ctx.accounts.leaf_owner.key(), false), @@ -161,56 +171,54 @@ pub mod cnft_vault { ctx.accounts.compression_program.to_account_info(), ctx.accounts.system_program.to_account_info(), ]; - - let mut i = 0u8; - for acc in ctx.remaining_accounts.iter() { - if i < proof_1_length { + + for (i, acc) in ctx.remaining_accounts.iter().enumerate() { + if i < proof_1_length as usize { accounts1.push(AccountMeta::new_readonly(acc.key(), false)); account_infos1.push(acc.to_account_info()); } else { accounts2.push(AccountMeta::new_readonly(acc.key(), false)); account_infos2.push(acc.to_account_info()); } - i+=1; } msg!("withdrawing cNFT#1"); solana_program::program::invoke_signed( - & solana_program::instruction::Instruction { - program_id: ctx.accounts.bubblegum_program.key(), - accounts: accounts1, - data: data1, - }, - &account_infos1[..], - &[&[b"cNFT-vault", &[*ctx.bumps.get("leaf_owner").unwrap()]]])?; - + &solana_program::instruction::Instruction { + program_id: ctx.accounts.bubblegum_program.key(), + accounts: accounts1, + data: data1, + }, + &account_infos1[..], + &[&[b"cNFT-vault", &[*ctx.bumps.get("leaf_owner").unwrap()]]], + )?; + msg!("withdrawing cNFT#2"); solana_program::program::invoke_signed( - & solana_program::instruction::Instruction { - program_id: ctx.accounts.bubblegum_program.key(), - accounts: accounts2, - data: data2, - }, - &account_infos2[..], - &[&[b"cNFT-vault", &[*ctx.bumps.get("leaf_owner").unwrap()]]])?; + &solana_program::instruction::Instruction { + program_id: ctx.accounts.bubblegum_program.key(), + accounts: accounts2, + data: data2, + }, + &account_infos2[..], + &[&[b"cNFT-vault", &[*ctx.bumps.get("leaf_owner").unwrap()]]], + )?; msg!("successfully sent cNFTs"); Ok(()) - } - } #[derive(Accounts)] pub struct Withdraw<'info> { #[account( seeds = [merkle_tree.key().as_ref()], - bump, + bump, seeds::program = bubblegum_program.key() )] /// CHECK: This account is neither written to nor read from. pub tree_authority: Account<'info, TreeConfig>, - + #[account( seeds = [b"cNFT-vault"], bump, @@ -232,7 +240,7 @@ pub struct Withdraw<'info> { pub struct WithdrawTwo<'info> { #[account( seeds = [merkle_tree1.key().as_ref()], - bump, + bump, seeds::program = bubblegum_program.key() )] /// CHECK: This account is neither written to nor read from. @@ -248,10 +256,10 @@ pub struct WithdrawTwo<'info> { #[account(mut)] /// CHECK: This account is modified in the downstream program pub merkle_tree1: UncheckedAccount<'info>, - + #[account( seeds = [merkle_tree2.key().as_ref()], - bump, + bump, seeds::program = bubblegum_program.key() )] /// CHECK: This account is neither written to nor read from. @@ -267,4 +275,3 @@ pub struct WithdrawTwo<'info> { pub bubblegum_program: Program<'info, MplBubblegum>, pub system_program: Program<'info, System>, } - diff --git a/compression/cutils/programs/cutils/Cargo.toml b/compression/cutils/programs/cutils/Cargo.toml index 1cfccd468..9f3003dba 100644 --- a/compression/cutils/programs/cutils/Cargo.toml +++ b/compression/cutils/programs/cutils/Cargo.toml @@ -17,11 +17,11 @@ default = [] [dependencies] anchor-lang = "0.26.0" -solana-program = "~1.14.18" +solana-program = "1.14.18" spl-account-compression = { version="0.1.8", features = ["cpi"] } mpl-bubblegum = { version = "0.7.0", features = ["no-entrypoint", "cpi"] } # Added due to anchor and solana-cli wonkyness as of late getrandom = { version = "0.2.10", features = ["custom"] } winnow = "=0.4.1" -toml_datetime = "=0.6.1" \ No newline at end of file +toml_datetime = "=0.6.1" diff --git a/compression/cutils/programs/cutils/src/actions/mint.rs b/compression/cutils/programs/cutils/src/actions/mint.rs index 6cfc22eca..528740bdc 100644 --- a/compression/cutils/programs/cutils/src/actions/mint.rs +++ b/compression/cutils/programs/cutils/src/actions/mint.rs @@ -1,13 +1,8 @@ use crate::*; -use mpl_bubblegum::{ - state::{ - TreeConfig, - COLLECTION_CPI_PREFIX, - metaplex_adapter::{Collection, Creator, MetadataArgs, TokenProgramVersion, TokenStandard}, - metaplex_anchor::{ - TokenMetadata, MplTokenMetadata - }, - } +use mpl_bubblegum::state::{ + metaplex_adapter::{Collection, Creator, MetadataArgs, TokenProgramVersion, TokenStandard}, + metaplex_anchor::{MplTokenMetadata, TokenMetadata}, + TreeConfig, COLLECTION_CPI_PREFIX, }; #[derive(Accounts)] @@ -26,7 +21,6 @@ pub struct Mint<'info> { // space = Data::LEN, // )] // pub data: Account<'info, Data>, - pub payer: Signer<'info>, // Bubblegum cNFT stuff MintToCollectionV1 @@ -86,17 +80,13 @@ pub struct MintParams { } impl Mint<'_> { - pub fn validate( - &self, - _ctx: &Context, - _params: &MintParams, - ) -> Result<()> { + pub fn validate(&self, _ctx: &Context, _params: &MintParams) -> Result<()> { Ok(()) } pub fn actuate<'info>( ctx: Context<'_, '_, '_, 'info, Mint<'info>>, - params: MintParams + params: MintParams, ) -> Result<()> { mpl_bubblegum::cpi::mint_to_collection_v1( CpiContext::new( @@ -109,7 +99,10 @@ impl Mint<'_> { payer: ctx.accounts.payer.to_account_info(), tree_delegate: ctx.accounts.tree_delegate.to_account_info(), collection_authority: ctx.accounts.collection_authority.to_account_info(), - collection_authority_record_pda: ctx.accounts.collection_authority_record_pda.to_account_info(), + collection_authority_record_pda: ctx + .accounts + .collection_authority_record_pda + .to_account_info(), collection_mint: ctx.accounts.collection_mint.to_account_info(), collection_metadata: ctx.accounts.collection_metadata.to_account_info(), edition_account: ctx.accounts.edition_account.to_account_info(), @@ -118,24 +111,29 @@ impl Mint<'_> { compression_program: ctx.accounts.compression_program.to_account_info(), token_metadata_program: ctx.accounts.token_metadata_program.to_account_info(), system_program: ctx.accounts.system_program.to_account_info(), - } + }, ), MetadataArgs { name: "BURGER".to_string(), symbol: "BURG".to_string(), uri: params.uri, - creators: vec![ - Creator {address: ctx.accounts.collection_authority.key(), verified: false, share: 100}, - ], + creators: vec![Creator { + address: ctx.accounts.collection_authority.key(), + verified: false, + share: 100, + }], seller_fee_basis_points: 0, primary_sale_happened: false, is_mutable: false, edition_nonce: Some(0), uses: None, - collection: Some(Collection {verified: false, key: ctx.accounts.collection_mint.key()}), + collection: Some(Collection { + verified: false, + key: ctx.accounts.collection_mint.key(), + }), token_program_version: TokenProgramVersion::Original, token_standard: Some(TokenStandard::NonFungible), - } + }, )?; Ok(()) diff --git a/compression/cutils/programs/cutils/src/actions/mod.rs b/compression/cutils/programs/cutils/src/actions/mod.rs index 51f437c33..f2a2113e1 100644 --- a/compression/cutils/programs/cutils/src/actions/mod.rs +++ b/compression/cutils/programs/cutils/src/actions/mod.rs @@ -2,4 +2,4 @@ pub mod mint; pub use mint::*; pub mod verify; -pub use verify::*; \ No newline at end of file +pub use verify::*; diff --git a/compression/cutils/programs/cutils/src/actions/verify.rs b/compression/cutils/programs/cutils/src/actions/verify.rs index 462a2c8c9..8d5cd6332 100644 --- a/compression/cutils/programs/cutils/src/actions/verify.rs +++ b/compression/cutils/programs/cutils/src/actions/verify.rs @@ -1,9 +1,7 @@ use crate::*; use mpl_bubblegum::state::leaf_schema::LeafSchema; use mpl_bubblegum::utils::get_asset_id; -use spl_account_compression::{ - program::SplAccountCompression -}; +use spl_account_compression::program::SplAccountCompression; #[derive(Accounts)] #[instruction(params: VerifyParams)] @@ -29,15 +27,14 @@ pub struct VerifyParams { } impl Verify<'_> { - pub fn validate( - &self, - _ctx: &Context, - _params: &VerifyParams - ) -> Result<()> { + pub fn validate(&self, _ctx: &Context, _params: &VerifyParams) -> Result<()> { Ok(()) } - pub fn actuate<'info>(ctx: Context<'_, '_, '_, 'info, Verify<'info>>, params: &VerifyParams) -> Result<()> { + pub fn actuate<'info>( + ctx: Context<'_, '_, '_, 'info, Verify<'info>>, + params: &VerifyParams, + ) -> Result<()> { let asset_id = get_asset_id(&ctx.accounts.merkle_tree.key(), params.nonce); let leaf = LeafSchema::new_v0( asset_id, @@ -53,7 +50,8 @@ impl Verify<'_> { spl_account_compression::cpi::accounts::VerifyLeaf { merkle_tree: ctx.accounts.merkle_tree.to_account_info(), }, - ).with_remaining_accounts(ctx.remaining_accounts.to_vec()); + ) + .with_remaining_accounts(ctx.remaining_accounts.to_vec()); spl_account_compression::cpi::verify_leaf( cpi_ctx, diff --git a/compression/cutils/programs/cutils/src/lib.rs b/compression/cutils/programs/cutils/src/lib.rs index ace39f5f4..aeb37bc5b 100644 --- a/compression/cutils/programs/cutils/src/lib.rs +++ b/compression/cutils/programs/cutils/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + pub mod actions; pub use actions::*; @@ -5,10 +7,8 @@ pub mod state; pub use state::*; use anchor_lang::prelude::*; -use solana_program::{pubkey::Pubkey}; -use spl_account_compression::{ - program::SplAccountCompression, Noop, -}; +use solana_program::pubkey::Pubkey; +use spl_account_compression::{program::SplAccountCompression, Noop}; #[derive(Clone)] pub struct MplBubblegum; @@ -28,7 +28,7 @@ pub mod cutils { #[access_control(ctx.accounts.validate(&ctx, ¶ms))] pub fn mint<'info>( ctx: Context<'_, '_, '_, 'info, Mint<'info>>, - params: MintParams + params: MintParams, ) -> Result<()> { Mint::actuate(ctx, params) } @@ -36,9 +36,8 @@ pub mod cutils { #[access_control(ctx.accounts.validate(&ctx, ¶ms))] pub fn verify<'info>( ctx: Context<'_, '_, '_, 'info, Verify<'info>>, - params: VerifyParams + params: VerifyParams, ) -> Result<()> { Verify::actuate(ctx, ¶ms) } - } diff --git a/compression/cutils/programs/cutils/src/state/data.rs b/compression/cutils/programs/cutils/src/state/data.rs index 1395c0b41..9a7d6f233 100644 --- a/compression/cutils/programs/cutils/src/state/data.rs +++ b/compression/cutils/programs/cutils/src/state/data.rs @@ -18,7 +18,7 @@ impl Data { Self { bump, tree, - tree_nonce + tree_nonce, } } } diff --git a/oracles/pyth/anchor/programs/pythexample/Cargo.toml b/oracles/pyth/anchor/programs/pythexample/Cargo.toml index c93eef08c..fdb48140e 100644 --- a/oracles/pyth/anchor/programs/pythexample/Cargo.toml +++ b/oracles/pyth/anchor/programs/pythexample/Cargo.toml @@ -16,6 +16,6 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.27.0" -pyth-sdk-solana = "0.7.1" -pyth-sdk = "0.7.0" +anchor-lang = "0.28.0" +pyth-sdk-solana = "0.8.0" +pyth-sdk = "0.8.0" diff --git a/oracles/pyth/anchor/programs/pythexample/src/lib.rs b/oracles/pyth/anchor/programs/pythexample/src/lib.rs index d48292108..08ade159e 100644 --- a/oracles/pyth/anchor/programs/pythexample/src/lib.rs +++ b/oracles/pyth/anchor/programs/pythexample/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; pub mod state; use state::PriceFeed; diff --git a/oracles/pyth/anchor/programs/pythexample/src/state.rs b/oracles/pyth/anchor/programs/pythexample/src/state.rs index 77fb83865..9f0cb2647 100644 --- a/oracles/pyth/anchor/programs/pythexample/src/state.rs +++ b/oracles/pyth/anchor/programs/pythexample/src/state.rs @@ -14,7 +14,7 @@ impl anchor_lang::Owner for PriceFeed { fn owner() -> Pubkey { // The mainnet Pyth program ID let oracle_addr = "FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH"; - return Pubkey::from_str(&oracle_addr).unwrap(); + Pubkey::from_str(oracle_addr).unwrap() } } @@ -24,7 +24,7 @@ impl anchor_lang::AccountDeserialize for PriceFeed { let zeros: [u8; 32] = [0; 32]; let dummy_key = Pubkey::new_from_array(zeros); let feed = account.to_price_feed(&dummy_key); - return Ok(PriceFeed(feed)); + Ok(PriceFeed(feed)) } } diff --git a/tokens/create-token/anchor/programs/create-token/Cargo.toml b/tokens/create-token/anchor/programs/create-token/Cargo.toml index 19dbfb2f3..7f5cf03f0 100644 --- a/tokens/create-token/anchor/programs/create-token/Cargo.toml +++ b/tokens/create-token/anchor/programs/create-token/Cargo.toml @@ -16,6 +16,6 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.25.0" -anchor-spl = "0.25.0" -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } \ No newline at end of file +anchor-lang = "0.28.0" +anchor-spl = "0.28.0" +mpl-token-metadata = { version = "1.11", features = [ "no-entrypoint" ] } diff --git a/tokens/create-token/anchor/programs/create-token/src/lib.rs b/tokens/create-token/anchor/programs/create-token/src/lib.rs index 3989162c1..cba062f9f 100644 --- a/tokens/create-token/anchor/programs/create-token/src/lib.rs +++ b/tokens/create-token/anchor/programs/create-token/src/lib.rs @@ -1,48 +1,47 @@ +#![allow(clippy::result_large_err)] + use { - anchor_lang::{ - prelude::*, - solana_program::program::invoke, - }, + anchor_lang::{prelude::*, solana_program::program::invoke}, anchor_spl::token, mpl_token_metadata::instruction as mpl_instruction, }; - declare_id!("5yRmjtx87UJMJF4NEeqjpmgAu7MBJZACW6ksiCYqQxVh"); - #[program] pub mod create_token { use super::*; pub fn create_token_mint( - ctx: Context, - token_title: String, - token_symbol: String, + ctx: Context, + token_title: String, + token_symbol: String, token_uri: String, _token_decimals: u8, ) -> Result<()> { - msg!("Creating metadata account..."); - msg!("Metadata account address: {}", &ctx.accounts.metadata_account.key()); + msg!( + "Metadata account address: {}", + &ctx.accounts.metadata_account.key() + ); invoke( &mpl_instruction::create_metadata_accounts_v3( - ctx.accounts.token_metadata_program.key(), // Program ID (the Token Metadata Program) - ctx.accounts.metadata_account.key(), // Metadata account - ctx.accounts.mint_account.key(), // Mint account - ctx.accounts.mint_authority.key(), // Mint authority - ctx.accounts.payer.key(), // Payer - ctx.accounts.mint_authority.key(), // Update authority - token_title, // Name - token_symbol, // Symbol - token_uri, // URI - None, // Creators - 0, // Seller fee basis points - true, // Update authority is signer - false, // Is mutable - None, // Collection - None, // Uses - None, // Collection Details + ctx.accounts.token_metadata_program.key(), // Program ID (the Token Metadata Program) + ctx.accounts.metadata_account.key(), // Metadata account + ctx.accounts.mint_account.key(), // Mint account + ctx.accounts.mint_authority.key(), // Mint authority + ctx.accounts.payer.key(), // Payer + ctx.accounts.mint_authority.key(), // Update authority + token_title, // Name + token_symbol, // Symbol + token_uri, // URI + None, // Creators + 0, // Seller fee basis points + true, // Update authority is signer + false, // Is mutable + None, // Collection + None, // Uses + None, // Collection Details ), &[ ctx.accounts.metadata_account.to_account_info(), @@ -51,24 +50,23 @@ pub mod create_token { ctx.accounts.payer.to_account_info(), ctx.accounts.mint_authority.to_account_info(), ctx.accounts.rent.to_account_info(), - ] + ], )?; - + msg!("Token mint created successfully."); - + Ok(()) } } - // The macros within the Account Context will create our // Mint account and initialize it as a Mint // We just have to do the metadata // #[derive(Accounts)] #[instruction( - token_title: String, - token_symbol: String, + token_title: String, + token_symbol: String, token_uri: String, token_decimals: u8, )] @@ -91,4 +89,4 @@ pub struct CreateTokenMint<'info> { pub token_program: Program<'info, token::Token>, /// CHECK: Metaplex will check this pub token_metadata_program: UncheckedAccount<'info>, -} \ No newline at end of file +} diff --git a/tokens/create-token/native/program/Cargo.toml b/tokens/create-token/native/program/Cargo.toml index 3efd12b71..91e2212a8 100644 --- a/tokens/create-token/native/program/Cargo.toml +++ b/tokens/create-token/native/program/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "program" +name = "create-token-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-token = { version="3.3.0", features = [ "no-entrypoint" ] } -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-token = { version = "4.0.0", features = [ "no-entrypoint" ] } +spl-associated-token-account = { version = "2.0.0", features = [ "no-entrypoint" ] } +mpl-token-metadata = { version = "1.11", features = [ "no-entrypoint" ] } [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/tokens/create-token/native/program/src/lib.rs b/tokens/create-token/native/program/src/lib.rs index d82ee1095..e7788f431 100644 --- a/tokens/create-token/native/program/src/lib.rs +++ b/tokens/create-token/native/program/src/lib.rs @@ -1,13 +1,11 @@ use { - borsh::{ - BorshSerialize, - BorshDeserialize - }, + borsh::{BorshDeserialize, BorshSerialize}, + mpl_token_metadata::instruction as mpl_instruction, solana_program::{ - account_info::{next_account_info, AccountInfo}, + account_info::{next_account_info, AccountInfo}, entrypoint, - entrypoint::ProgramResult, - msg, + entrypoint::ProgramResult, + msg, program::invoke, program_pack::Pack, pubkey::Pubkey, @@ -15,16 +13,9 @@ use { system_instruction, sysvar::Sysvar, }, - spl_token::{ - instruction as token_instruction, - state::Mint, - }, - mpl_token_metadata::{ - instruction as mpl_instruction, - }, + spl_token::{instruction as token_instruction, state::Mint}, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct CreateTokenArgs { pub token_title: String, @@ -33,16 +24,13 @@ pub struct CreateTokenArgs { pub token_decimals: u8, } - entrypoint!(process_instruction); - fn process_instruction( _program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - let args = CreateTokenArgs::try_from_slice(instruction_data)?; let accounts_iter = &mut accounts.iter(); @@ -62,18 +50,18 @@ fn process_instruction( msg!("Mint: {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, - &mint_account.key, + payer.key, + mint_account.key, (Rent::get()?).minimum_balance(Mint::LEN), Mint::LEN as u64, - &token_program.key, + token_program.key, ), &[ mint_account.clone(), payer.clone(), system_program.clone(), token_program.clone(), - ] + ], )?; // Now initialize that account as a Mint (standard Mint) @@ -82,10 +70,10 @@ fn process_instruction( msg!("Mint: {}", mint_account.key); invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), args.token_decimals, )?, &[ @@ -93,7 +81,7 @@ fn process_instruction( mint_authority.clone(), token_program.clone(), rent.clone(), - ] + ], )?; // Now create the account for that Mint's metadata @@ -126,10 +114,10 @@ fn process_instruction( payer.clone(), token_metadata_program.clone(), rent.clone(), - ] + ], )?; msg!("Token mint created successfully."); Ok(()) -} \ No newline at end of file +} diff --git a/tokens/nft-minter/anchor/programs/nft-minter/Cargo.toml b/tokens/nft-minter/anchor/programs/nft-minter/Cargo.toml index aaac2cdee..41335901a 100644 --- a/tokens/nft-minter/anchor/programs/nft-minter/Cargo.toml +++ b/tokens/nft-minter/anchor/programs/nft-minter/Cargo.toml @@ -16,7 +16,7 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = { version="0.25.0", features=["init-if-needed"] } -anchor-spl = "0.25.0" -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } -spl-token = "3.3.0" +anchor-lang = { version = "0.28.0", features=["init-if-needed"] } +anchor-spl = "0.28.0" +mpl-token-metadata = { version = "1.11" } +spl-token = "4.0.0" diff --git a/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/create.rs b/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/create.rs index 53a1b8ca4..43a00fb7d 100644 --- a/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/create.rs +++ b/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/create.rs @@ -1,40 +1,38 @@ use { - anchor_lang::{ - prelude::*, - solana_program::program::invoke, - }, + anchor_lang::{prelude::*, solana_program::program::invoke}, anchor_spl::token, mpl_token_metadata::instruction as mpl_instruction, }; - pub fn create_token( - ctx: Context, - nft_title: String, - nft_symbol: String, + ctx: Context, + nft_title: String, + nft_symbol: String, nft_uri: String, ) -> Result<()> { - msg!("Creating metadata account..."); - msg!("Metadata account address: {}", &ctx.accounts.metadata_account.key()); + msg!( + "Metadata account address: {}", + &ctx.accounts.metadata_account.key() + ); invoke( &mpl_instruction::create_metadata_accounts_v3( - ctx.accounts.token_metadata_program.key(), // Program ID (the Token Metadata Program) - ctx.accounts.metadata_account.key(), // Metadata account - ctx.accounts.mint_account.key(), // Mint account - ctx.accounts.mint_authority.key(), // Mint authority - ctx.accounts.payer.key(), // Payer - ctx.accounts.mint_authority.key(), // Update authority - nft_title, // Name - nft_symbol, // Symbol - nft_uri, // URI - None, // Creators - 0, // Seller fee basis points - true, // Update authority is signer - false, // Is mutable - None, // Collection - None, // Uses - None, // Collection Details + ctx.accounts.token_metadata_program.key(), // Program ID (the Token Metadata Program) + ctx.accounts.metadata_account.key(), // Metadata account + ctx.accounts.mint_account.key(), // Mint account + ctx.accounts.mint_authority.key(), // Mint authority + ctx.accounts.payer.key(), // Payer + ctx.accounts.mint_authority.key(), // Update authority + nft_title, // Name + nft_symbol, // Symbol + nft_uri, // URI + None, // Creators + 0, // Seller fee basis points + true, // Update authority is signer + false, // Is mutable + None, // Collection + None, // Uses + None, // Collection Details ), &[ ctx.accounts.metadata_account.to_account_info(), @@ -51,7 +49,6 @@ pub fn create_token( Ok(()) } - #[derive(Accounts)] pub struct CreateToken<'info> { /// CHECK: We're about to create this with Metaplex @@ -73,4 +70,4 @@ pub struct CreateToken<'info> { pub token_program: Program<'info, token::Token>, /// CHECK: Metaplex will check this pub token_metadata_program: UncheckedAccount<'info>, -} \ No newline at end of file +} diff --git a/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/mint.rs b/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/mint.rs index 5c16a3cde..b67c08c59 100644 --- a/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/mint.rs +++ b/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/mint.rs @@ -1,26 +1,22 @@ use { - anchor_lang::{ - prelude::*, - solana_program::program::invoke, - }, - anchor_spl::{ - token, - associated_token, - }, + anchor_lang::{prelude::*, solana_program::program::invoke}, + anchor_spl::{associated_token, token}, mpl_token_metadata::instruction as mpl_instruction, // spl_token::instruction::AuthorityType, }; - -pub fn mint_to( - ctx: Context, -) -> Result<()> { - +pub fn mint_to(ctx: Context) -> Result<()> { // Mint the NFT to the user's wallet // msg!("Minting NFT to associated token account..."); - msg!("Mint: {}", &ctx.accounts.mint_account.to_account_info().key()); - msg!("Token Address: {}", &ctx.accounts.associated_token_account.key()); + msg!( + "Mint: {}", + &ctx.accounts.mint_account.to_account_info().key() + ); + msg!( + "Token Address: {}", + &ctx.accounts.associated_token_account.key() + ); token::mint_to( CpiContext::new( ctx.accounts.token_program.to_account_info(), @@ -38,17 +34,20 @@ pub fn mint_to( // Edition Account. // msg!("Creating edition account..."); - msg!("Edition account address: {}", ctx.accounts.edition_account.key()); + msg!( + "Edition account address: {}", + ctx.accounts.edition_account.key() + ); invoke( &mpl_instruction::create_master_edition_v3( - ctx.accounts.token_metadata_program.key(), // Program ID - ctx.accounts.edition_account.key(), // Edition - ctx.accounts.mint_account.key(), // Mint - ctx.accounts.mint_authority.key(), // Update Authority - ctx.accounts.mint_authority.key(), // Mint Authority - ctx.accounts.metadata_account.key(), // Metadata - ctx.accounts.payer.key(), // Payer - Some(1), // Max Supply + ctx.accounts.token_metadata_program.key(), // Program ID + ctx.accounts.edition_account.key(), // Edition + ctx.accounts.mint_account.key(), // Mint + ctx.accounts.mint_authority.key(), // Update Authority + ctx.accounts.mint_authority.key(), // Mint Authority + ctx.accounts.metadata_account.key(), // Metadata + ctx.accounts.payer.key(), // Payer + Some(1), // Max Supply ), &[ ctx.accounts.edition_account.to_account_info(), @@ -58,13 +57,13 @@ pub fn mint_to( ctx.accounts.payer.to_account_info(), ctx.accounts.token_metadata_program.to_account_info(), ctx.accounts.rent.to_account_info(), - ] + ], )?; // If we don't use Metaplex Editions, we must disable minting manually // ------------------------------------------------------------------- // - // msg!("Disabling future minting of this NFT..."); + // msg!("Disabling future minting of this NFT..."); // token::set_authority( // CpiContext::new( // ctx.accounts.token_program.to_account_info(), @@ -93,7 +92,6 @@ pub fn mint_to( Ok(()) } - #[derive(Accounts)] pub struct MintTo<'info> { /// CHECK: Metaplex will check this @@ -125,4 +123,4 @@ pub struct MintTo<'info> { pub associated_token_program: Program<'info, associated_token::AssociatedToken>, /// CHECK: Metaplex will check this pub token_metadata_program: UncheckedAccount<'info>, -} \ No newline at end of file +} diff --git a/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/mod.rs b/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/mod.rs index cc57cdbc9..b5fc4285b 100644 --- a/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/mod.rs +++ b/tokens/nft-minter/anchor/programs/nft-minter/src/instructions/mod.rs @@ -2,4 +2,4 @@ pub mod create; pub mod mint; pub use create::*; -pub use mint::*; \ No newline at end of file +pub use mint::*; diff --git a/tokens/nft-minter/anchor/programs/nft-minter/src/lib.rs b/tokens/nft-minter/anchor/programs/nft-minter/src/lib.rs index 2869e03ac..21af633ad 100644 --- a/tokens/nft-minter/anchor/programs/nft-minter/src/lib.rs +++ b/tokens/nft-minter/anchor/programs/nft-minter/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; pub mod instructions; diff --git a/tokens/nft-minter/native/program/Cargo.toml b/tokens/nft-minter/native/program/Cargo.toml index 3efd12b71..551217948 100644 --- a/tokens/nft-minter/native/program/Cargo.toml +++ b/tokens/nft-minter/native/program/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "program" +name = "nft-minter-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-token = { version="3.3.0", features = [ "no-entrypoint" ] } -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-token = { version="4.0.0", features = [ "no-entrypoint" ] } +spl-associated-token-account = { version="2.0.0", features = [ "no-entrypoint" ] } +mpl-token-metadata = { version="1.11" } [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/tokens/nft-minter/native/program/src/instructions/create.rs b/tokens/nft-minter/native/program/src/instructions/create.rs index b0712d62c..1bc557ea9 100644 --- a/tokens/nft-minter/native/program/src/instructions/create.rs +++ b/tokens/nft-minter/native/program/src/instructions/create.rs @@ -1,28 +1,19 @@ use { - borsh::{ - BorshDeserialize, - BorshSerialize, - }, + borsh::{BorshDeserialize, BorshSerialize}, + mpl_token_metadata::instruction as mpl_instruction, solana_program::{ - account_info::{next_account_info, AccountInfo}, - entrypoint::ProgramResult, - msg, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, + msg, program::invoke, program_pack::Pack, rent::Rent, system_instruction, sysvar::Sysvar, }, - spl_token::{ - instruction as token_instruction, - state::Mint, - }, - mpl_token_metadata::{ - instruction as mpl_instruction, - }, + spl_token::{instruction as token_instruction, state::Mint}, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct CreateTokenArgs { pub nft_title: String, @@ -30,12 +21,7 @@ pub struct CreateTokenArgs { pub nft_uri: String, } - -pub fn create_token( - accounts: &[AccountInfo], - args: CreateTokenArgs, -) -> ProgramResult { - +pub fn create_token(accounts: &[AccountInfo], args: CreateTokenArgs) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let mint_account = next_account_info(accounts_iter)?; @@ -53,18 +39,18 @@ pub fn create_token( msg!("Mint: {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, - &mint_account.key, + payer.key, + mint_account.key, (Rent::get()?).minimum_balance(Mint::LEN), Mint::LEN as u64, - &token_program.key, + token_program.key, ), &[ mint_account.clone(), payer.clone(), system_program.clone(), token_program.clone(), - ] + ], )?; // Now initialize that account as a Mint (standard Mint) @@ -73,18 +59,18 @@ pub fn create_token( msg!("Mint: {}", mint_account.key); invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), - 0, // 0 Decimals for the NFT standard + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), + 0, // 0 Decimals for the NFT standard )?, &[ mint_account.clone(), mint_authority.clone(), token_program.clone(), rent.clone(), - ] + ], )?; // Now create the account for that Mint's metadata @@ -117,10 +103,10 @@ pub fn create_token( payer.clone(), token_metadata_program.clone(), rent.clone(), - ] + ], )?; msg!("Token mint created successfully."); Ok(()) -} \ No newline at end of file +} diff --git a/tokens/nft-minter/native/program/src/instructions/mint.rs b/tokens/nft-minter/native/program/src/instructions/mint.rs index 1bf7dd3d4..cf47ed677 100644 --- a/tokens/nft-minter/native/program/src/instructions/mint.rs +++ b/tokens/nft-minter/native/program/src/instructions/mint.rs @@ -1,26 +1,16 @@ use { + mpl_token_metadata::instruction as mpl_instruction, solana_program::{ account_info::{next_account_info, AccountInfo}, - entrypoint::ProgramResult, - msg, + entrypoint::ProgramResult, + msg, program::invoke, }, - spl_token::{ - instruction as token_instruction, - }, - spl_associated_token_account::{ - instruction as associated_token_account_instruction, - }, - mpl_token_metadata::{ - instruction as mpl_instruction, - }, + spl_associated_token_account::instruction as associated_token_account_instruction, + spl_token::instruction as token_instruction, }; - -pub fn mint_to( - accounts: &[AccountInfo], -) -> ProgramResult { - +pub fn mint_to(accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let mint_account = next_account_info(accounts_iter)?; @@ -39,9 +29,10 @@ pub fn mint_to( msg!("Creating associated token account..."); invoke( &associated_token_account_instruction::create_associated_token_account( - &payer.key, - &payer.key, - &mint_account.key, + payer.key, + payer.key, + mint_account.key, + token_program.key, ), &[ mint_account.clone(), @@ -49,7 +40,7 @@ pub fn mint_to( payer.clone(), token_program.clone(), associated_token_program.clone(), - ] + ], )?; } else { msg!("Associated token account exists."); @@ -61,11 +52,11 @@ pub fn mint_to( msg!("Minting NFT to associated token account..."); invoke( &token_instruction::mint_to( - &token_program.key, - &mint_account.key, - &associated_token_account.key, - &mint_authority.key, - &[&mint_authority.key], + token_program.key, + mint_account.key, + associated_token_account.key, + mint_authority.key, + &[mint_authority.key], 1, )?, &[ @@ -84,14 +75,14 @@ pub fn mint_to( msg!("Edition account address: {}", edition_account.key); invoke( &mpl_instruction::create_master_edition_v3( - *token_metadata_program.key, // Program ID - *edition_account.key, // Edition - *mint_account.key, // Mint - *mint_authority.key, // Update Authority - *mint_authority.key, // Mint Authority - *metadata_account.key, // Metadata - *payer.key, // Payer - Some(1), // Max Supply + *token_metadata_program.key, // Program ID + *edition_account.key, // Edition + *mint_account.key, // Mint + *mint_authority.key, // Update Authority + *mint_authority.key, // Mint Authority + *metadata_account.key, // Metadata + *payer.key, // Payer + Some(1), // Max Supply ), &[ edition_account.clone(), @@ -101,7 +92,7 @@ pub fn mint_to( payer.clone(), token_metadata_program.clone(), rent.clone(), - ] + ], )?; // If we don't use Metaplex Editions, we must disable minting manually @@ -110,10 +101,10 @@ pub fn mint_to( // msg!("Disabling future minting of this NFT..."); // invoke( // &token_instruction::set_authority( - // &token_program.key, - // &mint_account.key, - // None, - // token_instruction::AuthorityType::MintTokens, + // &token_program.key, + // &mint_account.key, + // None, + // token_instruction::AuthorityType::MintTokens, // &mint_authority.key, // &[&mint_authority.key], // )?, @@ -125,10 +116,10 @@ pub fn mint_to( // )?; // invoke( // &token_instruction::set_authority( - // &token_program.key, - // &mint_account.key, - // None, - // token_instruction::AuthorityType::FreezeAccount, + // &token_program.key, + // &mint_account.key, + // None, + // token_instruction::AuthorityType::FreezeAccount, // &mint_authority.key, // &[&mint_authority.key], // )?, @@ -143,4 +134,3 @@ pub fn mint_to( Ok(()) } - diff --git a/tokens/nft-minter/native/program/src/instructions/mod.rs b/tokens/nft-minter/native/program/src/instructions/mod.rs index cc57cdbc9..b5fc4285b 100644 --- a/tokens/nft-minter/native/program/src/instructions/mod.rs +++ b/tokens/nft-minter/native/program/src/instructions/mod.rs @@ -2,4 +2,4 @@ pub mod create; pub mod mint; pub use create::*; -pub use mint::*; \ No newline at end of file +pub use mint::*; diff --git a/tokens/nft-minter/native/program/src/lib.rs b/tokens/nft-minter/native/program/src/lib.rs index 0dd155c0e..ffe183c30 100644 --- a/tokens/nft-minter/native/program/src/lib.rs +++ b/tokens/nft-minter/native/program/src/lib.rs @@ -1,22 +1,16 @@ use solana_program::{ - account_info::AccountInfo, - entrypoint, - entrypoint::ProgramResult, - pubkey::Pubkey, + account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey, }; -pub mod processor; pub mod instructions; - +pub mod processor; entrypoint!(process_instruction); - fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - processor::process_instruction(program_id, accounts, instruction_data) -} \ No newline at end of file +} diff --git a/tokens/nft-minter/native/program/src/processor.rs b/tokens/nft-minter/native/program/src/processor.rs index cfb654a51..67a343b96 100644 --- a/tokens/nft-minter/native/program/src/processor.rs +++ b/tokens/nft-minter/native/program/src/processor.rs @@ -1,41 +1,28 @@ use { - borsh::{ - BorshDeserialize, - BorshSerialize, - }, - solana_program::{ - account_info::AccountInfo, - entrypoint::ProgramResult, - pubkey::Pubkey, - }, + borsh::{BorshDeserialize, BorshSerialize}, + solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}, }; -use crate::instructions::{ - create::{ - CreateTokenArgs, - create_token, - }, +use crate::instructions::{ + create::{create_token, CreateTokenArgs}, mint::mint_to, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] enum SplMinterIntstruction { Create(CreateTokenArgs), Mint, } - pub fn process_instruction( _program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - let instruction = SplMinterIntstruction::try_from_slice(instruction_data)?; match instruction { SplMinterIntstruction::Create(args) => create_token(accounts, args), SplMinterIntstruction::Mint => mint_to(accounts), } -} \ No newline at end of file +} diff --git a/tokens/pda-mint-authority/anchor/programs/nft-minter/Cargo.toml b/tokens/pda-mint-authority/anchor/programs/nft-minter/Cargo.toml index aaac2cdee..43f26edd0 100644 --- a/tokens/pda-mint-authority/anchor/programs/nft-minter/Cargo.toml +++ b/tokens/pda-mint-authority/anchor/programs/nft-minter/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "nft-minter" +name = "pda-mint-authority-anchor" version = "0.1.0" description = "Created with Anchor" edition = "2021" @@ -16,7 +16,7 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = { version="0.25.0", features=["init-if-needed"] } -anchor-spl = "0.25.0" -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } -spl-token = "3.3.0" +anchor-lang = { version="0.28.0", features=["init-if-needed"] } +anchor-spl = "0.28.0" +mpl-token-metadata = { version="1.11", features = [ "no-entrypoint" ] } +spl-token = "4.0.0" diff --git a/tokens/pda-mint-authority/anchor/programs/nft-minter/src/lib.rs b/tokens/pda-mint-authority/anchor/programs/nft-minter/src/lib.rs index d430d8951..b000832f6 100644 --- a/tokens/pda-mint-authority/anchor/programs/nft-minter/src/lib.rs +++ b/tokens/pda-mint-authority/anchor/programs/nft-minter/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; pub mod instructions; diff --git a/tokens/pda-mint-authority/native/program/Cargo.toml b/tokens/pda-mint-authority/native/program/Cargo.toml index 3efd12b71..751bf055a 100644 --- a/tokens/pda-mint-authority/native/program/Cargo.toml +++ b/tokens/pda-mint-authority/native/program/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "program" +name = "pda-mint-authority-native-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-token = { version="3.3.0", features = [ "no-entrypoint" ] } -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-token = { version="4.0.0", features = [ "no-entrypoint" ] } +spl-associated-token-account = { version="2.0.0", features = [ "no-entrypoint" ] } +mpl-token-metadata = { version="1.11", features = [ "no-entrypoint" ] } [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/tokens/pda-mint-authority/native/program/src/instructions/create.rs b/tokens/pda-mint-authority/native/program/src/instructions/create.rs index 491a7f0af..1a2a8e9e0 100644 --- a/tokens/pda-mint-authority/native/program/src/instructions/create.rs +++ b/tokens/pda-mint-authority/native/program/src/instructions/create.rs @@ -50,11 +50,11 @@ pub fn create_token( msg!("Mint: {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, - &mint_account.key, + payer.key, + mint_account.key, (Rent::get()?).minimum_balance(Mint::LEN), Mint::LEN as u64, - &token_program.key, + token_program.key, ), &[ mint_account.clone(), @@ -70,10 +70,10 @@ pub fn create_token( msg!("Mint: {}", mint_account.key); invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), 0, // 0 Decimals for the NFT standard )?, &[ diff --git a/tokens/pda-mint-authority/native/program/src/instructions/init.rs b/tokens/pda-mint-authority/native/program/src/instructions/init.rs index 13784c303..bc75700d3 100644 --- a/tokens/pda-mint-authority/native/program/src/instructions/init.rs +++ b/tokens/pda-mint-authority/native/program/src/instructions/init.rs @@ -27,8 +27,8 @@ pub fn init(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { msg!("Mint Authority: {}", &mint_authority.key); invoke_signed( &system_instruction::create_account( - &payer.key, - &mint_authority.key, + payer.key, + mint_authority.key, (Rent::get()?).minimum_balance(MintAuthorityPda::SIZE), MintAuthorityPda::SIZE as u64, program_id, diff --git a/tokens/pda-mint-authority/native/program/src/instructions/mint.rs b/tokens/pda-mint-authority/native/program/src/instructions/mint.rs index dcfd247dc..420b7e1af 100644 --- a/tokens/pda-mint-authority/native/program/src/instructions/mint.rs +++ b/tokens/pda-mint-authority/native/program/src/instructions/mint.rs @@ -36,9 +36,10 @@ pub fn mint_to(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { msg!("Creating associated token account..."); invoke( &associated_token_account_instruction::create_associated_token_account( - &payer.key, - &payer.key, - &mint_account.key, + payer.key, + payer.key, + mint_account.key, + token_program.key, ), &[ mint_account.clone(), @@ -58,11 +59,11 @@ pub fn mint_to(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { msg!("Minting NFT to associated token account..."); invoke_signed( &token_instruction::mint_to( - &token_program.key, - &mint_account.key, - &associated_token_account.key, - &mint_authority.key, - &[&mint_authority.key], + token_program.key, + mint_account.key, + associated_token_account.key, + mint_authority.key, + &[mint_authority.key], 1, )?, &[ diff --git a/tokens/spl-token-minter/anchor/programs/spl-token-minter/Cargo.toml b/tokens/spl-token-minter/anchor/programs/spl-token-minter/Cargo.toml index b97f53950..ffccd153f 100644 --- a/tokens/spl-token-minter/anchor/programs/spl-token-minter/Cargo.toml +++ b/tokens/spl-token-minter/anchor/programs/spl-token-minter/Cargo.toml @@ -16,6 +16,6 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = { version="0.25.0", features=["init-if-needed"] } -anchor-spl = "0.25.0" -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } \ No newline at end of file +anchor-lang = { version="0.28.0", features=["init-if-needed"] } +anchor-spl = "0.28.0" +mpl-token-metadata = { version="1.11.0", features = [ "no-entrypoint" ] } diff --git a/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/create.rs b/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/create.rs index 13c61d80e..9dcaec611 100644 --- a/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/create.rs +++ b/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/create.rs @@ -1,40 +1,38 @@ use { - anchor_lang::{ - prelude::*, - solana_program::program::invoke, - }, + anchor_lang::{prelude::*, solana_program::program::invoke}, anchor_spl::token, mpl_token_metadata::instruction as mpl_instruction, }; - pub fn create_token( - ctx: Context, - token_title: String, - token_symbol: String, + ctx: Context, + token_title: String, + token_symbol: String, token_uri: String, ) -> Result<()> { - msg!("Creating metadata account..."); - msg!("Metadata account address: {}", &ctx.accounts.metadata_account.key()); + msg!( + "Metadata account address: {}", + &ctx.accounts.metadata_account.key() + ); invoke( &mpl_instruction::create_metadata_accounts_v3( - ctx.accounts.token_metadata_program.key(), // Program ID (the Token Metadata Program) - ctx.accounts.metadata_account.key(), // Metadata account - ctx.accounts.mint_account.key(), // Mint account - ctx.accounts.mint_authority.key(), // Mint authority - ctx.accounts.payer.key(), // Payer - ctx.accounts.mint_authority.key(), // Update authority - token_title, // Name - token_symbol, // Symbol - token_uri, // URI - None, // Creators - 0, // Seller fee basis points - true, // Update authority is signer - false, // Is mutable - None, // Collection - None, // Uses - None, // Collection Details + ctx.accounts.token_metadata_program.key(), // Program ID (the Token Metadata Program) + ctx.accounts.metadata_account.key(), // Metadata account + ctx.accounts.mint_account.key(), // Mint account + ctx.accounts.mint_authority.key(), // Mint authority + ctx.accounts.payer.key(), // Payer + ctx.accounts.mint_authority.key(), // Update authority + token_title, // Name + token_symbol, // Symbol + token_uri, // URI + None, // Creators + 0, // Seller fee basis points + true, // Update authority is signer + false, // Is mutable + None, // Collection + None, // Uses + None, // Collection Details ), &[ ctx.accounts.metadata_account.to_account_info(), @@ -51,7 +49,6 @@ pub fn create_token( Ok(()) } - #[derive(Accounts)] pub struct CreateToken<'info> { /// CHECK: We're about to create this with Metaplex @@ -72,4 +69,4 @@ pub struct CreateToken<'info> { pub token_program: Program<'info, token::Token>, /// CHECK: Metaplex will check this pub token_metadata_program: UncheckedAccount<'info>, -} \ No newline at end of file +} diff --git a/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/mint.rs b/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/mint.rs index 1ab1d2495..e60bfc0d3 100644 --- a/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/mint.rs +++ b/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/mint.rs @@ -1,20 +1,18 @@ use { anchor_lang::prelude::*, - anchor_spl::{ - token, - associated_token, - }, + anchor_spl::{associated_token, token}, }; - -pub fn mint_to( - ctx: Context, - quantity: u64, -) -> Result<()> { - +pub fn mint_to(ctx: Context, quantity: u64) -> Result<()> { msg!("Minting token to token account..."); - msg!("Mint: {}", &ctx.accounts.mint_account.to_account_info().key()); - msg!("Token Address: {}", &ctx.accounts.associated_token_account.key()); + msg!( + "Mint: {}", + &ctx.accounts.mint_account.to_account_info().key() + ); + msg!( + "Token Address: {}", + &ctx.accounts.associated_token_account.key() + ); token::mint_to( CpiContext::new( ctx.accounts.token_program.to_account_info(), @@ -32,7 +30,6 @@ pub fn mint_to( Ok(()) } - #[derive(Accounts)] pub struct MintTo<'info> { #[account( @@ -55,4 +52,4 @@ pub struct MintTo<'info> { pub system_program: Program<'info, System>, pub token_program: Program<'info, token::Token>, pub associated_token_program: Program<'info, associated_token::AssociatedToken>, -} \ No newline at end of file +} diff --git a/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/mod.rs b/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/mod.rs index cc57cdbc9..b5fc4285b 100644 --- a/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/mod.rs +++ b/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/instructions/mod.rs @@ -2,4 +2,4 @@ pub mod create; pub mod mint; pub use create::*; -pub use mint::*; \ No newline at end of file +pub use mint::*; diff --git a/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/lib.rs b/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/lib.rs index 38fd80a31..b95c5bac6 100644 --- a/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/lib.rs +++ b/tokens/spl-token-minter/anchor/programs/spl-token-minter/src/lib.rs @@ -1,40 +1,27 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; pub mod instructions; use instructions::*; - declare_id!("5BStrknWEiQWHmDGdDBaG7j9qegfN2Nq83M3hXajjgXY"); - #[program] pub mod spl_token_minter { use super::*; pub fn create_token( - ctx: Context, - token_title: String, - token_symbol: String, + ctx: Context, + token_title: String, + token_symbol: String, token_uri: String, ) -> Result<()> { - - create::create_token( - ctx, - token_title, - token_symbol, - token_uri, - ) + create::create_token(ctx, token_title, token_symbol, token_uri) } - pub fn mint_to( - ctx: Context, - quantity: u64, - ) -> Result<()> { - - mint::mint_to( - ctx, - quantity, - ) + pub fn mint_to(ctx: Context, quantity: u64) -> Result<()> { + mint::mint_to(ctx, quantity) } } diff --git a/tokens/spl-token-minter/native/program/Cargo.toml b/tokens/spl-token-minter/native/program/Cargo.toml index 3efd12b71..99d312064 100644 --- a/tokens/spl-token-minter/native/program/Cargo.toml +++ b/tokens/spl-token-minter/native/program/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "program" +name = "spl-token-minter-native-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-token = { version="3.3.0", features = [ "no-entrypoint" ] } -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-token = { version="4.0.0", features = [ "no-entrypoint" ] } +spl-associated-token-account = { version="2.0.0", features = [ "no-entrypoint" ] } +mpl-token-metadata = { version="1.11", features = [ "no-entrypoint" ] } [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/tokens/spl-token-minter/native/program/src/instructions/create.rs b/tokens/spl-token-minter/native/program/src/instructions/create.rs index 0a8dbdc31..b0cc3708e 100644 --- a/tokens/spl-token-minter/native/program/src/instructions/create.rs +++ b/tokens/spl-token-minter/native/program/src/instructions/create.rs @@ -1,28 +1,19 @@ use { - borsh::{ - BorshDeserialize, - BorshSerialize, - }, + borsh::{BorshDeserialize, BorshSerialize}, + mpl_token_metadata::instruction as mpl_instruction, solana_program::{ - account_info::{next_account_info, AccountInfo}, - entrypoint::ProgramResult, - msg, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, + msg, program::invoke, program_pack::Pack, rent::Rent, system_instruction, sysvar::Sysvar, }, - spl_token::{ - instruction as token_instruction, - state::Mint, - }, - mpl_token_metadata::{ - instruction as mpl_instruction, - }, + spl_token::{instruction as token_instruction, state::Mint}, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct CreateTokenArgs { pub token_title: String, @@ -30,12 +21,7 @@ pub struct CreateTokenArgs { pub token_uri: String, } - -pub fn create_token( - accounts: &[AccountInfo], - args: CreateTokenArgs, -) -> ProgramResult { - +pub fn create_token(accounts: &[AccountInfo], args: CreateTokenArgs) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let mint_account = next_account_info(accounts_iter)?; @@ -53,18 +39,18 @@ pub fn create_token( msg!("Mint: {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, - &mint_account.key, + payer.key, + mint_account.key, (Rent::get()?).minimum_balance(Mint::LEN), Mint::LEN as u64, - &token_program.key, + token_program.key, ), &[ mint_account.clone(), payer.clone(), system_program.clone(), token_program.clone(), - ] + ], )?; // Now initialize that account as a Mint (standard Mint) @@ -73,18 +59,18 @@ pub fn create_token( msg!("Mint: {}", mint_account.key); invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), - 9, // 9 Decimals for the default SPL Token standard + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), + 9, // 9 Decimals for the default SPL Token standard )?, &[ mint_account.clone(), mint_authority.clone(), token_program.clone(), rent.clone(), - ] + ], )?; // Now create the account for that Mint's metadata @@ -117,10 +103,10 @@ pub fn create_token( payer.clone(), token_metadata_program.clone(), rent.clone(), - ] + ], )?; msg!("Token mint created successfully."); Ok(()) -} \ No newline at end of file +} diff --git a/tokens/spl-token-minter/native/program/src/instructions/mint.rs b/tokens/spl-token-minter/native/program/src/instructions/mint.rs index d37023567..78865299e 100644 --- a/tokens/spl-token-minter/native/program/src/instructions/mint.rs +++ b/tokens/spl-token-minter/native/program/src/instructions/mint.rs @@ -1,34 +1,21 @@ use { - borsh::{ - BorshDeserialize, - BorshSerialize, - }, + borsh::{BorshDeserialize, BorshSerialize}, solana_program::{ account_info::{next_account_info, AccountInfo}, - entrypoint::ProgramResult, - msg, + entrypoint::ProgramResult, + msg, program::invoke, }, - spl_token::{ - instruction as token_instruction, - }, - spl_associated_token_account::{ - instruction as associated_token_account_instruction, - }, + spl_associated_token_account::instruction as associated_token_account_instruction, + spl_token::instruction as token_instruction, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct MintToArgs { pub quantity: u64, } - -pub fn mint_to( - accounts: &[AccountInfo], - args: MintToArgs, -) -> ProgramResult { - +pub fn mint_to(accounts: &[AccountInfo], args: MintToArgs) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let mint_account = next_account_info(accounts_iter)?; @@ -43,9 +30,10 @@ pub fn mint_to( msg!("Creating associated token account..."); invoke( &associated_token_account_instruction::create_associated_token_account( - &payer.key, - &payer.key, - &mint_account.key, + payer.key, + payer.key, + mint_account.key, + token_program.key, ), &[ mint_account.clone(), @@ -54,21 +42,24 @@ pub fn mint_to( system_program.clone(), token_program.clone(), associated_token_program.clone(), - ] + ], )?; } else { msg!("Associated token account exists."); } msg!("Associated Token Address: {}", associated_token_account.key); - msg!("Minting {} tokens to associated token account...", args.quantity); + msg!( + "Minting {} tokens to associated token account...", + args.quantity + ); invoke( &token_instruction::mint_to( - &token_program.key, - &mint_account.key, - &associated_token_account.key, - &mint_authority.key, - &[&mint_authority.key], + token_program.key, + mint_account.key, + associated_token_account.key, + mint_authority.key, + &[mint_authority.key], args.quantity, )?, &[ @@ -83,4 +74,3 @@ pub fn mint_to( Ok(()) } - diff --git a/tokens/spl-token-minter/native/program/src/instructions/mod.rs b/tokens/spl-token-minter/native/program/src/instructions/mod.rs index cc57cdbc9..b5fc4285b 100644 --- a/tokens/spl-token-minter/native/program/src/instructions/mod.rs +++ b/tokens/spl-token-minter/native/program/src/instructions/mod.rs @@ -2,4 +2,4 @@ pub mod create; pub mod mint; pub use create::*; -pub use mint::*; \ No newline at end of file +pub use mint::*; diff --git a/tokens/spl-token-minter/native/program/src/lib.rs b/tokens/spl-token-minter/native/program/src/lib.rs index 0dd155c0e..ffe183c30 100644 --- a/tokens/spl-token-minter/native/program/src/lib.rs +++ b/tokens/spl-token-minter/native/program/src/lib.rs @@ -1,22 +1,16 @@ use solana_program::{ - account_info::AccountInfo, - entrypoint, - entrypoint::ProgramResult, - pubkey::Pubkey, + account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey, }; -pub mod processor; pub mod instructions; - +pub mod processor; entrypoint!(process_instruction); - fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - processor::process_instruction(program_id, accounts, instruction_data) -} \ No newline at end of file +} diff --git a/tokens/spl-token-minter/native/program/src/processor.rs b/tokens/spl-token-minter/native/program/src/processor.rs index 1c4058d45..90ee4eb87 100644 --- a/tokens/spl-token-minter/native/program/src/processor.rs +++ b/tokens/spl-token-minter/native/program/src/processor.rs @@ -1,44 +1,28 @@ use { - borsh::{ - BorshDeserialize, - BorshSerialize, - }, - solana_program::{ - account_info::AccountInfo, - entrypoint::ProgramResult, - pubkey::Pubkey, - }, + borsh::{BorshDeserialize, BorshSerialize}, + solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}, }; -use crate::instructions::{ - create::{ - CreateTokenArgs, - create_token, - }, - mint::{ - MintToArgs, - mint_to, - }, +use crate::instructions::{ + create::{create_token, CreateTokenArgs}, + mint::{mint_to, MintToArgs}, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] enum SplMinterIntstruction { Create(CreateTokenArgs), Mint(MintToArgs), } - pub fn process_instruction( _program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - let instruction = SplMinterIntstruction::try_from_slice(instruction_data)?; match instruction { SplMinterIntstruction::Create(args) => create_token(accounts, args), SplMinterIntstruction::Mint(args) => mint_to(accounts, args), } -} \ No newline at end of file +} diff --git a/tokens/token-2022/basics/anchor/programs/basics/Cargo.toml b/tokens/token-2022/basics/anchor/programs/basics/Cargo.toml index c2daf5720..62128633c 100644 --- a/tokens/token-2022/basics/anchor/programs/basics/Cargo.toml +++ b/tokens/token-2022/basics/anchor/programs/basics/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "anchor" +name = "token-2022-basic-anchor" version = "0.1.0" description = "Created with Anchor" edition = "2021" @@ -16,8 +16,7 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-spl = "0.27.0" -anchor-lang = { version = "0.27.0", features= ["init-if-needed"]} +anchor-spl = "0.28.0" +anchor-lang = { version = "0.28.0", features= ["init-if-needed"]} spl-token = { version = "3.1.1", features = ["no-entrypoint"] } -spl-token-2022 = { version = "0.5.0", features = ["no-entrypoint"] } - +spl-token-2022 = { version = "0.7.0", features = ["no-entrypoint"] } diff --git a/tokens/token-2022/basics/anchor/programs/basics/src/lib.rs b/tokens/token-2022/basics/anchor/programs/basics/src/lib.rs index 32e4a84d1..6875be40e 100644 --- a/tokens/token-2022/basics/anchor/programs/basics/src/lib.rs +++ b/tokens/token-2022/basics/anchor/programs/basics/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; use anchor_spl::associated_token::AssociatedToken; use anchor_spl::token_interface::{ diff --git a/tokens/token-2022/default-account-state/native/program/Cargo.toml b/tokens/token-2022/default-account-state/native/program/Cargo.toml index ad3d7cc9f..49ada413f 100644 --- a/tokens/token-2022/default-account-state/native/program/Cargo.toml +++ b/tokens/token-2022/default-account-state/native/program/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "program" +name = "token-2022-default-account-state-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -spl-token-2022 = {version = "0.6.1", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-associated-token-account = { version="2.0.0", features = [ "no-entrypoint" ] } +spl-token-2022 = {version = "0.7.0", features = [ "no-entrypoint" ] } [lib] crate-type = ["cdylib", "lib"] diff --git a/tokens/token-2022/default-account-state/native/program/src/lib.rs b/tokens/token-2022/default-account-state/native/program/src/lib.rs index ff2b33b6d..6697ba481 100644 --- a/tokens/token-2022/default-account-state/native/program/src/lib.rs +++ b/tokens/token-2022/default-account-state/native/program/src/lib.rs @@ -58,7 +58,7 @@ fn process_instruction( msg!("Mint account address : {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, + payer.key, mint_account.key, rent_required, space as u64, @@ -92,10 +92,10 @@ fn process_instruction( // Initialize the Token Mint invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), args.token_decimals, )?, &[ @@ -112,7 +112,7 @@ fn process_instruction( token_program.key, mint_account.key, payer.key, - &[&payer.key], + &[payer.key], &AccountState::Initialized, ) .unwrap(), diff --git a/tokens/token-2022/mint-close-authority/native/program/Cargo.toml b/tokens/token-2022/mint-close-authority/native/program/Cargo.toml index ad3d7cc9f..58360f9d8 100644 --- a/tokens/token-2022/mint-close-authority/native/program/Cargo.toml +++ b/tokens/token-2022/mint-close-authority/native/program/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "program" +name = "token-2022-mint-close-authority-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -spl-token-2022 = {version = "0.6.1", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-associated-token-account = { version="2.0.0", features = [ "no-entrypoint" ] } +spl-token-2022 = {version = "0.7.0", features = [ "no-entrypoint" ] } [lib] crate-type = ["cdylib", "lib"] diff --git a/tokens/token-2022/mint-close-authority/native/program/src/lib.rs b/tokens/token-2022/mint-close-authority/native/program/src/lib.rs index ae1d11a9c..fed3f177a 100644 --- a/tokens/token-2022/mint-close-authority/native/program/src/lib.rs +++ b/tokens/token-2022/mint-close-authority/native/program/src/lib.rs @@ -48,7 +48,7 @@ fn process_instruction( msg!("Mint account address : {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, + payer.key, mint_account.key, rent_required, space as u64, @@ -83,10 +83,10 @@ fn process_instruction( // Initialize the Token Mint invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), args.token_decimals, )?, &[ diff --git a/tokens/token-2022/multiple-extensions/native/program/Cargo.toml b/tokens/token-2022/multiple-extensions/native/program/Cargo.toml index ad3d7cc9f..bd3762735 100644 --- a/tokens/token-2022/multiple-extensions/native/program/Cargo.toml +++ b/tokens/token-2022/multiple-extensions/native/program/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "program" +name = "token-2022-multiple-extensions-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -spl-token-2022 = {version = "0.6.1", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-associated-token-account = { version="2.0.0", features = [ "no-entrypoint" ] } +spl-token-2022 = {version = "0.7.0", features = [ "no-entrypoint" ] } [lib] crate-type = ["cdylib", "lib"] diff --git a/tokens/token-2022/multiple-extensions/native/program/src/lib.rs b/tokens/token-2022/multiple-extensions/native/program/src/lib.rs index cddfc32fa..3f2e92532 100644 --- a/tokens/token-2022/multiple-extensions/native/program/src/lib.rs +++ b/tokens/token-2022/multiple-extensions/native/program/src/lib.rs @@ -51,7 +51,7 @@ fn process_instruction( msg!("Mint account address : {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, + payer.key, mint_account.key, rent_required, space as u64, @@ -97,10 +97,10 @@ fn process_instruction( // Initialize the Token Mint invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), args.token_decimals, )?, &[ diff --git a/tokens/token-2022/non-transferable/native/program/Cargo.toml b/tokens/token-2022/non-transferable/native/program/Cargo.toml index ad3d7cc9f..d47b883c8 100644 --- a/tokens/token-2022/non-transferable/native/program/Cargo.toml +++ b/tokens/token-2022/non-transferable/native/program/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "program" +name = "token-2022-non-transferable-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -spl-token-2022 = {version = "0.6.1", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-associated-token-account = { version="2.0.0", features = [ "no-entrypoint" ] } +spl-token-2022 = {version = "0.7.0", features = [ "no-entrypoint" ] } [lib] crate-type = ["cdylib", "lib"] diff --git a/tokens/token-2022/non-transferable/native/program/src/lib.rs b/tokens/token-2022/non-transferable/native/program/src/lib.rs index 3f204bbfe..ff31bc39f 100644 --- a/tokens/token-2022/non-transferable/native/program/src/lib.rs +++ b/tokens/token-2022/non-transferable/native/program/src/lib.rs @@ -47,7 +47,7 @@ fn process_instruction( msg!("Mint account address : {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, + payer.key, mint_account.key, rent_required, space as u64, @@ -77,10 +77,10 @@ fn process_instruction( // Initialize the Token Mint invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), args.token_decimals, )?, &[ diff --git a/tokens/token-2022/transfer-fees/native/program/Cargo.toml b/tokens/token-2022/transfer-fees/native/program/Cargo.toml index ad3d7cc9f..41ecccfe0 100644 --- a/tokens/token-2022/transfer-fees/native/program/Cargo.toml +++ b/tokens/token-2022/transfer-fees/native/program/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "program" +name = "token-2022-transfer-fees-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -spl-token-2022 = {version = "0.6.1", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-associated-token-account = { version="2.0.0", features = [ "no-entrypoint" ] } +spl-token-2022 = {version = "0.7.0", features = [ "no-entrypoint" ] } [lib] crate-type = ["cdylib", "lib"] diff --git a/tokens/token-2022/transfer-fees/native/program/src/lib.rs b/tokens/token-2022/transfer-fees/native/program/src/lib.rs index 46d5b0ebc..cd13bbd9b 100644 --- a/tokens/token-2022/transfer-fees/native/program/src/lib.rs +++ b/tokens/token-2022/transfer-fees/native/program/src/lib.rs @@ -54,7 +54,7 @@ fn process_instruction( msg!("Mint account address : {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, + payer.key, mint_account.key, rent_required, space as u64, @@ -95,10 +95,10 @@ fn process_instruction( // Initialize the Token Mint invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), args.token_decimals, )?, &[ diff --git a/tokens/token-swap/anchor/programs/token-swap/Cargo.toml b/tokens/token-swap/anchor/programs/token-swap/Cargo.toml index e48815d6c..78937c6f6 100644 --- a/tokens/token-swap/anchor/programs/token-swap/Cargo.toml +++ b/tokens/token-swap/anchor/programs/token-swap/Cargo.toml @@ -16,12 +16,11 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = { version = "0.26.0", features = ["init-if-needed"] } -anchor-spl = { version = "0.26.0" } +anchor-lang = { version = "0.28.0", features = ["init-if-needed"] } +anchor-spl = { version = "0.28.0" } fixed = "1.23.1" half = "=2.2.1" fixed-sqrt = "0.2.5" -solana-program = "~1.14.19" +solana-program = "1.16.10" winnow = "=0.4.1" toml_datetime = "=0.6.1" - diff --git a/tokens/token-swap/anchor/programs/token-swap/src/lib.rs b/tokens/token-swap/anchor/programs/token-swap/src/lib.rs index 26e6799c8..023f80ab1 100644 --- a/tokens/token-swap/anchor/programs/token-swap/src/lib.rs +++ b/tokens/token-swap/anchor/programs/token-swap/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; mod constants; @@ -5,13 +7,12 @@ mod errors; mod instructions; mod state; -pub use instructions::*; - // Set the correct key here declare_id!("C3ti6PFK6PoYShRFx1BNNTQU3qeY1iVwjwCA6SjJhiuW"); #[program] pub mod swap_example { + pub use super::instructions::*; use super::*; pub fn create_amm(ctx: Context, id: Pubkey, fee: u16) -> Result<()> { diff --git a/tokens/transfer-tokens/anchor/programs/transfer-tokens/Cargo.toml b/tokens/transfer-tokens/anchor/programs/transfer-tokens/Cargo.toml index 7d6e5652a..02b1509e9 100644 --- a/tokens/transfer-tokens/anchor/programs/transfer-tokens/Cargo.toml +++ b/tokens/transfer-tokens/anchor/programs/transfer-tokens/Cargo.toml @@ -16,6 +16,6 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = { version="0.25.0", features=["init-if-needed"] } -anchor-spl = "0.25.0" -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } \ No newline at end of file +anchor-lang = { version = "0.28.0", features=["init-if-needed"] } +anchor-spl = "0.28.0" +mpl-token-metadata = { version="1.11", features = ["no-entrypoint"] } diff --git a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/create.rs b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/create.rs index d5b762c3d..680798c1d 100644 --- a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/create.rs +++ b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/create.rs @@ -1,41 +1,39 @@ use { - anchor_lang::{ - prelude::*, - solana_program::program::invoke, - }, + anchor_lang::{prelude::*, solana_program::program::invoke}, anchor_spl::token, mpl_token_metadata::instruction as mpl_instruction, }; - pub fn create_token( - ctx: Context, - token_title: String, - token_symbol: String, + ctx: Context, + token_title: String, + token_symbol: String, token_uri: String, _decimals: u8, ) -> Result<()> { - msg!("Creating metadata account..."); - msg!("Metadata account address: {}", &ctx.accounts.metadata_account.key()); + msg!( + "Metadata account address: {}", + &ctx.accounts.metadata_account.key() + ); invoke( &mpl_instruction::create_metadata_accounts_v3( - ctx.accounts.token_metadata_program.key(), // Program ID (the Token Metadata Program) - ctx.accounts.metadata_account.key(), // Metadata account - ctx.accounts.mint_account.key(), // Mint account - ctx.accounts.mint_authority.key(), // Mint authority - ctx.accounts.payer.key(), // Payer - ctx.accounts.mint_authority.key(), // Update authority - token_title, // Name - token_symbol, // Symbol - token_uri, // URI - None, // Creators - 0, // Seller fee basis points - true, // Update authority is signer - false, // Is mutable - None, // Collection - None, // Uses - None, // Collection Details + ctx.accounts.token_metadata_program.key(), // Program ID (the Token Metadata Program) + ctx.accounts.metadata_account.key(), // Metadata account + ctx.accounts.mint_account.key(), // Mint account + ctx.accounts.mint_authority.key(), // Mint authority + ctx.accounts.payer.key(), // Payer + ctx.accounts.mint_authority.key(), // Update authority + token_title, // Name + token_symbol, // Symbol + token_uri, // URI + None, // Creators + 0, // Seller fee basis points + true, // Update authority is signer + false, // Is mutable + None, // Collection + None, // Uses + None, // Collection Details ), &[ ctx.accounts.metadata_account.to_account_info(), @@ -52,11 +50,10 @@ pub fn create_token( Ok(()) } - #[derive(Accounts)] #[instruction( - token_title: String, - token_symbol: String, + token_title: String, + token_symbol: String, token_uri: String, decimals: u8, )] @@ -80,4 +77,4 @@ pub struct CreateToken<'info> { pub token_program: Program<'info, token::Token>, /// CHECK: Metaplex will check this pub token_metadata_program: UncheckedAccount<'info>, -} \ No newline at end of file +} diff --git a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mint_nft.rs b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mint_nft.rs index bfcf64ad0..49fc2090c 100644 --- a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mint_nft.rs +++ b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mint_nft.rs @@ -1,26 +1,22 @@ use { - anchor_lang::{ - prelude::*, - solana_program::program::invoke, - }, - anchor_spl::{ - token, - associated_token, - }, + anchor_lang::{prelude::*, solana_program::program::invoke}, + anchor_spl::{associated_token, token}, mpl_token_metadata::instruction as mpl_instruction, // spl_token::instruction::AuthorityType, }; - -pub fn mint_nft( - ctx: Context, -) -> Result<()> { - +pub fn mint_nft(ctx: Context) -> Result<()> { // Mint the NFT to the user's wallet // msg!("Minting NFT to associated token account..."); - msg!("Mint: {}", &ctx.accounts.mint_account.to_account_info().key()); - msg!("Token Address: {}", &ctx.accounts.associated_token_account.key()); + msg!( + "Mint: {}", + &ctx.accounts.mint_account.to_account_info().key() + ); + msg!( + "Token Address: {}", + &ctx.accounts.associated_token_account.key() + ); token::mint_to( CpiContext::new( ctx.accounts.token_program.to_account_info(), @@ -38,17 +34,20 @@ pub fn mint_nft( // Edition Account. // msg!("Creating edition account..."); - msg!("Edition account address: {}", ctx.accounts.edition_account.key()); + msg!( + "Edition account address: {}", + ctx.accounts.edition_account.key() + ); invoke( &mpl_instruction::create_master_edition_v3( - ctx.accounts.token_metadata_program.key(), // Program ID - ctx.accounts.edition_account.key(), // Edition - ctx.accounts.mint_account.key(), // Mint - ctx.accounts.mint_authority.key(), // Update Authority - ctx.accounts.mint_authority.key(), // Mint Authority - ctx.accounts.metadata_account.key(), // Metadata - ctx.accounts.payer.key(), // Payer - Some(1), // Max Supply + ctx.accounts.token_metadata_program.key(), // Program ID + ctx.accounts.edition_account.key(), // Edition + ctx.accounts.mint_account.key(), // Mint + ctx.accounts.mint_authority.key(), // Update Authority + ctx.accounts.mint_authority.key(), // Mint Authority + ctx.accounts.metadata_account.key(), // Metadata + ctx.accounts.payer.key(), // Payer + Some(1), // Max Supply ), &[ ctx.accounts.edition_account.to_account_info(), @@ -58,13 +57,13 @@ pub fn mint_nft( ctx.accounts.payer.to_account_info(), ctx.accounts.token_metadata_program.to_account_info(), ctx.accounts.rent.to_account_info(), - ] + ], )?; // If we don't use Metaplex Editions, we must disable minting manually // ------------------------------------------------------------------- // - // msg!("Disabling future minting of this NFT..."); + // msg!("Disabling future minting of this NFT..."); // token::set_authority( // CpiContext::new( // ctx.accounts.token_program.to_account_info(), @@ -93,7 +92,6 @@ pub fn mint_nft( Ok(()) } - #[derive(Accounts)] pub struct MintNft<'info> { /// CHECK: Metaplex will check this @@ -125,4 +123,4 @@ pub struct MintNft<'info> { pub associated_token_program: Program<'info, associated_token::AssociatedToken>, /// CHECK: Metaplex will check this pub token_metadata_program: UncheckedAccount<'info>, -} \ No newline at end of file +} diff --git a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mint_spl.rs b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mint_spl.rs index 645e0effe..ebf9c14e3 100644 --- a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mint_spl.rs +++ b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mint_spl.rs @@ -1,20 +1,18 @@ use { anchor_lang::prelude::*, - anchor_spl::{ - token, - associated_token, - }, + anchor_spl::{associated_token, token}, }; - -pub fn mint_spl( - ctx: Context, - quantity: u64, -) -> Result<()> { - +pub fn mint_spl(ctx: Context, quantity: u64) -> Result<()> { msg!("Minting token to token account..."); - msg!("Mint: {}", &ctx.accounts.mint_account.to_account_info().key()); - msg!("Token Address: {}", &ctx.accounts.associated_token_account.key()); + msg!( + "Mint: {}", + &ctx.accounts.mint_account.to_account_info().key() + ); + msg!( + "Token Address: {}", + &ctx.accounts.associated_token_account.key() + ); token::mint_to( CpiContext::new( ctx.accounts.token_program.to_account_info(), @@ -32,7 +30,6 @@ pub fn mint_spl( Ok(()) } - #[derive(Accounts)] pub struct MintSpl<'info> { #[account( @@ -55,4 +52,4 @@ pub struct MintSpl<'info> { pub system_program: Program<'info, System>, pub token_program: Program<'info, token::Token>, pub associated_token_program: Program<'info, associated_token::AssociatedToken>, -} \ No newline at end of file +} diff --git a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mod.rs b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mod.rs index 9701a71ca..434c81ad1 100644 --- a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mod.rs +++ b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/mod.rs @@ -6,4 +6,4 @@ pub mod transfer; pub use create::*; pub use mint_nft::*; pub use mint_spl::*; -pub use transfer::*; \ No newline at end of file +pub use transfer::*; diff --git a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/transfer.rs b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/transfer.rs index 776880954..c1814c4b5 100644 --- a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/transfer.rs +++ b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/instructions/transfer.rs @@ -1,21 +1,22 @@ use { anchor_lang::prelude::*, - anchor_spl::{ - token, - associated_token, - }, + anchor_spl::{associated_token, token}, }; - -pub fn transfer_tokens( - ctx: Context, - quantity: u64, -) -> Result<()> { - +pub fn transfer_tokens(ctx: Context, quantity: u64) -> Result<()> { msg!("Transferring tokens..."); - msg!("Mint: {}", &ctx.accounts.mint_account.to_account_info().key()); - msg!("From Token Address: {}", &ctx.accounts.from_associated_token_account.key()); - msg!("To Token Address: {}", &ctx.accounts.to_associated_token_account.key()); + msg!( + "Mint: {}", + &ctx.accounts.mint_account.to_account_info().key() + ); + msg!( + "From Token Address: {}", + &ctx.accounts.from_associated_token_account.key() + ); + msg!( + "To Token Address: {}", + &ctx.accounts.to_associated_token_account.key() + ); token::transfer( CpiContext::new( ctx.accounts.token_program.to_account_info(), @@ -33,7 +34,6 @@ pub fn transfer_tokens( Ok(()) } - #[derive(Accounts)] pub struct TransferTokens<'info> { #[account(mut)] @@ -60,4 +60,4 @@ pub struct TransferTokens<'info> { pub system_program: Program<'info, System>, pub token_program: Program<'info, token::Token>, pub associated_token_program: Program<'info, associated_token::AssociatedToken>, -} \ No newline at end of file +} diff --git a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/lib.rs b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/lib.rs index a320f62f4..2be49f6ce 100644 --- a/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/lib.rs +++ b/tokens/transfer-tokens/anchor/programs/transfer-tokens/src/lib.rs @@ -1,62 +1,36 @@ +#![allow(clippy::result_large_err)] + use anchor_lang::prelude::*; pub mod instructions; use instructions::*; - declare_id!("7p8osL5uUKUFM8sUxRYfmFVGN264PxeBSDEdNv36Khe3"); - #[program] pub mod transfer_tokens { use super::*; pub fn create_token( - ctx: Context, - token_title: String, - token_symbol: String, + ctx: Context, + token_title: String, + token_symbol: String, token_uri: String, decimals: u8, ) -> Result<()> { - - create::create_token( - ctx, - token_title, - token_symbol, - token_uri, - decimals, - ) + create::create_token(ctx, token_title, token_symbol, token_uri, decimals) } - pub fn mint_spl( - ctx: Context, - quantity: u64, - ) -> Result<()> { - - mint_spl::mint_spl( - ctx, - quantity, - ) + pub fn mint_spl(ctx: Context, quantity: u64) -> Result<()> { + mint_spl::mint_spl(ctx, quantity) } - pub fn mint_nft( - ctx: Context, - ) -> Result<()> { - - mint_nft::mint_nft( - ctx, - ) + pub fn mint_nft(ctx: Context) -> Result<()> { + mint_nft::mint_nft(ctx) } - pub fn transfer_tokens( - ctx: Context, - quantity: u64, - ) -> Result<()> { - - transfer::transfer_tokens( - ctx, - quantity, - ) + pub fn transfer_tokens(ctx: Context, quantity: u64) -> Result<()> { + transfer::transfer_tokens(ctx, quantity) } } diff --git a/tokens/transfer-tokens/native/program/Cargo.toml b/tokens/transfer-tokens/native/program/Cargo.toml index 3efd12b71..8810f4f95 100644 --- a/tokens/transfer-tokens/native/program/Cargo.toml +++ b/tokens/transfer-tokens/native/program/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "program" +name = "transfer-tokens-program" version = "0.1.0" edition = "2021" [dependencies] borsh = "0.9.3" borsh-derive = "0.9.1" -solana-program = "1.10.26" -spl-token = { version="3.3.0", features = [ "no-entrypoint" ] } -spl-associated-token-account = { version="1.0.5", features = [ "no-entrypoint" ] } -mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] } +solana-program = "1.16.10" +spl-token = { version="4.0.0", features = [ "no-entrypoint" ] } +spl-associated-token-account = { version = "2.0.0", features = [ "no-entrypoint" ] } +mpl-token-metadata = { version="1.11", features = ["no-entrypoint"] } [lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file +crate-type = ["cdylib", "lib"] diff --git a/tokens/transfer-tokens/native/program/src/instructions/create.rs b/tokens/transfer-tokens/native/program/src/instructions/create.rs index f3f3f7275..27d0835b3 100644 --- a/tokens/transfer-tokens/native/program/src/instructions/create.rs +++ b/tokens/transfer-tokens/native/program/src/instructions/create.rs @@ -1,28 +1,19 @@ use { - borsh::{ - BorshDeserialize, - BorshSerialize, - }, + borsh::{BorshDeserialize, BorshSerialize}, + mpl_token_metadata::instruction as mpl_instruction, solana_program::{ - account_info::{next_account_info, AccountInfo}, - entrypoint::ProgramResult, - msg, + account_info::{next_account_info, AccountInfo}, + entrypoint::ProgramResult, + msg, program::invoke, program_pack::Pack, rent::Rent, system_instruction, sysvar::Sysvar, }, - spl_token::{ - instruction as token_instruction, - state::Mint, - }, - mpl_token_metadata::{ - instruction as mpl_instruction, - }, + spl_token::{instruction as token_instruction, state::Mint}, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct CreateTokenArgs { pub token_title: String, @@ -31,12 +22,7 @@ pub struct CreateTokenArgs { pub decimals: u8, } - -pub fn create_token( - accounts: &[AccountInfo], - args: CreateTokenArgs, -) -> ProgramResult { - +pub fn create_token(accounts: &[AccountInfo], args: CreateTokenArgs) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let mint_account = next_account_info(accounts_iter)?; @@ -54,18 +40,18 @@ pub fn create_token( msg!("Mint: {}", mint_account.key); invoke( &system_instruction::create_account( - &payer.key, - &mint_account.key, + payer.key, + mint_account.key, (Rent::get()?).minimum_balance(Mint::LEN), Mint::LEN as u64, - &token_program.key, + token_program.key, ), &[ mint_account.clone(), payer.clone(), system_program.clone(), token_program.clone(), - ] + ], )?; // Now initialize that account as a Mint (standard Mint) @@ -74,10 +60,10 @@ pub fn create_token( msg!("Mint: {}", mint_account.key); invoke( &token_instruction::initialize_mint( - &token_program.key, - &mint_account.key, - &mint_authority.key, - Some(&mint_authority.key), + token_program.key, + mint_account.key, + mint_authority.key, + Some(mint_authority.key), args.decimals, )?, &[ @@ -85,7 +71,7 @@ pub fn create_token( mint_authority.clone(), token_program.clone(), rent.clone(), - ] + ], )?; // Now create the account for that Mint's metadata @@ -118,10 +104,10 @@ pub fn create_token( payer.clone(), token_metadata_program.clone(), rent.clone(), - ] + ], )?; msg!("Token mint created successfully."); Ok(()) -} \ No newline at end of file +} diff --git a/tokens/transfer-tokens/native/program/src/instructions/mint_nft.rs b/tokens/transfer-tokens/native/program/src/instructions/mint_nft.rs index e3e54e054..ac166b21d 100644 --- a/tokens/transfer-tokens/native/program/src/instructions/mint_nft.rs +++ b/tokens/transfer-tokens/native/program/src/instructions/mint_nft.rs @@ -1,26 +1,16 @@ use { + mpl_token_metadata::instruction as mpl_instruction, solana_program::{ account_info::{next_account_info, AccountInfo}, - entrypoint::ProgramResult, - msg, + entrypoint::ProgramResult, + msg, program::invoke, }, - spl_token::{ - instruction as token_instruction, - }, - spl_associated_token_account::{ - instruction as associated_token_account_instruction, - }, - mpl_token_metadata::{ - instruction as mpl_instruction, - }, + spl_associated_token_account::instruction as associated_token_account_instruction, + spl_token::instruction as token_instruction, }; - -pub fn mint_nft( - accounts: &[AccountInfo], -) -> ProgramResult { - +pub fn mint_nft(accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let mint_account = next_account_info(accounts_iter)?; @@ -39,9 +29,10 @@ pub fn mint_nft( msg!("Creating associated token account..."); invoke( &associated_token_account_instruction::create_associated_token_account( - &payer.key, - &payer.key, - &mint_account.key, + payer.key, + payer.key, + mint_account.key, + token_program.key, ), &[ mint_account.clone(), @@ -49,7 +40,7 @@ pub fn mint_nft( payer.clone(), token_program.clone(), associated_token_program.clone(), - ] + ], )?; } else { msg!("Associated token account exists."); @@ -61,11 +52,11 @@ pub fn mint_nft( msg!("Minting NFT to associated token account..."); invoke( &token_instruction::mint_to( - &token_program.key, - &mint_account.key, - &associated_token_account.key, - &mint_authority.key, - &[&mint_authority.key], + token_program.key, + mint_account.key, + associated_token_account.key, + mint_authority.key, + &[mint_authority.key], 1, )?, &[ @@ -84,14 +75,14 @@ pub fn mint_nft( msg!("Edition account address: {}", edition_account.key); invoke( &mpl_instruction::create_master_edition_v3( - *token_metadata_program.key, // Program ID - *edition_account.key, // Edition - *mint_account.key, // Mint - *mint_authority.key, // Update Authority - *mint_authority.key, // Mint Authority - *metadata_account.key, // Metadata - *payer.key, // Payer - Some(1), // Max Supply + *token_metadata_program.key, // Program ID + *edition_account.key, // Edition + *mint_account.key, // Mint + *mint_authority.key, // Update Authority + *mint_authority.key, // Mint Authority + *metadata_account.key, // Metadata + *payer.key, // Payer + Some(1), // Max Supply ), &[ edition_account.clone(), @@ -101,7 +92,7 @@ pub fn mint_nft( payer.clone(), token_metadata_program.clone(), rent.clone(), - ] + ], )?; // If we don't use Metaplex Editions, we must disable minting manually @@ -110,10 +101,10 @@ pub fn mint_nft( // msg!("Disabling future minting of this NFT..."); // invoke( // &token_instruction::set_authority( - // &token_program.key, - // &mint_account.key, - // None, - // token_instruction::AuthorityType::MintTokens, + // &token_program.key, + // &mint_account.key, + // None, + // token_instruction::AuthorityType::MintTokens, // &mint_authority.key, // &[&mint_authority.key], // )?, @@ -125,10 +116,10 @@ pub fn mint_nft( // )?; // invoke( // &token_instruction::set_authority( - // &token_program.key, - // &mint_account.key, - // None, - // token_instruction::AuthorityType::FreezeAccount, + // &token_program.key, + // &mint_account.key, + // None, + // token_instruction::AuthorityType::FreezeAccount, // &mint_authority.key, // &[&mint_authority.key], // )?, @@ -143,4 +134,3 @@ pub fn mint_nft( Ok(()) } - diff --git a/tokens/transfer-tokens/native/program/src/instructions/mint_spl.rs b/tokens/transfer-tokens/native/program/src/instructions/mint_spl.rs index e3e8a0fc4..41ed91b20 100644 --- a/tokens/transfer-tokens/native/program/src/instructions/mint_spl.rs +++ b/tokens/transfer-tokens/native/program/src/instructions/mint_spl.rs @@ -1,34 +1,21 @@ use { - borsh::{ - BorshDeserialize, - BorshSerialize, - }, + borsh::{BorshDeserialize, BorshSerialize}, solana_program::{ account_info::{next_account_info, AccountInfo}, - entrypoint::ProgramResult, - msg, + entrypoint::ProgramResult, + msg, program::invoke, }, - spl_token::{ - instruction as token_instruction, - }, - spl_associated_token_account::{ - instruction as associated_token_account_instruction, - }, + spl_associated_token_account::instruction as associated_token_account_instruction, + spl_token::instruction as token_instruction, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct MintSplArgs { pub quantity: u64, } - -pub fn mint_spl( - accounts: &[AccountInfo], - args: MintSplArgs, -) -> ProgramResult { - +pub fn mint_spl(accounts: &[AccountInfo], args: MintSplArgs) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let mint_account = next_account_info(accounts_iter)?; @@ -43,9 +30,10 @@ pub fn mint_spl( msg!("Creating associated token account..."); invoke( &associated_token_account_instruction::create_associated_token_account( - &payer.key, - &payer.key, - &mint_account.key, + payer.key, + payer.key, + mint_account.key, + token_program.key, ), &[ mint_account.clone(), @@ -54,21 +42,24 @@ pub fn mint_spl( system_program.clone(), token_program.clone(), associated_token_program.clone(), - ] + ], )?; } else { msg!("Associated token account exists."); } msg!("Associated Token Address: {}", associated_token_account.key); - msg!("Minting {} tokens to associated token account...", args.quantity); + msg!( + "Minting {} tokens to associated token account...", + args.quantity + ); invoke( &token_instruction::mint_to( - &token_program.key, - &mint_account.key, - &associated_token_account.key, - &mint_authority.key, - &[&mint_authority.key], + token_program.key, + mint_account.key, + associated_token_account.key, + mint_authority.key, + &[mint_authority.key], args.quantity, )?, &[ @@ -83,4 +74,3 @@ pub fn mint_spl( Ok(()) } - diff --git a/tokens/transfer-tokens/native/program/src/instructions/mod.rs b/tokens/transfer-tokens/native/program/src/instructions/mod.rs index 9701a71ca..434c81ad1 100644 --- a/tokens/transfer-tokens/native/program/src/instructions/mod.rs +++ b/tokens/transfer-tokens/native/program/src/instructions/mod.rs @@ -6,4 +6,4 @@ pub mod transfer; pub use create::*; pub use mint_nft::*; pub use mint_spl::*; -pub use transfer::*; \ No newline at end of file +pub use transfer::*; diff --git a/tokens/transfer-tokens/native/program/src/instructions/transfer.rs b/tokens/transfer-tokens/native/program/src/instructions/transfer.rs index 7a8bcbf51..8133e002c 100644 --- a/tokens/transfer-tokens/native/program/src/instructions/transfer.rs +++ b/tokens/transfer-tokens/native/program/src/instructions/transfer.rs @@ -1,34 +1,21 @@ use { - borsh::{ - BorshDeserialize, - BorshSerialize, - }, + borsh::{BorshDeserialize, BorshSerialize}, solana_program::{ account_info::{next_account_info, AccountInfo}, - entrypoint::ProgramResult, - msg, + entrypoint::ProgramResult, + msg, program::invoke, }, - spl_token::{ - instruction as token_instruction, - }, - spl_associated_token_account::{ - instruction as associated_token_account_instruction, - }, + spl_associated_token_account::instruction as associated_token_account_instruction, + spl_token::instruction as token_instruction, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct TransferTokensArgs { pub quantity: u64, } - -pub fn transfer_tokens( - accounts: &[AccountInfo], - args: TransferTokensArgs, -) -> ProgramResult { - +pub fn transfer_tokens(accounts: &[AccountInfo], args: TransferTokensArgs) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let mint_account = next_account_info(accounts_iter)?; @@ -45,9 +32,10 @@ pub fn transfer_tokens( msg!("Creating associated token account for recipient..."); invoke( &associated_token_account_instruction::create_associated_token_account( - &payer.key, - &recipient.key, - &mint_account.key, + payer.key, + recipient.key, + mint_account.key, + token_program.key, ), &[ mint_account.clone(), @@ -57,24 +45,30 @@ pub fn transfer_tokens( system_program.clone(), token_program.clone(), associated_token_program.clone(), - ] + ], )?; } else { msg!("Associated token account exists."); } - msg!("Recipient Associated Token Address: {}", to_associated_token_account.key); + msg!( + "Recipient Associated Token Address: {}", + to_associated_token_account.key + ); msg!("Transferring {} tokens...", args.quantity); - msg!("Mint: {}", mint_account.key); + msg!("Mint: {}", mint_account.key); msg!("Owner Token Address: {}", from_associated_token_account.key); - msg!("Recipient Token Address: {}", to_associated_token_account.key); + msg!( + "Recipient Token Address: {}", + to_associated_token_account.key + ); invoke( &token_instruction::transfer( - &token_program.key, - &from_associated_token_account.key, - &to_associated_token_account.key, - &owner.key, - &[&owner.key, &recipient.key], + token_program.key, + from_associated_token_account.key, + to_associated_token_account.key, + owner.key, + &[owner.key, recipient.key], args.quantity, )?, &[ @@ -84,11 +78,10 @@ pub fn transfer_tokens( owner.clone(), recipient.clone(), token_program.clone(), - ] + ], )?; msg!("Tokens transferred successfully."); Ok(()) } - diff --git a/tokens/transfer-tokens/native/program/src/lib.rs b/tokens/transfer-tokens/native/program/src/lib.rs index 0dd155c0e..ffe183c30 100644 --- a/tokens/transfer-tokens/native/program/src/lib.rs +++ b/tokens/transfer-tokens/native/program/src/lib.rs @@ -1,22 +1,16 @@ use solana_program::{ - account_info::AccountInfo, - entrypoint, - entrypoint::ProgramResult, - pubkey::Pubkey, + account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey, }; -pub mod processor; pub mod instructions; - +pub mod processor; entrypoint!(process_instruction); - fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - processor::process_instruction(program_id, accounts, instruction_data) -} \ No newline at end of file +} diff --git a/tokens/transfer-tokens/native/program/src/processor.rs b/tokens/transfer-tokens/native/program/src/processor.rs index 63a0be445..4ad005aa7 100644 --- a/tokens/transfer-tokens/native/program/src/processor.rs +++ b/tokens/transfer-tokens/native/program/src/processor.rs @@ -1,32 +1,15 @@ use { - borsh::{ - BorshDeserialize, - BorshSerialize, - }, - solana_program::{ - account_info::AccountInfo, - entrypoint::ProgramResult, - pubkey::Pubkey, - }, + borsh::{BorshDeserialize, BorshSerialize}, + solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}, }; -use crate::instructions::{ - create::{ - CreateTokenArgs, - create_token, - }, +use crate::instructions::{ + create::{create_token, CreateTokenArgs}, mint_nft::mint_nft, - mint_spl::{ - MintSplArgs, - mint_spl, - }, - transfer::{ - TransferTokensArgs, - transfer_tokens, - } + mint_spl::{mint_spl, MintSplArgs}, + transfer::{transfer_tokens, TransferTokensArgs}, }; - #[derive(BorshSerialize, BorshDeserialize, Debug)] enum MyInstruction { Create(CreateTokenArgs), @@ -35,13 +18,11 @@ enum MyInstruction { TransferTokens(TransferTokensArgs), } - pub fn process_instruction( _program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - let instruction = MyInstruction::try_from_slice(instruction_data)?; match instruction { @@ -50,4 +31,4 @@ pub fn process_instruction( MyInstruction::MintSpl(args) => mint_spl(accounts, args), MyInstruction::TransferTokens(args) => transfer_tokens(accounts, args), } -} \ No newline at end of file +} diff --git a/tools/shank-and-solita/native/program/src/state/mod.rs b/tools/shank-and-solita/native/program/src/state/mod.rs index 0d5b508ac..109f2af4b 100644 --- a/tools/shank-and-solita/native/program/src/state/mod.rs +++ b/tools/shank-and-solita/native/program/src/state/mod.rs @@ -1,7 +1,7 @@ use { borsh::{ - BorshDeserialize, - BorshSerialize + BorshDeserialize, + BorshSerialize }, shank::ShankAccount, solana_program::pubkey::Pubkey, @@ -45,4 +45,4 @@ pub struct RentalOrder { impl RentalOrder { pub const SEED_PREFIX: &'static str = "rental_order"; -} \ No newline at end of file +}