Skip to content

Commit 8fcedaf

Browse files
committed
fix: fmt lifinity amm v2 decoder instruction mod file
1 parent 92100c8 commit 8fcedaf

File tree

2 files changed

+57
-40
lines changed

2 files changed

+57
-40
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

decoders/lifinity-amm-v2-decoder/src/instructions/mod.rs

Lines changed: 56 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@ mod tests {
141141

142142
#[test]
143143
fn test_decode_deposit_all_token_types() {
144-
let expected_ix = LifinityAmmV2Instruction::DepositAllTokenTypes(deposit_all_token_types::DepositAllTokenTypes {
145-
pool_token_amount: 2457402,
146-
maximum_token_a_amount: 1000000,
147-
maximum_token_b_amount: 64575,
148-
});
144+
let expected_ix = LifinityAmmV2Instruction::DepositAllTokenTypes(
145+
deposit_all_token_types::DepositAllTokenTypes {
146+
pool_token_amount: 2457402,
147+
maximum_token_a_amount: 1000000,
148+
maximum_token_b_amount: 64575,
149+
},
150+
);
149151

150152
let expected_accounts = vec![
151153
AccountMeta::new(
@@ -190,27 +192,32 @@ mod tests {
190192
),
191193
];
192194

193-
let expected_arranged_accounts = deposit_all_token_types::DepositAllTokenTypesInstructionAccounts {
194-
amm: pubkey!("4ruXyJT6rgHERQeVmMCc5pJDC5wgLujuMjTQgY562sdh"),
195-
authority: pubkey!("2p4AA6xU2gxVvCVMVMAwpmyF49zBfp9MD4Ef8JeGVeMY"),
196-
user_transfer_authority_info: pubkey!("CbYf9QNrkVgNRCMTDiVdvzMqSzXh8AAgnrKAoTfEACdh"),
197-
source_a_info: pubkey!("oVzCGsiinVTxPNmWFzi4QvGJ1iyhzUHj148Jc7SPuyj"),
198-
source_b_info: pubkey!("74NpLshFLkuVyFKq2L3yBU2V8mcExSGy5E8tjCpMfVvU"),
199-
token_a: pubkey!("7GawBqVSriYXQYCTr5XygeRNTeHamRWeHmVFiuf6wLfK"),
200-
token_b: pubkey!("7oWW46LfAzrzWaZxV8CURBKpWwR8cc3ZpaXMFi6CH8sC"),
201-
pool_mint: pubkey!("Dt1EBunetoSDPSEj2EB5m5bc93bt75ZB8Yy9vmaJ2ng"),
202-
destination: pubkey!("3hmRWv4Qik4rEzut8kqjxChN3n7Ms1MLKFKLqcoWkbGg"),
203-
token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
204-
};
195+
let expected_arranged_accounts =
196+
deposit_all_token_types::DepositAllTokenTypesInstructionAccounts {
197+
amm: pubkey!("4ruXyJT6rgHERQeVmMCc5pJDC5wgLujuMjTQgY562sdh"),
198+
authority: pubkey!("2p4AA6xU2gxVvCVMVMAwpmyF49zBfp9MD4Ef8JeGVeMY"),
199+
user_transfer_authority_info: pubkey!(
200+
"CbYf9QNrkVgNRCMTDiVdvzMqSzXh8AAgnrKAoTfEACdh"
201+
),
202+
source_a_info: pubkey!("oVzCGsiinVTxPNmWFzi4QvGJ1iyhzUHj148Jc7SPuyj"),
203+
source_b_info: pubkey!("74NpLshFLkuVyFKq2L3yBU2V8mcExSGy5E8tjCpMfVvU"),
204+
token_a: pubkey!("7GawBqVSriYXQYCTr5XygeRNTeHamRWeHmVFiuf6wLfK"),
205+
token_b: pubkey!("7oWW46LfAzrzWaZxV8CURBKpWwR8cc3ZpaXMFi6CH8sC"),
206+
pool_mint: pubkey!("Dt1EBunetoSDPSEj2EB5m5bc93bt75ZB8Yy9vmaJ2ng"),
207+
destination: pubkey!("3hmRWv4Qik4rEzut8kqjxChN3n7Ms1MLKFKLqcoWkbGg"),
208+
token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
209+
};
205210

206211
let decoder = LifinityAmmV2Decoder;
207-
let instruction = carbon_test_utils::read_instruction("tests/fixtures/deposit_all_token_types_ix.json")
208-
.expect("read fixture");
212+
let instruction =
213+
carbon_test_utils::read_instruction("tests/fixtures/deposit_all_token_types_ix.json")
214+
.expect("read fixture");
209215
let decoded = decoder
210216
.decode_instruction(&instruction)
211217
.expect("decode instruction");
212218
let decoded_arranged_accounts =
213-
deposit_all_token_types::DepositAllTokenTypes::arrange_accounts(&instruction.accounts).expect("arrange accounts");
219+
deposit_all_token_types::DepositAllTokenTypes::arrange_accounts(&instruction.accounts)
220+
.expect("arrange accounts");
214221

215222
assert_eq!(decoded.data, expected_ix);
216223
assert_eq!(decoded.program_id, PROGRAM_ID);
@@ -220,11 +227,13 @@ mod tests {
220227

221228
#[test]
222229
fn test_decode_withdraw_all_token_types() {
223-
let expected_ix = LifinityAmmV2Instruction::WithdrawAllTokenTypes(withdraw_all_token_types::WithdrawAllTokenTypes {
224-
pool_token_amount: 2000655039581,
225-
minimum_token_a_amount: 1076172871830,
226-
minimum_token_b_amount: 752578501683,
227-
});
230+
let expected_ix = LifinityAmmV2Instruction::WithdrawAllTokenTypes(
231+
withdraw_all_token_types::WithdrawAllTokenTypes {
232+
pool_token_amount: 2000655039581,
233+
minimum_token_a_amount: 1076172871830,
234+
minimum_token_b_amount: 752578501683,
235+
},
236+
);
228237

229238
let expected_accounts = vec![
230239
AccountMeta::new(
@@ -269,27 +278,34 @@ mod tests {
269278
),
270279
];
271280

272-
let expected_arranged_accounts = withdraw_all_token_types::WithdrawAllTokenTypesInstructionAccounts {
273-
amm: pubkey!("DrRd8gYMJu9XGxLhwTCPdHNLXCKHsxJtMpbn62YqmwQe"),
274-
authority: pubkey!("7GmDCbu7bYiWJvFaNUyPNiM8PjvvBcmyBcZY1qSsAGi2"),
275-
user_transfer_authority_info: pubkey!("71hhezkHQ2dhmPySsHVCCkLggfWzPFEBdfEjbn4NCXMG"),
276-
source_info: pubkey!("A9x5SwN9vbg3YDxZySDWaHuVoQQ8YSJDrmjFZ3yMksqW"),
277-
token_a: pubkey!("EVGW4q1iFjDmtxtHr3NoPi5iVKAxwEjohsusMrinDxr6"),
278-
token_b: pubkey!("53EkU98Vbv2TQPwGG6t2asCynzFjCX5AnvaabbXafaed"),
279-
pool_mint: pubkey!("FGYgFJSxZTGzaLwzUL9YZqK2yUZ8seofCwGq8BPEw4o8"),
280-
dest_token_a_info: pubkey!("Gf5ucgWGfJ8NLvVaKJVen9CYsPFRK4eAsZWT8zDjARkA"),
281-
dest_token_b_info: pubkey!("8vPGw7d6a4rmejVg2uXMs8kvEnVy7WgN1oNk9mRpdfGP"),
282-
token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
283-
};
281+
let expected_arranged_accounts =
282+
withdraw_all_token_types::WithdrawAllTokenTypesInstructionAccounts {
283+
amm: pubkey!("DrRd8gYMJu9XGxLhwTCPdHNLXCKHsxJtMpbn62YqmwQe"),
284+
authority: pubkey!("7GmDCbu7bYiWJvFaNUyPNiM8PjvvBcmyBcZY1qSsAGi2"),
285+
user_transfer_authority_info: pubkey!(
286+
"71hhezkHQ2dhmPySsHVCCkLggfWzPFEBdfEjbn4NCXMG"
287+
),
288+
source_info: pubkey!("A9x5SwN9vbg3YDxZySDWaHuVoQQ8YSJDrmjFZ3yMksqW"),
289+
token_a: pubkey!("EVGW4q1iFjDmtxtHr3NoPi5iVKAxwEjohsusMrinDxr6"),
290+
token_b: pubkey!("53EkU98Vbv2TQPwGG6t2asCynzFjCX5AnvaabbXafaed"),
291+
pool_mint: pubkey!("FGYgFJSxZTGzaLwzUL9YZqK2yUZ8seofCwGq8BPEw4o8"),
292+
dest_token_a_info: pubkey!("Gf5ucgWGfJ8NLvVaKJVen9CYsPFRK4eAsZWT8zDjARkA"),
293+
dest_token_b_info: pubkey!("8vPGw7d6a4rmejVg2uXMs8kvEnVy7WgN1oNk9mRpdfGP"),
294+
token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
295+
};
284296

285297
let decoder = LifinityAmmV2Decoder;
286-
let instruction = carbon_test_utils::read_instruction("tests/fixtures/withdraw_all_token_types_ix.json")
287-
.expect("read fixture");
298+
let instruction =
299+
carbon_test_utils::read_instruction("tests/fixtures/withdraw_all_token_types_ix.json")
300+
.expect("read fixture");
288301
let decoded = decoder
289302
.decode_instruction(&instruction)
290303
.expect("decode instruction");
291304
let decoded_arranged_accounts =
292-
withdraw_all_token_types::WithdrawAllTokenTypes::arrange_accounts(&instruction.accounts).expect("arrange accounts");
305+
withdraw_all_token_types::WithdrawAllTokenTypes::arrange_accounts(
306+
&instruction.accounts,
307+
)
308+
.expect("arrange accounts");
293309

294310
assert_eq!(decoded.data, expected_ix);
295311
assert_eq!(decoded.program_id, PROGRAM_ID);

0 commit comments

Comments
 (0)