@@ -163,7 +163,6 @@ pub mod LaunchpadMarketplace {
163
163
liquidity_raised_amount_in_dollar : u256 ,
164
164
protocol_fee_percent : u256 ,
165
165
creator_fee_percent : u256 ,
166
- is_fees_protocol : bool ,
167
166
step_increase_linear : u256 ,
168
167
// Admins params fees
169
168
is_fees_protocol_sell_enabled : bool ,
@@ -898,7 +897,16 @@ pub mod LaunchpadMarketplace {
898
897
pool . clone (), coin_address , sell_amount , true , false
899
898
);
900
899
let mut quote_amount = quote_amount_total . clone ();
901
-
900
+ // AUDIT
901
+ // Validate against liquidity and balance constraints
902
+ // High security check to do.
903
+ // Approximation and rounding issue can cause to enter this check
904
+ // We maybe do something wrong to enter this check
905
+ // println!("check liq raised and quote amount");
906
+ if pool . liquidity_raised < quote_amount {
907
+ // println!("pool.liquidity_raised < quote_amount");
908
+ quote_amount = pool . liquidity_raised;
909
+ }
902
910
// AUDIT
903
911
// HIGH RISK SECURITY
904
912
// Rounding and approximation of the Linear and Exponential bonding curve can occurs
@@ -911,7 +919,7 @@ pub mod LaunchpadMarketplace {
911
919
// let creator_fee_amount = sell_amount * creator_fee_percent / BPS;
912
920
913
921
// Handle protocol fees if enabled
914
- let is_fees_enabled = self . is_fees_protocol_enabled. read ()
922
+ let is_fees_protocol_enabled = self . is_fees_protocol_enabled. read ()
915
923
&& self . is_fees_protocol_sell_enabled. read ();
916
924
917
925
let mut quote_fee_amount = 0_u256 ;
@@ -922,7 +930,7 @@ pub mod LaunchpadMarketplace {
922
930
// Substract fees protocol from quote amount
923
931
// AUDIT
924
932
// High security check to do: rounding, approximation, balance of contract
925
- if is_fees_enabled {
933
+ if is_fees_protocol_enabled {
926
934
quote_fee_amount = quote_amount * protocol_fee_percent / BPS ;
927
935
quote_amount -= quote_fee_amount ;
928
936
}
@@ -962,28 +970,13 @@ pub mod LaunchpadMarketplace {
962
970
}
963
971
}
964
972
965
- // AUDIT
966
- // Validate against liquidity and balance constraints
967
- // High security check to do.
968
- // Approximation and rounding issue can cause to enter this check
969
- // We maybe do something wrong to enter this check
970
- // println!("check liq raised and quote amount");
971
- if pool . liquidity_raised < quote_amount {
972
- // println!("pool.liquidity_raised < quote_amount");
973
- quote_amount = pool . liquidity_raised;
974
- if is_fees_enabled {
975
- quote_fee_amount = quote_amount * protocol_fee_percent / BPS ;
976
- quote_amount -= quote_fee_amount ;
977
- // creator_fee_amount = quote_amount * creator_fee_percent / BPS;
978
- // quote_amount -= creator_fee_amount;
979
- }
980
- }
973
+
981
974
982
975
// println!("quote_amount: {}", quote_amount.clone());
983
976
assert (pool . liquidity_raised >= quote_amount , errors :: LIQUIDITY_BELOW_AMOUNT );
984
977
985
978
// Transfer protocol fees to the address
986
- if is_fees_enabled && quote_fee_amount > 0 {
979
+ if is_fees_protocol_enabled && quote_fee_amount > 0 {
987
980
quote_token . transfer (self . protocol_fee_destination. read (), quote_fee_amount );
988
981
}
989
982
0 commit comments