diff --git a/examples/plutus.mdx b/examples/plutus.mdx index 71a447c..a38dae4 100644 --- a/examples/plutus.mdx +++ b/examples/plutus.mdx @@ -11,9 +11,9 @@ party Beneficiary; policy TimeLock = 0x6b9c456aa650cb808a9ab54326e039d5235ed69f069c9664a8fe5b69; type State { - lock_until: Int, - owner: Bytes, - beneficiary: Bytes, + lock_until: Int, + owner: Bytes, + beneficiary: Bytes, } tx lock( @@ -24,7 +24,7 @@ tx lock( from: Owner, min_amount: Ada(quantity) + fees, } - + output target { to: TimeLock, amount: Ada(quantity), @@ -66,44 +66,51 @@ tx unlock( ```tx3 party Sender; -party Receiver; -// Always true plutus v2 -policy OrderBook = 0x39c520d0627aafa728f7e4dd10142b77c257813c36f57e2cb88f72a5; +policy OrderBook { + hash: 0x7039c520d0627aafa728f7e4dd10142b77c257813c36f57e2cb88f72a5, + script: 0xfacd82a32c6692dd60b6b930a86569d4f7a5558684bebc7b2f34259f0dc20b07#0, +} -// Policy always true -asset ControlToken = 0x13a0e59ca61ab277e909ffd20def27d296051fbc634cf623c02322a5.CONTROL; -asset Ask = 0x13a0e59ca61ab277e909ffd20def27d296051fbc634cf623c02322a5.ASK; -asset Bid = 0x13a0e59ca61ab277e909ffd20def27d296051fbc634cf623c02322a5.BID; +asset ControlToken = 0x39c520d0627aafa728f7e4dd10142b77c257813c36f57e2cb88f72a5."CONTROL"; +asset Bid = 0x39c520d0627aafa728f7e4dd10142b77c257813c36f57e2cb88f72a5."BID"; type AssetClass { - policy: Bytes, - name: Bytes, + policy: Bytes, + name: Bytes, } type DatumValue { - asset_class: AssetClass, - amount: Int, + asset_class: AssetClass, + amount: Int, } type OrderInfo { - sender_address: Bytes, - token: DatumValue, + sender_address: Bytes, + token: DatumValue, } type OrderDatum { - info: OrderInfo, - control_asset_class: AssetClass, + info: OrderInfo, + control_asset_class: AssetClass, } tx new_order() { + reference contract { + ref: 0xfacd82a32c6692dd60b6b930a86569d4f7a5558684bebc7b2f34259f0dc20b07#0, + } + input source { from: Sender, min_amount: fees + Bid(1) + Ada(2000000), } + collateral { + ref: 0x5f820f170b7a7322f51e51fe6ed871d35b312d5ebcd6ac37cd2f9cfdf50f8c85#9, + } + mint { amount: ControlToken(1), redeemer: (), @@ -111,31 +118,31 @@ tx new_order() { output change { to: Sender, - amount: source - Ada(2000000)- fees - Bid(1), + amount: source - Ada(2000000) - fees - Bid(1), } output order { to: OrderBook, - amount: Ada(2000000) + Bid(1), + amount: Ada(2000000) + Bid(1) + ControlToken(1), datum: OrderDatum { info: OrderInfo { - // Problem: serialize address into datum - sender_address: 0x00eb5a3cf99aa1d77357864ed2d2fcbdb07a292363f0944122c510a30d58305b9bc8f9bea6e23d4e459d46aacc606eb20b29a27024175549e9, + sender_address: Sender, token: DatumValue { - // Problem: serialize the ASK token asset_class: AssetClass { - policy: 0x13a0e59ca61ab277e909ffd20def27d296051fbc634cf623c02322a5, + policy: 0x39c520d0627aafa728f7e4dd10142b77c257813c36f57e2cb88f72a5, name: "ASK", }, amount: 1, }, }, - // Problem: serialize the CONTROL token control_asset_class: AssetClass { - policy: 0x13a0e59ca61ab277e909ffd20def27d296051fbc634cf623c02322a5, + policy: 0x39c520d0627aafa728f7e4dd10142b77c257813c36f57e2cb88f72a5, name: "CONTROL", }, }, } + metadata { + 674: "SOME METADATA", + } } -``` \ No newline at end of file +```