Skip to content

Commit

Permalink
anchor: track swap output asset (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurushao authored Nov 4, 2024
1 parent 0586429 commit e15d2dc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions anchor/programs/glam/src/instructions/jupiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ pub fn jupiter_swap<'c: 'info, 'info>(
});
require!(can_swap_any_asset, ManagerError::InvalidAssetForSwap);
}
}

// Add output mint to fund assets
if !output_in_assets {
assets.push(ctx.accounts.output_mint.key());
}
// Add output mint to fund assets
if !output_in_assets {
assets.push(ctx.accounts.output_mint.key());
}

// Parse Jupiter Swap accounts
Expand Down
9 changes: 9 additions & 0 deletions anchor/programs/glam/src/state/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,4 +856,13 @@ static ASSETS: phf::Map<&'static str, AssetMeta> = phf_map! {
pyth_account: "",
staking_state: "FxhzbU8rn4MhZxmeH2u7M18qkvFH3LjkWk8z9686TE45",
},

// bbSOL
"Bybit2vBJGhPF52GBdNaQfUJ6ZpThSgHBobjWZpLPb4B" => AssetMeta {
decimals: 9,
is_stable_coin: false,
is_token_2022: false,
pyth_account: "",
staking_state: "2aMLkB5p5gVvCwKkdSo5eZAL1WwhZbxezQr1wxiynRhq",
},
};
9 changes: 9 additions & 0 deletions anchor/src/client/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,15 @@ export const ASSETS_MAINNET: Map<string, AssetMeta> = new Map([
),
},
],
[
// bbSOL
"Bybit2vBJGhPF52GBdNaQfUJ6ZpThSgHBobjWZpLPb4B",
{
stateAccount: new PublicKey(
"2aMLkB5p5gVvCwKkdSo5eZAL1WwhZbxezQr1wxiynRhq" // state
),
},
],
]);

export const ASSETS_TESTS: Map<string, AssetMeta> = new Map([
Expand Down

0 comments on commit e15d2dc

Please sign in to comment.