File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use types/u32
1010pub type Action {
1111 Mint
1212 Burn
13+ Liquidate
1314}
1415
1516validator synth_dolar (pyth_policy_id: PolicyId , ada_usd_feed_id: Int ) {
@@ -24,16 +25,34 @@ validator synth_dolar(pyth_policy_id: PolicyId, ada_usd_feed_id: Int) {
2425 let Transaction { mint, .. } = _self
2526 let minted_amount = get_minted_amount (mint, _policy_id)
2627
27- let is_deposit_not_zero: Bool = ada_deposited >= 1
28+ when _redeemer is {
29+ Mint -> {
30+ let is_deposit_not_zero: Bool = ada_deposited >= 1
2831
29- let expected_minted_amount =
30- todo @"compute_expected_synth_amount(ada_deposited, raw_price, exponent) — pending lib from partner"
32+ let expected_minted_amount =
33+ todo @"compute_expected_synth_amount(ada_deposited, raw_price, exponent) — pending lib from partner"
3134
32- let is_deposit_correct: Bool = minted_amount == expected_minted_amount
35+ let is_deposit_correct: Bool = minted_amount == expected_minted_amount
3336
34- and {
35- is_deposit_correct,
36- is_deposit_not_zero
37+ and {
38+ is_deposit_not_zero,
39+ is_deposit_correct,
40+ }
41+ }
42+
43+ Burn -> {
44+ let is_withdrawal_not_zero: Bool = ada_deposited <= - 1
45+
46+ let expected_burned_amount =
47+ todo @"compute_expected_synth_amount(-ada_deposited, raw_price, exponent) — pending lib from partner"
48+
49+ let is_burn_correct: Bool = minted_amount == - expected_burned_amount
50+
51+ and {
52+ is_withdrawal_not_zero,
53+ is_burn_correct,
54+ }
55+ }
3756 }
3857 }
3958
You can’t perform that action at this time.
0 commit comments