diff --git a/contracts/lending_pool/src/flash_loan_receiver.rs b/contracts/lending_pool/src/flash_loan_receiver.rs index 83d2fd0..4815750 100644 --- a/contracts/lending_pool/src/flash_loan_receiver.rs +++ b/contracts/lending_pool/src/flash_loan_receiver.rs @@ -15,7 +15,7 @@ pub trait FlashLoanReceiver { /// # Arguments /// * `env` - Soroban environment /// * `amount` - Borrowed amount (must repay fully) - /// * `fee` - Flash loan fee (0.08% = 8 bps) + /// * `fee` - Flash loan fee (0.05% = 5 bps) /// * `params` - Caller-provided params (user data) /// /// # Panics diff --git a/contracts/lending_pool/src/lib.rs b/contracts/lending_pool/src/lib.rs index acd37d9..a2401e9 100644 --- a/contracts/lending_pool/src/lib.rs +++ b/contracts/lending_pool/src/lib.rs @@ -4,10 +4,10 @@ use soroban_sdk::{contract, contracterror, contractimpl, contracttype, token, Ad pub mod flash_loan_receiver; pub use flash_loan_receiver::FlashLoanReceiver; -/// Flash loan fee in basis points (8 bps = 0.08%) +/// Flash loan fee in basis points (5 bps = 0.05%) /// This fee compensates Liquidity Providers for temporary risk exposure /// while generating additional protocol revenue. -const FLASH_LOAN_FEE_BPS: i128 = 8; +const FLASH_LOAN_FEE_BPS: i128 = 5; #[contracterror] #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] @@ -431,7 +431,7 @@ impl LendingPool { if amount < 0 { panic_with_error!(&env, Error::MathOverflow); } - // amount * 8 / 10000 + // amount * 5 / 10000 amount .checked_mul(FLASH_LOAN_FEE_BPS) .and_then(|v| v.checked_div(10_000)) @@ -442,7 +442,7 @@ impl LendingPool { /// `amount + calculate_flash_fee(amount)` to be returned before callback returns. /// /// # Flash Loan Fee & LP Share Value - /// A fee of 0.08% (8 bps) is charged. Fees stay in pool reserves, increasing LP share value. + /// A fee of 0.05% (5 bps) is charged. Fees stay in pool reserves, increasing LP share value. /// /// # Callback Interface /// Receiver must implement [`FlashLoanReceiver`] trait: diff --git a/contracts/lending_pool/src/tests.rs b/contracts/lending_pool/src/tests.rs index 7dcfde1..43e41bb 100644 --- a/contracts/lending_pool/src/tests.rs +++ b/contracts/lending_pool/src/tests.rs @@ -254,21 +254,21 @@ use crate::mock_flash_receiver::MockFlashReceiverClient; let contract_id = env.register(crate::LendingPool, ()); let client = LendingPoolClient::new(&env, &contract_id); - // 10000 * 8 / 10000 = 8 - assert_eq!(client.calculate_flash_fee(&10000), 8); + // 10000 * 5 / 10000 = 5 + assert_eq!(client.calculate_flash_fee(&10000), 5); - // 5000 * 8 / 10000 = 4 - assert_eq!(client.calculate_flash_fee(&5000), 4); + // 5000 * 5 / 10000 = 2 + assert_eq!(client.calculate_flash_fee(&5000), 2); // Zero amount assert_eq!(client.calculate_flash_fee(&0), 0); - // Large amount: 1_000_000 * 8 / 10000 = 800 - assert_eq!(client.calculate_flash_fee(&1_000_000), 800); + // Large amount: 1_000_000 * 5 / 10000 = 500 + assert_eq!(client.calculate_flash_fee(&1_000_000), 500); // Max limit consideration: using i128, large amounts won't overflow let large_amount: i128 = 1_000_000_000_000_000; - assert_eq!(client.calculate_flash_fee(&large_amount), 800_000_000_000); + assert_eq!(client.calculate_flash_fee(&large_amount), 500_000_000_000); } #[test]