From 7e6dc978a1038fcf5ee85ca2aba4060371ebfc4c Mon Sep 17 00:00:00 2001 From: rvcas Date: Mon, 5 Dec 2022 14:09:52 -0500 Subject: [PATCH] feat: commit latest build assets for sample --- crates/lang/src/parser.rs | 23 +- crates/lang/src/tipo/error.rs | 2 +- examples/sample/assets/swap/spend/mainnet.txt | 2 +- .../assets/swap/spend/payment_script.json | 2 +- examples/sample/assets/swap/spend/raw.uplc | 208 +++++++++--------- examples/sample/assets/swap/spend/script.txt | 2 +- examples/sample/assets/swap/spend/testnet.txt | 2 +- examples/sample/validators/swap.ak | 39 +--- 8 files changed, 118 insertions(+), 162 deletions(-) diff --git a/crates/lang/src/parser.rs b/crates/lang/src/parser.rs index f83c28e3..ad18fd24 100644 --- a/crates/lang/src/parser.rs +++ b/crates/lang/src/parser.rs @@ -1319,24 +1319,13 @@ pub fn pattern_parser() -> impl Parser name}.map_with_span(|name, span| ast::CallArg { + location: span, + value: ast::UntypedPattern::Var { + name: name.clone(), location: span, - value: pattern, - label, - } + }, + label: Some(name), }), )) .separated_by(just(Token::Comma)) diff --git a/crates/lang/src/tipo/error.rs b/crates/lang/src/tipo/error.rs index 61e9c1d8..ae30413d 100644 --- a/crates/lang/src/tipo/error.rs +++ b/crates/lang/src/tipo/error.rs @@ -64,7 +64,7 @@ pub enum Error { name: String, }, - #[error("Incorrect arity\n\nExpected\n\n{expected}\n\nGiven\n\n{given}\n")] + #[error("Incorrect arity\n\nExpected\n\n {expected}\n\nGiven\n\n {given}\n")] IncorrectArity { #[label] location: Span, diff --git a/examples/sample/assets/swap/spend/mainnet.txt b/examples/sample/assets/swap/spend/mainnet.txt index b9f377e0..eeb5c39c 100644 --- a/examples/sample/assets/swap/spend/mainnet.txt +++ b/examples/sample/assets/swap/spend/mainnet.txt @@ -1 +1 @@ -addr1wywnrptcz7rcmzpmmlugx5jdlsqy5kr53x5wyfrvudy63cgdwqdyp \ No newline at end of file +addr1wxdwvaptgf8kvxj3xuud67y6mnzgkvmkmz620nc77e9u65ghx46hl \ No newline at end of file diff --git a/examples/sample/assets/swap/spend/payment_script.json b/examples/sample/assets/swap/spend/payment_script.json index a676f530..b0399d52 100644 --- a/examples/sample/assets/swap/spend/payment_script.json +++ b/examples/sample/assets/swap/spend/payment_script.json @@ -1,5 +1,5 @@ { "type": "PlutusScriptV2", "description": "Generated by Aiken", - "cborHex": "589358910100002225333573464646464a666ae68cdc3800a40002646464646466e212000004375a6ae84004d55d10009aba2002375a6ae84004c01000854ccd5cd19b87001480104c8c8cdc4000a40006eb4d5d080098020010a5035573a6ea800401488c8ccc00400520000032223333573466e1c0100095d0919980200219b8000348008d5d100080091aab9e37540022930b01" + "cborHex": "58b258b0010000222533357346464646464a666ae68cdc3800a40002646466e3c0052201030303ff00375c6ae84004c01400854ccd5cd19b87001480084c8c8cdc7800a441030303ff00375c6ae84004c0140085281aab9d375400200266446e94cdd82601010000374e66ae80008cd5d0000a61029fff004881030404ff00483403c88c8ccc00400520000032223333573466e1c0100095d0919980200219b8000348008d5d100080091aab9e37540022930b01" } \ No newline at end of file diff --git a/examples/sample/assets/swap/spend/raw.uplc b/examples/sample/assets/swap/spend/raw.uplc index 672a4844..4e9863be 100644 --- a/examples/sample/assets/swap/spend/raw.uplc +++ b/examples/sample/assets/swap/spend/raw.uplc @@ -19,157 +19,155 @@ __constr_get_field [ (lam - __constr_name_1 + x [ (lam - __subject_name_0 - (force - [ - [ + __constr_name_8 + [ + (lam + __subject_name_7 + (force [ - (force (builtin ifThenElse)) [ [ - (builtin equalsInteger) - __subject_name_0 + (force (builtin ifThenElse)) + [ + [ + (builtin equalsInteger) + __subject_name_7 + ] + (con integer 0) + ] ] - (con integer 0) - ] - ] - (delay - [ - (lam - __constr_fields_5 + (delay [ (lam - price + __constr_fields_18 [ (lam - __tail_0_3 + signer [ - (lam - __tail_1_4 - [ - (lam - t - [ - [ - (builtin - lessThanInteger - ) - (con integer 0) - ] - price - ] - ) - [ - (builtin unIData) - [ - (force - (builtin - headList - ) - ) - __tail_1_4 - ] - ] - ] - ) [ - (force - (force - (builtin tailList) - ) + (builtin + equalsByteString ) - __tail_0_3 + signer ] + (con bytestring #0303ff) ] ) [ - (force (builtin tailList)) - __constr_fields_5 + (builtin unBData) + [ + (force (builtin headList)) + __constr_fields_18 + ] ] ] ) [ - (builtin unIData) - [ - (force (builtin headList)) - __constr_fields_5 - ] + __constr_fields_exposer + __constr_name_8 ] ] ) - [ - __constr_fields_exposer - __constr_name_1 - ] ] - ) - ] - (delay - (force - [ - [ + (delay + (force [ - (force (builtin ifThenElse)) [ [ - (builtin equalsInteger) - __subject_name_0 + (force (builtin ifThenElse)) + [ + [ + (builtin equalsInteger) + __subject_name_7 + ] + (con integer 1) + ] ] - (con integer 2) - ] - ] - (delay - [ - (lam - __constr_fields_2 + (delay [ (lam - less + __constr_fields_17 [ + (lam + signer + [ + [ + (builtin + equalsByteString + ) + signer + ] + (con + bytestring + #0303ff + ) + ] + ) [ - (builtin - lessThanInteger - ) - less + (builtin unBData) + [ + (force + (builtin headList) + ) + __constr_fields_17 + ] ] - (con integer 0) ] ) [ - (builtin unIData) - [ - (force - (builtin headList) - ) - __constr_fields_2 - ] + __constr_fields_exposer + __constr_name_8 ] ] ) - [ - __constr_fields_exposer - __constr_name_1 - ] ] - ) - ] - (delay (con bool False)) - ] - ) + (delay (con bool False)) + ] + ) + ) + ] ) + ) + [ + (force (force (builtin fstPair))) + [ (builtin unConstrData) __constr_name_8 ] + ] + ] + ) + x + ] + ) + [ + [ + (lam + signer + (lam + amount + [ + (builtin constrData) + [ + [ (builtin mkPairData) (con data #00) ] + [ + (builtin listData) + [ + [ (force (builtin mkCons)) signer ] + [ + [ (force (builtin mkCons)) amount ] + (con data #9fff) + ] + ] + ] + ] ] ) ) - [ - (force (force (builtin fstPair))) - [ (builtin unConstrData) __constr_name_1 ] - ] + (con bytestring #0404ff) ] - ) - datum + (con integer 1000) + ] ] ) (lam diff --git a/examples/sample/assets/swap/spend/script.txt b/examples/sample/assets/swap/spend/script.txt index 331c2111..d8d62421 100644 --- a/examples/sample/assets/swap/spend/script.txt +++ b/examples/sample/assets/swap/spend/script.txt @@ -1 +1 @@ -58910100002225333573464646464a666ae68cdc3800a40002646464646466e212000004375a6ae84004d55d10009aba2002375a6ae84004c01000854ccd5cd19b87001480104c8c8cdc4000a40006eb4d5d080098020010a5035573a6ea800401488c8ccc00400520000032223333573466e1c0100095d0919980200219b8000348008d5d100080091aab9e37540022930b01 \ No newline at end of file +58b0010000222533357346464646464a666ae68cdc3800a40002646466e3c0052201030303ff00375c6ae84004c01400854ccd5cd19b87001480084c8c8cdc7800a441030303ff00375c6ae84004c0140085281aab9d375400200266446e94cdd82601010000374e66ae80008cd5d0000a61029fff004881030404ff00483403c88c8ccc00400520000032223333573466e1c0100095d0919980200219b8000348008d5d100080091aab9e37540022930b01 \ No newline at end of file diff --git a/examples/sample/assets/swap/spend/testnet.txt b/examples/sample/assets/swap/spend/testnet.txt index 3ded9749..574c9a81 100644 --- a/examples/sample/assets/swap/spend/testnet.txt +++ b/examples/sample/assets/swap/spend/testnet.txt @@ -1 +1 @@ -addr_test1wqwnrptcz7rcmzpmmlugx5jdlsqy5kr53x5wyfrvudy63cgkx53ty \ No newline at end of file +addr_test1wzdwvaptgf8kvxj3xuud67y6mnzgkvmkmz620nc77e9u65gvwpxc6 \ No newline at end of file diff --git a/examples/sample/validators/swap.ak b/examples/sample/validators/swap.ak index f135024d..49a1a5d9 100644 --- a/examples/sample/validators/swap.ak +++ b/examples/sample/validators/swap.ak @@ -13,6 +13,7 @@ pub type Redeemer { pub type Reen { Buy1 { signer: ByteArray, amount: Int } + Stuff(ByteArray, Int) Sell1 } @@ -49,42 +50,10 @@ pub type Datum { } pub fn spend(datum: Datum, _rdmr: Nil, _ctx: Nil) -> Bool { - // when datum is { - // Sell -> sample.eqIntPlusOne(sample.incrementor(0, 8), 9) - // Offer { - // prices: p, - // asset_class: ac, - // other_thing: Offer { - // other_thing: Offer { asset_class: nested_signer, prices: amounts, .. }, - // .. - // }, - // } -> 1 == 1 - // Offer { prices, other_thing: thing, .. } -> - // when prices is { - // [] -> True - // [a] -> True - // [a, b, c] -> True - // [a, b, c, d, ..e] -> sample.big_a == a - // } - // _ -> False - // } - let x = Buy1{signer: #[4, 4, 255], amount: 1000} + let x = Buy1 { signer: #[4, 4, 255], amount: 1000 } when x is { - Buy1{signer, ..} -> signer == #[3,3,255] + Buy1 { signer, .. } -> signer == #[3, 3, 255] + Stuff(signer, _) -> signer == #[3, 3, 255] _ -> False } } -// let Redeemer{ signer, amount: amount2, other_thing: Redeemer{ signer: nested_signer, ..}} = datum -// True -// when datum is { -// Offer{ price: p, asset_class: ac, thing: thing, other_thing: Redeemer{ other_thing: Redeemer{ signer: nested_signer, amount: amount, ..}, .. } } -> True -// _ -> False -// } -// Offer{ prices, other_thing: thing, .. } -> { -// when prices is { -// [] -> True -// [1] -> False -// [a, b] -> True -// [a, b, ..[a]] -> False -// } -// }