Skip to content

Commit

Permalink
Remove unneccesary tuples
Browse files Browse the repository at this point in the history
Closes #39
  • Loading branch information
Quantumplation committed Jan 26, 2024
1 parent 4cd115c commit 00d71b1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions validators/pool.ak
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,11 @@ validator(settings_policy_id: PolicyId) {
// sizes of pools, such that an individual LP token is granular enough for depositing and withdrawing for most users.
expect Some(initial_lq) = math.sqrt(coin_a_amt_sans_protocol_fees * coin_b_amt)

// Use the asset names we computed above to compute the whole Asset IDs of the tokens we expect
let new_pool_ref = (own_policy_id, new_pool_ref_token)
let new_pool_nft = (own_policy_id, new_pool_nft_token)
let new_pool_lq = (own_policy_id, new_pool_lp_token)

// And check that we mint the correct tokens, and nothing else.
let expected_mint =
shared.to_value((new_pool_ref.1st, new_pool_ref.2nd, 1))
|> value.merge(shared.to_value((new_pool_nft.1st, new_pool_nft.2nd, 1)))
|> value.merge(shared.to_value((new_pool_lq.1st, new_pool_lq.2nd, initial_lq)))
shared.to_value((own_policy_id, new_pool_ref_token, 1))
|> value.merge(shared.to_value((own_policy_id, new_pool_nft_token, 1)))
|> value.merge(shared.to_value((own_policy_id, new_pool_lp_token, initial_lq)))
let mint_is_correct =
value.from_minted_value(ctx.transaction.mint) == expected_mint

Expand Down

0 comments on commit 00d71b1

Please sign in to comment.