Skip to content

Commit

Permalink
reorder args
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Jan 14, 2025
1 parent 9531419 commit 3eea0ea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions contracts/svm/testing/src/express_relay/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ pub fn create_swap_instruction(
trader: Pubkey,
searcher_input_ta: Option<Pubkey>,
searcher_output_ta: Option<Pubkey>,
trader_output_ata_override: Option<Pubkey>,
router_fee_receiver_ta: Pubkey,
fee_receiver_relayer: Pubkey,
mint_input: Pubkey,
mint_output: Pubkey,
mint_fee_override: Option<Pubkey>,
token_program_input: Option<Pubkey>,
token_program_output: Option<Pubkey>,
swap_args: SwapArgs,
trader_output_ata_override: Option<Pubkey>,
mint_fee_override: Option<Pubkey>,
) -> Instruction {
let express_relay_metadata = get_express_relay_metadata_key();

Expand Down Expand Up @@ -118,15 +118,15 @@ pub fn build_swap_instructions(
trader: Pubkey,
searcher_input_ta: Option<Pubkey>,
searcher_output_ta: Option<Pubkey>,
trader_output_ata_override: Option<Pubkey>,
router_fee_receiver_ta: Pubkey,
fee_receiver_relayer: Pubkey,
mint_input: Pubkey,
mint_output: Pubkey,
mint_fee_override: Option<Pubkey>,
token_program_input: Option<Pubkey>,
token_program_output: Option<Pubkey>,
swap_args: SwapArgs,
trader_output_ata_override: Option<Pubkey>,
mint_fee_override: Option<Pubkey>,
) -> Vec<Instruction> {
let mut instructions: Vec<Instruction> = vec![];

Expand Down Expand Up @@ -174,15 +174,15 @@ pub fn build_swap_instructions(
trader,
searcher_input_ta,
searcher_output_ta,
trader_output_ata_override,
router_fee_receiver_ta,
fee_receiver_relayer,
mint_input,
mint_output,
mint_fee_override,
Some(token_program_input),
Some(token_program_output),
swap_args,
trader_output_ata_override,
mint_fee_override,
));

instructions
Expand Down
40 changes: 20 additions & 20 deletions contracts/svm/testing/tests/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,15 @@ fn test_swap_fee_input_token(args: SwapSetupParams) {
trader.pubkey(),
None,
None,
None,
router_input_ta,
express_relay_metadata.fee_receiver_relayer,
input_token.mint,
output_token.mint,
None,
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
None,
None,
);
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap();

Expand Down Expand Up @@ -505,15 +505,15 @@ fn test_swap_fee_output_token(args: SwapSetupParams) {
trader.pubkey(),
None,
None,
None,
router_output_ta,
express_relay_metadata.fee_receiver_relayer,
input_token.mint,
output_token.mint,
None,
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
None,
None,
);
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap();

Expand Down Expand Up @@ -606,15 +606,15 @@ fn test_swap_expired_deadline() {
trader.pubkey(),
None,
None,
None,
router_output_ta,
express_relay_metadata.fee_receiver_relayer,
input_token.mint,
output_token.mint,
None,
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
None,
None,
);
let result =
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap_err();
Expand Down Expand Up @@ -654,15 +654,15 @@ fn test_swap_invalid_referral_fee_bps() {
trader.pubkey(),
None,
None,
None,
router_output_ta,
express_relay_metadata.fee_receiver_relayer,
input_token.mint,
output_token.mint,
None,
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
None,
None,
);
let result =
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap_err();
Expand Down Expand Up @@ -702,15 +702,15 @@ fn test_swap_router_ta_has_wrong_mint() {
trader.pubkey(),
None,
None,
None,
router_output_ta,
express_relay_metadata.fee_receiver_relayer,
input_token.mint,
output_token.mint,
None,
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
None,
None,
);
let result =
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap_err();
Expand Down Expand Up @@ -753,15 +753,15 @@ fn test_swap_searcher_ta_wrong_mint() {
trader.pubkey(),
Some(third_token.get_associated_token_address(&searcher.pubkey())),
None,
None,
router_output_ta,
express_relay_metadata.fee_receiver_relayer,
input_token.mint,
output_token.mint,
None,
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
None,
None,
);
let result =
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap_err();
Expand Down Expand Up @@ -801,15 +801,15 @@ fn test_swap_searcher_ta_wrong_owner() {
trader.pubkey(),
Some(input_token.get_associated_token_address(&trader.pubkey())),
None,
None,
router_output_ta,
express_relay_metadata.fee_receiver_relayer,
input_token.mint,
output_token.mint,
None,
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
None,
None,
);
let result =
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap_err();
Expand Down Expand Up @@ -847,15 +847,15 @@ fn test_swap_wrong_express_relay_fee_receiver() {
trader.pubkey(),
None,
None,
None,
router_output_ta,
Keypair::new().pubkey(),
input_token.mint,
output_token.mint,
None,
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
None,
None,
);
let result =
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap_err();
Expand Down Expand Up @@ -896,15 +896,15 @@ fn test_swap_trader_output_ata_is_not_ata() {
trader.pubkey(),
None,
None,
Some(trader_output_ata),
router_output_ta,
express_relay_metadata.fee_receiver_relayer,
input_token.mint,
output_token.mint,
None,
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
Some(trader_output_ata),
None,
);
let result =
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap_err();
Expand Down Expand Up @@ -944,15 +944,15 @@ fn test_swap_wrong_mint_fee() {
trader.pubkey(),
None,
None,
None,
router_input_ta,
express_relay_metadata.fee_receiver_relayer,
input_token.mint,
output_token.mint,
Some(input_token.mint),
Some(input_token.token_program),
Some(output_token.token_program),
swap_args,
None,
Some(input_token.mint),
);
let result =
submit_transaction(&mut svm, &instructions, &searcher, &[&searcher, &trader]).unwrap_err();
Expand Down

0 comments on commit 3eea0ea

Please sign in to comment.