When [ (Case (Deposit (Role "Party") (Role "Party") (Token "" "") (ConstantParam "Amount paid by party")) (When [ (Case (Deposit (Address "addr1v87n0zzth5zycuh972w7rdmh48qur4f3wu6ntn2m2h30dlchhlqt3") (Role "Counterparty") (Token "" "") (ConstantParam "Amount paid by counterparty")) (When [] (TimeParam "First window beginning") (When [ (Case (Choice (ChoiceId "dir-adausd" (Role "kraken")) [ (Bound 0 100000000000)]) (When [] (TimeParam "Second window beginning") (When [ (Case (Choice (ChoiceId "inv-adausd" (Role "kraken")) [ (Bound 0 100000000000)]) (Let "Price in second window" (DivValue (MulValue (ConstantParam "Amount of lovelace to use as asset") (MulValue (ChoiceValue (ChoiceId "dir-adausd" (Role "kraken"))) (ChoiceValue (ChoiceId "inv-adausd" (Role "kraken"))))) (Constant 10000000000000000)) (If (ValueEQ (ConstantParam "Amount of lovelace to use as asset") (UseValue "Price in second window")) (Let "Decrease in price" (SubValue (ConstantParam "Amount of lovelace to use as asset") (UseValue "Price in second window")) (Pay (Role "Counterparty") (Account (Role "Party")) (Token "" "") (Cond (ValueLT (UseValue "Decrease in price") (ConstantParam "Amount paid by counterparty")) (UseValue "Decrease in price") (ConstantParam "Amount paid by counterparty")) Close)) (If (ValueLT (ConstantParam "Amount of lovelace to use as asset") (UseValue "Price in second window")) (Let "Increase in price" (SubValue (UseValue "Price in second window") (ConstantParam "Amount of lovelace to use as asset")) (Pay (Role "Party") (Account (Role "Counterparty")) (Token "" "") (Cond (ValueLT (UseValue "Increase in price") (ConstantParam "Amount paid by party")) (UseValue "Increase in price") (ConstantParam "Amount paid by party")) Close)) Close))))] (TimeParam "Second window deadline") Close)))] (TimeParam "First window deadline") Close)))] (TimeParam "Counterparty deposit deadline") Close))] (TimeParam "Party deposit deadline") Close