Skip to content

Commit

Permalink
increase Pool Minimum ADA from 3 ADA to 4.5 ADA to buffer for ledger …
Browse files Browse the repository at this point in the history
…change and inline datum (#50)

* increase Pool Minimum ADA from 3 ADA to 4.5 ADA to buffer for ledger change and inline datum

* update script
  • Loading branch information
h2physics authored Apr 16, 2024
1 parent 7e09270 commit 7cc7012
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
10 changes: 5 additions & 5 deletions lib/amm_dex_v2/pool_validation.ak
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ pub fn get_batching_pool(
let (value_reserve_a_in, value_reserve_a_out) =
if utils.is_ada_asset(asset_a_policy_id, asset_a_asset_name) {
(
estimate_value_reserve_a_in - 3000000,
estimate_value_reserve_a_out - 3000000,
estimate_value_reserve_a_in - utils.min_pool_ada,
estimate_value_reserve_a_out - utils.min_pool_ada,
)
} else {
(estimate_value_reserve_a_in, estimate_value_reserve_a_out)
Expand All @@ -199,14 +199,14 @@ pub fn get_batching_pool(
value.quantity_of(pool_out_value, authen_policy_id, lp_asset_name)
let estimate_pool_in_value =
value.zero()
|> value.add(ada_policy_id, ada_asset_name, 3000000)
|> value.add(ada_policy_id, ada_asset_name, utils.min_pool_ada)
|> value.add(authen_policy_id, utils.pool_auth_asset_name, 1)
|> value.add(asset_a_policy_id, asset_a_asset_name, value_reserve_a_in)
|> value.add(asset_b_policy_id, asset_b_asset_name, value_reserve_b_in)
|> value.add(authen_policy_id, lp_asset_name, remaining_liquidity_supply_in)
let estimate_pool_out_value =
value.zero()
|> value.add(ada_policy_id, ada_asset_name, 3000000)
|> value.add(ada_policy_id, ada_asset_name, utils.min_pool_ada)
|> value.add(authen_policy_id, utils.pool_auth_asset_name, 1)
|> value.add(asset_a_policy_id, asset_a_asset_name, value_reserve_a_out)
|> value.add(asset_b_policy_id, asset_b_asset_name, value_reserve_b_out)
Expand Down Expand Up @@ -434,7 +434,7 @@ pub fn validate_withdraw_fee_sharing(
value.quantity_of(pool_in_value, asset_a_policy_id, asset_a_asset_name)
let value_reserve_a_in =
if utils.is_ada_asset(asset_a_policy_id, asset_a_asset_name) {
temp_value_reserve_a_in - 3000000
temp_value_reserve_a_in - utils.min_pool_ada
} else {
temp_value_reserve_a_in
}
Expand Down
2 changes: 2 additions & 0 deletions lib/amm_dex_v2/utils.ak
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ pub const max_fee_sharing_numerator = 5000
// Min 16.66%
pub const min_fee_sharing_numerator = 1666

pub const min_pool_ada = 4500000

pub fn sorted_asset(asset_a: Asset, asset_b: Asset) -> Bool {
let Asset { policy_id: asset_a_policy_id, asset_name: asset_a_asset_name } =
asset_a
Expand Down
Loading

0 comments on commit 7cc7012

Please sign in to comment.