Skip to content

Commit

Permalink
avoid division by zero (#33)
Browse files Browse the repository at this point in the history
* avoid division by zero

* add build script
  • Loading branch information
h2physics authored Feb 11, 2024
1 parent 17ab42b commit 242e522
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/amm_dex_v2/order_validation.ak
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ pub fn apply_orders(
) -> {
expect and {
io_ratio_numerator > 0,
io_ratio_numerator > 0,
io_ratio_denominator > 0,
hops > 0,
minimum_swap_amount_required > 0,
total_swap_amount >= minimum_swap_amount_required,
Expand Down
2 changes: 2 additions & 0 deletions lib/amm_dex_v2/pool_validation.ak
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ pub fn validate_trading_fee_percent(
trading_fee_numerator: Int,
trading_fee_denominator: Int,
) -> Bool {
expect trading_fee_denominator > 0
// Max 10%, Min 0.05%
let max_trading_fee_numerator = 1
let max_trading_fee_denominator = 10
Expand All @@ -615,6 +616,7 @@ pub fn validate_fee_sharing_percent(
fee_sharing_numerator: Int,
fee_sharing_denominator: Int,
) -> Bool {
expect fee_sharing_denominator > 0
// Max 50%, Min 16.66%
let max_fee_sharing_numerator = 1
let max_fee_sharing_denominator = 2
Expand Down
8 changes: 4 additions & 4 deletions plutus.json

Large diffs are not rendered by default.

0 comments on commit 242e522

Please sign in to comment.