Skip to content

Commit c9686ff

Browse files
committed
Validator fix on collateral calc
1 parent f5bc902 commit c9686ff

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

on-chain/validators/synth-dolar.ak

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ validator synth_dolar(
3737
let ada_deposited = get_ada_delta(policy_id, inputs, outputs)
3838
let is_deposit_not_zero: Bool = ada_deposited >= 1
3939

40-
// Collateral requirement: deposited ADA must be worth at least
41-
// collateral_ratio% of the synth tokens being minted.
42-
let collateralized_ada = ada_deposited * collateral_ratio / 100
40+
41+
42+
// Collateral requirement: the user can only mint a fraction of the ADA's
43+
// USD value. With collateral_ratio=150, $1.50 of ADA mints $1.00 of synth.
4344
let expected_minted_amount =
44-
compute_expected_synth_amount(collateralized_ada, raw_price, exponent)
45+
compute_expected_synth_amount(ada_deposited, raw_price, exponent) * 100 / collateral_ratio
4546

4647
let is_deposit_correct: Bool = minted_amount == expected_minted_amount
4748

0 commit comments

Comments
 (0)