Bump anchor v0.9.0 and export ID

This commit is contained in:
armaniferrante 2021-06-26 10:19:06 -07:00
parent 7bfa4d6fab
commit c4223c4880
No known key found for this signature in database
GPG Key ID: 58BEF301E91F7828
3 changed files with 94 additions and 64 deletions

94
Cargo.lock generated
View File

@ -25,9 +25,9 @@ checksum = "6b2d54853319fd101b8dd81de382bcbf3e03410a64d8928bbee85a3e7dcde483"
[[package]]
name = "anchor-attribute-access-control"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59a5a5b14eaa4535945c4799a2121d935dea2aa990e89b892985434471ed05ae"
checksum = "479e8f2646f29e2dfbbe4e17fa0653f0adf5c8a04ad326a4459984744779dba4"
dependencies = [
"anchor-syn",
"anyhow",
@ -39,9 +39,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-account"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1076ad7bc578c864fa559f16c172c1463d8cb02b6443b8061e623c212652921"
checksum = "6487b31039b831a08f3c45ea92e2bbbeca0a420b4fb3e85740cf1f05ad6fee27"
dependencies = [
"anchor-syn",
"anyhow",
@ -52,9 +52,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-error"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7acb3a4f83627cce3912d9915acf7db78b5f7c3fbec8375ba766db2f58aa2054"
checksum = "f9bbf7db6ebc60396903989e82c092279f7ebb8d45a7374f4a3600a38111039e"
dependencies = [
"anchor-syn",
"proc-macro2",
@ -64,9 +64,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-event"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e396eb7941e35f545e11d499300d738feccdc920e7dbcea30adcce349669e545"
checksum = "67f7487563d039a233f87edb7ffbe5ff92fe3a170c879a8076d5062cb7195b9d"
dependencies = [
"anchor-syn",
"anyhow",
@ -77,9 +77,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-interface"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "848ddeeeffdf3e3c2ea006bd8b00716bebae6ba92aeb34bdb7db16bc7744fb7e"
checksum = "3443a6f06f9e426bbbd28aa79fb7c16ba2c2f13fbd83bb12f1f3255d62ed409e"
dependencies = [
"anchor-syn",
"anyhow",
@ -91,9 +91,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-program"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc72e379b34a4f975f02dd6b500126e381000fd526e4388072fa2ef5e4aef2db"
checksum = "3a7121581092a0c0d6841d15d3c5bef1e440a479f0cdf80a7106d5dacba069a2"
dependencies = [
"anchor-syn",
"anyhow",
@ -104,9 +104,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-state"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75d9cfa1d15e665f6c67e3bfb3d95069edfaaf140bf0c2c3f9f78455bed45ef4"
checksum = "998663806dbd6fb9a08cf17c9ae072dd3a6da262a28166e13b1be5b59539440c"
dependencies = [
"anchor-syn",
"anyhow",
@ -117,9 +117,9 @@ dependencies = [
[[package]]
name = "anchor-derive-accounts"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89e0562d6e20af401acc334db975adf2f4243096102188d53ba767ebd47da93c"
checksum = "df3cee4342989ae84303015e4276c62fef6e97788acb0db943a771ed51bc174e"
dependencies = [
"anchor-syn",
"anyhow",
@ -130,9 +130,9 @@ dependencies = [
[[package]]
name = "anchor-lang"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eab80a68813ec31bd9068e7e16665aae7d0bf1a96ef032155b837d66ed91620"
checksum = "2d30de5a0690275bdaff35ad9e92b3a034e69f56c2140b7f3d220f8aa5cc7502"
dependencies = [
"anchor-attribute-access-control",
"anchor-attribute-account",
@ -151,9 +151,9 @@ dependencies = [
[[package]]
name = "anchor-spl"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc7645f58767121a6e04681a444af5358c5780d211cffb2793b4e6c3d1de3c72"
checksum = "c97177591843cf707b2efcc9e1b05a23c17bba3356315ef2373af3c3a5165fb0"
dependencies = [
"anchor-lang",
"lazy_static",
@ -164,9 +164,9 @@ dependencies = [
[[package]]
name = "anchor-syn"
version = "0.7.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf72c2970b8dd3c81aa7da780357d24d535f11d878cbf186662a60c09771f6d"
checksum = "2be3cbb0586a6c4ee587c8e163c096bf5df7475862a8f31f02788bfec129cfd3"
dependencies = [
"anyhow",
"bs58",
@ -251,9 +251,16 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
"block-padding",
"generic-array 0.14.4",
]
[[package]]
name = "block-padding"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]]
name = "borsh"
version = "0.8.2"
@ -549,6 +556,12 @@ version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]]
name = "keccak"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7"
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -889,10 +902,22 @@ dependencies = [
]
[[package]]
name = "solana-frozen-abi"
version = "1.6.6"
name = "sha3"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10272e9486b3cb41b04e899929c521c5c2a037ba6be1651cff68ad3959f4d1f9"
checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809"
dependencies = [
"block-buffer",
"digest 0.9.0",
"keccak",
"opaque-debug",
]
[[package]]
name = "solana-frozen-abi"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95c481f0f29753f5b2d382628abae98a1dd87b572ddc7cbe5fe55ca62b6f7f07"
dependencies = [
"bs58",
"bv",
@ -910,11 +935,10 @@ dependencies = [
[[package]]
name = "solana-frozen-abi-macro"
version = "1.6.6"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82f4b6a34f19cc4b09da1919ff9810c1a499c7e77fc9d26bea022f69dc965edf"
checksum = "f2068bcc47160ac9081893439b10a05e4bbe85cc0f6bccb6f1b0815423fbdd0c"
dependencies = [
"lazy_static",
"proc-macro2",
"quote",
"rustc_version 0.2.3",
@ -923,9 +947,9 @@ dependencies = [
[[package]]
name = "solana-logger"
version = "1.6.6"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c17fa89f2e5fe988cf95a34df411950db4609f68af8df602371d9b7f83cefa7"
checksum = "7ea5932e186629f47859924b3773cfd8bcb4b8796898ac85c1fa0a6a2024e5c6"
dependencies = [
"env_logger",
"lazy_static",
@ -934,9 +958,9 @@ dependencies = [
[[package]]
name = "solana-program"
version = "1.6.6"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "885552ce43e9f2cf13fda274bf2b4ef75c5de6e5e0190f53acb83f84cda739c0"
checksum = "7a2df39c63e21c5b58e2012e7675bed5e8dd5100470ffddedcafb78f5a7e3abe"
dependencies = [
"bincode",
"blake3",
@ -958,6 +982,7 @@ dependencies = [
"serde_bytes",
"serde_derive",
"sha2",
"sha3",
"solana-frozen-abi",
"solana-frozen-abi-macro",
"solana-logger",
@ -967,9 +992,9 @@ dependencies = [
[[package]]
name = "solana-sdk-macro"
version = "1.6.6"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8264149655cbbcfa1dccd0dc9f62eb04d6832ec08540fcb81db6f305a21d3b65"
checksum = "6473d8fa445520564c84e8803320721404d160ffd876a125326a726541f11534"
dependencies = [
"bs58",
"proc-macro2",
@ -1010,6 +1035,7 @@ version = "0.1.0"
dependencies = [
"anchor-lang",
"anchor-spl",
"solana-program",
]
[[package]]

View File

@ -15,5 +15,6 @@ cpi = ["no-entrypoint"]
default = []
[dependencies]
anchor-lang = "0.7.0"
anchor-spl = "0.7.0"
anchor-lang = "0.9.0"
anchor-spl = "0.9.0"
solana-program = "1.7.1"

View File

@ -13,8 +13,11 @@ use anchor_spl::dex::serum_dex::instruction::SelfTradeBehavior;
use anchor_spl::dex::serum_dex::matching::{OrderType, Side as SerumSide};
use anchor_spl::dex::serum_dex::state::MarketState;
use anchor_spl::token;
use solana_program::declare_id;
use std::num::NonZeroU64;
declare_id!("22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD");
#[program]
pub mod swap {
use super::*;
@ -364,16 +367,16 @@ impl<'info> From<&mut CloseAccount<'info>> for dex::CloseOpenOrders<'info> {
// done by the DEX on CPI.
#[derive(Accounts)]
pub struct Swap<'info> {
market: MarketAccounts<'info>,
pub market: MarketAccounts<'info>,
#[account(signer)]
authority: AccountInfo<'info>,
pub authority: AccountInfo<'info>,
#[account(mut)]
pc_wallet: AccountInfo<'info>,
pub pc_wallet: AccountInfo<'info>,
// Programs.
dex_program: AccountInfo<'info>,
token_program: AccountInfo<'info>,
pub dex_program: AccountInfo<'info>,
pub token_program: AccountInfo<'info>,
// Sysvars.
rent: AccountInfo<'info>,
pub rent: AccountInfo<'info>,
}
impl<'info> From<&Swap<'info>> for OrderbookClient<'info> {
@ -395,18 +398,18 @@ impl<'info> From<&Swap<'info>> for OrderbookClient<'info> {
// the same on both markets since there's only one account field for it).
#[derive(Accounts)]
pub struct SwapTransitive<'info> {
from: MarketAccounts<'info>,
to: MarketAccounts<'info>,
pub from: MarketAccounts<'info>,
pub to: MarketAccounts<'info>,
// Must be the authority over all open orders accounts used.
#[account(signer)]
authority: AccountInfo<'info>,
pub authority: AccountInfo<'info>,
#[account(mut)]
pc_wallet: AccountInfo<'info>,
pub pc_wallet: AccountInfo<'info>,
// Programs.
dex_program: AccountInfo<'info>,
token_program: AccountInfo<'info>,
pub dex_program: AccountInfo<'info>,
pub token_program: AccountInfo<'info>,
// Sysvars.
rent: AccountInfo<'info>,
pub rent: AccountInfo<'info>,
}
impl<'info> SwapTransitive<'info> {
@ -581,36 +584,36 @@ fn coin_lots(market: &MarketState, size: u64) -> u64 {
#[derive(Accounts, Clone)]
pub struct MarketAccounts<'info> {
#[account(mut)]
market: AccountInfo<'info>,
pub market: AccountInfo<'info>,
#[account(mut)]
open_orders: AccountInfo<'info>,
pub open_orders: AccountInfo<'info>,
#[account(mut)]
request_queue: AccountInfo<'info>,
pub request_queue: AccountInfo<'info>,
#[account(mut)]
event_queue: AccountInfo<'info>,
pub event_queue: AccountInfo<'info>,
#[account(mut)]
bids: AccountInfo<'info>,
pub bids: AccountInfo<'info>,
#[account(mut)]
asks: AccountInfo<'info>,
pub asks: AccountInfo<'info>,
// The `spl_token::Account` that funds will be taken from, i.e., transferred
// from the user into the market's vault.
//
// For bids, this is the base currency. For asks, the quote.
#[account(mut)]
order_payer_token_account: AccountInfo<'info>,
pub order_payer_token_account: AccountInfo<'info>,
// Also known as the "base" currency. For a given A/B market,
// this is the vault for the A mint.
#[account(mut)]
coin_vault: AccountInfo<'info>,
pub coin_vault: AccountInfo<'info>,
// Also known as the "quote" currency. For a given A/B market,
// this is the vault for the B mint.
#[account(mut)]
pc_vault: AccountInfo<'info>,
pub pc_vault: AccountInfo<'info>,
// PDA owner of the DEX's token accounts for base + quote currencies.
vault_signer: AccountInfo<'info>,
pub vault_signer: AccountInfo<'info>,
// User wallets.
#[account(mut)]
coin_wallet: AccountInfo<'info>,
pub coin_wallet: AccountInfo<'info>,
}
#[derive(AnchorSerialize, AnchorDeserialize)]
@ -686,12 +689,12 @@ pub struct ExchangeRate {
// The amount of *to* tokens one should receive for a single *from token.
// This number must be in native *to* units with the same amount of decimals
// as the *to* mint.
rate: u64,
pub rate: u64,
// Number of decimals of the *from* token's mint.
from_decimals: u8,
pub from_decimals: u8,
// Number of decimals of the *to* token's mint.
// For a direct swap, this should be zero.
quote_decimals: u8,
pub quote_decimals: u8,
// True if *all* of the *from* currency sold should be used when calculating
// the executed exchange rate.
//
@ -710,7 +713,7 @@ pub struct ExchangeRate {
// *to* mint received before calculating the swap's exchange rate.
//
// Transitive swaps only. For direct swaps, this field is ignored.
strict: bool,
pub strict: bool,
}
#[error]