Update all solana dependencies to 1.7.3, fix issues (#1958)
* Update all dependencies to 1.7.3, fix issues * Remove esm from mocha * Fix missed token test * Also update rust version * token-swap: update tolerance on sim test * Run `cargo clippy --fix` for needless_borrow errors * Rerun cargo fmt
This commit is contained in:
parent
586e5f9ec5
commit
21f8af34e7
|
@ -393,12 +393,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.49"
|
version = "1.0.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e450b8da92aa6f274e7c6437692f9f2ce6d701fb73bacfcf87897b3f89a4c20e"
|
checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"num_cpus",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -436,9 +435,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono-humanize"
|
name = "chrono-humanize"
|
||||||
version = "0.1.2"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8164ae3089baf04ff71f32aeb70213283dcd236dce8bc976d00b17a458f5f71c"
|
checksum = "2eddc119501d583fd930cb92144e605f44e0252c38dd89d9247fffa1993375cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
]
|
]
|
||||||
|
@ -1039,12 +1038,6 @@ dependencies = [
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fs_extra"
|
|
||||||
version = "1.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fuchsia-zircon"
|
name = "fuchsia-zircon"
|
||||||
version = "0.3.3"
|
version = "0.3.3"
|
||||||
|
@ -1584,38 +1577,6 @@ version = "0.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "jemalloc-ctl"
|
|
||||||
version = "0.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c502a5ff9dd2924f1ed32ba96e3b65735d837b4bfd978d3161b1702e66aca4b7"
|
|
||||||
dependencies = [
|
|
||||||
"jemalloc-sys",
|
|
||||||
"libc",
|
|
||||||
"paste",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "jemalloc-sys"
|
|
||||||
version = "0.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"fs_extra",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "jemallocator"
|
|
||||||
version = "0.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
|
|
||||||
dependencies = [
|
|
||||||
"jemalloc-sys",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jobserver"
|
name = "jobserver"
|
||||||
version = "0.1.21"
|
version = "0.1.21"
|
||||||
|
@ -2639,13 +2600,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ring"
|
name = "ring"
|
||||||
version = "0.16.12"
|
version = "0.16.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c"
|
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"lazy_static",
|
|
||||||
"libc",
|
"libc",
|
||||||
|
"once_cell",
|
||||||
"spin",
|
"spin",
|
||||||
"untrusted",
|
"untrusted",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
|
@ -3022,9 +2983,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-account-decoder"
|
name = "solana-account-decoder"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5eb4860be724565c9664939a498424baa392b3ccdec4cc2677f5397afd20fd8c"
|
checksum = "e49c9e97fbaa91220924064f23ce367c02af1a3bc8cc514f84168b47cbb075c7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"base64 0.12.3",
|
"base64 0.12.3",
|
||||||
|
@ -3037,18 +2998,17 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"solana-config-program",
|
"solana-config-program",
|
||||||
"solana-sdk",
|
"solana-sdk",
|
||||||
"solana-stake-program",
|
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-token 3.1.0",
|
"spl-token 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"zstd",
|
"zstd",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-banks-client"
|
name = "solana-banks-client"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9977706df3b1d69e91eb4d0c53d60bd262f96de4116b606afea8728d33e8072e"
|
checksum = "570ed9c8e78fabbd2f93140f731c9361b7aa6292341e03811e5b6d3ed2470c5a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"borsh",
|
"borsh",
|
||||||
|
@ -3065,9 +3025,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-banks-interface"
|
name = "solana-banks-interface"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0066bd7c2655141b095cfe25afc1aa76879254e0fe02ac212b858449cbddf275"
|
checksum = "f3b253e4d53eef373ab186829988a9ad4f7bfce886cf0e1fade1ad866c294df2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mio 0.7.11",
|
"mio 0.7.11",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -3077,9 +3037,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-banks-server"
|
name = "solana-banks-server"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "950c7a4061aaf4f79293caf06c12f639a4a55cfd5f3ec9f5323be869e4426ef9"
|
checksum = "a350a47e84f4e28a28e985e96150a222559b0e23f71a3b34760b7463091d0877"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"futures 0.3.14",
|
"futures 0.3.14",
|
||||||
|
@ -3097,9 +3057,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-bpf-loader-program"
|
name = "solana-bpf-loader-program"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ba7fcf2994963a758c97b6c9d205036ea9b1baf84227398f9bbc47d25877e00"
|
checksum = "7305c923737fc515d88454dd991b8c21c5e9270f72db3cd52da888d4d233fe07"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
|
@ -3117,9 +3077,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-clap-utils"
|
name = "solana-clap-utils"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a515dc715a2a57636e7f8025184bd2d08cdfaf697b1733894ffa9ae5a440de83"
|
checksum = "29dca103fa63d4fa564c719d2f043feb4a116722362cbcbf027d4404fc65e7b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
@ -3134,9 +3094,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-cli-config"
|
name = "solana-cli-config"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3667436885eb17fc016858a1b8e19500e6dd47565b5c2a55388c95bf1124412"
|
checksum = "f22f4acf359df9e859878fc456bb98cfd3d008ee239a6300259c439a2356d1c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dirs-next",
|
"dirs-next",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -3148,14 +3108,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-cli-output"
|
name = "solana-cli-output"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "65aaaf890913d51e8362a4e255ff478774a29720f49362ec17302b49d9706f04"
|
checksum = "7e90601ae12c8bea054ed0f896f8871564087b094fd3d45fa1f4e0f45df492f9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
"chrono",
|
"chrono",
|
||||||
"console 0.11.3",
|
"console 0.14.1",
|
||||||
"humantime",
|
"humantime",
|
||||||
"indicatif",
|
"indicatif",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -3165,7 +3125,6 @@ dependencies = [
|
||||||
"solana-clap-utils",
|
"solana-clap-utils",
|
||||||
"solana-client",
|
"solana-client",
|
||||||
"solana-sdk",
|
"solana-sdk",
|
||||||
"solana-stake-program",
|
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-memo 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"spl-memo 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3173,9 +3132,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-client"
|
name = "solana-client"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "984434a42a0c49275cb1c290bbc89b03b08a857ca4d7f34465eb30a3ba572170"
|
checksum = "15a149653548051cdcfdfb3494ad46a9810e647cbf004b0f65dccafd92eec152"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
@ -3207,9 +3166,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-config-program"
|
name = "solana-config-program"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e9341b8d8c32b970b6aa3e4a58795f5120154b3896b7231b830a5a9a13bc8083"
|
checksum = "056a9300b5e2665d0f6cf1dfbc5f9778ec616485adbe35af01fec234e1f9b288"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -3222,9 +3181,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-crate-features"
|
name = "solana-crate-features"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d62c8e8a526b62e3cefe51f079cc48585a5026d1d5a86a99ce38d782273027f"
|
checksum = "887ff45393b195ab7d93cdc94511c7cc2319a379b659e8008de77028c2326846"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes 0.4.12",
|
"bytes 0.4.12",
|
||||||
|
@ -3237,6 +3196,7 @@ dependencies = [
|
||||||
"rand_chacha 0.2.2",
|
"rand_chacha 0.2.2",
|
||||||
"regex-syntax",
|
"regex-syntax",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
"ring",
|
||||||
"serde",
|
"serde",
|
||||||
"syn 0.15.44",
|
"syn 0.15.44",
|
||||||
"syn 1.0.69",
|
"syn 1.0.69",
|
||||||
|
@ -3246,9 +3206,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-faucet"
|
name = "solana-faucet"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "be5f5f36174686ca4ec091578050d73cddd2bbdf3e486bbe817fdca0c857364a"
|
checksum = "981359d3f0f420dfa6d5eee4d33357d619817425a64ad090f2f88e521c9a24bd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
|
@ -3269,9 +3229,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-frozen-abi"
|
name = "solana-frozen-abi"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "439fb97ca6bf4098973413e806071116a0d87dcb197c0c2ae01f71a1588d6dcc"
|
checksum = "dc00a9f7c3eb2fb8687d34ce6d8672fbf7bd8f67002a5f75ccd6f6c4e8cd8a91"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58 0.3.1",
|
"bs58 0.3.1",
|
||||||
"bv",
|
"bv",
|
||||||
|
@ -3289,11 +3249,10 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-frozen-abi-macro"
|
name = "solana-frozen-abi-macro"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aa4b1844deb909101f83735504f41f7ce539fe0c448fa52bda1a7d2233aaefc3"
|
checksum = "bc381a29ab68515e69dcfad633ab78dd98d83c0b959c2cae9a9a98df6e265acf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
|
||||||
"proc-macro2 1.0.26",
|
"proc-macro2 1.0.26",
|
||||||
"quote 1.0.9",
|
"quote 1.0.9",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
|
@ -3302,9 +3261,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-logger"
|
name = "solana-logger"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "01545ecd73ca356dd3d31db303e0ecc1989b67a1561dce0c8d8ae2d4c536562d"
|
checksum = "62f8e4921602f61681d8d29d2606d4f8e1c848d4f6b9964813bfc1b457dfd7ce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -3313,12 +3272,10 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-measure"
|
name = "solana-measure"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ddf22ce1f47ebc723bceec387100a52a27ed6a807092ac90ecc70189bb10ce2"
|
checksum = "958b8dab77246d9c71c78a4e9c5c31a1092dafb70294ce0334acf572442b9d84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jemalloc-ctl",
|
|
||||||
"jemallocator",
|
|
||||||
"log",
|
"log",
|
||||||
"solana-metrics",
|
"solana-metrics",
|
||||||
"solana-sdk",
|
"solana-sdk",
|
||||||
|
@ -3326,9 +3283,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-metrics"
|
name = "solana-metrics"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc2aa796e88a5fc8628474a55929cc3d8c5dd2d10900cd591917eac22de86a5a"
|
checksum = "77968c10909ef49d7a3cccc3ca8de9415e8750411ad917889ef8ba9ae8692d94"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"gethostname",
|
"gethostname",
|
||||||
|
@ -3340,9 +3297,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-net-utils"
|
name = "solana-net-utils"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "00ca51d139c4b6768a0a73500725281a6feb833daf5666222dd605db1c8e6623"
|
checksum = "9de765ffc78c8068b9efce0ff08b399a94105b004588c90a4b0835995dfc4712"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"clap",
|
"clap",
|
||||||
|
@ -3354,6 +3311,7 @@ dependencies = [
|
||||||
"socket2 0.3.19",
|
"socket2 0.3.19",
|
||||||
"solana-clap-utils",
|
"solana-clap-utils",
|
||||||
"solana-logger",
|
"solana-logger",
|
||||||
|
"solana-sdk",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
"tokio 1.5.0",
|
"tokio 1.5.0",
|
||||||
"url",
|
"url",
|
||||||
|
@ -3361,9 +3319,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-program"
|
name = "solana-program"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ac6cafe3bb91070644839600e65b185292e285abc31ac626ddab6a79c0cc18e"
|
checksum = "9f9c454274436aac77286369e35835fafa1f79d1da1c4b7a1c662b2c41705f77"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"blake3",
|
"blake3",
|
||||||
|
@ -3395,9 +3353,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-program-test"
|
name = "solana-program-test"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b5c6637e910327d7dbcd23b121437eb7bc64f98bc1080bc50db944f015f21d43"
|
checksum = "4cd5922e4a9a7437a19ff5d79f60bac64ea2636a365586cb3511f4d562a20cf7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.12.3",
|
"base64 0.12.3",
|
||||||
|
@ -3421,9 +3379,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-rayon-threadlimit"
|
name = "solana-rayon-threadlimit"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e0a2dbe5f36a32c5f4c366bde65ac10f516693f0342da36dd6b3daf012ba50f"
|
checksum = "d837161f598afd30c445a7f9c39d640cd4cdf362c30062ed0831b71daaf63a45"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
|
@ -3431,12 +3389,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-remote-wallet"
|
name = "solana-remote-wallet"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "975ad7bac4f07188e4d70df8c018f429da3c02d3cc2f1e8a56c4d9f03261dc9d"
|
checksum = "24087b3048534e154db68c4cdd8233f3a35dd6f860d97e5ad1008c44e0d311f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base32",
|
"base32",
|
||||||
"console 0.11.3",
|
"console 0.14.1",
|
||||||
"dialoguer",
|
"dialoguer",
|
||||||
"hidapi",
|
"hidapi",
|
||||||
"log",
|
"log",
|
||||||
|
@ -3452,9 +3410,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-runtime"
|
name = "solana-runtime"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4f4ca322a5fbcc3b647de773d8b8f30659b0b956f0226ec1a8fadc08159cc8be"
|
checksum = "224e6ef5ea772d9636493dd4fd196cf3b167ff73b7d54e7f591b2f2d452c70d6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayref",
|
"arrayref",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
@ -3503,9 +3461,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-sdk"
|
name = "solana-sdk"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0a978bfd23136d5af402c5b932ffc6cb5a9a047d3dddc2522b729b270b8df546"
|
checksum = "339cc1a9d437ae2f5f05d2d678c8f6d19ea6cf57cbdf719b7726156d294487bd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assert_matches",
|
"assert_matches",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
@ -3552,9 +3510,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-sdk-macro"
|
name = "solana-sdk-macro"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9205b47aa8e2474d014033375dea8734f14038fc860feed2ef654ee17c73353"
|
checksum = "85ee9c0af66098ec40bf9012b7910c8cdb1ce8b95fc9fad90e6a0cbe692a48fe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58 0.3.1",
|
"bs58 0.3.1",
|
||||||
"proc-macro2 1.0.26",
|
"proc-macro2 1.0.26",
|
||||||
|
@ -3565,9 +3523,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-secp256k1-program"
|
name = "solana-secp256k1-program"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eade5b09385c7139a8aab6420d76087a4ef6e47a03343cb70e77a50d6567eb62"
|
checksum = "2666ffed520bff7d0eb6747da156435def7f97341634e72af39fefc0d27496f1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"digest 0.9.0",
|
"digest 0.9.0",
|
||||||
|
@ -3580,9 +3538,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-stake-program"
|
name = "solana-stake-program"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4a42ec32e879eb261fa847f659cd5631111c7a4b824bc29d90f4d9d497b93774"
|
checksum = "42f9e0309f95b3160c4961f11a3940d98126a86a7410b04bf88ff79448984257"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"log",
|
"log",
|
||||||
|
@ -3602,9 +3560,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-transaction-status"
|
name = "solana-transaction-status"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e8d51bde7edc91f03220eb2399ba313e8bea7c9394d90c79783863942323ddd9"
|
checksum = "952083e52e835be5c0f10707d9019df84f3be5f0c524391848d4c8c7e05151da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"base64 0.12.3",
|
"base64 0.12.3",
|
||||||
|
@ -3617,19 +3575,18 @@ dependencies = [
|
||||||
"solana-account-decoder",
|
"solana-account-decoder",
|
||||||
"solana-runtime",
|
"solana-runtime",
|
||||||
"solana-sdk",
|
"solana-sdk",
|
||||||
"solana-stake-program",
|
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-associated-token-account 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"spl-associated-token-account 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"spl-memo 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"spl-memo 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"spl-token 3.1.0",
|
"spl-token 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-version"
|
name = "solana-version"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "44b0676fb5106f50350e46864c5304cd2beb8383bc470b43ccb42e6cf9747686"
|
checksum = "797f12524e5ea25d18f345cd4c34a4839dea83e979a9ccb43a02b486ba9d913c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
|
@ -3643,9 +3600,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-vote-program"
|
name = "solana-vote-program"
|
||||||
version = "1.6.11"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "63c69608668f8738cbaa3a25d15943dd202448b6eafe5d480326a91bd87f0eac"
|
checksum = "8583f429404acb3ab8eb255cd9cb1c65496dda7a8be3d73058d63b7d26cc1c3d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"log",
|
"log",
|
||||||
|
@ -3664,9 +3621,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana_rbpf"
|
name = "solana_rbpf"
|
||||||
version = "0.2.9"
|
version = "0.2.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "debbc13545a1d972955a4fd3014e7c9d6d81da16c3626ee5f64bf3aa619548f8"
|
checksum = "7c1c5bdfa63c68d848d95024c7f4335bae4b1917f7df2e48e2d945f4664a8b45"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"combine",
|
"combine",
|
||||||
|
@ -3675,6 +3632,7 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
|
"rustc-demangle",
|
||||||
"scroll",
|
"scroll",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time",
|
"time",
|
||||||
|
@ -3703,7 +3661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4adc47eebe5d2b662cbaaba1843719c28a67e5ec5d0460bc3ca60900a51f74e2"
|
checksum = "4adc47eebe5d2b662cbaaba1843719c28a67e5ec5d0460bc3ca60900a51f74e2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"solana-program",
|
"solana-program",
|
||||||
"spl-token 3.1.0",
|
"spl-token 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3927,20 +3885,6 @@ dependencies = [
|
||||||
"spl-token 3.1.1",
|
"spl-token 3.1.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "spl-token"
|
|
||||||
version = "3.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b795e50d15dfd35aa5460b80a16414503a322be115a417a43db987c5824c6798"
|
|
||||||
dependencies = [
|
|
||||||
"arrayref",
|
|
||||||
"num-derive",
|
|
||||||
"num-traits",
|
|
||||||
"num_enum",
|
|
||||||
"solana-program",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spl-token"
|
name = "spl-token"
|
||||||
version = "3.1.1"
|
version = "3.1.1"
|
||||||
|
@ -3954,6 +3898,20 @@ dependencies = [
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "spl-token"
|
||||||
|
version = "3.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fbfa8fd791aeb4d7ad5fedb7872478de9f4e8b4fcb02dfd9e7f2f9ae3f3ddd73"
|
||||||
|
dependencies = [
|
||||||
|
"arrayref",
|
||||||
|
"num-derive",
|
||||||
|
"num-traits",
|
||||||
|
"num_enum",
|
||||||
|
"solana-program",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spl-token-cli"
|
name = "spl-token-cli"
|
||||||
version = "2.0.12"
|
version = "2.0.12"
|
||||||
|
|
|
@ -12,12 +12,12 @@ no-entrypoint = []
|
||||||
test-bpf = []
|
test-bpf = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
spl-token = { version = "3.1", path = "../../token/program", features = ["no-entrypoint"] }
|
spl-token = { version = "3.1", path = "../../token/program", features = ["no-entrypoint"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub fn get_associated_token_address(
|
||||||
wallet_address: &Pubkey,
|
wallet_address: &Pubkey,
|
||||||
spl_token_mint_address: &Pubkey,
|
spl_token_mint_address: &Pubkey,
|
||||||
) -> Pubkey {
|
) -> Pubkey {
|
||||||
get_associated_token_address_and_bump_seed(&wallet_address, &spl_token_mint_address, &id()).0
|
get_associated_token_address_and_bump_seed(wallet_address, spl_token_mint_address, &id()).0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_associated_token_address_and_bump_seed_internal(
|
fn get_associated_token_address_and_bump_seed_internal(
|
||||||
|
|
|
@ -31,10 +31,10 @@ pub fn process_instruction(
|
||||||
let rent_sysvar_info = next_account_info(account_info_iter)?;
|
let rent_sysvar_info = next_account_info(account_info_iter)?;
|
||||||
|
|
||||||
let (associated_token_address, bump_seed) = get_associated_token_address_and_bump_seed_internal(
|
let (associated_token_address, bump_seed) = get_associated_token_address_and_bump_seed_internal(
|
||||||
&wallet_account_info.key,
|
wallet_account_info.key,
|
||||||
&spl_token_mint_info.key,
|
spl_token_mint_info.key,
|
||||||
program_id,
|
program_id,
|
||||||
&spl_token_program_id,
|
spl_token_program_id,
|
||||||
);
|
);
|
||||||
if associated_token_address != *associated_token_account_info.key {
|
if associated_token_address != *associated_token_account_info.key {
|
||||||
msg!("Error: Associated address does not match seed derivation");
|
msg!("Error: Associated address does not match seed derivation");
|
||||||
|
@ -62,7 +62,7 @@ pub fn process_instruction(
|
||||||
);
|
);
|
||||||
invoke(
|
invoke(
|
||||||
&system_instruction::transfer(
|
&system_instruction::transfer(
|
||||||
&funder_info.key,
|
funder_info.key,
|
||||||
associated_token_account_info.key,
|
associated_token_account_info.key,
|
||||||
required_lamports,
|
required_lamports,
|
||||||
),
|
),
|
||||||
|
@ -84,23 +84,23 @@ pub fn process_instruction(
|
||||||
associated_token_account_info.clone(),
|
associated_token_account_info.clone(),
|
||||||
system_program_info.clone(),
|
system_program_info.clone(),
|
||||||
],
|
],
|
||||||
&[&associated_token_account_signer_seeds],
|
&[associated_token_account_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
msg!("Assign the associated token account to the SPL Token program");
|
msg!("Assign the associated token account to the SPL Token program");
|
||||||
invoke_signed(
|
invoke_signed(
|
||||||
&system_instruction::assign(associated_token_account_info.key, &spl_token_program_id),
|
&system_instruction::assign(associated_token_account_info.key, spl_token_program_id),
|
||||||
&[
|
&[
|
||||||
associated_token_account_info.clone(),
|
associated_token_account_info.clone(),
|
||||||
system_program_info.clone(),
|
system_program_info.clone(),
|
||||||
],
|
],
|
||||||
&[&associated_token_account_signer_seeds],
|
&[associated_token_account_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
msg!("Initialize the associated token account");
|
msg!("Initialize the associated token account");
|
||||||
invoke(
|
invoke(
|
||||||
&spl_token::instruction::initialize_account(
|
&spl_token::instruction::initialize_account(
|
||||||
&spl_token_program_id,
|
spl_token_program_id,
|
||||||
associated_token_account_info.key,
|
associated_token_account_info.key,
|
||||||
spl_token_mint_info.key,
|
spl_token_mint_info.key,
|
||||||
wallet_account_info.key,
|
wallet_account_info.key,
|
||||||
|
|
|
@ -13,7 +13,7 @@ test-bpf = []
|
||||||
[dependencies]
|
[dependencies]
|
||||||
num-derive = "0.3"
|
num-derive = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
spl-token = { version = "3.1", path = "../../token/program", features = [ "no-entrypoint" ] }
|
spl-token = { version = "3.1", path = "../../token/program", features = [ "no-entrypoint" ] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
uint = "0.8"
|
uint = "0.8"
|
||||||
|
@ -21,8 +21,8 @@ arbitrary = { version = "0.4", features = ["derive"], optional = true }
|
||||||
borsh = "0.8.2"
|
borsh = "0.8.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -421,7 +421,7 @@ impl Processor {
|
||||||
authority_account_info.clone(),
|
authority_account_info.clone(),
|
||||||
user_transfer_authority_info.clone(),
|
user_transfer_authority_info.clone(),
|
||||||
amount,
|
amount,
|
||||||
&pool_account_info.key,
|
pool_account_info.key,
|
||||||
pool.bump_seed,
|
pool.bump_seed,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ impl Processor {
|
||||||
authority_account_info.clone(),
|
authority_account_info.clone(),
|
||||||
user_transfer_authority_info.clone(),
|
user_transfer_authority_info.clone(),
|
||||||
amount,
|
amount,
|
||||||
&pool_account_info.key,
|
pool_account_info.key,
|
||||||
pool.bump_seed,
|
pool.bump_seed,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ impl Processor {
|
||||||
authority_account_info.clone(),
|
authority_account_info.clone(),
|
||||||
user_transfer_authority_info.clone(),
|
user_transfer_authority_info.clone(),
|
||||||
possible_withdraw_amount,
|
possible_withdraw_amount,
|
||||||
&pool_account_info.key,
|
pool_account_info.key,
|
||||||
pool.bump_seed,
|
pool.bump_seed,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ impl Processor {
|
||||||
authority_account_info.clone(),
|
authority_account_info.clone(),
|
||||||
user_transfer_authority_info.clone(),
|
user_transfer_authority_info.clone(),
|
||||||
amount,
|
amount,
|
||||||
&pool_account_info.key,
|
pool_account_info.key,
|
||||||
pool.bump_seed,
|
pool.bump_seed,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
if [[ -n $RUST_STABLE_VERSION ]]; then
|
if [[ -n $RUST_STABLE_VERSION ]]; then
|
||||||
stable_version="$RUST_STABLE_VERSION"
|
stable_version="$RUST_STABLE_VERSION"
|
||||||
else
|
else
|
||||||
stable_version=1.52.1
|
stable_version=1.53.0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $RUST_NIGHTLY_VERSION ]]; then
|
if [[ -n $RUST_NIGHTLY_VERSION ]]; then
|
||||||
nightly_version="$RUST_NIGHTLY_VERSION"
|
nightly_version="$RUST_NIGHTLY_VERSION"
|
||||||
else
|
else
|
||||||
nightly_version=2021-04-18
|
nightly_version=2021-06-09
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
if [[ -n $SOLANA_VERSION ]]; then
|
if [[ -n $SOLANA_VERSION ]]; then
|
||||||
solana_version="$SOLANA_VERSION"
|
solana_version="$SOLANA_VERSION"
|
||||||
else
|
else
|
||||||
solana_version=v1.6.11
|
solana_version=v1.7.3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export solana_version="$solana_version"
|
export solana_version="$solana_version"
|
||||||
|
|
|
@ -13,11 +13,11 @@ no-entrypoint = []
|
||||||
test-bpf = []
|
test-bpf = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -15,11 +15,11 @@ no-entrypoint = []
|
||||||
test-bpf = []
|
test-bpf = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -8,7 +8,7 @@ use {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_custom_heap() {
|
async fn test_custom_heap() {
|
||||||
let program_id = Pubkey::from_str(&"CustomHeap111111111111111111111111111111111").unwrap();
|
let program_id = Pubkey::from_str("CustomHeap111111111111111111111111111111111").unwrap();
|
||||||
let (mut banks_client, payer, recent_blockhash) = ProgramTest::new(
|
let (mut banks_client, payer, recent_blockhash) = ProgramTest::new(
|
||||||
"spl_example_custom_heap",
|
"spl_example_custom_heap",
|
||||||
program_id,
|
program_id,
|
||||||
|
|
|
@ -13,11 +13,11 @@ no-entrypoint = []
|
||||||
test-bpf = []
|
test-bpf = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -11,7 +11,7 @@ use {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_logging() {
|
async fn test_logging() {
|
||||||
let program_id = Pubkey::from_str(&"Logging111111111111111111111111111111111111").unwrap();
|
let program_id = Pubkey::from_str("Logging111111111111111111111111111111111111").unwrap();
|
||||||
let (mut banks_client, payer, recent_blockhash) = ProgramTest::new(
|
let (mut banks_client, payer, recent_blockhash) = ProgramTest::new(
|
||||||
"spl_example_logging",
|
"spl_example_logging",
|
||||||
program_id,
|
program_id,
|
||||||
|
|
|
@ -13,11 +13,11 @@ no-entrypoint = []
|
||||||
test-bpf = []
|
test-bpf = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub fn process_instruction(
|
||||||
let clock_via_sysvar = Clock::get()?;
|
let clock_via_sysvar = Clock::get()?;
|
||||||
// Or deserialize the account into a clock struct
|
// Or deserialize the account into a clock struct
|
||||||
let clock_sysvar_info = next_account_info(account_info_iter)?;
|
let clock_sysvar_info = next_account_info(account_info_iter)?;
|
||||||
let clock_via_account = Clock::from_account_info(&clock_sysvar_info)?;
|
let clock_via_account = Clock::from_account_info(clock_sysvar_info)?;
|
||||||
// Both produce the same sysvar
|
// Both produce the same sysvar
|
||||||
assert_eq!(clock_via_sysvar, clock_via_account);
|
assert_eq!(clock_via_sysvar, clock_via_account);
|
||||||
// Note: `format!` can be very expensive, use cautiously
|
// Note: `format!` can be very expensive, use cautiously
|
||||||
|
@ -31,7 +31,7 @@ pub fn process_instruction(
|
||||||
let rent_via_sysvar = Rent::get()?;
|
let rent_via_sysvar = Rent::get()?;
|
||||||
// Or deserialize the account into a rent struct
|
// Or deserialize the account into a rent struct
|
||||||
let rent_sysvar_info = next_account_info(account_info_iter)?;
|
let rent_sysvar_info = next_account_info(account_info_iter)?;
|
||||||
let rent_via_account = Rent::from_account_info(&rent_sysvar_info)?;
|
let rent_via_account = Rent::from_account_info(rent_sysvar_info)?;
|
||||||
// Both produce the same sysvar
|
// Both produce the same sysvar
|
||||||
assert_eq!(rent_via_sysvar, rent_via_account);
|
assert_eq!(rent_via_sysvar, rent_via_account);
|
||||||
// Can't print `exemption_threshold` because BPF does not support printing floats
|
// Can't print `exemption_threshold` because BPF does not support printing floats
|
||||||
|
|
|
@ -12,7 +12,7 @@ use {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_sysvar() {
|
async fn test_sysvar() {
|
||||||
let program_id = Pubkey::from_str(&"Sysvar1111111111111111111111111111111111111").unwrap();
|
let program_id = Pubkey::from_str("Sysvar1111111111111111111111111111111111111").unwrap();
|
||||||
let (mut banks_client, payer, recent_blockhash) = ProgramTest::new(
|
let (mut banks_client, payer, recent_blockhash) = ProgramTest::new(
|
||||||
"spl_example_sysvar",
|
"spl_example_sysvar",
|
||||||
program_id,
|
program_id,
|
||||||
|
|
|
@ -12,11 +12,11 @@ no-entrypoint = []
|
||||||
test-bpf = []
|
test-bpf = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -11,7 +11,7 @@ use {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_lamport_transfer() {
|
async fn test_lamport_transfer() {
|
||||||
let program_id = Pubkey::from_str(&"TransferLamports111111111111111111111111111").unwrap();
|
let program_id = Pubkey::from_str("TransferLamports111111111111111111111111111").unwrap();
|
||||||
let source_pubkey = Pubkey::new_unique();
|
let source_pubkey = Pubkey::new_unique();
|
||||||
let destination_pubkey = Pubkey::new_unique();
|
let destination_pubkey = Pubkey::new_unique();
|
||||||
let mut program_test = ProgramTest::new(
|
let mut program_test = ProgramTest::new(
|
||||||
|
|
|
@ -10,11 +10,11 @@ edition = "2018"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
clap = "2.33.3"
|
clap = "2.33.3"
|
||||||
solana-clap-utils = "1.6.11"
|
solana-clap-utils = "1.7.3"
|
||||||
solana-cli-config = "1.6.11"
|
solana-cli-config = "1.7.3"
|
||||||
solana-client = "1.6.11"
|
solana-client = "1.7.3"
|
||||||
solana-logger = "1.6.11"
|
solana-logger = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
spl-feature-proposal = { version = "1.0", path = "../program", features = ["no-entrypoint"] }
|
spl-feature-proposal = { version = "1.0", path = "../program", features = ["no-entrypoint"] }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|
|
@ -46,7 +46,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
.global(true)
|
.global(true)
|
||||||
.help("Configuration file to use");
|
.help("Configuration file to use");
|
||||||
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
|
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
|
||||||
arg.default_value(&config_file)
|
arg.default_value(config_file)
|
||||||
} else {
|
} else {
|
||||||
arg
|
arg
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ fn process_propose(
|
||||||
Some(&config.keypair.pubkey()),
|
Some(&config.keypair.pubkey()),
|
||||||
);
|
);
|
||||||
let blockhash = rpc_client.get_recent_blockhash()?.0;
|
let blockhash = rpc_client.get_recent_blockhash()?.0;
|
||||||
transaction.try_sign(&[&config.keypair, &feature_proposal_keypair], blockhash)?;
|
transaction.try_sign(&[&config.keypair, feature_proposal_keypair], blockhash)?;
|
||||||
|
|
||||||
println!("JSON RPC URL: {}", config.json_rpc_url);
|
println!("JSON RPC URL: {}", config.json_rpc_url);
|
||||||
|
|
||||||
|
@ -399,10 +399,9 @@ fn process_tally(
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let feature_proposal = get_feature_proposal(rpc_client, feature_proposal_address)?;
|
let feature_proposal = get_feature_proposal(rpc_client, feature_proposal_address)?;
|
||||||
|
|
||||||
let feature_id_address =
|
let feature_id_address = spl_feature_proposal::get_feature_id_address(feature_proposal_address);
|
||||||
spl_feature_proposal::get_feature_id_address(&feature_proposal_address);
|
|
||||||
let acceptance_token_address =
|
let acceptance_token_address =
|
||||||
spl_feature_proposal::get_acceptance_token_address(&feature_proposal_address);
|
spl_feature_proposal::get_acceptance_token_address(feature_proposal_address);
|
||||||
|
|
||||||
println!("Feature Id: {}", feature_id_address);
|
println!("Feature Id: {}", feature_id_address);
|
||||||
println!("Acceptance Token Address: {}", acceptance_token_address);
|
println!("Acceptance Token Address: {}", acceptance_token_address);
|
||||||
|
|
|
@ -14,12 +14,12 @@ test-bpf = []
|
||||||
[dependencies]
|
[dependencies]
|
||||||
borsh = "0.8"
|
borsh = "0.8"
|
||||||
borsh-derive = "0.8.1"
|
borsh-derive = "0.8.1"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
spl-token = { version = "3.1", path = "../../token/program", features = ["no-entrypoint"] }
|
spl-token = { version = "3.1", path = "../../token/program", features = ["no-entrypoint"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -126,7 +126,7 @@ pub fn process_instruction(
|
||||||
mint_info.clone(),
|
mint_info.clone(),
|
||||||
system_program_info.clone(),
|
system_program_info.clone(),
|
||||||
],
|
],
|
||||||
&[&mint_signer_seeds],
|
&[mint_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
msg!("Initializing mint");
|
msg!("Initializing mint");
|
||||||
|
@ -159,7 +159,7 @@ pub fn process_instruction(
|
||||||
distributor_token_info.clone(),
|
distributor_token_info.clone(),
|
||||||
system_program_info.clone(),
|
system_program_info.clone(),
|
||||||
],
|
],
|
||||||
&[&distributor_token_signer_seeds],
|
&[distributor_token_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
msg!("Initializing distributor token account");
|
msg!("Initializing distributor token account");
|
||||||
|
@ -193,7 +193,7 @@ pub fn process_instruction(
|
||||||
acceptance_token_info.clone(),
|
acceptance_token_info.clone(),
|
||||||
system_program_info.clone(),
|
system_program_info.clone(),
|
||||||
],
|
],
|
||||||
&[&acceptance_token_signer_seeds],
|
&[acceptance_token_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
msg!("Initializing acceptance token account");
|
msg!("Initializing acceptance token account");
|
||||||
|
@ -216,7 +216,7 @@ pub fn process_instruction(
|
||||||
&spl_token::instruction::set_authority(
|
&spl_token::instruction::set_authority(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
acceptance_token_info.key,
|
acceptance_token_info.key,
|
||||||
Some(&feature_proposal_info.key),
|
Some(feature_proposal_info.key),
|
||||||
spl_token::instruction::AuthorityType::CloseAccount,
|
spl_token::instruction::AuthorityType::CloseAccount,
|
||||||
feature_proposal_info.key,
|
feature_proposal_info.key,
|
||||||
&[],
|
&[],
|
||||||
|
@ -231,7 +231,7 @@ pub fn process_instruction(
|
||||||
&spl_token::instruction::set_authority(
|
&spl_token::instruction::set_authority(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
acceptance_token_info.key,
|
acceptance_token_info.key,
|
||||||
Some(&program_id),
|
Some(program_id),
|
||||||
spl_token::instruction::AuthorityType::AccountOwner,
|
spl_token::instruction::AuthorityType::AccountOwner,
|
||||||
feature_proposal_info.key,
|
feature_proposal_info.key,
|
||||||
&[],
|
&[],
|
||||||
|
@ -260,7 +260,7 @@ pub fn process_instruction(
|
||||||
distributor_token_info.clone(),
|
distributor_token_info.clone(),
|
||||||
spl_token_program_info.clone(),
|
spl_token_program_info.clone(),
|
||||||
],
|
],
|
||||||
&[&mint_signer_seeds],
|
&[mint_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Fully fund the feature id account so the `Tally` instruction will not require any
|
// Fully fund the feature id account so the `Tally` instruction will not require any
|
||||||
|
@ -283,7 +283,7 @@ pub fn process_instruction(
|
||||||
invoke_signed(
|
invoke_signed(
|
||||||
&system_instruction::allocate(feature_id_info.key, Feature::size_of() as u64),
|
&system_instruction::allocate(feature_id_info.key, Feature::size_of() as u64),
|
||||||
&[feature_id_info.clone(), system_program_info.clone()],
|
&[feature_id_info.clone(), system_program_info.clone()],
|
||||||
&[&feature_id_signer_seeds],
|
&[feature_id_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ pub fn process_instruction(
|
||||||
invoke_signed(
|
invoke_signed(
|
||||||
&system_instruction::assign(feature_id_info.key, &feature::id()),
|
&system_instruction::assign(feature_id_info.key, &feature::id()),
|
||||||
&[feature_id_info.clone(), system_program_info.clone()],
|
&[feature_id_info.clone(), system_program_info.clone()],
|
||||||
&[&feature_id_signer_seeds],
|
&[feature_id_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
msg!("Feature proposal accepted");
|
msg!("Feature proposal accepted");
|
||||||
|
|
|
@ -19,15 +19,15 @@ num-derive = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
serde = "1.0.121"
|
serde = "1.0.121"
|
||||||
serde_derive = "1.0.103"
|
serde_derive = "1.0.103"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
spl-token = { path = "../../token/program", features = [ "no-entrypoint" ] }
|
spl-token = { path = "../../token/program", features = [ "no-entrypoint" ] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_matches = "1.5.0"
|
assert_matches = "1.5.0"
|
||||||
proptest = "0.10"
|
proptest = "0.10"
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -64,7 +64,7 @@ pub enum GovernanceInstruction {
|
||||||
/// 1. `[writable]` Governing Token Holding account. PDA seeds: ['governance',realm, governing_token_mint]
|
/// 1. `[writable]` Governing Token Holding account. PDA seeds: ['governance',realm, governing_token_mint]
|
||||||
/// 2. `[writable]` Governing Token Source account. All tokens from the account will be transferred to the Holding account
|
/// 2. `[writable]` Governing Token Source account. All tokens from the account will be transferred to the Holding account
|
||||||
/// 3. `[signer]` Governing Token Owner account
|
/// 3. `[signer]` Governing Token Owner account
|
||||||
/// 4. `[signer]` Governing Token Transfer authority
|
/// 4. `[signer]` Governing Token Transfer authority
|
||||||
/// 5. `[writable]` Token Owner Record account. PDA seeds: ['governance',realm, governing_token_mint, governing_token_owner]
|
/// 5. `[writable]` Token Owner Record account. PDA seeds: ['governance',realm, governing_token_mint, governing_token_owner]
|
||||||
/// 6. `[signer]` Payer
|
/// 6. `[signer]` Payer
|
||||||
/// 7. `[]` System
|
/// 7. `[]` System
|
||||||
|
@ -81,7 +81,7 @@ pub enum GovernanceInstruction {
|
||||||
/// 2. `[writable]` Governing Token Destination account. All tokens will be transferred to this account
|
/// 2. `[writable]` Governing Token Destination account. All tokens will be transferred to this account
|
||||||
/// 3. `[signer]` Governing Token Owner account
|
/// 3. `[signer]` Governing Token Owner account
|
||||||
/// 4. `[writable]` Token Owner Record account. PDA seeds: ['governance',realm, governing_token_mint, governing_token_owner]
|
/// 4. `[writable]` Token Owner Record account. PDA seeds: ['governance',realm, governing_token_mint, governing_token_owner]
|
||||||
/// 5. `[]` SPL Token
|
/// 5. `[]` SPL Token
|
||||||
WithdrawGoverningTokens {},
|
WithdrawGoverningTokens {},
|
||||||
|
|
||||||
/// Sets Governance Delegate for the given Realm and Governing Token Mint (Community or Council)
|
/// Sets Governance Delegate for the given Realm and Governing Token Mint (Community or Council)
|
||||||
|
@ -112,7 +112,7 @@ pub enum GovernanceInstruction {
|
||||||
|
|
||||||
/// Creates Program Governance account which governs an upgradable program
|
/// Creates Program Governance account which governs an upgradable program
|
||||||
///
|
///
|
||||||
/// 0. `[]` Realm account the created Governance belongs to
|
/// 0. `[]` Realm account the created Governance belongs to
|
||||||
/// 1. `[writable]` Program Governance account. PDA seeds: ['program-governance', realm, governed_program]
|
/// 1. `[writable]` Program Governance account. PDA seeds: ['program-governance', realm, governed_program]
|
||||||
/// 2. `[writable]` Program Data account of the Program governed by this Governance account
|
/// 2. `[writable]` Program Data account of the Program governed by this Governance account
|
||||||
/// 3. `[signer]` Current Upgrade Authority account of the Program governed by this Governance account
|
/// 3. `[signer]` Current Upgrade Authority account of the Program governed by this Governance account
|
||||||
|
@ -137,11 +137,11 @@ pub enum GovernanceInstruction {
|
||||||
/// 0. `[writable]` Proposal account. PDA seeds ['governance',governance, governing_token_mint, proposal_index]
|
/// 0. `[writable]` Proposal account. PDA seeds ['governance',governance, governing_token_mint, proposal_index]
|
||||||
/// 1. `[writable]` Governance account
|
/// 1. `[writable]` Governance account
|
||||||
/// 2. `[]` TokenOwnerRecord account for Proposal owner
|
/// 2. `[]` TokenOwnerRecord account for Proposal owner
|
||||||
/// 3. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
/// 3. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
||||||
/// 4. `[signer]` Payer
|
/// 4. `[signer]` Payer
|
||||||
/// 5. `[]` System program
|
/// 5. `[]` System program
|
||||||
/// 6. `[]` Rent sysvar
|
/// 6. `[]` Rent sysvar
|
||||||
/// 7. `[]` Clock sysvar
|
/// 7. `[]` Clock sysvar
|
||||||
CreateProposal {
|
CreateProposal {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
/// UTF-8 encoded name of the proposal
|
/// UTF-8 encoded name of the proposal
|
||||||
|
@ -160,7 +160,7 @@ pub enum GovernanceInstruction {
|
||||||
///
|
///
|
||||||
/// 0. `[writable]` Proposal account
|
/// 0. `[writable]` Proposal account
|
||||||
/// 1. `[]` TokenOwnerRecord account for Proposal owner
|
/// 1. `[]` TokenOwnerRecord account for Proposal owner
|
||||||
/// 2. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
/// 2. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
||||||
/// 3. `[writable]` Signatory Record Account
|
/// 3. `[writable]` Signatory Record Account
|
||||||
/// 4. `[signer]` Payer
|
/// 4. `[signer]` Payer
|
||||||
/// 5. `[]` System program
|
/// 5. `[]` System program
|
||||||
|
@ -173,7 +173,7 @@ pub enum GovernanceInstruction {
|
||||||
|
|
||||||
/// Removes a Signatory from the Proposal
|
/// Removes a Signatory from the Proposal
|
||||||
///
|
///
|
||||||
/// 0. `[writable]` Proposal account
|
/// 0. `[writable]` Proposal account
|
||||||
/// 1. `[]` TokenOwnerRecord account for Proposal owner
|
/// 1. `[]` TokenOwnerRecord account for Proposal owner
|
||||||
/// 2. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
/// 2. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
||||||
/// 3. `[writable]` Signatory Record Account
|
/// 3. `[writable]` Signatory Record Account
|
||||||
|
@ -189,13 +189,13 @@ pub enum GovernanceInstruction {
|
||||||
/// If an Instruction replaces an existing Instruction at a given index then the old one must be removed using RemoveInstruction first
|
/// If an Instruction replaces an existing Instruction at a given index then the old one must be removed using RemoveInstruction first
|
||||||
|
|
||||||
/// 0. `[]` Governance account
|
/// 0. `[]` Governance account
|
||||||
/// 1. `[writable]` Proposal account
|
/// 1. `[writable]` Proposal account
|
||||||
/// 2. `[]` TokenOwnerRecord account for Proposal owner
|
/// 2. `[]` TokenOwnerRecord account for Proposal owner
|
||||||
/// 3. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
/// 3. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
||||||
/// 4. `[writable]` ProposalInstruction account. PDA seeds: ['governance',proposal,index]
|
/// 4. `[writable]` ProposalInstruction account. PDA seeds: ['governance',proposal,index]
|
||||||
/// 5. `[signer]` Payer
|
/// 5. `[signer]` Payer
|
||||||
/// 6. `[]` System program
|
/// 6. `[]` System program
|
||||||
/// 7. `[]` Clock sysvar
|
/// 7. `[]` Clock sysvar
|
||||||
InsertInstruction {
|
InsertInstruction {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
/// Instruction index to be inserted at.
|
/// Instruction index to be inserted at.
|
||||||
|
@ -214,8 +214,8 @@ pub enum GovernanceInstruction {
|
||||||
/// 0. `[writable]` Proposal account
|
/// 0. `[writable]` Proposal account
|
||||||
/// 1. `[]` TokenOwnerRecord account for Proposal owner
|
/// 1. `[]` TokenOwnerRecord account for Proposal owner
|
||||||
/// 2. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
/// 2. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
||||||
/// 3. `[writable]` ProposalInstruction account
|
/// 3. `[writable]` ProposalInstruction account
|
||||||
/// 4. `[writable]` Beneficiary Account which would receive lamports from the disposed ProposalInstruction account
|
/// 4. `[writable]` Beneficiary Account which would receive lamports from the disposed ProposalInstruction account
|
||||||
RemoveInstruction,
|
RemoveInstruction,
|
||||||
|
|
||||||
/// Cancels Proposal by changing its state to Canceled
|
/// Cancels Proposal by changing its state to Canceled
|
||||||
|
@ -223,7 +223,7 @@ pub enum GovernanceInstruction {
|
||||||
/// 0. `[writable]` Proposal account
|
/// 0. `[writable]` Proposal account
|
||||||
/// 1. `[]` TokenOwnerRecord account for Proposal owner
|
/// 1. `[]` TokenOwnerRecord account for Proposal owner
|
||||||
/// 2 `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
/// 2 `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
||||||
/// 3. `[]` Clock sysvar
|
/// 3. `[]` Clock sysvar
|
||||||
CancelProposal,
|
CancelProposal,
|
||||||
|
|
||||||
/// Signs off Proposal indicating the Signatory approves the Proposal
|
/// Signs off Proposal indicating the Signatory approves the Proposal
|
||||||
|
@ -243,12 +243,12 @@ pub enum GovernanceInstruction {
|
||||||
/// 1. `[writable]` Proposal account
|
/// 1. `[writable]` Proposal account
|
||||||
/// 2. `[writable]` Token Owner Record account. PDA seeds: ['governance',realm, governing_token_mint, governing_token_owner]
|
/// 2. `[writable]` Token Owner Record account. PDA seeds: ['governance',realm, governing_token_mint, governing_token_owner]
|
||||||
/// 3. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
/// 3. `[signer]` Governance Authority (Token Owner or Governance Delegate)
|
||||||
/// 4. `[writable]` Proposal VoteRecord account. PDA seeds: ['governance',proposal,governing_token_owner_record]
|
/// 4. `[writable]` Proposal VoteRecord account. PDA seeds: ['governance',proposal,governing_token_owner_record]
|
||||||
/// 5. `[]` Governing Token Mint
|
/// 5. `[]` Governing Token Mint
|
||||||
/// 6. `[signer]` Payer
|
/// 6. `[signer]` Payer
|
||||||
/// 7. `[]` System program
|
/// 7. `[]` System program
|
||||||
/// 8. `[]` Rent sysvar
|
/// 8. `[]` Rent sysvar
|
||||||
/// 9. `[]` Clock sysvar
|
/// 9. `[]` Clock sysvar
|
||||||
CastVote {
|
CastVote {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
/// Yes/No vote
|
/// Yes/No vote
|
||||||
|
@ -258,9 +258,9 @@ pub enum GovernanceInstruction {
|
||||||
/// Finalizes vote in case the Vote was not automatically tipped within max_voting_time period
|
/// Finalizes vote in case the Vote was not automatically tipped within max_voting_time period
|
||||||
///
|
///
|
||||||
/// 0. `[]` Governance account
|
/// 0. `[]` Governance account
|
||||||
/// 1. `[writable]` Proposal account
|
/// 1. `[writable]` Proposal account
|
||||||
/// 2. `[]` Governing Token Mint
|
/// 2. `[]` Governing Token Mint
|
||||||
/// 3. `[]` Clock sysvar
|
/// 3. `[]` Clock sysvar
|
||||||
FinalizeVote {},
|
FinalizeVote {},
|
||||||
|
|
||||||
/// Relinquish Vote removes voter weight from a Proposal and removes it from voter's active votes
|
/// Relinquish Vote removes voter weight from a Proposal and removes it from voter's active votes
|
||||||
|
@ -268,15 +268,15 @@ pub enum GovernanceInstruction {
|
||||||
/// If the Proposal is already in decided state then the instruction has no impact on the Proposal
|
/// If the Proposal is already in decided state then the instruction has no impact on the Proposal
|
||||||
/// and only allows voters to prune their outstanding votes in case they wanted to withdraw Governing tokens from the Realm
|
/// and only allows voters to prune their outstanding votes in case they wanted to withdraw Governing tokens from the Realm
|
||||||
///
|
///
|
||||||
/// 0. `[]` Governance account
|
/// 0. `[]` Governance account
|
||||||
/// 1. `[writable]` Proposal account
|
/// 1. `[writable]` Proposal account
|
||||||
/// 2. `[writable]` TokenOwnerRecord account. PDA seeds: ['governance',realm, governing_token_mint, governing_token_owner]
|
/// 2. `[writable]` TokenOwnerRecord account. PDA seeds: ['governance',realm, governing_token_mint, governing_token_owner]
|
||||||
/// 3. `[writable]` Proposal VoteRecord account. PDA seeds: ['governance',proposal,governing_token_owner_record]
|
/// 3. `[writable]` Proposal VoteRecord account. PDA seeds: ['governance',proposal,governing_token_owner_record]
|
||||||
/// 4. `[]` Governing Token Mint
|
/// 4. `[]` Governing Token Mint
|
||||||
|
|
||||||
/// 5. `[signer]` Optional Governance Authority (Token Owner or Governance Delegate)
|
/// 5. `[signer]` Optional Governance Authority (Token Owner or Governance Delegate)
|
||||||
/// It's required only when Proposal is still being voted on
|
/// It's required only when Proposal is still being voted on
|
||||||
/// 6. `[writable]` Optional Beneficiary account which would receive lamports when VoteRecord Account is disposed
|
/// 6. `[writable]` Optional Beneficiary account which would receive lamports when VoteRecord Account is disposed
|
||||||
/// It's required only when Proposal is still being voted on
|
/// It's required only when Proposal is still being voted on
|
||||||
RelinquishVote,
|
RelinquishVote,
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ pub enum GovernanceInstruction {
|
||||||
/// The actual instruction being executed will be signed by Governance PDA the Proposal belongs to
|
/// The actual instruction being executed will be signed by Governance PDA the Proposal belongs to
|
||||||
/// For example to execute Program upgrade the ProgramGovernance PDA would be used as the singer
|
/// For example to execute Program upgrade the ProgramGovernance PDA would be used as the singer
|
||||||
///
|
///
|
||||||
/// 0. `[writable]` Proposal account
|
/// 0. `[writable]` Proposal account
|
||||||
/// 1. `[writable]` ProposalInstruction account you wish to execute
|
/// 1. `[writable]` ProposalInstruction account you wish to execute
|
||||||
/// 2. `[]` Clock sysvar
|
/// 2. `[]` Clock sysvar
|
||||||
/// 3+ Any extra accounts that are part of the instruction, in order
|
/// 3+ Any extra accounts that are part of the instruction, in order
|
||||||
|
@ -304,7 +304,7 @@ pub fn create_realm(
|
||||||
) -> Instruction {
|
) -> Instruction {
|
||||||
let realm_address = get_realm_address(program_id, &name);
|
let realm_address = get_realm_address(program_id, &name);
|
||||||
let community_token_holding_address =
|
let community_token_holding_address =
|
||||||
get_governing_token_holding_address(program_id, &realm_address, &community_token_mint);
|
get_governing_token_holding_address(program_id, &realm_address, community_token_mint);
|
||||||
|
|
||||||
let mut accounts = vec![
|
let mut accounts = vec![
|
||||||
AccountMeta::new(realm_address, false),
|
AccountMeta::new(realm_address, false),
|
||||||
|
@ -671,7 +671,7 @@ pub fn cast_vote(
|
||||||
// Args
|
// Args
|
||||||
vote: Vote,
|
vote: Vote,
|
||||||
) -> Instruction {
|
) -> Instruction {
|
||||||
let vote_record_address = get_vote_record_address(program_id, &proposal, &token_owner_record);
|
let vote_record_address = get_vote_record_address(program_id, proposal, token_owner_record);
|
||||||
|
|
||||||
let accounts = vec![
|
let accounts = vec![
|
||||||
AccountMeta::new_readonly(*governance, false),
|
AccountMeta::new_readonly(*governance, false),
|
||||||
|
@ -730,7 +730,7 @@ pub fn relinquish_vote(
|
||||||
governance_authority: Option<Pubkey>,
|
governance_authority: Option<Pubkey>,
|
||||||
beneficiary: Option<Pubkey>,
|
beneficiary: Option<Pubkey>,
|
||||||
) -> Instruction {
|
) -> Instruction {
|
||||||
let vote_record_address = get_vote_record_address(program_id, &proposal, &token_owner_record);
|
let vote_record_address = get_vote_record_address(program_id, proposal, token_owner_record);
|
||||||
|
|
||||||
let mut accounts = vec![
|
let mut accounts = vec![
|
||||||
AccountMeta::new_readonly(*governance, false),
|
AccountMeta::new_readonly(*governance, false),
|
||||||
|
@ -794,7 +794,7 @@ pub fn insert_instruction(
|
||||||
instruction: InstructionData,
|
instruction: InstructionData,
|
||||||
) -> Instruction {
|
) -> Instruction {
|
||||||
let proposal_instruction_address =
|
let proposal_instruction_address =
|
||||||
get_proposal_instruction_address(program_id, &proposal, &index.to_le_bytes());
|
get_proposal_instruction_address(program_id, proposal, &index.to_le_bytes());
|
||||||
|
|
||||||
let accounts = vec![
|
let accounts = vec![
|
||||||
AccountMeta::new_readonly(*governance, false),
|
AccountMeta::new_readonly(*governance, false),
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub fn process_cast_vote(
|
||||||
|
|
||||||
let mut proposal_data = get_proposal_data_for_governance_and_governing_mint(
|
let mut proposal_data = get_proposal_data_for_governance_and_governing_mint(
|
||||||
program_id,
|
program_id,
|
||||||
&proposal_info,
|
proposal_info,
|
||||||
governance_info.key,
|
governance_info.key,
|
||||||
governing_token_mint_info.key,
|
governing_token_mint_info.key,
|
||||||
)?;
|
)?;
|
||||||
|
@ -65,7 +65,7 @@ pub fn process_cast_vote(
|
||||||
|
|
||||||
let mut token_owner_record_data = get_token_owner_record_data_for_realm_and_governing_mint(
|
let mut token_owner_record_data = get_token_owner_record_data_for_realm_and_governing_mint(
|
||||||
program_id,
|
program_id,
|
||||||
&token_owner_record_info,
|
token_owner_record_info,
|
||||||
&governance_data.config.realm,
|
&governance_data.config.realm,
|
||||||
governing_token_mint_info.key,
|
governing_token_mint_info.key,
|
||||||
)?;
|
)?;
|
||||||
|
@ -104,7 +104,7 @@ pub fn process_cast_vote(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let governing_token_supply = get_spl_token_mint_supply(&governing_token_mint_info)?;
|
let governing_token_supply = get_spl_token_mint_supply(governing_token_mint_info)?;
|
||||||
proposal_data.try_tip_vote(governing_token_supply, &governance_data.config, clock.slot);
|
proposal_data.try_tip_vote(governing_token_supply, &governance_data.config, clock.slot);
|
||||||
|
|
||||||
proposal_data.serialize(&mut *proposal_info.data.borrow_mut())?;
|
proposal_data.serialize(&mut *proposal_info.data.borrow_mut())?;
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub fn process_create_account_governance(
|
||||||
|
|
||||||
create_and_serialize_account_signed::<Governance>(
|
create_and_serialize_account_signed::<Governance>(
|
||||||
payer_info,
|
payer_info,
|
||||||
&account_governance_info,
|
account_governance_info,
|
||||||
&account_governance_data,
|
&account_governance_data,
|
||||||
&get_account_governance_address_seeds(&config.realm, &config.governed_account),
|
&get_account_governance_address_seeds(&config.realm, &config.governed_account),
|
||||||
program_id,
|
program_id,
|
||||||
|
|
|
@ -47,7 +47,7 @@ pub fn process_create_program_governance(
|
||||||
let rent_sysvar_info = next_account_info(account_info_iter)?; // 6
|
let rent_sysvar_info = next_account_info(account_info_iter)?; // 6
|
||||||
let rent = &Rent::from_account_info(rent_sysvar_info)?;
|
let rent = &Rent::from_account_info(rent_sysvar_info)?;
|
||||||
|
|
||||||
assert_is_valid_governance_config(program_id, &config, &realm_info)?;
|
assert_is_valid_governance_config(program_id, &config, realm_info)?;
|
||||||
|
|
||||||
let program_governance_data = Governance {
|
let program_governance_data = Governance {
|
||||||
account_type: GovernanceAccountType::ProgramGovernance,
|
account_type: GovernanceAccountType::ProgramGovernance,
|
||||||
|
@ -57,7 +57,7 @@ pub fn process_create_program_governance(
|
||||||
|
|
||||||
create_and_serialize_account_signed::<Governance>(
|
create_and_serialize_account_signed::<Governance>(
|
||||||
payer_info,
|
payer_info,
|
||||||
&program_governance_info,
|
program_governance_info,
|
||||||
&program_governance_data,
|
&program_governance_data,
|
||||||
&get_program_governance_address_seeds(&config.realm, &config.governed_account),
|
&get_program_governance_address_seeds(&config.realm, &config.governed_account),
|
||||||
program_id,
|
program_id,
|
||||||
|
@ -76,8 +76,8 @@ pub fn process_create_program_governance(
|
||||||
} else {
|
} else {
|
||||||
assert_program_upgrade_authority_is_signer(
|
assert_program_upgrade_authority_is_signer(
|
||||||
&config.governed_account,
|
&config.governed_account,
|
||||||
&governed_program_data_info,
|
governed_program_data_info,
|
||||||
&governed_program_upgrade_authority_info,
|
governed_program_upgrade_authority_info,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ pub fn process_create_proposal(
|
||||||
|
|
||||||
let token_owner_record_data = get_token_owner_record_data_for_realm_and_governing_mint(
|
let token_owner_record_data = get_token_owner_record_data_for_realm_and_governing_mint(
|
||||||
program_id,
|
program_id,
|
||||||
&token_owner_record_info,
|
token_owner_record_info,
|
||||||
&governance_data.config.realm,
|
&governance_data.config.realm,
|
||||||
&governing_token_mint,
|
&governing_token_mint,
|
||||||
)?;
|
)?;
|
||||||
|
|
|
@ -87,7 +87,7 @@ pub fn process_create_realm(
|
||||||
|
|
||||||
create_and_serialize_account_signed::<Realm>(
|
create_and_serialize_account_signed::<Realm>(
|
||||||
payer_info,
|
payer_info,
|
||||||
&realm_info,
|
realm_info,
|
||||||
&realm_data,
|
&realm_data,
|
||||||
&get_realm_address_seeds(&name),
|
&get_realm_address_seeds(&name),
|
||||||
program_id,
|
program_id,
|
||||||
|
|
|
@ -55,9 +55,9 @@ pub fn process_deposit_governing_tokens(
|
||||||
let amount = get_spl_token_amount(governing_token_source_info)?;
|
let amount = get_spl_token_amount(governing_token_source_info)?;
|
||||||
|
|
||||||
transfer_spl_tokens(
|
transfer_spl_tokens(
|
||||||
&governing_token_source_info,
|
governing_token_source_info,
|
||||||
&governing_token_holding_info,
|
governing_token_holding_info,
|
||||||
&governing_token_transfer_authority_info,
|
governing_token_transfer_authority_info,
|
||||||
amount,
|
amount,
|
||||||
spl_token_info,
|
spl_token_info,
|
||||||
)?;
|
)?;
|
||||||
|
@ -70,7 +70,7 @@ pub fn process_deposit_governing_tokens(
|
||||||
|
|
||||||
if token_owner_record_info.data_is_empty() {
|
if token_owner_record_info.data_is_empty() {
|
||||||
// Deposited tokens can only be withdrawn by the owner so let's make sure the owner signed the transaction
|
// Deposited tokens can only be withdrawn by the owner so let's make sure the owner signed the transaction
|
||||||
let governing_token_owner = get_spl_token_owner(&governing_token_source_info)?;
|
let governing_token_owner = get_spl_token_owner(governing_token_source_info)?;
|
||||||
|
|
||||||
if !(governing_token_owner == *governing_token_owner_info.key
|
if !(governing_token_owner == *governing_token_owner_info.key
|
||||||
&& governing_token_owner_info.is_signer)
|
&& governing_token_owner_info.is_signer)
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub fn process_execute_instruction(program_id: &Pubkey, accounts: &[AccountInfo]
|
||||||
|
|
||||||
invoke_signed(
|
invoke_signed(
|
||||||
&instruction,
|
&instruction,
|
||||||
&instruction_account_infos,
|
instruction_account_infos,
|
||||||
&[&governance_seeds[..]],
|
&[&governance_seeds[..]],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,12 @@ pub fn process_finalize_vote(program_id: &Pubkey, accounts: &[AccountInfo]) -> P
|
||||||
|
|
||||||
let mut proposal_data = get_proposal_data_for_governance_and_governing_mint(
|
let mut proposal_data = get_proposal_data_for_governance_and_governing_mint(
|
||||||
program_id,
|
program_id,
|
||||||
&proposal_info,
|
proposal_info,
|
||||||
governance_info.key,
|
governance_info.key,
|
||||||
governing_token_mint_info.key,
|
governing_token_mint_info.key,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let governing_token_supply = get_spl_token_mint_supply(&governing_token_mint_info)?;
|
let governing_token_supply = get_spl_token_mint_supply(governing_token_mint_info)?;
|
||||||
|
|
||||||
proposal_data.finalize_vote(governing_token_supply, &governance_data.config, clock.slot)?;
|
proposal_data.finalize_vote(governing_token_supply, &governance_data.config, clock.slot)?;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub fn process_insert_instruction(
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut proposal_data =
|
let mut proposal_data =
|
||||||
get_proposal_data_for_governance(program_id, &proposal_info, governance_info.key)?;
|
get_proposal_data_for_governance(program_id, proposal_info, governance_info.key)?;
|
||||||
proposal_data.assert_can_edit_instructions()?;
|
proposal_data.assert_can_edit_instructions()?;
|
||||||
|
|
||||||
let token_owner_record_data = get_token_owner_record_data_for_proposal_owner(
|
let token_owner_record_data = get_token_owner_record_data_for_proposal_owner(
|
||||||
|
|
|
@ -34,14 +34,14 @@ pub fn process_relinquish_vote(program_id: &Pubkey, accounts: &[AccountInfo]) ->
|
||||||
|
|
||||||
let mut proposal_data = get_proposal_data_for_governance_and_governing_mint(
|
let mut proposal_data = get_proposal_data_for_governance_and_governing_mint(
|
||||||
program_id,
|
program_id,
|
||||||
&proposal_info,
|
proposal_info,
|
||||||
governance_info.key,
|
governance_info.key,
|
||||||
governing_token_mint_info.key,
|
governing_token_mint_info.key,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let mut token_owner_record_data = get_token_owner_record_data_for_realm_and_governing_mint(
|
let mut token_owner_record_data = get_token_owner_record_data_for_realm_and_governing_mint(
|
||||||
program_id,
|
program_id,
|
||||||
&token_owner_record_info,
|
token_owner_record_info,
|
||||||
&governance_data.config.realm,
|
&governance_data.config.realm,
|
||||||
governing_token_mint_info.key,
|
governing_token_mint_info.key,
|
||||||
)?;
|
)?;
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub fn process_set_governance_delegate(
|
||||||
let mut token_owner_record_data =
|
let mut token_owner_record_data =
|
||||||
get_token_owner_record_data(program_id, token_owner_record_info)?;
|
get_token_owner_record_data(program_id, token_owner_record_info)?;
|
||||||
|
|
||||||
token_owner_record_data.assert_token_owner_or_delegate_is_signer(&governance_authority_info)?;
|
token_owner_record_data.assert_token_owner_or_delegate_is_signer(governance_authority_info)?;
|
||||||
|
|
||||||
token_owner_record_data.governance_delegate = *new_governance_delegate;
|
token_owner_record_data.governance_delegate = *new_governance_delegate;
|
||||||
token_owner_record_data.serialize(&mut *token_owner_record_info.data.borrow_mut())?;
|
token_owner_record_data.serialize(&mut *token_owner_record_info.data.borrow_mut())?;
|
||||||
|
|
|
@ -56,9 +56,9 @@ pub fn process_withdraw_governing_tokens(
|
||||||
}
|
}
|
||||||
|
|
||||||
transfer_spl_tokens_signed(
|
transfer_spl_tokens_signed(
|
||||||
&governing_token_holding_info,
|
governing_token_holding_info,
|
||||||
&governing_token_destination_info,
|
governing_token_destination_info,
|
||||||
&realm_info,
|
realm_info,
|
||||||
&get_realm_address_seeds(&realm_data.name),
|
&get_realm_address_seeds(&realm_data.name),
|
||||||
program_id,
|
program_id,
|
||||||
token_owner_record_data.governing_token_deposit_amount,
|
token_owner_record_data.governing_token_deposit_amount,
|
||||||
|
|
|
@ -97,8 +97,8 @@ pub fn get_program_governance_address_seeds<'a>(
|
||||||
// Note: Only the current program upgrade authority can create an account with this PDA using CreateProgramGovernance instruction
|
// Note: Only the current program upgrade authority can create an account with this PDA using CreateProgramGovernance instruction
|
||||||
[
|
[
|
||||||
b"program-governance",
|
b"program-governance",
|
||||||
&realm.as_ref(),
|
realm.as_ref(),
|
||||||
&governed_program.as_ref(),
|
governed_program.as_ref(),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +122,8 @@ pub fn get_account_governance_address_seeds<'a>(
|
||||||
) -> [&'a [u8]; 3] {
|
) -> [&'a [u8]; 3] {
|
||||||
[
|
[
|
||||||
b"account-governance",
|
b"account-governance",
|
||||||
&realm.as_ref(),
|
realm.as_ref(),
|
||||||
&governed_account.as_ref(),
|
governed_account.as_ref(),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ pub fn get_proposal_address_seeds<'a>(
|
||||||
PROGRAM_AUTHORITY_SEED,
|
PROGRAM_AUTHORITY_SEED,
|
||||||
governance.as_ref(),
|
governance.as_ref(),
|
||||||
governing_token_mint.as_ref(),
|
governing_token_mint.as_ref(),
|
||||||
&proposal_index_le_bytes,
|
proposal_index_le_bytes,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ pub fn get_proposal_address<'a>(
|
||||||
proposal_index_le_bytes: &'a [u8],
|
proposal_index_le_bytes: &'a [u8],
|
||||||
) -> Pubkey {
|
) -> Pubkey {
|
||||||
Pubkey::find_program_address(
|
Pubkey::find_program_address(
|
||||||
&get_proposal_address_seeds(governance, governing_token_mint, &proposal_index_le_bytes),
|
&get_proposal_address_seeds(governance, governing_token_mint, proposal_index_le_bytes),
|
||||||
program_id,
|
program_id,
|
||||||
)
|
)
|
||||||
.0
|
.0
|
||||||
|
|
|
@ -118,7 +118,7 @@ pub fn get_proposal_instruction_address_seeds<'a>(
|
||||||
[
|
[
|
||||||
PROGRAM_AUTHORITY_SEED,
|
PROGRAM_AUTHORITY_SEED,
|
||||||
proposal.as_ref(),
|
proposal.as_ref(),
|
||||||
&instruction_index_le_bytes,
|
instruction_index_le_bytes,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ pub fn get_proposal_instruction_address<'a>(
|
||||||
instruction_index_le_bytes: &'a [u8],
|
instruction_index_le_bytes: &'a [u8],
|
||||||
) -> Pubkey {
|
) -> Pubkey {
|
||||||
Pubkey::find_program_address(
|
Pubkey::find_program_address(
|
||||||
&get_proposal_instruction_address_seeds(proposal, &instruction_index_le_bytes),
|
&get_proposal_instruction_address_seeds(proposal, instruction_index_le_bytes),
|
||||||
program_id,
|
program_id,
|
||||||
)
|
)
|
||||||
.0
|
.0
|
||||||
|
|
|
@ -76,12 +76,12 @@ pub fn get_realm_data(
|
||||||
|
|
||||||
/// Returns Realm PDA seeds
|
/// Returns Realm PDA seeds
|
||||||
pub fn get_realm_address_seeds(name: &str) -> [&[u8]; 2] {
|
pub fn get_realm_address_seeds(name: &str) -> [&[u8]; 2] {
|
||||||
[PROGRAM_AUTHORITY_SEED, &name.as_bytes()]
|
[PROGRAM_AUTHORITY_SEED, name.as_bytes()]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns Realm PDA address
|
/// Returns Realm PDA address
|
||||||
pub fn get_realm_address(program_id: &Pubkey, name: &str) -> Pubkey {
|
pub fn get_realm_address(program_id: &Pubkey, name: &str) -> Pubkey {
|
||||||
Pubkey::find_program_address(&get_realm_address_seeds(&name), program_id).0
|
Pubkey::find_program_address(&get_realm_address_seeds(name), program_id).0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns Realm Token Holding PDA seeds
|
/// Returns Realm Token Holding PDA seeds
|
||||||
|
|
|
@ -42,8 +42,8 @@ pub fn set_program_upgrade_authority<'a>(
|
||||||
) -> Result<(), ProgramError> {
|
) -> Result<(), ProgramError> {
|
||||||
let set_upgrade_authority_instruction = bpf_loader_upgradeable::set_upgrade_authority(
|
let set_upgrade_authority_instruction = bpf_loader_upgradeable::set_upgrade_authority(
|
||||||
program_address,
|
program_address,
|
||||||
&program_upgrade_authority_info.key,
|
program_upgrade_authority_info.key,
|
||||||
Some(&new_authority_info.key),
|
Some(new_authority_info.key),
|
||||||
);
|
);
|
||||||
|
|
||||||
invoke(
|
invoke(
|
||||||
|
|
|
@ -16,14 +16,14 @@ borsh = "0.8"
|
||||||
borsh-derive = "0.8.1"
|
borsh-derive = "0.8.1"
|
||||||
num-derive = "0.3"
|
num-derive = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
uint = "0.8"
|
uint = "0.8"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
proptest = "1.0.0"
|
proptest = "1.0.0"
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -322,7 +322,7 @@ impl PreciseNumber {
|
||||||
Some(num) => self.checked_div(&num)?,
|
Some(num) => self.checked_div(&num)?,
|
||||||
None => Self::new(0)?,
|
None => Self::new(0)?,
|
||||||
};
|
};
|
||||||
guess = first_term.checked_add(&second_term)?.checked_div(&root)?;
|
guess = first_term.checked_add(&second_term)?.checked_div(root)?;
|
||||||
if last_guess.almost_eq(&guess, precision) {
|
if last_guess.almost_eq(&guess, precision) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,11 +12,11 @@ no-entrypoint = []
|
||||||
test-bpf = []
|
test-bpf = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -52,7 +52,7 @@ mod tests {
|
||||||
let emoji = "🐆".as_bytes();
|
let emoji = "🐆".as_bytes();
|
||||||
let bytes = [0xF0, 0x9F, 0x90, 0x86];
|
let bytes = [0xF0, 0x9F, 0x90, 0x86];
|
||||||
assert_eq!(emoji, bytes);
|
assert_eq!(emoji, bytes);
|
||||||
assert_eq!(Ok(()), process_instruction(&program_id, &[], &emoji));
|
assert_eq!(Ok(()), process_instruction(&program_id, &[], emoji));
|
||||||
|
|
||||||
let mut bad_utf8 = bytes;
|
let mut bad_utf8 = bytes;
|
||||||
bad_utf8[3] = 0xFF; // Invalid UTF-8 byte
|
bad_utf8[3] = 0xFF; // Invalid UTF-8 byte
|
||||||
|
|
|
@ -14,15 +14,15 @@ no-entrypoint = []
|
||||||
test-bpf = []
|
test-bpf = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
borsh = "0.8.1"
|
borsh = "0.8.1"
|
||||||
num-derive = "0.3.3"
|
num-derive = "0.3.3"
|
||||||
thiserror = "1.0.24"
|
thiserror = "1.0.24"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -82,7 +82,7 @@ pub enum NameRegistryInstruction {
|
||||||
Delete,
|
Delete,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn create(
|
pub fn create(
|
||||||
name_service_program_id: Pubkey,
|
name_service_program_id: Pubkey,
|
||||||
instruction_data: NameRegistryInstruction,
|
instruction_data: NameRegistryInstruction,
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl Processor {
|
||||||
let parent_name_owner = next_account_info(accounts_iter).ok();
|
let parent_name_owner = next_account_info(accounts_iter).ok();
|
||||||
|
|
||||||
let (name_account_key, seeds) = get_seeds_and_key(
|
let (name_account_key, seeds) = get_seeds_and_key(
|
||||||
&program_id,
|
program_id,
|
||||||
hashed_name,
|
hashed_name,
|
||||||
Some(name_class.key),
|
Some(name_class.key),
|
||||||
Some(parent_name_account.key),
|
Some(parent_name_account.key),
|
||||||
|
@ -84,7 +84,7 @@ impl Processor {
|
||||||
// The creation is done in three steps: transfer, allocate and assign, because
|
// The creation is done in three steps: transfer, allocate and assign, because
|
||||||
// one cannot `system_instruction::create` an account to which lamports have been transfered before.
|
// one cannot `system_instruction::create` an account to which lamports have been transfered before.
|
||||||
invoke(
|
invoke(
|
||||||
&system_instruction::transfer(&payer_account.key, &name_account_key, lamports),
|
&system_instruction::transfer(payer_account.key, &name_account_key, lamports),
|
||||||
&[
|
&[
|
||||||
payer_account.clone(),
|
payer_account.clone(),
|
||||||
name_account.clone(),
|
name_account.clone(),
|
||||||
|
@ -99,7 +99,7 @@ impl Processor {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
invoke_signed(
|
invoke_signed(
|
||||||
&system_instruction::assign(name_account.key, &program_id),
|
&system_instruction::assign(name_account.key, program_id),
|
||||||
&[name_account.clone(), system_program.clone()],
|
&[name_account.clone(), system_program.clone()],
|
||||||
&[&seeds.chunks(32).collect::<Vec<&[u8]>>()],
|
&[&seeds.chunks(32).collect::<Vec<&[u8]>>()],
|
||||||
)?;
|
)?;
|
||||||
|
|
|
@ -16,12 +16,12 @@ borsh = "0.8.1"
|
||||||
borsh-derive = "0.8.1"
|
borsh-derive = "0.8.1"
|
||||||
num-derive = "0.3"
|
num-derive = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -12,11 +12,11 @@ test-bpf = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrayref = "0.3.6"
|
arrayref = "0.3.6"
|
||||||
solana-program = "=1.6.11"
|
solana-program = "=1.7.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-program-test = "=1.6.11"
|
solana-program-test = "=1.7.3"
|
||||||
solana-sdk = "=1.6.11"
|
solana-sdk = "=1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -12,13 +12,13 @@ version = "0.2.0"
|
||||||
borsh = "0.8"
|
borsh = "0.8"
|
||||||
clap = "2.33.3"
|
clap = "2.33.3"
|
||||||
serde_json = "1.0.62"
|
serde_json = "1.0.62"
|
||||||
solana-account-decoder = "1.6.11"
|
solana-account-decoder = "1.7.3"
|
||||||
solana-clap-utils = "1.6.11"
|
solana-clap-utils = "1.7.3"
|
||||||
solana-cli-config = "1.6.11"
|
solana-cli-config = "1.7.3"
|
||||||
solana-client = "1.6.11"
|
solana-client = "1.7.3"
|
||||||
solana-logger = "1.6.11"
|
solana-logger = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
spl-associated-token-account = { version = "1.0", path="../../associated-token-account/program", features = [ "no-entrypoint" ] }
|
spl-associated-token-account = { version = "1.0", path="../../associated-token-account/program", features = [ "no-entrypoint" ] }
|
||||||
spl-stake-pool = { version = "0.2", path="../program", features = [ "no-entrypoint" ] }
|
spl-stake-pool = { version = "0.2", path="../program", features = [ "no-entrypoint" ] }
|
||||||
spl-token = { version = "3.1", path="../../token/program", features = [ "no-entrypoint" ] }
|
spl-token = { version = "3.1", path="../../token/program", features = [ "no-entrypoint" ] }
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub fn get_validator_list(
|
||||||
validator_list_address: &Pubkey,
|
validator_list_address: &Pubkey,
|
||||||
) -> Result<ValidatorList, Error> {
|
) -> Result<ValidatorList, Error> {
|
||||||
let account_data = rpc_client.get_account_data(validator_list_address)?;
|
let account_data = rpc_client.get_account_data(validator_list_address)?;
|
||||||
let validator_list = try_from_slice_unchecked::<ValidatorList>(&account_data.as_slice())
|
let validator_list = try_from_slice_unchecked::<ValidatorList>(account_data.as_slice())
|
||||||
.map_err(|err| format!("Invalid validator list {}: {}", validator_list_address, err))?;
|
.map_err(|err| format!("Invalid validator list {}: {}", validator_list_address, err))?;
|
||||||
Ok(validator_list)
|
Ok(validator_list)
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,8 +252,8 @@ fn command_create_pool(
|
||||||
check_fee_payer_balance(
|
check_fee_payer_balance(
|
||||||
config,
|
config,
|
||||||
total_rent_free_balances
|
total_rent_free_balances
|
||||||
+ fee_calculator.calculate_fee(&setup_transaction.message())
|
+ fee_calculator.calculate_fee(setup_transaction.message())
|
||||||
+ fee_calculator.calculate_fee(&initialize_transaction.message()),
|
+ fee_calculator.calculate_fee(initialize_transaction.message()),
|
||||||
)?;
|
)?;
|
||||||
let mut setup_signers = vec![
|
let mut setup_signers = vec![
|
||||||
config.fee_payer.as_ref(),
|
config.fee_payer.as_ref(),
|
||||||
|
@ -263,7 +263,7 @@ fn command_create_pool(
|
||||||
];
|
];
|
||||||
unique_signers!(setup_signers);
|
unique_signers!(setup_signers);
|
||||||
setup_transaction.sign(&setup_signers, recent_blockhash);
|
setup_transaction.sign(&setup_signers, recent_blockhash);
|
||||||
send_transaction(&config, setup_transaction)?;
|
send_transaction(config, setup_transaction)?;
|
||||||
|
|
||||||
println!("Creating stake pool {}", stake_pool_keypair.pubkey());
|
println!("Creating stake pool {}", stake_pool_keypair.pubkey());
|
||||||
let mut initialize_signers = vec![
|
let mut initialize_signers = vec![
|
||||||
|
@ -274,7 +274,7 @@ fn command_create_pool(
|
||||||
];
|
];
|
||||||
unique_signers!(initialize_signers);
|
unique_signers!(initialize_signers);
|
||||||
initialize_transaction.sign(&initialize_signers, recent_blockhash);
|
initialize_transaction.sign(&initialize_signers, recent_blockhash);
|
||||||
send_transaction(&config, initialize_transaction)?;
|
send_transaction(config, initialize_transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,22 +290,22 @@ fn command_vsa_create(
|
||||||
// Create new validator stake account address
|
// Create new validator stake account address
|
||||||
spl_stake_pool::instruction::create_validator_stake_account_with_vote(
|
spl_stake_pool::instruction::create_validator_stake_account_with_vote(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&config.staker.pubkey(),
|
&config.staker.pubkey(),
|
||||||
&config.fee_payer.pubkey(),
|
&config.fee_payer.pubkey(),
|
||||||
&vote_account,
|
vote_account,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
Some(&config.fee_payer.pubkey()),
|
Some(&config.fee_payer.pubkey()),
|
||||||
);
|
);
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
transaction.sign(
|
transaction.sign(
|
||||||
&[config.fee_payer.as_ref(), config.staker.as_ref()],
|
&[config.fee_payer.as_ref(), config.staker.as_ref()],
|
||||||
recent_blockhash,
|
recent_blockhash,
|
||||||
);
|
);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,19 +347,19 @@ fn command_vsa_add(
|
||||||
let instruction = spl_stake_pool::instruction::add_validator_to_pool_with_vote(
|
let instruction = spl_stake_pool::instruction::add_validator_to_pool_with_vote(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&stake_pool,
|
&stake_pool,
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&vote_account,
|
vote_account,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut transaction =
|
let mut transaction =
|
||||||
Transaction::new_with_payer(&[instruction], Some(&config.fee_payer.pubkey()));
|
Transaction::new_with_payer(&[instruction], Some(&config.fee_payer.pubkey()));
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
let mut signers = vec![config.fee_payer.as_ref(), config.staker.as_ref()];
|
let mut signers = vec![config.fee_payer.as_ref(), config.staker.as_ref()];
|
||||||
unique_signers!(signers);
|
unique_signers!(signers);
|
||||||
transaction.sign(&signers, recent_blockhash);
|
transaction.sign(&signers, recent_blockhash);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,12 +393,12 @@ fn command_vsa_remove(
|
||||||
);
|
);
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
transaction.sign(
|
transaction.sign(
|
||||||
&[config.fee_payer.as_ref(), config.staker.as_ref()],
|
&[config.fee_payer.as_ref(), config.staker.as_ref()],
|
||||||
recent_blockhash,
|
recent_blockhash,
|
||||||
);
|
);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,12 +426,12 @@ fn command_increase_validator_stake(
|
||||||
Transaction::new_with_payer(&[instruction], Some(&config.fee_payer.pubkey()));
|
Transaction::new_with_payer(&[instruction], Some(&config.fee_payer.pubkey()));
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
transaction.sign(
|
transaction.sign(
|
||||||
&[config.fee_payer.as_ref(), config.staker.as_ref()],
|
&[config.fee_payer.as_ref(), config.staker.as_ref()],
|
||||||
recent_blockhash,
|
recent_blockhash,
|
||||||
);
|
);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,12 +459,12 @@ fn command_decrease_validator_stake(
|
||||||
Transaction::new_with_payer(&[instruction], Some(&config.fee_payer.pubkey()));
|
Transaction::new_with_payer(&[instruction], Some(&config.fee_payer.pubkey()));
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
transaction.sign(
|
transaction.sign(
|
||||||
&[config.fee_payer.as_ref(), config.staker.as_ref()],
|
&[config.fee_payer.as_ref(), config.staker.as_ref()],
|
||||||
recent_blockhash,
|
recent_blockhash,
|
||||||
);
|
);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ fn command_set_preferred_validator(
|
||||||
let mut transaction = Transaction::new_with_payer(
|
let mut transaction = Transaction::new_with_payer(
|
||||||
&[spl_stake_pool::instruction::set_preferred_validator(
|
&[spl_stake_pool::instruction::set_preferred_validator(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&config.staker.pubkey(),
|
&config.staker.pubkey(),
|
||||||
&stake_pool.validator_list,
|
&stake_pool.validator_list,
|
||||||
preferred_type,
|
preferred_type,
|
||||||
|
@ -488,11 +488,11 @@ fn command_set_preferred_validator(
|
||||||
);
|
);
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
let mut signers = vec![config.fee_payer.as_ref(), config.staker.as_ref()];
|
let mut signers = vec![config.fee_payer.as_ref(), config.staker.as_ref()];
|
||||||
unique_signers!(signers);
|
unique_signers!(signers);
|
||||||
transaction.sign(&signers, recent_blockhash);
|
transaction.sign(&signers, recent_blockhash);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ fn command_deposit(
|
||||||
}
|
}
|
||||||
|
|
||||||
let stake_pool = get_stake_pool(&config.rpc_client, stake_pool_address)?;
|
let stake_pool = get_stake_pool(&config.rpc_client, stake_pool_address)?;
|
||||||
let stake_state = get_stake_state(&config.rpc_client, &stake)?;
|
let stake_state = get_stake_state(&config.rpc_client, stake)?;
|
||||||
|
|
||||||
if config.verbose {
|
if config.verbose {
|
||||||
println!("Depositing stake account {:?}", stake_state);
|
println!("Depositing stake account {:?}", stake_state);
|
||||||
|
@ -568,7 +568,7 @@ fn command_deposit(
|
||||||
|
|
||||||
// Create token account if not specified
|
// Create token account if not specified
|
||||||
let token_receiver = token_receiver.unwrap_or(add_associated_token_account(
|
let token_receiver = token_receiver.unwrap_or(add_associated_token_account(
|
||||||
&config,
|
config,
|
||||||
&stake_pool.pool_mint,
|
&stake_pool.pool_mint,
|
||||||
&mut instructions,
|
&mut instructions,
|
||||||
&mut total_rent_free_balances,
|
&mut total_rent_free_balances,
|
||||||
|
@ -590,11 +590,11 @@ fn command_deposit(
|
||||||
|
|
||||||
spl_stake_pool::instruction::deposit_with_authority(
|
spl_stake_pool::instruction::deposit_with_authority(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&stake_pool.validator_list,
|
&stake_pool.validator_list,
|
||||||
&deposit_authority.pubkey(),
|
&deposit_authority.pubkey(),
|
||||||
&pool_withdraw_authority,
|
&pool_withdraw_authority,
|
||||||
&stake,
|
stake,
|
||||||
&config.staker.pubkey(),
|
&config.staker.pubkey(),
|
||||||
&validator_stake_account,
|
&validator_stake_account,
|
||||||
&stake_pool.reserve_stake,
|
&stake_pool.reserve_stake,
|
||||||
|
@ -605,10 +605,10 @@ fn command_deposit(
|
||||||
} else {
|
} else {
|
||||||
spl_stake_pool::instruction::deposit(
|
spl_stake_pool::instruction::deposit(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&stake_pool.validator_list,
|
&stake_pool.validator_list,
|
||||||
&pool_withdraw_authority,
|
&pool_withdraw_authority,
|
||||||
&stake,
|
stake,
|
||||||
&config.staker.pubkey(),
|
&config.staker.pubkey(),
|
||||||
&validator_stake_account,
|
&validator_stake_account,
|
||||||
&stake_pool.reserve_stake,
|
&stake_pool.reserve_stake,
|
||||||
|
@ -626,11 +626,11 @@ fn command_deposit(
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(
|
check_fee_payer_balance(
|
||||||
config,
|
config,
|
||||||
total_rent_free_balances + fee_calculator.calculate_fee(&transaction.message()),
|
total_rent_free_balances + fee_calculator.calculate_fee(transaction.message()),
|
||||||
)?;
|
)?;
|
||||||
unique_signers!(signers);
|
unique_signers!(signers);
|
||||||
transaction.sign(&signers, recent_blockhash);
|
transaction.sign(&signers, recent_blockhash);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,9 +737,9 @@ fn command_update(
|
||||||
Transaction::new_with_payer(&[instruction], Some(&config.fee_payer.pubkey()));
|
Transaction::new_with_payer(&[instruction], Some(&config.fee_payer.pubkey()));
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
transaction.sign(&[config.fee_payer.as_ref()], recent_blockhash);
|
transaction.sign(&[config.fee_payer.as_ref()], recent_blockhash);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -757,7 +757,7 @@ fn prepare_withdraw_accounts(
|
||||||
pool_amount: u64,
|
pool_amount: u64,
|
||||||
) -> Result<Vec<WithdrawAccount>, Error> {
|
) -> Result<Vec<WithdrawAccount>, Error> {
|
||||||
let mut accounts =
|
let mut accounts =
|
||||||
get_stake_accounts_by_withdraw_authority(rpc_client, &pool_withdraw_authority)?;
|
get_stake_accounts_by_withdraw_authority(rpc_client, pool_withdraw_authority)?;
|
||||||
if accounts.is_empty() {
|
if accounts.is_empty() {
|
||||||
return Err("No accounts found.".to_string().into());
|
return Err("No accounts found.".to_string().into());
|
||||||
}
|
}
|
||||||
|
@ -853,7 +853,7 @@ fn command_withdraw(
|
||||||
} else if let Some(vote_account_address) = vote_account_address {
|
} else if let Some(vote_account_address) = vote_account_address {
|
||||||
let (stake_account_address, _) = find_stake_program_address(
|
let (stake_account_address, _) = find_stake_program_address(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&vote_account_address,
|
vote_account_address,
|
||||||
stake_pool_address,
|
stake_pool_address,
|
||||||
);
|
);
|
||||||
let stake_account = config.rpc_client.get_account(&stake_account_address)?;
|
let stake_account = config.rpc_client.get_account(&stake_account_address)?;
|
||||||
|
@ -953,7 +953,7 @@ fn command_withdraw(
|
||||||
|
|
||||||
instructions.push(spl_stake_pool::instruction::withdraw(
|
instructions.push(spl_stake_pool::instruction::withdraw(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&stake_pool.validator_list,
|
&stake_pool.validator_list,
|
||||||
&pool_withdraw_authority,
|
&pool_withdraw_authority,
|
||||||
&withdraw_account.address,
|
&withdraw_account.address,
|
||||||
|
@ -973,11 +973,11 @@ fn command_withdraw(
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(
|
check_fee_payer_balance(
|
||||||
config,
|
config,
|
||||||
total_rent_free_balances + fee_calculator.calculate_fee(&transaction.message()),
|
total_rent_free_balances + fee_calculator.calculate_fee(transaction.message()),
|
||||||
)?;
|
)?;
|
||||||
unique_signers!(signers);
|
unique_signers!(signers);
|
||||||
transaction.sign(&signers, recent_blockhash);
|
transaction.sign(&signers, recent_blockhash);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,7 +1012,7 @@ fn command_set_manager(
|
||||||
let mut transaction = Transaction::new_with_payer(
|
let mut transaction = Transaction::new_with_payer(
|
||||||
&[spl_stake_pool::instruction::set_manager(
|
&[spl_stake_pool::instruction::set_manager(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&config.manager.pubkey(),
|
&config.manager.pubkey(),
|
||||||
&new_manager,
|
&new_manager,
|
||||||
&new_fee_receiver,
|
&new_fee_receiver,
|
||||||
|
@ -1021,11 +1021,11 @@ fn command_set_manager(
|
||||||
);
|
);
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
let mut signers = vec![config.fee_payer.as_ref(), config.manager.as_ref()];
|
let mut signers = vec![config.fee_payer.as_ref(), config.manager.as_ref()];
|
||||||
unique_signers!(signers);
|
unique_signers!(signers);
|
||||||
transaction.sign(&signers, recent_blockhash);
|
transaction.sign(&signers, recent_blockhash);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,19 +1037,19 @@ fn command_set_staker(
|
||||||
let mut transaction = Transaction::new_with_payer(
|
let mut transaction = Transaction::new_with_payer(
|
||||||
&[spl_stake_pool::instruction::set_staker(
|
&[spl_stake_pool::instruction::set_staker(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&config.manager.pubkey(),
|
&config.manager.pubkey(),
|
||||||
&new_staker,
|
new_staker,
|
||||||
)],
|
)],
|
||||||
Some(&config.fee_payer.pubkey()),
|
Some(&config.fee_payer.pubkey()),
|
||||||
);
|
);
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
let mut signers = vec![config.fee_payer.as_ref(), config.manager.as_ref()];
|
let mut signers = vec![config.fee_payer.as_ref(), config.manager.as_ref()];
|
||||||
unique_signers!(signers);
|
unique_signers!(signers);
|
||||||
transaction.sign(&signers, recent_blockhash);
|
transaction.sign(&signers, recent_blockhash);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1057,7 +1057,7 @@ fn command_set_fee(config: &Config, stake_pool_address: &Pubkey, new_fee: Fee) -
|
||||||
let mut transaction = Transaction::new_with_payer(
|
let mut transaction = Transaction::new_with_payer(
|
||||||
&[spl_stake_pool::instruction::set_fee(
|
&[spl_stake_pool::instruction::set_fee(
|
||||||
&spl_stake_pool::id(),
|
&spl_stake_pool::id(),
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&config.manager.pubkey(),
|
&config.manager.pubkey(),
|
||||||
new_fee,
|
new_fee,
|
||||||
)],
|
)],
|
||||||
|
@ -1065,11 +1065,11 @@ fn command_set_fee(config: &Config, stake_pool_address: &Pubkey, new_fee: Fee) -
|
||||||
);
|
);
|
||||||
|
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
|
check_fee_payer_balance(config, fee_calculator.calculate_fee(transaction.message()))?;
|
||||||
let mut signers = vec![config.fee_payer.as_ref(), config.manager.as_ref()];
|
let mut signers = vec![config.fee_payer.as_ref(), config.manager.as_ref()];
|
||||||
unique_signers!(signers);
|
unique_signers!(signers);
|
||||||
transaction.sign(&signers, recent_blockhash);
|
transaction.sign(&signers, recent_blockhash);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1089,7 +1089,7 @@ fn main() {
|
||||||
.global(true)
|
.global(true)
|
||||||
.help("Configuration file to use");
|
.help("Configuration file to use");
|
||||||
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
|
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
|
||||||
arg.default_value(&config_file)
|
arg.default_value(config_file)
|
||||||
} else {
|
} else {
|
||||||
arg
|
arg
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,16 @@ num-traits = "0.2"
|
||||||
num_enum = "0.5.1"
|
num_enum = "0.5.1"
|
||||||
serde = "1.0.121"
|
serde = "1.0.121"
|
||||||
serde_derive = "1.0.103"
|
serde_derive = "1.0.103"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
spl-token = { version = "3.1", path = "../../token/program", features = [ "no-entrypoint" ] }
|
spl-token = { version = "3.1", path = "../../token/program", features = [ "no-entrypoint" ] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
bincode = "1.3.1"
|
bincode = "1.3.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
proptest = "0.10"
|
proptest = "0.10"
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
solana-vote-program = "1.6.11"
|
solana-vote-program = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -580,7 +580,7 @@ pub fn remove_validator_from_pool_with_vote(
|
||||||
let (stake_account_address, _) =
|
let (stake_account_address, _) =
|
||||||
find_stake_program_address(program_id, vote_account_address, stake_pool_address);
|
find_stake_program_address(program_id, vote_account_address, stake_pool_address);
|
||||||
let (transient_stake_account, _) =
|
let (transient_stake_account, _) =
|
||||||
find_transient_stake_program_address(program_id, &vote_account_address, stake_pool_address);
|
find_transient_stake_program_address(program_id, vote_account_address, stake_pool_address);
|
||||||
remove_validator_from_pool(
|
remove_validator_from_pool(
|
||||||
program_id,
|
program_id,
|
||||||
stake_pool_address,
|
stake_pool_address,
|
||||||
|
@ -632,12 +632,12 @@ pub fn decrease_validator_stake_with_vote(
|
||||||
let pool_withdraw_authority =
|
let pool_withdraw_authority =
|
||||||
find_withdraw_authority_program_address(program_id, stake_pool_address).0;
|
find_withdraw_authority_program_address(program_id, stake_pool_address).0;
|
||||||
let (validator_stake_address, _) =
|
let (validator_stake_address, _) =
|
||||||
find_stake_program_address(program_id, &vote_account_address, stake_pool_address);
|
find_stake_program_address(program_id, vote_account_address, stake_pool_address);
|
||||||
let (transient_stake_address, _) =
|
let (transient_stake_address, _) =
|
||||||
find_transient_stake_program_address(program_id, &vote_account_address, stake_pool_address);
|
find_transient_stake_program_address(program_id, vote_account_address, stake_pool_address);
|
||||||
decrease_validator_stake(
|
decrease_validator_stake(
|
||||||
program_id,
|
program_id,
|
||||||
&stake_pool_address,
|
stake_pool_address,
|
||||||
&stake_pool.staker,
|
&stake_pool.staker,
|
||||||
&pool_withdraw_authority,
|
&pool_withdraw_authority,
|
||||||
&stake_pool.validator_list,
|
&stake_pool.validator_list,
|
||||||
|
@ -753,7 +753,7 @@ pub fn update_stake_pool(
|
||||||
&withdraw_authority,
|
&withdraw_authority,
|
||||||
&stake_pool.validator_list,
|
&stake_pool.validator_list,
|
||||||
&stake_pool.reserve_stake,
|
&stake_pool.reserve_stake,
|
||||||
&accounts_chunk,
|
accounts_chunk,
|
||||||
start_index,
|
start_index,
|
||||||
no_merge,
|
no_merge,
|
||||||
));
|
));
|
||||||
|
|
|
@ -53,7 +53,7 @@ fn check_validator_stake_address(
|
||||||
) -> Result<(), ProgramError> {
|
) -> Result<(), ProgramError> {
|
||||||
// Check stake account address validity
|
// Check stake account address validity
|
||||||
let (validator_stake_address, _) =
|
let (validator_stake_address, _) =
|
||||||
crate::find_stake_program_address(&program_id, &vote_address, &stake_pool_address);
|
crate::find_stake_program_address(program_id, vote_address, stake_pool_address);
|
||||||
if validator_stake_address != *stake_account_address {
|
if validator_stake_address != *stake_account_address {
|
||||||
msg!(
|
msg!(
|
||||||
"Incorrect stake account address for vote {}, expected {}, received {}",
|
"Incorrect stake account address for vote {}, expected {}, received {}",
|
||||||
|
@ -75,11 +75,8 @@ fn check_transient_stake_address(
|
||||||
vote_address: &Pubkey,
|
vote_address: &Pubkey,
|
||||||
) -> Result<u8, ProgramError> {
|
) -> Result<u8, ProgramError> {
|
||||||
// Check stake account address validity
|
// Check stake account address validity
|
||||||
let (transient_stake_address, bump_seed) = crate::find_transient_stake_program_address(
|
let (transient_stake_address, bump_seed) =
|
||||||
&program_id,
|
crate::find_transient_stake_program_address(program_id, vote_address, stake_pool_address);
|
||||||
&vote_address,
|
|
||||||
&stake_pool_address,
|
|
||||||
);
|
|
||||||
if transient_stake_address != *stake_account_address {
|
if transient_stake_address != *stake_account_address {
|
||||||
Err(StakePoolError::InvalidStakeAccountAddress.into())
|
Err(StakePoolError::InvalidStakeAccountAddress.into())
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,12 +144,12 @@ fn create_transient_stake_account<'a>(
|
||||||
transient_stake_account_info.clone(),
|
transient_stake_account_info.clone(),
|
||||||
system_program_info.clone(),
|
system_program_info.clone(),
|
||||||
],
|
],
|
||||||
&[&transient_stake_account_signer_seeds],
|
&[transient_stake_account_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
invoke_signed(
|
invoke_signed(
|
||||||
&system_instruction::assign(transient_stake_account_info.key, &stake_program::id()),
|
&system_instruction::assign(transient_stake_account_info.key, &stake_program::id()),
|
||||||
&[transient_stake_account_info, system_program_info],
|
&[transient_stake_account_info, system_program_info],
|
||||||
&[&transient_stake_account_signer_seeds],
|
&[transient_stake_account_signer_seeds],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,11 +645,8 @@ impl Processor {
|
||||||
check_system_program(system_program_info.key)?;
|
check_system_program(system_program_info.key)?;
|
||||||
check_stake_program(stake_program_info.key)?;
|
check_stake_program(stake_program_info.key)?;
|
||||||
|
|
||||||
let (stake_address, bump_seed) = crate::find_stake_program_address(
|
let (stake_address, bump_seed) =
|
||||||
&program_id,
|
crate::find_stake_program_address(program_id, validator_info.key, stake_pool_info.key);
|
||||||
&validator_info.key,
|
|
||||||
&stake_pool_info.key,
|
|
||||||
);
|
|
||||||
if stake_address != *stake_account_info.key {
|
if stake_address != *stake_account_info.key {
|
||||||
return Err(StakePoolError::InvalidStakeAccountAddress.into());
|
return Err(StakePoolError::InvalidStakeAccountAddress.into());
|
||||||
}
|
}
|
||||||
|
@ -670,19 +664,19 @@ impl Processor {
|
||||||
// Create new stake account
|
// Create new stake account
|
||||||
invoke_signed(
|
invoke_signed(
|
||||||
&system_instruction::create_account(
|
&system_instruction::create_account(
|
||||||
&funder_info.key,
|
funder_info.key,
|
||||||
&stake_account_info.key,
|
stake_account_info.key,
|
||||||
required_lamports,
|
required_lamports,
|
||||||
std::mem::size_of::<stake_program::StakeState>() as u64,
|
std::mem::size_of::<stake_program::StakeState>() as u64,
|
||||||
&stake_program::id(),
|
&stake_program::id(),
|
||||||
),
|
),
|
||||||
&[funder_info.clone(), stake_account_info.clone()],
|
&[funder_info.clone(), stake_account_info.clone()],
|
||||||
&[&stake_account_signer_seeds],
|
&[stake_account_signer_seeds],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
invoke(
|
invoke(
|
||||||
&stake_program::initialize(
|
&stake_program::initialize(
|
||||||
&stake_account_info.key,
|
stake_account_info.key,
|
||||||
&stake_program::Authorized {
|
&stake_program::Authorized {
|
||||||
staker: *staker_info.key,
|
staker: *staker_info.key,
|
||||||
withdrawer: *staker_info.key,
|
withdrawer: *staker_info.key,
|
||||||
|
@ -698,9 +692,9 @@ impl Processor {
|
||||||
|
|
||||||
invoke(
|
invoke(
|
||||||
&stake_program::delegate_stake(
|
&stake_program::delegate_stake(
|
||||||
&stake_account_info.key,
|
stake_account_info.key,
|
||||||
&staker_info.key,
|
staker_info.key,
|
||||||
&validator_info.key,
|
validator_info.key,
|
||||||
),
|
),
|
||||||
&[
|
&[
|
||||||
stake_account_info.clone(),
|
stake_account_info.clone(),
|
||||||
|
@ -1037,7 +1031,7 @@ impl Processor {
|
||||||
|
|
||||||
create_transient_stake_account(
|
create_transient_stake_account(
|
||||||
transient_stake_account_info.clone(),
|
transient_stake_account_info.clone(),
|
||||||
&transient_stake_account_signer_seeds,
|
transient_stake_account_signer_seeds,
|
||||||
system_program_info.clone(),
|
system_program_info.clone(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
@ -1131,7 +1125,7 @@ impl Processor {
|
||||||
program_id,
|
program_id,
|
||||||
stake_pool_info.key,
|
stake_pool_info.key,
|
||||||
transient_stake_account_info.key,
|
transient_stake_account_info.key,
|
||||||
&vote_account_address,
|
vote_account_address,
|
||||||
)?;
|
)?;
|
||||||
let transient_stake_account_signer_seeds: &[&[_]] = &[
|
let transient_stake_account_signer_seeds: &[&[_]] = &[
|
||||||
TRANSIENT_STAKE_SEED,
|
TRANSIENT_STAKE_SEED,
|
||||||
|
@ -1140,7 +1134,7 @@ impl Processor {
|
||||||
&[transient_stake_bump_seed],
|
&[transient_stake_bump_seed],
|
||||||
];
|
];
|
||||||
|
|
||||||
let maybe_validator_list_entry = validator_list.find_mut(&vote_account_address);
|
let maybe_validator_list_entry = validator_list.find_mut(vote_account_address);
|
||||||
if maybe_validator_list_entry.is_none() {
|
if maybe_validator_list_entry.is_none() {
|
||||||
msg!(
|
msg!(
|
||||||
"Vote account {} not found in stake pool",
|
"Vote account {} not found in stake pool",
|
||||||
|
@ -1184,7 +1178,7 @@ impl Processor {
|
||||||
|
|
||||||
create_transient_stake_account(
|
create_transient_stake_account(
|
||||||
transient_stake_account_info.clone(),
|
transient_stake_account_info.clone(),
|
||||||
&transient_stake_account_signer_seeds,
|
transient_stake_account_signer_seeds,
|
||||||
system_program_info.clone(),
|
system_program_info.clone(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
@ -1290,7 +1284,7 @@ impl Processor {
|
||||||
if !stake_pool.is_valid() {
|
if !stake_pool.is_valid() {
|
||||||
return Err(StakePoolError::InvalidState.into());
|
return Err(StakePoolError::InvalidState.into());
|
||||||
}
|
}
|
||||||
stake_pool.check_validator_list(&validator_list_info)?;
|
stake_pool.check_validator_list(validator_list_info)?;
|
||||||
stake_pool.check_authority_withdraw(
|
stake_pool.check_authority_withdraw(
|
||||||
withdraw_authority_info.key,
|
withdraw_authority_info.key,
|
||||||
program_id,
|
program_id,
|
||||||
|
@ -1848,7 +1842,7 @@ impl Processor {
|
||||||
.find(|&&x| x.stake_lamports() != 0)
|
.find(|&&x| x.stake_lamports() != 0)
|
||||||
{
|
{
|
||||||
let (validator_stake_address, _) = crate::find_stake_program_address(
|
let (validator_stake_address, _) = crate::find_stake_program_address(
|
||||||
&program_id,
|
program_id,
|
||||||
&withdrawable_entry.vote_account_address,
|
&withdrawable_entry.vote_account_address,
|
||||||
stake_pool_info.key,
|
stake_pool_info.key,
|
||||||
);
|
);
|
||||||
|
@ -1863,7 +1857,7 @@ impl Processor {
|
||||||
let meta = stake_state.meta().ok_or(StakePoolError::WrongStakeState)?;
|
let meta = stake_state.meta().ok_or(StakePoolError::WrongStakeState)?;
|
||||||
stake_split_from
|
stake_split_from
|
||||||
.lamports()
|
.lamports()
|
||||||
.checked_sub(minimum_reserve_lamports(&meta))
|
.checked_sub(minimum_reserve_lamports(meta))
|
||||||
.ok_or(StakePoolError::StakeLamportsNotEqualToMinimum)?;
|
.ok_or(StakePoolError::StakeLamportsNotEqualToMinimum)?;
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -349,7 +349,7 @@ async fn fail_with_small_lamport_amount() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
match error {
|
match error {
|
||||||
TransactionError::InstructionError(_, InstructionError::InvalidError) => {}
|
TransactionError::InstructionError(_, InstructionError::AccountNotRentExempt) => {}
|
||||||
_ => panic!("Wrong error occurs while try to decrease small stake"),
|
_ => panic!("Wrong error occurs while try to decrease small stake"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,7 +348,7 @@ async fn fail_with_small_lamport_amount() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
match error {
|
match error {
|
||||||
TransactionError::InstructionError(_, InstructionError::InvalidError) => {}
|
TransactionError::InstructionError(_, InstructionError::AccountNotRentExempt) => {}
|
||||||
_ => panic!("Wrong error"),
|
_ => panic!("Wrong error"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@ borsh = "0.8"
|
||||||
curve25519-dalek = {package = "curve25519-dalek-ng", git = "https://github.com/garious/curve25519-dalek", rev = "fcef1fa11b3d3e89a1abf8986386ba9ae375392c", default-features = false, features = ["borsh"]}
|
curve25519-dalek = {package = "curve25519-dalek-ng", git = "https://github.com/garious/curve25519-dalek", rev = "fcef1fa11b3d3e89a1abf8986386ba9ae375392c", default-features = false, features = ["borsh"]}
|
||||||
elgamal_ristretto = { git = "https://github.com/garious/elgamal", rev = "892dbe115104bcb8cc26d79f9676c836ff6c018e", default-features = false }
|
elgamal_ristretto = { git = "https://github.com/garious/elgamal", rev = "892dbe115104bcb8cc26d79f9676c836ff6c018e", default-features = false }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
solana-banks-client = "1.6.11"
|
solana-banks-client = "1.7.3"
|
||||||
solana-cli-config = "1.6.11"
|
solana-cli-config = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
spl-themis-ristretto = { version = "0.1.0", path = "../program_ristretto", features = ["no-entrypoint"] }
|
spl-themis-ristretto = { version = "0.1.0", path = "../program_ristretto", features = ["no-entrypoint"] }
|
||||||
tarpc = { version = "0.22.0", features = ["full"] }
|
tarpc = { version = "0.22.0", features = ["full"] }
|
||||||
tokio = "0.3"
|
tokio = "0.3"
|
||||||
|
@ -25,11 +25,11 @@ url = "2.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
separator = "0.4.1"
|
separator = "0.4.1"
|
||||||
solana-banks-server = "1.6.11"
|
solana-banks-server = "1.7.3"
|
||||||
solana-bpf-loader-program = "1.6.11"
|
solana-bpf-loader-program = "1.7.3"
|
||||||
solana-core = "1.6.11"
|
solana-core = "1.7.3"
|
||||||
solana_rbpf = "0.1"
|
solana_rbpf = "0.1"
|
||||||
solana-runtime = "1.6.11"
|
solana-runtime = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -20,7 +20,7 @@ getrandom = { version = "0.1.15", features = ["dummy"] }
|
||||||
num-derive = "0.3"
|
num-derive = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
rand = "0.8.0"
|
rand = "0.8.0"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
subtle = "=2.2.3"
|
subtle = "=2.2.3"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@ version = "0.1.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.33.3"
|
clap = "2.33.3"
|
||||||
solana-clap-utils = "1.6.6"
|
solana-clap-utils = "1.7.3"
|
||||||
solana-cli-config = "1.6.6"
|
solana-cli-config = "1.7.3"
|
||||||
solana-client = "1.6.6"
|
solana-client = "1.7.3"
|
||||||
solana-logger = "1.6.6"
|
solana-logger = "1.7.3"
|
||||||
solana-sdk = "1.6.6"
|
solana-sdk = "1.7.3"
|
||||||
solana-program = "1.6.6"
|
solana-program = "1.7.3"
|
||||||
spl-token-lending = { path="../program", features = [ "no-entrypoint" ] }
|
spl-token-lending = { path="../program", features = [ "no-entrypoint" ] }
|
||||||
spl-token = { path="../../token/program", features = [ "no-entrypoint" ] }
|
spl-token = { path="../../token/program", features = [ "no-entrypoint" ] }
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ fn main() {
|
||||||
.global(true)
|
.global(true)
|
||||||
.help("Configuration file to use");
|
.help("Configuration file to use");
|
||||||
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
|
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
|
||||||
arg.default_value(&config_file)
|
arg.default_value(config_file)
|
||||||
} else {
|
} else {
|
||||||
arg
|
arg
|
||||||
}
|
}
|
||||||
|
@ -459,13 +459,13 @@ fn command_create_lending_market(
|
||||||
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
|
||||||
check_fee_payer_balance(
|
check_fee_payer_balance(
|
||||||
config,
|
config,
|
||||||
lending_market_balance + fee_calculator.calculate_fee(&transaction.message()),
|
lending_market_balance + fee_calculator.calculate_fee(transaction.message()),
|
||||||
)?;
|
)?;
|
||||||
transaction.sign(
|
transaction.sign(
|
||||||
&vec![config.fee_payer.as_ref(), &lending_market_keypair],
|
&vec![config.fee_payer.as_ref(), &lending_market_keypair],
|
||||||
recent_blockhash,
|
recent_blockhash,
|
||||||
);
|
);
|
||||||
send_transaction(&config, transaction)?;
|
send_transaction(config, transaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,9 +644,9 @@ fn command_add_reserve(
|
||||||
check_fee_payer_balance(
|
check_fee_payer_balance(
|
||||||
config,
|
config,
|
||||||
total_balance
|
total_balance
|
||||||
+ fee_calculator.calculate_fee(&transaction_1.message())
|
+ fee_calculator.calculate_fee(transaction_1.message())
|
||||||
+ fee_calculator.calculate_fee(&transaction_2.message())
|
+ fee_calculator.calculate_fee(transaction_2.message())
|
||||||
+ fee_calculator.calculate_fee(&transaction_3.message()),
|
+ fee_calculator.calculate_fee(transaction_3.message()),
|
||||||
)?;
|
)?;
|
||||||
transaction_1.sign(
|
transaction_1.sign(
|
||||||
&vec![
|
&vec![
|
||||||
|
@ -675,9 +675,9 @@ fn command_add_reserve(
|
||||||
],
|
],
|
||||||
recent_blockhash,
|
recent_blockhash,
|
||||||
);
|
);
|
||||||
send_transaction(&config, transaction_1)?;
|
send_transaction(config, transaction_1)?;
|
||||||
send_transaction(&config, transaction_2)?;
|
send_transaction(config, transaction_2)?;
|
||||||
send_transaction(&config, transaction_3)?;
|
send_transaction(config, transaction_3)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ arrayref = "0.3.6"
|
||||||
bytemuck = "1.5.1"
|
bytemuck = "1.5.1"
|
||||||
num-derive = "0.3"
|
num-derive = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
spl-token = { path = "../../token/program", features = [ "no-entrypoint" ] }
|
spl-token = { path = "../../token/program", features = [ "no-entrypoint" ] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
uint = "0.8"
|
uint = "0.8"
|
||||||
|
@ -26,8 +26,8 @@ assert_matches = "1.5.0"
|
||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
proptest = "1.0"
|
proptest = "1.0"
|
||||||
solana-program-test = "1.6.11"
|
solana-program-test = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_yaml = "0.8"
|
serde_yaml = "0.8"
|
||||||
|
|
||||||
|
|
|
@ -1484,8 +1484,8 @@ fn process_liquidate_obligation(
|
||||||
} = withdraw_reserve.calculate_liquidation(
|
} = withdraw_reserve.calculate_liquidation(
|
||||||
liquidity_amount,
|
liquidity_amount,
|
||||||
&obligation,
|
&obligation,
|
||||||
&liquidity,
|
liquidity,
|
||||||
&collateral,
|
collateral,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if repay_amount == 0 {
|
if repay_amount == 0 {
|
||||||
|
|
|
@ -32,6 +32,7 @@ async fn test_success() {
|
||||||
|
|
||||||
let receiver_program_account = Keypair::new();
|
let receiver_program_account = Keypair::new();
|
||||||
let receiver_program_id = receiver_program_account.pubkey();
|
let receiver_program_id = receiver_program_account.pubkey();
|
||||||
|
test.prefer_bpf(false);
|
||||||
test.add_program(
|
test.add_program(
|
||||||
"flash_loan_receiver",
|
"flash_loan_receiver",
|
||||||
receiver_program_id.clone(),
|
receiver_program_id.clone(),
|
||||||
|
@ -151,6 +152,7 @@ async fn test_failure() {
|
||||||
|
|
||||||
let flash_loan_receiver_program_keypair = Keypair::new();
|
let flash_loan_receiver_program_keypair = Keypair::new();
|
||||||
let flash_loan_receiver_program_id = flash_loan_receiver_program_keypair.pubkey();
|
let flash_loan_receiver_program_id = flash_loan_receiver_program_keypair.pubkey();
|
||||||
|
test.prefer_bpf(false);
|
||||||
test.add_program(
|
test.add_program(
|
||||||
"flash_loan_receiver",
|
"flash_loan_receiver",
|
||||||
flash_loan_receiver_program_id.clone(),
|
flash_loan_receiver_program_id.clone(),
|
||||||
|
|
|
@ -17,7 +17,7 @@ arrayref = "0.3.6"
|
||||||
enum_dispatch = "0.3.4"
|
enum_dispatch = "0.3.4"
|
||||||
num-derive = "0.3"
|
num-derive = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
spl-math = { version = "0.1", path = "../../libraries/math", features = [ "no-entrypoint" ] }
|
spl-math = { version = "0.1", path = "../../libraries/math", features = [ "no-entrypoint" ] }
|
||||||
spl-token = { version = "3.1", path = "../../token/program", features = [ "no-entrypoint" ] }
|
spl-token = { version = "3.1", path = "../../token/program", features = [ "no-entrypoint" ] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
@ -25,7 +25,7 @@ arbitrary = { version = "0.4", features = ["derive"], optional = true }
|
||||||
roots = { version = "0.0.6", optional = true }
|
roots = { version = "0.0.6", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
proptest = "1.0"
|
proptest = "1.0"
|
||||||
sim = { path = "./sim" }
|
sim = { path = "./sim" }
|
||||||
roots = "0.0.6"
|
roots = "0.0.6"
|
||||||
|
|
|
@ -11,7 +11,7 @@ publish = false
|
||||||
[dependencies]
|
[dependencies]
|
||||||
honggfuzz = { version = "0.5.52" }
|
honggfuzz = { version = "0.5.52" }
|
||||||
arbitrary = { version = "0.4", features = ["derive"] }
|
arbitrary = { version = "0.4", features = ["derive"] }
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
spl-math = { version = "0.1", path = "../../../libraries/math", features = [ "no-entrypoint" ] }
|
spl-math = { version = "0.1", path = "../../../libraries/math", features = [ "no-entrypoint" ] }
|
||||||
spl-token = { version = "3.1", path = "../../../token/program", features = [ "no-entrypoint" ] }
|
spl-token = { version = "3.1", path = "../../../token/program", features = [ "no-entrypoint" ] }
|
||||||
spl-token-swap = { path = "..", features = ["fuzz", "no-entrypoint"] }
|
spl-token-swap = { path = "..", features = ["fuzz", "no-entrypoint"] }
|
||||||
|
|
|
@ -246,7 +246,7 @@ fn run_fuzz(fuzz_data: FuzzData) {
|
||||||
// fees and a potential crash when withdrawing just 1 pool token.
|
// fees and a potential crash when withdrawing just 1 pool token.
|
||||||
let mut fee_account = token_swap.pool_fee_account.clone();
|
let mut fee_account = token_swap.pool_fee_account.clone();
|
||||||
for mut pool_account in pool_accounts.values_mut() {
|
for mut pool_account in pool_accounts.values_mut() {
|
||||||
let pool_token_amount = get_token_balance(&pool_account);
|
let pool_token_amount = get_token_balance(pool_account);
|
||||||
if pool_token_amount > 0 {
|
if pool_token_amount > 0 {
|
||||||
transfer(&mut pool_account, &mut fee_account, pool_token_amount);
|
transfer(&mut pool_account, &mut fee_account, pool_token_amount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl program_stubs::SyscallStubs for TestSyscallStubs {
|
||||||
let mut new_account_info = account_info.clone();
|
let mut new_account_info = account_info.clone();
|
||||||
for seeds in signers_seeds.iter() {
|
for seeds in signers_seeds.iter() {
|
||||||
let signer =
|
let signer =
|
||||||
Pubkey::create_program_address(&seeds, &spl_token_swap::id()).unwrap();
|
Pubkey::create_program_address(seeds, &spl_token_swap::id()).unwrap();
|
||||||
if *account_info.key == signer {
|
if *account_info.key == signer {
|
||||||
new_account_info.is_signer = true;
|
new_account_info.is_signer = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -359,7 +359,7 @@ impl NativeTokenSwap {
|
||||||
) -> ProgramResult {
|
) -> ProgramResult {
|
||||||
let mut user_transfer_account = NativeAccountData::new(0, system_program::id());
|
let mut user_transfer_account = NativeAccountData::new(0, system_program::id());
|
||||||
user_transfer_account.is_signer = true;
|
user_transfer_account.is_signer = true;
|
||||||
let pool_token_amount = native_token::get_token_balance(&pool_account);
|
let pool_token_amount = native_token::get_token_balance(pool_account);
|
||||||
// special logic to avoid withdrawing down to 1 pool token, which
|
// special logic to avoid withdrawing down to 1 pool token, which
|
||||||
// eventually causes an error on withdrawing all
|
// eventually causes an error on withdrawing all
|
||||||
if pool_token_amount.saturating_sub(instruction.pool_token_amount) == 1 {
|
if pool_token_amount.saturating_sub(instruction.pool_token_amount) == 1 {
|
||||||
|
@ -489,7 +489,7 @@ impl NativeTokenSwap {
|
||||||
) -> ProgramResult {
|
) -> ProgramResult {
|
||||||
let mut user_transfer_account = NativeAccountData::new(0, system_program::id());
|
let mut user_transfer_account = NativeAccountData::new(0, system_program::id());
|
||||||
user_transfer_account.is_signer = true;
|
user_transfer_account.is_signer = true;
|
||||||
let pool_token_amount = native_token::get_token_balance(&pool_account);
|
let pool_token_amount = native_token::get_token_balance(pool_account);
|
||||||
// special logic to avoid withdrawing down to 1 pool token, which
|
// special logic to avoid withdrawing down to 1 pool token, which
|
||||||
// eventually causes an error on withdrawing all
|
// eventually causes an error on withdrawing all
|
||||||
if pool_token_amount.saturating_sub(instruction.maximum_pool_token_amount) == 1 {
|
if pool_token_amount.saturating_sub(instruction.maximum_pool_token_amount) == 1 {
|
||||||
|
@ -552,7 +552,7 @@ impl NativeTokenSwap {
|
||||||
mut token_a_account: &mut NativeAccountData,
|
mut token_a_account: &mut NativeAccountData,
|
||||||
mut token_b_account: &mut NativeAccountData,
|
mut token_b_account: &mut NativeAccountData,
|
||||||
) -> ProgramResult {
|
) -> ProgramResult {
|
||||||
let pool_token_amount = native_token::get_token_balance(&pool_account);
|
let pool_token_amount = native_token::get_token_balance(pool_account);
|
||||||
if pool_token_amount > 0 {
|
if pool_token_amount > 0 {
|
||||||
let instruction = WithdrawAllTokenTypes {
|
let instruction = WithdrawAllTokenTypes {
|
||||||
pool_token_amount,
|
pool_token_amount,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
cc ccac4396e983bbc29b354a5b048bf9da13013fed999bd331049d2fd1f674dc55
|
|
@ -48,12 +48,12 @@ pub struct StableCurve {
|
||||||
/// d = (leverage * sum_x + d_product * n_coins) * initial_d / ((leverage - 1) * initial_d + (n_coins + 1) * d_product)
|
/// d = (leverage * sum_x + d_product * n_coins) * initial_d / ((leverage - 1) * initial_d + (n_coins + 1) * d_product)
|
||||||
fn calculate_step(initial_d: &U256, leverage: u64, sum_x: u128, d_product: &U256) -> Option<U256> {
|
fn calculate_step(initial_d: &U256, leverage: u64, sum_x: u128, d_product: &U256) -> Option<U256> {
|
||||||
let leverage_mul = U256::from(leverage).checked_mul(sum_x.into())?;
|
let leverage_mul = U256::from(leverage).checked_mul(sum_x.into())?;
|
||||||
let d_p_mul = checked_u8_mul(&d_product, N_COINS)?;
|
let d_p_mul = checked_u8_mul(d_product, N_COINS)?;
|
||||||
|
|
||||||
let l_val = leverage_mul.checked_add(d_p_mul)?.checked_mul(*initial_d)?;
|
let l_val = leverage_mul.checked_add(d_p_mul)?.checked_mul(*initial_d)?;
|
||||||
|
|
||||||
let leverage_sub = initial_d.checked_mul((leverage.checked_sub(1)?).into())?;
|
let leverage_sub = initial_d.checked_mul((leverage.checked_sub(1)?).into())?;
|
||||||
let n_coins_sum = checked_u8_mul(&d_product, N_COINS.checked_add(1)?)?;
|
let n_coins_sum = checked_u8_mul(d_product, N_COINS.checked_add(1)?)?;
|
||||||
|
|
||||||
let r_val = leverage_sub.checked_add(n_coins_sum)?;
|
let r_val = leverage_sub.checked_add(n_coins_sum)?;
|
||||||
|
|
||||||
|
@ -422,8 +422,10 @@ mod tests {
|
||||||
let diff =
|
let diff =
|
||||||
(sim_result as i128 - result.destination_amount_swapped as i128).abs();
|
(sim_result as i128 - result.destination_amount_swapped as i128).abs();
|
||||||
|
|
||||||
|
let tolerance = std::cmp::max(1, sim_result as i128 / 1_000_000_000);
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
diff <= 1,
|
diff <= tolerance,
|
||||||
"result={}, sim_result={}, amp={}, source_amount={}, swap_source_amount={}, swap_destination_amount={}, diff={}",
|
"result={}, sim_result={}, amp={}, source_amount={}, swap_source_amount={}, swap_destination_amount={}, diff={}",
|
||||||
result.destination_amount_swapped,
|
result.destination_amount_swapped,
|
||||||
sim_result,
|
sim_result,
|
||||||
|
|
|
@ -380,10 +380,10 @@ impl Processor {
|
||||||
}
|
}
|
||||||
|
|
||||||
let source_account =
|
let source_account =
|
||||||
Self::unpack_token_account(swap_source_info, &token_swap.token_program_id())?;
|
Self::unpack_token_account(swap_source_info, token_swap.token_program_id())?;
|
||||||
let dest_account =
|
let dest_account =
|
||||||
Self::unpack_token_account(swap_destination_info, &token_swap.token_program_id())?;
|
Self::unpack_token_account(swap_destination_info, token_swap.token_program_id())?;
|
||||||
let pool_mint = Self::unpack_mint(pool_mint_info, &token_swap.token_program_id())?;
|
let pool_mint = Self::unpack_mint(pool_mint_info, token_swap.token_program_id())?;
|
||||||
|
|
||||||
let trade_direction = if *swap_source_info.key == *token_swap.token_a_account() {
|
let trade_direction = if *swap_source_info.key == *token_swap.token_a_account() {
|
||||||
TradeDirection::AtoB
|
TradeDirection::AtoB
|
||||||
|
@ -529,9 +529,9 @@ impl Processor {
|
||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let token_a = Self::unpack_token_account(token_a_info, &token_swap.token_program_id())?;
|
let token_a = Self::unpack_token_account(token_a_info, token_swap.token_program_id())?;
|
||||||
let token_b = Self::unpack_token_account(token_b_info, &token_swap.token_program_id())?;
|
let token_b = Self::unpack_token_account(token_b_info, token_swap.token_program_id())?;
|
||||||
let pool_mint = Self::unpack_mint(pool_mint_info, &token_swap.token_program_id())?;
|
let pool_mint = Self::unpack_mint(pool_mint_info, token_swap.token_program_id())?;
|
||||||
let current_pool_mint_supply = to_u128(pool_mint.supply)?;
|
let current_pool_mint_supply = to_u128(pool_mint.supply)?;
|
||||||
let (pool_token_amount, pool_mint_supply) = if current_pool_mint_supply > 0 {
|
let (pool_token_amount, pool_mint_supply) = if current_pool_mint_supply > 0 {
|
||||||
(to_u128(pool_token_amount)?, current_pool_mint_supply)
|
(to_u128(pool_token_amount)?, current_pool_mint_supply)
|
||||||
|
@ -743,11 +743,11 @@ impl Processor {
|
||||||
|
|
||||||
let token_swap = SwapVersion::unpack(&swap_info.data.borrow())?;
|
let token_swap = SwapVersion::unpack(&swap_info.data.borrow())?;
|
||||||
let source_account =
|
let source_account =
|
||||||
Self::unpack_token_account(source_info, &token_swap.token_program_id())?;
|
Self::unpack_token_account(source_info, token_swap.token_program_id())?;
|
||||||
let swap_token_a =
|
let swap_token_a =
|
||||||
Self::unpack_token_account(swap_token_a_info, &token_swap.token_program_id())?;
|
Self::unpack_token_account(swap_token_a_info, token_swap.token_program_id())?;
|
||||||
let swap_token_b =
|
let swap_token_b =
|
||||||
Self::unpack_token_account(swap_token_b_info, &token_swap.token_program_id())?;
|
Self::unpack_token_account(swap_token_b_info, token_swap.token_program_id())?;
|
||||||
|
|
||||||
let trade_direction = if source_account.mint == swap_token_a.mint {
|
let trade_direction = if source_account.mint == swap_token_a.mint {
|
||||||
TradeDirection::AtoB
|
TradeDirection::AtoB
|
||||||
|
@ -776,7 +776,7 @@ impl Processor {
|
||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let pool_mint = Self::unpack_mint(pool_mint_info, &token_swap.token_program_id())?;
|
let pool_mint = Self::unpack_mint(pool_mint_info, token_swap.token_program_id())?;
|
||||||
let pool_mint_supply = to_u128(pool_mint.supply)?;
|
let pool_mint_supply = to_u128(pool_mint.supply)?;
|
||||||
let pool_token_amount = if pool_mint_supply > 0 {
|
let pool_token_amount = if pool_mint_supply > 0 {
|
||||||
token_swap
|
token_swap
|
||||||
|
@ -860,11 +860,11 @@ impl Processor {
|
||||||
|
|
||||||
let token_swap = SwapVersion::unpack(&swap_info.data.borrow())?;
|
let token_swap = SwapVersion::unpack(&swap_info.data.borrow())?;
|
||||||
let destination_account =
|
let destination_account =
|
||||||
Self::unpack_token_account(destination_info, &token_swap.token_program_id())?;
|
Self::unpack_token_account(destination_info, token_swap.token_program_id())?;
|
||||||
let swap_token_a =
|
let swap_token_a =
|
||||||
Self::unpack_token_account(swap_token_a_info, &token_swap.token_program_id())?;
|
Self::unpack_token_account(swap_token_a_info, token_swap.token_program_id())?;
|
||||||
let swap_token_b =
|
let swap_token_b =
|
||||||
Self::unpack_token_account(swap_token_b_info, &token_swap.token_program_id())?;
|
Self::unpack_token_account(swap_token_b_info, token_swap.token_program_id())?;
|
||||||
|
|
||||||
let trade_direction = if destination_account.mint == swap_token_a.mint {
|
let trade_direction = if destination_account.mint == swap_token_a.mint {
|
||||||
TradeDirection::AtoB
|
TradeDirection::AtoB
|
||||||
|
@ -892,7 +892,7 @@ impl Processor {
|
||||||
Some(pool_fee_account_info),
|
Some(pool_fee_account_info),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let pool_mint = Self::unpack_mint(pool_mint_info, &token_swap.token_program_id())?;
|
let pool_mint = Self::unpack_mint(pool_mint_info, token_swap.token_program_id())?;
|
||||||
let pool_mint_supply = to_u128(pool_mint.supply)?;
|
let pool_mint_supply = to_u128(pool_mint.supply)?;
|
||||||
let swap_token_a_amount = to_u128(swap_token_a.amount)?;
|
let swap_token_a_amount = to_u128(swap_token_a.amount)?;
|
||||||
let swap_token_b_amount = to_u128(swap_token_b.amount)?;
|
let swap_token_b_amount = to_u128(swap_token_b.amount)?;
|
||||||
|
@ -1200,7 +1200,7 @@ mod tests {
|
||||||
let mut new_account_info = account_info.clone();
|
let mut new_account_info = account_info.clone();
|
||||||
for seeds in signers_seeds.iter() {
|
for seeds in signers_seeds.iter() {
|
||||||
let signer =
|
let signer =
|
||||||
Pubkey::create_program_address(&seeds, &SWAP_PROGRAM_ID).unwrap();
|
Pubkey::create_program_address(seeds, &SWAP_PROGRAM_ID).unwrap();
|
||||||
if *account_info.key == signer {
|
if *account_info.key == signer {
|
||||||
new_account_info.is_signer = true;
|
new_account_info.is_signer = true;
|
||||||
}
|
}
|
||||||
|
@ -1270,7 +1270,7 @@ mod tests {
|
||||||
&pool_mint_key,
|
&pool_mint_key,
|
||||||
&mut pool_mint_account,
|
&mut pool_mint_account,
|
||||||
&authority_key,
|
&authority_key,
|
||||||
&user_key,
|
user_key,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
let (pool_fee_key, pool_fee_account) = mint_token(
|
let (pool_fee_key, pool_fee_account) = mint_token(
|
||||||
|
@ -1278,26 +1278,26 @@ mod tests {
|
||||||
&pool_mint_key,
|
&pool_mint_key,
|
||||||
&mut pool_mint_account,
|
&mut pool_mint_account,
|
||||||
&authority_key,
|
&authority_key,
|
||||||
&user_key,
|
user_key,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
let (token_a_mint_key, mut token_a_mint_account) =
|
let (token_a_mint_key, mut token_a_mint_account) =
|
||||||
create_mint(&spl_token::id(), &user_key, None);
|
create_mint(&spl_token::id(), user_key, None);
|
||||||
let (token_a_key, token_a_account) = mint_token(
|
let (token_a_key, token_a_account) = mint_token(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&token_a_mint_key,
|
&token_a_mint_key,
|
||||||
&mut token_a_mint_account,
|
&mut token_a_mint_account,
|
||||||
&user_key,
|
user_key,
|
||||||
&authority_key,
|
&authority_key,
|
||||||
token_a_amount,
|
token_a_amount,
|
||||||
);
|
);
|
||||||
let (token_b_mint_key, mut token_b_mint_account) =
|
let (token_b_mint_key, mut token_b_mint_account) =
|
||||||
create_mint(&spl_token::id(), &user_key, None);
|
create_mint(&spl_token::id(), user_key, None);
|
||||||
let (token_b_key, token_b_account) = mint_token(
|
let (token_b_key, token_b_account) = mint_token(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&token_b_mint_key,
|
&token_b_mint_key,
|
||||||
&mut token_b_mint_account,
|
&mut token_b_mint_account,
|
||||||
&user_key,
|
user_key,
|
||||||
&authority_key,
|
&authority_key,
|
||||||
token_b_amount,
|
token_b_amount,
|
||||||
);
|
);
|
||||||
|
@ -1368,16 +1368,16 @@ mod tests {
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&self.token_a_mint_key,
|
&self.token_a_mint_key,
|
||||||
&mut self.token_a_mint_account,
|
&mut self.token_a_mint_account,
|
||||||
&mint_owner,
|
mint_owner,
|
||||||
&account_owner,
|
account_owner,
|
||||||
a_amount,
|
a_amount,
|
||||||
);
|
);
|
||||||
let (token_b_key, token_b_account) = mint_token(
|
let (token_b_key, token_b_account) = mint_token(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&self.token_b_mint_key,
|
&self.token_b_mint_key,
|
||||||
&mut self.token_b_mint_account,
|
&mut self.token_b_mint_account,
|
||||||
&mint_owner,
|
mint_owner,
|
||||||
&account_owner,
|
account_owner,
|
||||||
b_amount,
|
b_amount,
|
||||||
);
|
);
|
||||||
let (pool_key, pool_account) = mint_token(
|
let (pool_key, pool_account) = mint_token(
|
||||||
|
@ -1385,7 +1385,7 @@ mod tests {
|
||||||
&self.pool_mint_key,
|
&self.pool_mint_key,
|
||||||
&mut self.pool_mint_account,
|
&mut self.pool_mint_account,
|
||||||
&self.authority_key,
|
&self.authority_key,
|
||||||
&account_owner,
|
account_owner,
|
||||||
pool_amount,
|
pool_amount,
|
||||||
);
|
);
|
||||||
(
|
(
|
||||||
|
@ -1436,9 +1436,9 @@ mod tests {
|
||||||
do_process_instruction(
|
do_process_instruction(
|
||||||
approve(
|
approve(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&user_source_key,
|
user_source_key,
|
||||||
&user_transfer_key,
|
&user_transfer_key,
|
||||||
&user_key,
|
user_key,
|
||||||
&[],
|
&[],
|
||||||
amount_in,
|
amount_in,
|
||||||
)
|
)
|
||||||
|
@ -1462,10 +1462,10 @@ mod tests {
|
||||||
&self.swap_key,
|
&self.swap_key,
|
||||||
&self.authority_key,
|
&self.authority_key,
|
||||||
&user_transfer_key,
|
&user_transfer_key,
|
||||||
&user_source_key,
|
user_source_key,
|
||||||
&swap_source_key,
|
swap_source_key,
|
||||||
&swap_destination_key,
|
swap_destination_key,
|
||||||
&user_destination_key,
|
user_destination_key,
|
||||||
&self.pool_mint_key,
|
&self.pool_mint_key,
|
||||||
&self.pool_fee_key,
|
&self.pool_fee_key,
|
||||||
None,
|
None,
|
||||||
|
@ -1513,9 +1513,9 @@ mod tests {
|
||||||
do_process_instruction(
|
do_process_instruction(
|
||||||
approve(
|
approve(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&depositor_token_a_key,
|
depositor_token_a_key,
|
||||||
&user_transfer_authority,
|
&user_transfer_authority,
|
||||||
&depositor_key,
|
depositor_key,
|
||||||
&[],
|
&[],
|
||||||
maximum_token_a_amount,
|
maximum_token_a_amount,
|
||||||
)
|
)
|
||||||
|
@ -1531,9 +1531,9 @@ mod tests {
|
||||||
do_process_instruction(
|
do_process_instruction(
|
||||||
approve(
|
approve(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&depositor_token_b_key,
|
depositor_token_b_key,
|
||||||
&user_transfer_authority,
|
&user_transfer_authority,
|
||||||
&depositor_key,
|
depositor_key,
|
||||||
&[],
|
&[],
|
||||||
maximum_token_b_amount,
|
maximum_token_b_amount,
|
||||||
)
|
)
|
||||||
|
@ -1553,12 +1553,12 @@ mod tests {
|
||||||
&self.swap_key,
|
&self.swap_key,
|
||||||
&self.authority_key,
|
&self.authority_key,
|
||||||
&user_transfer_authority,
|
&user_transfer_authority,
|
||||||
&depositor_token_a_key,
|
depositor_token_a_key,
|
||||||
&depositor_token_b_key,
|
depositor_token_b_key,
|
||||||
&self.token_a_key,
|
&self.token_a_key,
|
||||||
&self.token_b_key,
|
&self.token_b_key,
|
||||||
&self.pool_mint_key,
|
&self.pool_mint_key,
|
||||||
&depositor_pool_key,
|
depositor_pool_key,
|
||||||
DepositAllTokenTypes {
|
DepositAllTokenTypes {
|
||||||
pool_token_amount,
|
pool_token_amount,
|
||||||
maximum_token_a_amount,
|
maximum_token_a_amount,
|
||||||
|
@ -1600,9 +1600,9 @@ mod tests {
|
||||||
do_process_instruction(
|
do_process_instruction(
|
||||||
approve(
|
approve(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&pool_key,
|
pool_key,
|
||||||
&user_transfer_authority_key,
|
&user_transfer_authority_key,
|
||||||
&user_key,
|
user_key,
|
||||||
&[],
|
&[],
|
||||||
pool_token_amount,
|
pool_token_amount,
|
||||||
)
|
)
|
||||||
|
@ -1625,11 +1625,11 @@ mod tests {
|
||||||
&user_transfer_authority_key,
|
&user_transfer_authority_key,
|
||||||
&self.pool_mint_key,
|
&self.pool_mint_key,
|
||||||
&self.pool_fee_key,
|
&self.pool_fee_key,
|
||||||
&pool_key,
|
pool_key,
|
||||||
&self.token_a_key,
|
&self.token_a_key,
|
||||||
&self.token_b_key,
|
&self.token_b_key,
|
||||||
&token_a_key,
|
token_a_key,
|
||||||
&token_b_key,
|
token_b_key,
|
||||||
WithdrawAllTokenTypes {
|
WithdrawAllTokenTypes {
|
||||||
pool_token_amount,
|
pool_token_amount,
|
||||||
minimum_token_a_amount,
|
minimum_token_a_amount,
|
||||||
|
@ -1668,9 +1668,9 @@ mod tests {
|
||||||
do_process_instruction(
|
do_process_instruction(
|
||||||
approve(
|
approve(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&deposit_account_key,
|
deposit_account_key,
|
||||||
&user_transfer_authority_key,
|
&user_transfer_authority_key,
|
||||||
&depositor_key,
|
depositor_key,
|
||||||
&[],
|
&[],
|
||||||
source_token_amount,
|
source_token_amount,
|
||||||
)
|
)
|
||||||
|
@ -1690,11 +1690,11 @@ mod tests {
|
||||||
&self.swap_key,
|
&self.swap_key,
|
||||||
&self.authority_key,
|
&self.authority_key,
|
||||||
&user_transfer_authority_key,
|
&user_transfer_authority_key,
|
||||||
&deposit_account_key,
|
deposit_account_key,
|
||||||
&self.token_a_key,
|
&self.token_a_key,
|
||||||
&self.token_b_key,
|
&self.token_b_key,
|
||||||
&self.pool_mint_key,
|
&self.pool_mint_key,
|
||||||
&deposit_pool_key,
|
deposit_pool_key,
|
||||||
DepositSingleTokenTypeExactAmountIn {
|
DepositSingleTokenTypeExactAmountIn {
|
||||||
source_token_amount,
|
source_token_amount,
|
||||||
minimum_pool_token_amount,
|
minimum_pool_token_amount,
|
||||||
|
@ -1731,9 +1731,9 @@ mod tests {
|
||||||
do_process_instruction(
|
do_process_instruction(
|
||||||
approve(
|
approve(
|
||||||
&spl_token::id(),
|
&spl_token::id(),
|
||||||
&pool_key,
|
pool_key,
|
||||||
&user_transfer_authority_key,
|
&user_transfer_authority_key,
|
||||||
&user_key,
|
user_key,
|
||||||
&[],
|
&[],
|
||||||
maximum_pool_token_amount,
|
maximum_pool_token_amount,
|
||||||
)
|
)
|
||||||
|
@ -1755,10 +1755,10 @@ mod tests {
|
||||||
&user_transfer_authority_key,
|
&user_transfer_authority_key,
|
||||||
&self.pool_mint_key,
|
&self.pool_mint_key,
|
||||||
&self.pool_fee_key,
|
&self.pool_fee_key,
|
||||||
&pool_key,
|
pool_key,
|
||||||
&self.token_a_key,
|
&self.token_a_key,
|
||||||
&self.token_b_key,
|
&self.token_b_key,
|
||||||
&destination_key,
|
destination_key,
|
||||||
WithdrawSingleTokenTypeExactAmountOut {
|
WithdrawSingleTokenTypeExactAmountOut {
|
||||||
destination_token_amount,
|
destination_token_amount,
|
||||||
maximum_pool_token_amount,
|
maximum_pool_token_amount,
|
||||||
|
@ -1861,13 +1861,13 @@ mod tests {
|
||||||
let mut account_account = Account::new(
|
let mut account_account = Account::new(
|
||||||
account_minimum_balance(),
|
account_minimum_balance(),
|
||||||
spl_token::state::Account::get_packed_len(),
|
spl_token::state::Account::get_packed_len(),
|
||||||
&program_id,
|
program_id,
|
||||||
);
|
);
|
||||||
let mut mint_authority_account = Account::default();
|
let mut mint_authority_account = Account::default();
|
||||||
let mut rent_sysvar_account = create_account_for_test(&Rent::free());
|
let mut rent_sysvar_account = create_account_for_test(&Rent::free());
|
||||||
|
|
||||||
do_process_instruction(
|
do_process_instruction(
|
||||||
initialize_account(&program_id, &account_key, &mint_key, account_owner_key).unwrap(),
|
initialize_account(program_id, &account_key, mint_key, account_owner_key).unwrap(),
|
||||||
vec![
|
vec![
|
||||||
&mut account_account,
|
&mut account_account,
|
||||||
&mut mint_account,
|
&mut mint_account,
|
||||||
|
@ -1880,10 +1880,10 @@ mod tests {
|
||||||
if amount > 0 {
|
if amount > 0 {
|
||||||
do_process_instruction(
|
do_process_instruction(
|
||||||
mint_to(
|
mint_to(
|
||||||
&program_id,
|
program_id,
|
||||||
&mint_key,
|
mint_key,
|
||||||
&account_key,
|
&account_key,
|
||||||
&mint_authority_key,
|
mint_authority_key,
|
||||||
&[],
|
&[],
|
||||||
amount,
|
amount,
|
||||||
)
|
)
|
||||||
|
@ -1909,12 +1909,12 @@ mod tests {
|
||||||
let mut mint_account = Account::new(
|
let mut mint_account = Account::new(
|
||||||
mint_minimum_balance(),
|
mint_minimum_balance(),
|
||||||
spl_token::state::Mint::get_packed_len(),
|
spl_token::state::Mint::get_packed_len(),
|
||||||
&program_id,
|
program_id,
|
||||||
);
|
);
|
||||||
let mut rent_sysvar_account = create_account_for_test(&Rent::free());
|
let mut rent_sysvar_account = create_account_for_test(&Rent::free());
|
||||||
|
|
||||||
do_process_instruction(
|
do_process_instruction(
|
||||||
initialize_mint(&program_id, &mint_key, authority_key, freeze_authority, 2).unwrap(),
|
initialize_mint(program_id, &mint_key, authority_key, freeze_authority, 2).unwrap(),
|
||||||
vec![&mut mint_account, &mut rent_sysvar_account],
|
vec![&mut mint_account, &mut rent_sysvar_account],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -2788,7 +2788,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let swap_state = SwapVersion::unpack(&accounts.swap_account.data).unwrap();
|
let swap_state = SwapVersion::unpack(&accounts.swap_account.data).unwrap();
|
||||||
assert_eq!(swap_state.is_initialized(), true);
|
assert!(swap_state.is_initialized());
|
||||||
assert_eq!(swap_state.nonce(), accounts.nonce);
|
assert_eq!(swap_state.nonce(), accounts.nonce);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
swap_state.swap_curve().curve_type,
|
swap_state.swap_curve().curve_type,
|
||||||
|
|
|
@ -304,7 +304,7 @@ mod tests {
|
||||||
SwapVersion::pack(swap_info, &mut packed).unwrap();
|
SwapVersion::pack(swap_info, &mut packed).unwrap();
|
||||||
let unpacked = SwapVersion::unpack(&packed).unwrap();
|
let unpacked = SwapVersion::unpack(&packed).unwrap();
|
||||||
|
|
||||||
assert_eq!(unpacked.is_initialized(), true);
|
assert!(unpacked.is_initialized());
|
||||||
assert_eq!(unpacked.nonce(), TEST_NONCE);
|
assert_eq!(unpacked.nonce(), TEST_NONCE);
|
||||||
assert_eq!(*unpacked.token_program_id(), TEST_TOKEN_PROGRAM_ID);
|
assert_eq!(*unpacked.token_program_id(), TEST_TOKEN_PROGRAM_ID);
|
||||||
assert_eq!(*unpacked.token_a_account(), TEST_TOKEN_A);
|
assert_eq!(*unpacked.token_a_account(), TEST_TOKEN_A);
|
||||||
|
|
|
@ -12,14 +12,14 @@ version = "2.0.12"
|
||||||
clap = "2.33.3"
|
clap = "2.33.3"
|
||||||
console = "0.14.0"
|
console = "0.14.0"
|
||||||
serde_json = "1.0.62"
|
serde_json = "1.0.62"
|
||||||
solana-account-decoder = "=1.6.11"
|
solana-account-decoder = "=1.7.3"
|
||||||
solana-clap-utils = "=1.6.11"
|
solana-clap-utils = "=1.7.3"
|
||||||
solana-cli-config = "=1.6.11"
|
solana-cli-config = "=1.7.3"
|
||||||
solana-cli-output = "=1.6.11"
|
solana-cli-output = "=1.7.3"
|
||||||
solana-client = "=1.6.11"
|
solana-client = "=1.7.3"
|
||||||
solana-logger = "=1.6.11"
|
solana-logger = "=1.7.3"
|
||||||
solana-remote-wallet = "=1.6.11"
|
solana-remote-wallet = "=1.7.3"
|
||||||
solana-sdk = "=1.6.11"
|
solana-sdk = "=1.7.3"
|
||||||
spl-token = { version = "3.1", path="../program", features = [ "no-entrypoint" ] }
|
spl-token = { version = "3.1", path="../program", features = [ "no-entrypoint" ] }
|
||||||
spl-associated-token-account = { version = "1.0", path="../../associated-token-account/program", features = [ "no-entrypoint" ] }
|
spl-associated-token-account = { version = "1.0", path="../../associated-token-account/program", features = [ "no-entrypoint" ] }
|
||||||
spl-memo = { version = "3.0.1", path="../../memo/program", features = ["no-entrypoint"] }
|
spl-memo = { version = "3.0.1", path="../../memo/program", features = ["no-entrypoint"] }
|
||||||
|
|
|
@ -82,7 +82,7 @@ impl<'a> Config<'a> {
|
||||||
if authority_name != "owner" {
|
if authority_name != "owner" {
|
||||||
if let Some(keypair_path) = arg_matches.value_of(authority_name) {
|
if let Some(keypair_path) = arg_matches.value_of(authority_name) {
|
||||||
return signer_from_path(
|
return signer_from_path(
|
||||||
&arg_matches,
|
arg_matches,
|
||||||
keypair_path,
|
keypair_path,
|
||||||
authority_name,
|
authority_name,
|
||||||
wallet_manager,
|
wallet_manager,
|
||||||
|
@ -123,7 +123,7 @@ impl<'a> Config<'a> {
|
||||||
) -> Result<Box<dyn Signer>, Box<dyn std::error::Error>> {
|
) -> Result<Box<dyn Signer>, Box<dyn std::error::Error>> {
|
||||||
// for backwards compatibility, check owner before cli config default
|
// for backwards compatibility, check owner before cli config default
|
||||||
if let Some(owner_path) = matches.value_of("owner") {
|
if let Some(owner_path) = matches.value_of("owner") {
|
||||||
return signer_from_path(&matches, owner_path, "owner", wallet_manager);
|
return signer_from_path(matches, owner_path, "owner", wallet_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
let path = &self.default_keypair_path;
|
let path = &self.default_keypair_path;
|
||||||
|
|
|
@ -503,7 +503,7 @@ fn resolve_mint_info(
|
||||||
if !config.sign_only {
|
if !config.sign_only {
|
||||||
let source_account = config
|
let source_account = config
|
||||||
.rpc_client
|
.rpc_client
|
||||||
.get_token_account(&token_account)?
|
.get_token_account(token_account)?
|
||||||
.ok_or_else(|| format!("Could not find token account {}", token_account))?;
|
.ok_or_else(|| format!("Could not find token account {}", token_account))?;
|
||||||
let source_mint = Pubkey::from_str(&source_account.mint)?;
|
let source_mint = Pubkey::from_str(&source_account.mint)?;
|
||||||
if let Some(mint) = mint_address {
|
if let Some(mint) = mint_address {
|
||||||
|
@ -1175,7 +1175,7 @@ fn command_account_info(config: &Config, address: Pubkey) -> CommandResult {
|
||||||
}
|
}
|
||||||
println_name_value(
|
println_name_value(
|
||||||
"Close authority:",
|
"Close authority:",
|
||||||
&account.close_authority.as_ref().unwrap_or(&String::new()),
|
account.close_authority.as_ref().unwrap_or(&String::new()),
|
||||||
);
|
);
|
||||||
if !is_associated {
|
if !is_associated {
|
||||||
println!();
|
println!();
|
||||||
|
@ -1185,7 +1185,7 @@ fn command_account_info(config: &Config, address: Pubkey) -> CommandResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_multisig(config: &Config, address: &Pubkey) -> Result<Multisig, Error> {
|
fn get_multisig(config: &Config, address: &Pubkey) -> Result<Multisig, Error> {
|
||||||
let account = config.rpc_client.get_account(&address)?;
|
let account = config.rpc_client.get_account(address)?;
|
||||||
Multisig::unpack(&account.data).map_err(|e| e.into())
|
Multisig::unpack(&account.data).map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1376,7 +1376,7 @@ fn main() {
|
||||||
.global(true)
|
.global(true)
|
||||||
.help("Configuration file to use");
|
.help("Configuration file to use");
|
||||||
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
|
if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE {
|
||||||
arg.default_value(&config_file)
|
arg.default_value(config_file)
|
||||||
} else {
|
} else {
|
||||||
arg
|
arg
|
||||||
}
|
}
|
||||||
|
@ -1435,7 +1435,7 @@ fn main() {
|
||||||
.validator(is_mint_decimals)
|
.validator(is_mint_decimals)
|
||||||
.value_name("DECIMALS")
|
.value_name("DECIMALS")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value(&default_decimals)
|
.default_value(default_decimals)
|
||||||
.help("Number of base 10 digits to the right of the decimal place"),
|
.help("Number of base 10 digits to the right of the decimal place"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -2125,7 +2125,7 @@ fn main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
let (signer, fee_payer) = signer_from_path(
|
let (signer, fee_payer) = signer_from_path(
|
||||||
&matches,
|
matches,
|
||||||
matches
|
matches
|
||||||
.value_of("fee_payer")
|
.value_of("fee_payer")
|
||||||
.unwrap_or(&cli_config.keypair_path),
|
.unwrap_or(&cli_config.keypair_path),
|
||||||
|
@ -2144,14 +2144,14 @@ fn main() {
|
||||||
|
|
||||||
let verbose = matches.is_present("verbose");
|
let verbose = matches.is_present("verbose");
|
||||||
|
|
||||||
let nonce_account = pubkey_of_signer(&matches, NONCE_ARG.name, &mut wallet_manager)
|
let nonce_account = pubkey_of_signer(matches, NONCE_ARG.name, &mut wallet_manager)
|
||||||
.unwrap_or_else(|e| {
|
.unwrap_or_else(|e| {
|
||||||
eprintln!("error: {}", e);
|
eprintln!("error: {}", e);
|
||||||
exit(1);
|
exit(1);
|
||||||
});
|
});
|
||||||
let nonce_authority = if nonce_account.is_some() {
|
let nonce_authority = if nonce_account.is_some() {
|
||||||
let (signer, nonce_authority) = signer_from_path(
|
let (signer, nonce_authority) = signer_from_path(
|
||||||
&matches,
|
matches,
|
||||||
matches
|
matches
|
||||||
.value_of(NONCE_AUTHORITY_ARG.name)
|
.value_of(NONCE_AUTHORITY_ARG.name)
|
||||||
.unwrap_or(&cli_config.keypair_path),
|
.unwrap_or(&cli_config.keypair_path),
|
||||||
|
@ -2176,7 +2176,7 @@ fn main() {
|
||||||
let blockhash_query = BlockhashQuery::new_from_matches(matches);
|
let blockhash_query = BlockhashQuery::new_from_matches(matches);
|
||||||
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
|
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
|
||||||
|
|
||||||
let multisig_signers = signers_of(&matches, MULTISIG_SIGNER_ARG.name, &mut wallet_manager)
|
let multisig_signers = signers_of(matches, MULTISIG_SIGNER_ARG.name, &mut wallet_manager)
|
||||||
.unwrap_or_else(|e| {
|
.unwrap_or_else(|e| {
|
||||||
eprintln!("error: {}", e);
|
eprintln!("error: {}", e);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -2242,9 +2242,9 @@ fn main() {
|
||||||
command_create_account(&config, token, owner, account)
|
command_create_account(&config, token, owner, account)
|
||||||
}
|
}
|
||||||
("create-multisig", Some(arg_matches)) => {
|
("create-multisig", Some(arg_matches)) => {
|
||||||
let minimum_signers = value_of::<u8>(&arg_matches, "minimum_signers").unwrap();
|
let minimum_signers = value_of::<u8>(arg_matches, "minimum_signers").unwrap();
|
||||||
let multisig_members =
|
let multisig_members =
|
||||||
pubkeys_of_multiple_signers(&arg_matches, "multisig_member", &mut wallet_manager)
|
pubkeys_of_multiple_signers(arg_matches, "multisig_member", &mut wallet_manager)
|
||||||
.unwrap_or_else(|e| {
|
.unwrap_or_else(|e| {
|
||||||
eprintln!("error: {}", e);
|
eprintln!("error: {}", e);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -2310,7 +2310,7 @@ fn main() {
|
||||||
config.signer_or_default(arg_matches, "owner", &mut wallet_manager);
|
config.signer_or_default(arg_matches, "owner", &mut wallet_manager);
|
||||||
bulk_signers.push(owner_signer);
|
bulk_signers.push(owner_signer);
|
||||||
|
|
||||||
let mint_decimals = value_of::<u8>(&arg_matches, MINT_DECIMALS_ARG.name);
|
let mint_decimals = value_of::<u8>(arg_matches, MINT_DECIMALS_ARG.name);
|
||||||
let fund_recipient = matches.is_present("fund_recipient");
|
let fund_recipient = matches.is_present("fund_recipient");
|
||||||
let allow_unfunded_recipient = matches.is_present("allow_empty_recipient")
|
let allow_unfunded_recipient = matches.is_present("allow_empty_recipient")
|
||||||
|| matches.is_present("allow_unfunded_recipient");
|
|| matches.is_present("allow_unfunded_recipient");
|
||||||
|
@ -2342,7 +2342,7 @@ fn main() {
|
||||||
let amount = value_t_or_exit!(arg_matches, "amount", f64);
|
let amount = value_t_or_exit!(arg_matches, "amount", f64);
|
||||||
let mint_address =
|
let mint_address =
|
||||||
pubkey_of_signer(arg_matches, MINT_ADDRESS_ARG.name, &mut wallet_manager).unwrap();
|
pubkey_of_signer(arg_matches, MINT_ADDRESS_ARG.name, &mut wallet_manager).unwrap();
|
||||||
let mint_decimals = value_of::<u8>(&arg_matches, MINT_DECIMALS_ARG.name);
|
let mint_decimals = value_of::<u8>(arg_matches, MINT_DECIMALS_ARG.name);
|
||||||
command_burn(&config, source, owner, amount, mint_address, mint_decimals)
|
command_burn(&config, source, owner, amount, mint_address, mint_decimals)
|
||||||
}
|
}
|
||||||
("mint", Some(arg_matches)) => {
|
("mint", Some(arg_matches)) => {
|
||||||
|
@ -2359,7 +2359,7 @@ fn main() {
|
||||||
"recipient",
|
"recipient",
|
||||||
&mut wallet_manager,
|
&mut wallet_manager,
|
||||||
);
|
);
|
||||||
let mint_decimals = value_of::<u8>(&arg_matches, MINT_DECIMALS_ARG.name);
|
let mint_decimals = value_of::<u8>(arg_matches, MINT_DECIMALS_ARG.name);
|
||||||
command_mint(
|
command_mint(
|
||||||
&config,
|
&config,
|
||||||
token,
|
token,
|
||||||
|
@ -2432,7 +2432,7 @@ fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mint_address =
|
let mint_address =
|
||||||
pubkey_of_signer(arg_matches, MINT_ADDRESS_ARG.name, &mut wallet_manager).unwrap();
|
pubkey_of_signer(arg_matches, MINT_ADDRESS_ARG.name, &mut wallet_manager).unwrap();
|
||||||
let mint_decimals = value_of::<u8>(&arg_matches, MINT_DECIMALS_ARG.name);
|
let mint_decimals = value_of::<u8>(arg_matches, MINT_DECIMALS_ARG.name);
|
||||||
command_approve(
|
command_approve(
|
||||||
&config,
|
&config,
|
||||||
account,
|
account,
|
||||||
|
|
|
@ -10,10 +10,6 @@ flow-typed/
|
||||||
[options]
|
[options]
|
||||||
|
|
||||||
emoji=true
|
emoji=true
|
||||||
esproposal.class_instance_fields=enable
|
|
||||||
esproposal.class_static_fields=enable
|
|
||||||
esproposal.decorators=ignore
|
|
||||||
esproposal.export_star_as=enable
|
|
||||||
module.system.node.resolve_dirname=./src
|
module.system.node.resolve_dirname=./src
|
||||||
module.use_strict=true
|
module.use_strict=true
|
||||||
experimental.const_params=true
|
experimental.const_params=true
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
// Configure Node.js tests
|
// Configure Node.js tests
|
||||||
module.exports = {
|
module.exports = {
|
||||||
require: ['@babel/register', 'esm'],
|
require: ['@babel/register'],
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,9 +41,9 @@ function assert(condition, message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function didThrow(obj, func, args): Promise<boolean> {
|
async function didThrow(func): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
await func.apply(testToken, args);
|
await func();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -226,9 +226,9 @@ export async function createAssociatedAccount(): Promise<void> {
|
||||||
|
|
||||||
// creating again should cause TX error for the associated token account
|
// creating again should cause TX error for the associated token account
|
||||||
assert(
|
assert(
|
||||||
await didThrow(testToken, testToken.createAssociatedTokenAccount, [
|
await didThrow(async () => {
|
||||||
owner.publicKey,
|
await testToken.createAssociatedTokenAccount(owner.publicKey);
|
||||||
]),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,13 +244,15 @@ export async function mintTo(): Promise<void> {
|
||||||
|
|
||||||
export async function mintToChecked(): Promise<void> {
|
export async function mintToChecked(): Promise<void> {
|
||||||
assert(
|
assert(
|
||||||
await didThrow(testToken, testToken.mintToChecked, [
|
await didThrow(async () => {
|
||||||
testAccount,
|
await testToken.mintToChecked(
|
||||||
testMintAuthority,
|
testAccount,
|
||||||
[],
|
testMintAuthority,
|
||||||
1000,
|
[],
|
||||||
1,
|
1000,
|
||||||
]),
|
1,
|
||||||
|
);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
await testToken.mintToChecked(testAccount, testMintAuthority, [], 1000, 2);
|
await testToken.mintToChecked(testAccount, testMintAuthority, [], 1000, 2);
|
||||||
|
@ -283,14 +285,16 @@ export async function transferChecked(): Promise<void> {
|
||||||
const dest = await testToken.createAccount(destOwner.publicKey);
|
const dest = await testToken.createAccount(destOwner.publicKey);
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
await didThrow(testToken, testToken.transferChecked, [
|
await didThrow(async () => {
|
||||||
testAccount,
|
await testToken.transferChecked(
|
||||||
dest,
|
testAccount,
|
||||||
testAccountOwner,
|
dest,
|
||||||
[],
|
testAccountOwner,
|
||||||
100,
|
[],
|
||||||
testTokenDecimals - 1,
|
100,
|
||||||
]),
|
testTokenDecimals - 1,
|
||||||
|
);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
await testToken.transferChecked(
|
await testToken.transferChecked(
|
||||||
|
@ -387,13 +391,9 @@ export async function failOnApproveOverspend(): Promise<void> {
|
||||||
assert(account1Info.delegatedAmount.toNumber() == 0);
|
assert(account1Info.delegatedAmount.toNumber() == 0);
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
await didThrow(testToken, testToken.transfer, [
|
await didThrow(async () => {
|
||||||
account1,
|
await testToken.transfer(account1, account2, delegate, [], 1);
|
||||||
account2,
|
}),
|
||||||
delegate,
|
|
||||||
[],
|
|
||||||
1,
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,13 +407,15 @@ export async function setAuthority(): Promise<void> {
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
assert(
|
assert(
|
||||||
await didThrow(testToken, testToken.setAuthority, [
|
await didThrow(async () => {
|
||||||
testAccount,
|
await testToken.setAuthority(
|
||||||
newOwner.publicKey,
|
testAccount,
|
||||||
'AccountOwner',
|
newOwner.publicKey,
|
||||||
testAccountOwner,
|
'AccountOwner',
|
||||||
[],
|
testAccountOwner,
|
||||||
]),
|
[],
|
||||||
|
);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
await testToken.setAuthority(
|
await testToken.setAuthority(
|
||||||
testAccount,
|
testAccount,
|
||||||
|
@ -439,13 +441,9 @@ export async function burnChecked(): Promise<void> {
|
||||||
const amount = accountInfo.amount.toNumber();
|
const amount = accountInfo.amount.toNumber();
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
await didThrow(testToken, testToken.burnChecked, [
|
await didThrow(async () => {
|
||||||
testAccount,
|
await testToken.burnChecked(testAccount, testAccountOwner, [], 1, 1);
|
||||||
testAccountOwner,
|
}),
|
||||||
[],
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await testToken.burnChecked(testAccount, testAccountOwner, [], 1, 2);
|
await testToken.burnChecked(testAccount, testAccountOwner, [], 1, 2);
|
||||||
|
@ -464,13 +462,9 @@ export async function freezeThawAccount(): Promise<void> {
|
||||||
const dest = await testToken.createAccount(destOwner.publicKey);
|
const dest = await testToken.createAccount(destOwner.publicKey);
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
await didThrow(testToken, testToken.transfer, [
|
await didThrow(async () => {
|
||||||
testAccount,
|
await testToken.transfer(testAccount, dest, testAccountOwner, [], 100);
|
||||||
dest,
|
}),
|
||||||
testAccountOwner,
|
|
||||||
[],
|
|
||||||
100,
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await testToken.thawAccount(testAccount, testMintAuthority, []);
|
await testToken.thawAccount(testAccount, testMintAuthority, []);
|
||||||
|
@ -503,12 +497,9 @@ export async function closeAccount(): Promise<void> {
|
||||||
|
|
||||||
// Check that accounts with non-zero token balance cannot be closed
|
// Check that accounts with non-zero token balance cannot be closed
|
||||||
assert(
|
assert(
|
||||||
await didThrow(testToken, testToken.closeAccount, [
|
await didThrow(async () => {
|
||||||
testAccount,
|
await testToken.closeAccount(testAccount, dest, closeAuthority, []);
|
||||||
dest,
|
}),
|
||||||
closeAuthority,
|
|
||||||
[],
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const connection = await getConnection();
|
const connection = await getConnection();
|
||||||
|
|
|
@ -10,9 +10,9 @@ edition = "2018"
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = { version = "0.7.0"}
|
rand = { version = "0.7.0"}
|
||||||
spl-token = { path = "../program", features = [ "no-entrypoint" ] }
|
spl-token = { path = "../program", features = [ "no-entrypoint" ] }
|
||||||
solana-runtime = "1.6.11"
|
solana-runtime = "1.7.3"
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
solana-bpf-loader-program = "1.6.11"
|
solana-bpf-loader-program = "1.7.3"
|
||||||
solana_rbpf = "0.2"
|
solana_rbpf = "0.2"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|
|
@ -16,11 +16,11 @@ arrayref = "0.3.6"
|
||||||
num-derive = "0.3"
|
num-derive = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
num_enum = "0.5.1"
|
num_enum = "0.5.1"
|
||||||
solana-program = "1.6.11"
|
solana-program = "1.7.3"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "lib"]
|
crate-type = ["cdylib", "lib"]
|
||||||
|
|
|
@ -1927,9 +1927,9 @@ mod tests {
|
||||||
// transfer
|
// transfer
|
||||||
let instruction = transfer(
|
let instruction = transfer(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_info.key,
|
owner_info.key,
|
||||||
&[],
|
&[],
|
||||||
1000,
|
1000,
|
||||||
)
|
)
|
||||||
|
@ -1953,10 +1953,10 @@ mod tests {
|
||||||
// transfer checked
|
// transfer checked
|
||||||
let instruction = transfer_checked(
|
let instruction = transfer_checked(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&mint_info.key,
|
mint_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_info.key,
|
owner_info.key,
|
||||||
&[],
|
&[],
|
||||||
1000,
|
1000,
|
||||||
2,
|
2,
|
||||||
|
@ -1983,9 +1983,9 @@ mod tests {
|
||||||
let mut owner_no_sign_info = owner_info.clone();
|
let mut owner_no_sign_info = owner_info.clone();
|
||||||
let mut instruction = transfer(
|
let mut instruction = transfer(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_no_sign_info.key,
|
owner_no_sign_info.key,
|
||||||
&[],
|
&[],
|
||||||
1000,
|
1000,
|
||||||
)
|
)
|
||||||
|
@ -2008,10 +2008,10 @@ mod tests {
|
||||||
// missing signer checked
|
// missing signer checked
|
||||||
let mut instruction = transfer_checked(
|
let mut instruction = transfer_checked(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&mint_info.key,
|
mint_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_no_sign_info.key,
|
owner_no_sign_info.key,
|
||||||
&[],
|
&[],
|
||||||
1000,
|
1000,
|
||||||
2,
|
2,
|
||||||
|
@ -2035,9 +2035,9 @@ mod tests {
|
||||||
// missing owner
|
// missing owner
|
||||||
let instruction = transfer(
|
let instruction = transfer(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner2_info.key,
|
owner2_info.key,
|
||||||
&[],
|
&[],
|
||||||
1000,
|
1000,
|
||||||
)
|
)
|
||||||
|
@ -2058,10 +2058,10 @@ mod tests {
|
||||||
// missing owner checked
|
// missing owner checked
|
||||||
let instruction = transfer_checked(
|
let instruction = transfer_checked(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&mint_info.key,
|
mint_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner2_info.key,
|
owner2_info.key,
|
||||||
&[],
|
&[],
|
||||||
1000,
|
1000,
|
||||||
2,
|
2,
|
||||||
|
@ -2084,9 +2084,9 @@ mod tests {
|
||||||
// insufficient funds
|
// insufficient funds
|
||||||
let instruction = transfer(
|
let instruction = transfer(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_info.key,
|
owner_info.key,
|
||||||
&[],
|
&[],
|
||||||
1001,
|
1001,
|
||||||
)
|
)
|
||||||
|
@ -2107,10 +2107,10 @@ mod tests {
|
||||||
// insufficient funds checked
|
// insufficient funds checked
|
||||||
let instruction = transfer_checked(
|
let instruction = transfer_checked(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&mint_info.key,
|
mint_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_info.key,
|
owner_info.key,
|
||||||
&[],
|
&[],
|
||||||
1001,
|
1001,
|
||||||
2,
|
2,
|
||||||
|
@ -2133,10 +2133,10 @@ mod tests {
|
||||||
// incorrect decimals
|
// incorrect decimals
|
||||||
let instruction = transfer_checked(
|
let instruction = transfer_checked(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&mint_info.key,
|
mint_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_info.key,
|
owner_info.key,
|
||||||
&[],
|
&[],
|
||||||
1,
|
1,
|
||||||
10, // <-- incorrect decimals
|
10, // <-- incorrect decimals
|
||||||
|
@ -2159,10 +2159,10 @@ mod tests {
|
||||||
// incorrect mint
|
// incorrect mint
|
||||||
let instruction = transfer_checked(
|
let instruction = transfer_checked(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&account3_info.key, // <-- incorrect mint
|
account3_info.key, // <-- incorrect mint
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_info.key,
|
owner_info.key,
|
||||||
&[],
|
&[],
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
|
@ -2185,9 +2185,9 @@ mod tests {
|
||||||
// approve delegate
|
// approve delegate
|
||||||
let instruction = approve(
|
let instruction = approve(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&delegate_info.key,
|
delegate_info.key,
|
||||||
&owner_info.key,
|
owner_info.key,
|
||||||
&[],
|
&[],
|
||||||
100,
|
100,
|
||||||
)
|
)
|
||||||
|
@ -2206,9 +2206,9 @@ mod tests {
|
||||||
// delegate transfer
|
// delegate transfer
|
||||||
let instruction = transfer(
|
let instruction = transfer(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&delegate_info.key,
|
delegate_info.key,
|
||||||
&[],
|
&[],
|
||||||
100,
|
100,
|
||||||
)
|
)
|
||||||
|
@ -2233,10 +2233,10 @@ mod tests {
|
||||||
// delegate transfer checked
|
// delegate transfer checked
|
||||||
let instruction = transfer_checked(
|
let instruction = transfer_checked(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&mint_info.key,
|
mint_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&delegate_info.key,
|
delegate_info.key,
|
||||||
&[],
|
&[],
|
||||||
100,
|
100,
|
||||||
2,
|
2,
|
||||||
|
@ -2263,9 +2263,9 @@ mod tests {
|
||||||
// delegate insufficient funds
|
// delegate insufficient funds
|
||||||
let instruction = transfer(
|
let instruction = transfer(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&delegate_info.key,
|
delegate_info.key,
|
||||||
&[],
|
&[],
|
||||||
101,
|
101,
|
||||||
)
|
)
|
||||||
|
@ -2286,10 +2286,10 @@ mod tests {
|
||||||
// delegate insufficient funds checked
|
// delegate insufficient funds checked
|
||||||
let instruction = transfer_checked(
|
let instruction = transfer_checked(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&mint_info.key,
|
mint_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&delegate_info.key,
|
delegate_info.key,
|
||||||
&[],
|
&[],
|
||||||
101,
|
101,
|
||||||
2,
|
2,
|
||||||
|
@ -2312,9 +2312,9 @@ mod tests {
|
||||||
// owner transfer with delegate assigned
|
// owner transfer with delegate assigned
|
||||||
let instruction = transfer(
|
let instruction = transfer(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_info.key,
|
owner_info.key,
|
||||||
&[],
|
&[],
|
||||||
1000,
|
1000,
|
||||||
)
|
)
|
||||||
|
@ -2338,10 +2338,10 @@ mod tests {
|
||||||
// owner transfer with delegate assigned checked
|
// owner transfer with delegate assigned checked
|
||||||
let instruction = transfer_checked(
|
let instruction = transfer_checked(
|
||||||
&program_id,
|
&program_id,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&mint_info.key,
|
mint_info.key,
|
||||||
&account_info.key,
|
account_info.key,
|
||||||
&owner_info.key,
|
owner_info.key,
|
||||||
&[],
|
&[],
|
||||||
1000,
|
1000,
|
||||||
2,
|
2,
|
||||||
|
|
|
@ -11,6 +11,8 @@ fi
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
sed -i'' -e "s#solana_version=v.*#solana_version=v${solana_ver}#" ./ci/solana-version.sh
|
||||||
|
|
||||||
declare tomls=()
|
declare tomls=()
|
||||||
while IFS='' read -r line; do tomls+=("$line"); done < <(find . -name Cargo.toml)
|
while IFS='' read -r line; do tomls+=("$line"); done < <(find . -name Cargo.toml)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ edition = "2018"
|
||||||
# Used to ensure that SPL programs are buildable by external clients
|
# Used to ensure that SPL programs are buildable by external clients
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
solana-sdk = "1.6.11"
|
solana-sdk = "1.7.3"
|
||||||
spl-memo = { path = "../../memo/program", features = [ "no-entrypoint" ] }
|
spl-memo = { path = "../../memo/program", features = [ "no-entrypoint" ] }
|
||||||
spl-token = { path = "../../token/program", features = [ "no-entrypoint" ] }
|
spl-token = { path = "../../token/program", features = [ "no-entrypoint" ] }
|
||||||
spl-token-swap = { path = "../../token-swap/program", features = [ "no-entrypoint" ] }
|
spl-token-swap = { path = "../../token-swap/program", features = [ "no-entrypoint" ] }
|
||||||
|
|
Loading…
Reference in New Issue