fix warnings
This commit is contained in:
@@ -19,6 +19,7 @@ pub struct CreateListing<'info> {
|
|||||||
pub system_program: Program<'info, System>,
|
pub system_program: Program<'info, System>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn handler(
|
pub fn handler(
|
||||||
ctx: Context<CreateListing>,
|
ctx: Context<CreateListing>,
|
||||||
listing_id: u64,
|
listing_id: u64,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ pub struct UpdateListing<'info> {
|
|||||||
pub listing_account: Account<'info, ListingAccount>,
|
pub listing_account: Account<'info, ListingAccount>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn handler(
|
pub fn handler(
|
||||||
ctx: Context<UpdateListing>,
|
ctx: Context<UpdateListing>,
|
||||||
canonical_currency: Currency,
|
canonical_currency: Currency,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![allow(clippy::diverging_sub_expression)]
|
||||||
|
|
||||||
pub mod constants;
|
pub mod constants;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod instructions;
|
pub mod instructions;
|
||||||
@@ -19,6 +21,7 @@ pub mod solisting {
|
|||||||
initialize::handler(ctx)
|
initialize::handler(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn create_listing(
|
pub fn create_listing(
|
||||||
ctx: Context<CreateListing>,
|
ctx: Context<CreateListing>,
|
||||||
listing_id: u64,
|
listing_id: u64,
|
||||||
@@ -36,6 +39,7 @@ pub mod solisting {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn update_listing(
|
pub fn update_listing(
|
||||||
ctx: Context<UpdateListing>,
|
ctx: Context<UpdateListing>,
|
||||||
canonical_currency: state::Currency,
|
canonical_currency: state::Currency,
|
||||||
|
|||||||
@@ -78,10 +78,7 @@ pub fn convert_with_slippage(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if max_slippage_bps > 0 && expected_amount > 0 {
|
if max_slippage_bps > 0 && expected_amount > 0 {
|
||||||
let tolerance = (expected_amount as u128)
|
let tolerance = (expected_amount as u128).saturating_mul(max_slippage_bps as u128) / 10_000;
|
||||||
.checked_mul(max_slippage_bps as u128)
|
|
||||||
.unwrap_or(u128::MAX)
|
|
||||||
/ 10_000;
|
|
||||||
let diff = computed.abs_diff(expected_amount) as u128;
|
let diff = computed.abs_diff(expected_amount) as u128;
|
||||||
require!(diff <= tolerance, SolistingError::SlippageExceeded);
|
require!(diff <= tolerance, SolistingError::SlippageExceeded);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ pub fn send(svm: &mut LiteSVM, ixs: &[Instruction], signers: &[&Keypair]) {
|
|||||||
svm.send_transaction(tx).expect("transaction failed");
|
svm.send_transaction(tx).expect("transaction failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::result_large_err)]
|
||||||
pub fn try_send(
|
pub fn try_send(
|
||||||
svm: &mut LiteSVM,
|
svm: &mut LiteSVM,
|
||||||
ixs: &[Instruction],
|
ixs: &[Instruction],
|
||||||
@@ -90,6 +91,7 @@ pub fn try_send(
|
|||||||
|
|
||||||
// --- Listing instruction builders ---
|
// --- Listing instruction builders ---
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn ix_create_listing(
|
pub fn ix_create_listing(
|
||||||
seller: &Pubkey,
|
seller: &Pubkey,
|
||||||
listing_id: u64,
|
listing_id: u64,
|
||||||
@@ -124,6 +126,7 @@ pub fn ix_create_listing(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn ix_update_listing(
|
pub fn ix_update_listing(
|
||||||
seller: &Pubkey,
|
seller: &Pubkey,
|
||||||
listing_id: u64,
|
listing_id: u64,
|
||||||
@@ -173,6 +176,7 @@ pub fn ix_close_listing(seller: &Pubkey, listing_id: u64) -> Instruction {
|
|||||||
|
|
||||||
/// Build a create_order instruction paying in the canonical currency (no oracle accounts needed).
|
/// Build a create_order instruction paying in the canonical currency (no oracle accounts needed).
|
||||||
/// For alt-currency orders, use ix_create_order_with_resolver with explicit oracle keys.
|
/// For alt-currency orders, use ix_create_order_with_resolver with explicit oracle keys.
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn ix_create_order(
|
pub fn ix_create_order(
|
||||||
buyer: &Pubkey,
|
buyer: &Pubkey,
|
||||||
seller: &Pubkey,
|
seller: &Pubkey,
|
||||||
@@ -197,6 +201,7 @@ pub fn ix_create_order(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn ix_create_order_with_resolver(
|
pub fn ix_create_order_with_resolver(
|
||||||
buyer: &Pubkey,
|
buyer: &Pubkey,
|
||||||
seller: &Pubkey,
|
seller: &Pubkey,
|
||||||
|
|||||||
Reference in New Issue
Block a user