diff --git a/Cargo.toml b/Cargo.toml index 313c0b3..2119e06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,13 +7,13 @@ edition = "2021" [dependencies] # anchor-lang = "0.30.1" -anchor-lang = { git = "https://github.com/coral-xyz/anchor.git", rev = "fe4fcded34a68934a6017a85d43a307cdb86d803" } #"f677742a978ffdf7bc321746b4119394f6654b7c" } +anchor-lang = { git = "https://github.com/coral-xyz/anchor.git", rev = "04536725c2ea16329e84bcfe3200afd47eeeb464" } #"fe4fcded34a68934a6017a85d43a307cdb86d803" } #"f677742a978ffdf7bc321746b4119394f6654b7c" } # anchor-client = "0.30.1" -anchor-client = { git = "https://github.com/coral-xyz/anchor.git", rev = "fe4fcded34a68934a6017a85d43a307cdb86d803" } #"f677742a978ffdf7bc321746b4119394f6654b7c" } -spl-token-2022 = "4.0.0" +anchor-client = { git = "https://github.com/coral-xyz/anchor.git", rev = "04536725c2ea16329e84bcfe3200afd47eeeb464" } #"fe4fcded34a68934a6017a85d43a307cdb86d803" } #"f677742a978ffdf7bc321746b4119394f6654b7c" } +spl-token-2022 = "6.0.0" bytemuck = "1.19.0" anyhow = "1.0.91" -solana-program = "~2.0.10" +solana-program = "2.0.18" num-traits = "0.2.19" log = "0.4.22" borsh = "1.5.1" diff --git a/idl/adrena.json b/idl/adrena.json index 686073c..d88f152 100644 --- a/idl/adrena.json +++ b/idl/adrena.json @@ -1,5 +1,5 @@ { - "version": "1.1.1", + "version": "1.1.4", "name": "adrena", "instructions": [ { @@ -1367,19 +1367,27 @@ "name": "swap", "accounts": [ { - "name": "owner", + "name": "caller", "isMut": false, "isSigner": true, "docs": [ "#1" ] }, + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": [ + "#2" + ] + }, { "name": "fundingAccount", "isMut": true, "isSigner": false, "docs": [ - "#2" + "#3" ] }, { @@ -1387,7 +1395,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#3" + "#4" ] }, { @@ -1395,7 +1403,7 @@ "isMut": false, "isSigner": false, "docs": [ - "#4" + "#5" ] }, { @@ -1403,7 +1411,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#5" + "#6" ] }, { @@ -1411,7 +1419,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#6" + "#7" ] }, { @@ -1419,7 +1427,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#7" + "#8" ] }, { @@ -1427,7 +1435,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#8" + "#9" ] }, { @@ -1435,7 +1443,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#9" + "#10" ] }, { @@ -1443,7 +1451,7 @@ "isMut": false, "isSigner": false, "docs": [ - "#10" + "#11" ] }, { @@ -1451,7 +1459,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#11" + "#12" ] }, { @@ -1459,7 +1467,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#12" + "#13" ] }, { @@ -1467,7 +1475,7 @@ "isMut": false, "isSigner": false, "docs": [ - "#13" + "#14" ] }, { @@ -1475,7 +1483,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#14" + "#15" ] }, { @@ -1483,7 +1491,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#15" + "#16" ] }, { @@ -1491,7 +1499,7 @@ "isMut": false, "isSigner": false, "docs": [ - "#16" + "#17" ] }, { @@ -1499,7 +1507,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#17" + "#18" ] }, { @@ -1507,7 +1515,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#18" + "#19" ] }, { @@ -1515,7 +1523,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#19" + "#20" ] }, { @@ -1523,7 +1531,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#20" + "#21" ] }, { @@ -1531,7 +1539,7 @@ "isMut": true, "isSigner": false, "docs": [ - "#21" + "#22" ] }, { @@ -1540,7 +1548,7 @@ "isSigner": false, "isOptional": true, "docs": [ - "#22" + "#23" ] }, { @@ -1548,7 +1556,7 @@ "isMut": false, "isSigner": false, "docs": [ - "#23" + "#24" ] }, { @@ -1556,7 +1564,7 @@ "isMut": false, "isSigner": false, "docs": [ - "#24" + "#25" ] } ], @@ -8481,6 +8489,44 @@ } ], "args": [] + }, + { + "name": "setPoolWhitelistedSwapper", + "accounts": [ + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "#1" + ] + }, + { + "name": "cortex", + "isMut": false, + "isSigner": false, + "docs": [ + "#2" + ] + }, + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "#3" + ] + }, + { + "name": "whitelistedSwapper", + "isMut": false, + "isSigner": false, + "docs": [ + "#4" + ] + } + ], + "args": [] } ], "accounts": [ @@ -8867,10 +8913,23 @@ "type": { "array": [ "publicKey", - 10 + 8 ] } }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "whitelistedSwapper", + "type": "publicKey" + }, { "name": "ratios", "type": { @@ -8878,7 +8937,16 @@ { "defined": "TokenRatios" }, - 10 + 8 + ] + } + }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 16 ] } }, @@ -9434,7 +9502,7 @@ { "defined": "TokenRatios" }, - 10 + 8 ] } } @@ -9453,7 +9521,7 @@ { "defined": "TokenRatios" }, - 10 + 8 ] } } @@ -9526,7 +9594,7 @@ { "defined": "TokenRatios" }, - 10 + 8 ] } } @@ -10327,6 +10395,10 @@ { "name": "cumulativeBorrowFeeUsd", "type": "u64" + }, + { + "name": "cumulativeTradingVolumeUsd", + "type": "u64" } ] } @@ -12152,8 +12224,5 @@ "name": "PositionAlreadyClosed", "msg": "The position is already pending cleanup and close" } - ], - "metadata": { - "address": "13gDzEXCdocbj8iAiqrScGo47NiSuYENGsRqi3SEAwet" - } + ] } \ No newline at end of file diff --git a/idl/adrena.ts b/idl/adrena.ts index 45fefc0..5ce45f8 100644 --- a/idl/adrena.ts +++ b/idl/adrena.ts @@ -1,5 +1,5 @@ export type Adrena = { - "version": "1.1.1", + "version": "1.1.4", "name": "adrena", "instructions": [ { @@ -1367,19 +1367,27 @@ export type Adrena = { "name": "swap", "accounts": [ { - "name": "owner", + "name": "caller", "isMut": false, "isSigner": true, "docs": [ "#1" ] }, + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": [ + "#2" + ] + }, { "name": "fundingAccount", "isMut": true, "isSigner": false, "docs": [ - "#2" + "#3" ] }, { @@ -1387,7 +1395,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#3" + "#4" ] }, { @@ -1395,7 +1403,7 @@ export type Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#4" + "#5" ] }, { @@ -1403,7 +1411,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#5" + "#6" ] }, { @@ -1411,7 +1419,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#6" + "#7" ] }, { @@ -1419,7 +1427,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#7" + "#8" ] }, { @@ -1427,7 +1435,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#8" + "#9" ] }, { @@ -1435,7 +1443,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#9" + "#10" ] }, { @@ -1443,7 +1451,7 @@ export type Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#10" + "#11" ] }, { @@ -1451,7 +1459,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#11" + "#12" ] }, { @@ -1459,7 +1467,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#12" + "#13" ] }, { @@ -1467,7 +1475,7 @@ export type Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#13" + "#14" ] }, { @@ -1475,7 +1483,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#14" + "#15" ] }, { @@ -1483,7 +1491,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#15" + "#16" ] }, { @@ -1491,7 +1499,7 @@ export type Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#16" + "#17" ] }, { @@ -1499,7 +1507,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#17" + "#18" ] }, { @@ -1507,7 +1515,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#18" + "#19" ] }, { @@ -1515,7 +1523,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#19" + "#20" ] }, { @@ -1523,7 +1531,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#20" + "#21" ] }, { @@ -1531,7 +1539,7 @@ export type Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#21" + "#22" ] }, { @@ -1540,7 +1548,7 @@ export type Adrena = { "isSigner": false, "isOptional": true, "docs": [ - "#22" + "#23" ] }, { @@ -1548,7 +1556,7 @@ export type Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#23" + "#24" ] }, { @@ -1556,7 +1564,7 @@ export type Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#24" + "#25" ] } ], @@ -8481,6 +8489,44 @@ export type Adrena = { } ], "args": [] + }, + { + "name": "setPoolWhitelistedSwapper", + "accounts": [ + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "#1" + ] + }, + { + "name": "cortex", + "isMut": false, + "isSigner": false, + "docs": [ + "#2" + ] + }, + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "#3" + ] + }, + { + "name": "whitelistedSwapper", + "isMut": false, + "isSigner": false, + "docs": [ + "#4" + ] + } + ], + "args": [] } ], "accounts": [ @@ -8867,10 +8913,23 @@ export type Adrena = { "type": { "array": [ "publicKey", - 10 + 8 ] } }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "whitelistedSwapper", + "type": "publicKey" + }, { "name": "ratios", "type": { @@ -8878,7 +8937,16 @@ export type Adrena = { { "defined": "TokenRatios" }, - 10 + 8 + ] + } + }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 16 ] } }, @@ -9434,7 +9502,7 @@ export type Adrena = { { "defined": "TokenRatios" }, - 10 + 8 ] } } @@ -9453,7 +9521,7 @@ export type Adrena = { { "defined": "TokenRatios" }, - 10 + 8 ] } } @@ -9526,7 +9594,7 @@ export type Adrena = { { "defined": "TokenRatios" }, - 10 + 8 ] } } @@ -10327,6 +10395,10 @@ export type Adrena = { { "name": "cumulativeBorrowFeeUsd", "type": "u64" + }, + { + "name": "cumulativeTradingVolumeUsd", + "type": "u64" } ] } @@ -12156,7 +12228,7 @@ export type Adrena = { }; export const IDL: Adrena = { - "version": "1.1.1", + "version": "1.1.4", "name": "adrena", "instructions": [ { @@ -13524,19 +13596,27 @@ export const IDL: Adrena = { "name": "swap", "accounts": [ { - "name": "owner", + "name": "caller", "isMut": false, "isSigner": true, "docs": [ "#1" ] }, + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": [ + "#2" + ] + }, { "name": "fundingAccount", "isMut": true, "isSigner": false, "docs": [ - "#2" + "#3" ] }, { @@ -13544,7 +13624,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#3" + "#4" ] }, { @@ -13552,7 +13632,7 @@ export const IDL: Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#4" + "#5" ] }, { @@ -13560,7 +13640,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#5" + "#6" ] }, { @@ -13568,7 +13648,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#6" + "#7" ] }, { @@ -13576,7 +13656,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#7" + "#8" ] }, { @@ -13584,7 +13664,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#8" + "#9" ] }, { @@ -13592,7 +13672,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#9" + "#10" ] }, { @@ -13600,7 +13680,7 @@ export const IDL: Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#10" + "#11" ] }, { @@ -13608,7 +13688,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#11" + "#12" ] }, { @@ -13616,7 +13696,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#12" + "#13" ] }, { @@ -13624,7 +13704,7 @@ export const IDL: Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#13" + "#14" ] }, { @@ -13632,7 +13712,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#14" + "#15" ] }, { @@ -13640,7 +13720,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#15" + "#16" ] }, { @@ -13648,7 +13728,7 @@ export const IDL: Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#16" + "#17" ] }, { @@ -13656,7 +13736,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#17" + "#18" ] }, { @@ -13664,7 +13744,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#18" + "#19" ] }, { @@ -13672,7 +13752,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#19" + "#20" ] }, { @@ -13680,7 +13760,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#20" + "#21" ] }, { @@ -13688,7 +13768,7 @@ export const IDL: Adrena = { "isMut": true, "isSigner": false, "docs": [ - "#21" + "#22" ] }, { @@ -13697,7 +13777,7 @@ export const IDL: Adrena = { "isSigner": false, "isOptional": true, "docs": [ - "#22" + "#23" ] }, { @@ -13705,7 +13785,7 @@ export const IDL: Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#23" + "#24" ] }, { @@ -13713,7 +13793,7 @@ export const IDL: Adrena = { "isMut": false, "isSigner": false, "docs": [ - "#24" + "#25" ] } ], @@ -20638,6 +20718,44 @@ export const IDL: Adrena = { } ], "args": [] + }, + { + "name": "setPoolWhitelistedSwapper", + "accounts": [ + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "#1" + ] + }, + { + "name": "cortex", + "isMut": false, + "isSigner": false, + "docs": [ + "#2" + ] + }, + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "#3" + ] + }, + { + "name": "whitelistedSwapper", + "isMut": false, + "isSigner": false, + "docs": [ + "#4" + ] + } + ], + "args": [] } ], "accounts": [ @@ -21024,10 +21142,23 @@ export const IDL: Adrena = { "type": { "array": [ "publicKey", - 10 + 8 ] } }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "whitelistedSwapper", + "type": "publicKey" + }, { "name": "ratios", "type": { @@ -21035,7 +21166,16 @@ export const IDL: Adrena = { { "defined": "TokenRatios" }, - 10 + 8 + ] + } + }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 16 ] } }, @@ -21591,7 +21731,7 @@ export const IDL: Adrena = { { "defined": "TokenRatios" }, - 10 + 8 ] } } @@ -21610,7 +21750,7 @@ export const IDL: Adrena = { { "defined": "TokenRatios" }, - 10 + 8 ] } } @@ -21683,7 +21823,7 @@ export const IDL: Adrena = { { "defined": "TokenRatios" }, - 10 + 8 ] } } @@ -22484,6 +22624,10 @@ export const IDL: Adrena = { { "name": "cumulativeBorrowFeeUsd", "type": "u64" + }, + { + "name": "cumulativeTradingVolumeUsd", + "type": "u64" } ] } diff --git a/src/pda.rs b/src/pda.rs index e6180d8..8ee6512 100644 --- a/src/pda.rs +++ b/src/pda.rs @@ -3,7 +3,6 @@ use { anchor_lang::prelude::*, }; - #[constant] pub const SEED_CONFIG: &[u8] = b"config";