update to anchor 0.17.0 (#4)

This commit is contained in:
John Rees 2021-10-09 16:46:29 +01:00 committed by GitHub
parent aa68417b1e
commit b2875811a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 19 deletions

74
Cargo.lock generated
View File

@ -25,7 +25,9 @@ checksum = "6b2d54853319fd101b8dd81de382bcbf3e03410a64d8928bbee85a3e7dcde483"
[[package]]
name = "anchor-attribute-access-control"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b8ab97bfde16e49bc399586a857e9bd56e7c867a66a89ca809134d53d999138"
dependencies = [
"anchor-syn",
"anyhow",
@ -37,18 +39,24 @@ dependencies = [
[[package]]
name = "anchor-attribute-account"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40d3c2f1ebf823c4a8f0e41c57125991713177d4f02957600f8c1da8bd87adfd"
dependencies = [
"anchor-syn",
"anyhow",
"bs58 0.4.0",
"proc-macro2",
"quote",
"rustversion",
"syn",
]
[[package]]
name = "anchor-attribute-error"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8b5b954878c4cb1ad373143b42765abaf789691e13dbd0a3a8707dbfd0612cd"
dependencies = [
"anchor-syn",
"proc-macro2",
@ -58,7 +66,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-event"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418daba265c778d2386c27191b4ec927c24be270ed6a8667be81de9e541c7a3e"
dependencies = [
"anchor-syn",
"anyhow",
@ -69,7 +79,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-interface"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd2159348897db16999d76ff396ba8722fb101e0e0cc6845b3722eb7472bd0d0"
dependencies = [
"anchor-syn",
"anyhow",
@ -81,7 +93,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-program"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6695b491d73439ad9839565beb0749107f5acca6d96b4cbaaaef428ba7b6c11"
dependencies = [
"anchor-syn",
"anyhow",
@ -92,7 +106,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-state"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bcbbeade2b868e597b55d90418dc51334c4e388f988c0eea1af5d511083ed10"
dependencies = [
"anchor-syn",
"anyhow",
@ -103,7 +119,9 @@ dependencies = [
[[package]]
name = "anchor-derive-accounts"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc82ef304c38e7529883176c428acfab9a7bb9e851aa694fff53c8789fbc47b3"
dependencies = [
"anchor-syn",
"anyhow",
@ -114,7 +132,9 @@ dependencies = [
[[package]]
name = "anchor-lang"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff6b7025eb65638005fd2af58e2bd136b61c2ecbadda379e908a5af541351a3a"
dependencies = [
"anchor-attribute-access-control",
"anchor-attribute-account",
@ -133,21 +153,26 @@ dependencies = [
[[package]]
name = "anchor-spl"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b49dfaf04f0794ecbdafa1f5dda93d47fc042ae70478fc079194c6c7cd265e94"
dependencies = [
"anchor-lang",
"lazy_static",
"serum_dex",
"solana-program",
"spl-associated-token-account",
"spl-token",
]
[[package]]
name = "anchor-syn"
version = "0.14.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "321cca8ea1c35b199956e11b2869e8b1b1ae2d547326a12fc45375d0806470c8"
dependencies = [
"anyhow",
"bs58",
"bs58 0.3.1",
"heck",
"proc-macro2",
"proc-macro2-diagnostics",
@ -305,6 +330,12 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb"
[[package]]
name = "bs58"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3"
[[package]]
name = "bv"
version = "0.11.1"
@ -961,7 +992,8 @@ dependencies = [
[[package]]
name = "serum_dex"
version = "0.4.0"
source = "git+https://github.com/project-serum/serum-dex#d82f6cd7a0b8d966a79c8e60e6139129b01256da"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02705854bae4622e552346c8edd43ab90c7425da35d63d2c689f39238f8d8b25"
dependencies = [
"arrayref",
"bincode",
@ -1012,7 +1044,7 @@ version = "1.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21ddfc2b65a555c0e0156c043bce092d473bc4f00daa7ca3c223d97d92d2e807"
dependencies = [
"bs58",
"bs58 0.3.1",
"bv",
"generic-array 0.14.4",
"log",
@ -1059,7 +1091,7 @@ dependencies = [
"blake3",
"borsh",
"borsh-derive",
"bs58",
"bs58 0.3.1",
"bv",
"curve25519-dalek",
"hex",
@ -1090,13 +1122,23 @@ version = "1.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b453dca160617b1676c47e3cfd4361f455dc5bb1c93659ec84b0c5d566b5c039"
dependencies = [
"bs58",
"bs58 0.3.1",
"proc-macro2",
"quote",
"rustversion",
"syn",
]
[[package]]
name = "spl-associated-token-account"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "393e2240d521c3dd770806bff25c2c00d761ac962be106e14e22dd912007f428"
dependencies = [
"solana-program",
"spl-token",
]
[[package]]
name = "spl-token"
version = "3.2.0"

View File

@ -15,5 +15,5 @@ cpi = ["no-entrypoint"]
default = []
[dependencies]
anchor-lang = "0.13.2"
anchor-spl = "0.13.2"
anchor-lang = "0.17.0"
anchor-spl = "0.17.0"

View File

@ -1,6 +1,8 @@
use anchor_lang::prelude::*;
use anchor_spl::token::{self, TokenAccount};
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod assert_balances {
use super::*;
@ -40,7 +42,7 @@ pub mod assert_balances {
}
// Deserialize the token account.
let token = CpiAccount::<TokenAccount>::try_accounts(ctx.program_id, &mut accs, &[])?;
let token = Account::<TokenAccount>::try_accounts(ctx.program_id, &mut accs, &[])?;
// Is it owned by the SPL token program.
if token.to_account_info().owner != &token::ID {