diff --git a/Cargo.lock b/Cargo.lock index 08ae4d3d..cf5ce3db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1942,6 +1942,7 @@ checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" [[package]] name = "pallas-addresses" version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "base58", "bech32", @@ -1956,6 +1957,7 @@ dependencies = [ [[package]] name = "pallas-codec" version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "hex", "minicbor", @@ -1967,6 +1969,7 @@ dependencies = [ [[package]] name = "pallas-crypto" version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "cryptoxide", "hex", @@ -1979,6 +1982,7 @@ dependencies = [ [[package]] name = "pallas-primitives" version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "base58", "bech32", @@ -1993,6 +1997,7 @@ dependencies = [ [[package]] name = "pallas-traverse" version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "hex", "itertools 0.13.0", diff --git a/crates/uplc/src/tx/script_context.rs b/crates/uplc/src/tx/script_context.rs index b8471c4d..8c6f2d28 100644 --- a/crates/uplc/src/tx/script_context.rs +++ b/crates/uplc/src/tx/script_context.rs @@ -968,7 +968,7 @@ mod tests { } #[test] - fn tx_to_plutus_data() { + fn script_context_simple_send() { let datum = Some(Data::constr(0, Vec::new())); let redeemer = Redeemer { @@ -1005,4 +1005,64 @@ mod tests { // from the Haskell ledger / cardano node. insta::assert_debug_snapshot!(script_context.to_plutus_data()) } + + #[test] + fn script_context_mint() { + let redeemer = Redeemer { + tag: RedeemerTag::Mint, + index: 1, + data: Data::integer(42.into()), + ex_units: ExUnits { + mem: 1000000, + steps: 100000000, + }, + }; + + let script_context = fixture_tx_info( + "84a9008182582000000000000000000000000000000000000000000000000000\ + 00000000000000000183a300581d600000000000000000000000000000000000\ + 0000000000000000000000011a000f42400282005820923918e403bf43c34b4e\ + f6b48eb2ee04babed17320d8d1b9ff9ad086e86f44eca2005839000000000000\ + 0000000000000000000000000000000000000000000000000000000000000000\ + 0000000000000000000000000000000000000001821a000f4240a2581c12593b\ + 4cbf7fdfd8636db99fe356437cd6af8539aadaa0a401964874a14474756e611b\ + 00005af3107a4000581c0c8eaf490c53afbf27e3d84a3b57da51fbafe5aa7844\ + 3fcec2dc262ea14561696b656e182aa300583910000000000000000000000000\ + 0000000000000000000000000000000000000000000000000000000000000000\ + 00000000000000000000000001821a000f4240a1581c0c8eaf490c53afbf27e3\ + d84a3b57da51fbafe5aa78443fcec2dc262ea14763617264616e6f0103d81847\ + 82034463666f6f02182a09a2581c12593b4cbf7fdfd8636db99fe356437cd6af\ + 8539aadaa0a401964874a14474756e611b00005af3107a4000581c0c8eaf490c\ + 53afbf27e3d84a3b57da51fbafe5aa78443fcec2dc262ea24763617264616e6f\ + 014561696b656e2d0b5820ffffffffffffffffffffffffffffffffffffffffff\ + ffffffffffffffffffffff0d8182582000000000000000000000000000000000\ + 00000000000000000000000000000000001082581d6000000000000000000000\ + 0000000000000000000000000000000000001a3b9aca00110112818258200000\ + 00000000000000000000000000000000000000000000000000000000000000a3\ + 0582840100d87980821a000f42401a05f5e100840101182a821a000f42401a05\ + f5e1000481d879800782587d587b010100323232323232322533333300800115\ + 3330033370e900018029baa001153330073006375400224a6660089445261533\ + 0054911856616c696461746f722072657475726e65642066616c736500136560\ + 02002002002002002153300249010b5f746d70323a20566f696400165734ae71\ + 55ceaab9e5573eae915895589301010032323232323232253333330080011533\ + 30033370e900018029baa001153330073006375400224a666008a6600a920110\ + 5f5f5f5f5f6d696e745f325f5f5f5f5f0014a22930a99802a4811856616c6964\ + 61746f722072657475726e65642066616c736500136560020020020020020021\ + 53300249010b5f746d70323a20566f696400165734ae7155ceaab9e5573eae91\ + f5f6", + "8182582000000000000000000000000000000000000000000000000000000000\ + 0000000000", + "81a200581d600000000000000000000000000000000000000000000000000000\ + 0000011a000f4240", + ) + .into_script_context(&redeemer, None) + .unwrap(); + + // NOTE: The initial snapshot has been generated using the Haskell + // implementation of the ledger library for that same serialized + // transactions. It is meant to control that our construction of the + // script context and its serialization matches exactly those + // from the Haskell ledger / cardano node. + insta::assert_debug_snapshot!(script_context.to_plutus_data()); + } } diff --git a/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_mint.snap b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_mint.snap new file mode 100644 index 00000000..cb1705d4 --- /dev/null +++ b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_mint.snap @@ -0,0 +1,1616 @@ +--- +source: crates/uplc/src/tx/script_context.rs +expression: script_context.to_plutus_data() +--- +Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + ], + ), + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + ], + ), + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 146, + 57, + 24, + 228, + 3, + 191, + 67, + 195, + 75, + 78, + 246, + 180, + 142, + 178, + 238, + 4, + 186, + 190, + 209, + 115, + 32, + 216, + 209, + 185, + 255, + 154, + 208, + 134, + 232, + 111, + 68, + 236, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ( + BoundedBytes( + BoundedBytes( + [ + 12, + 142, + 175, + 73, + 12, + 83, + 175, + 191, + 39, + 227, + 216, + 74, + 59, + 87, + 218, + 81, + 251, + 175, + 229, + 170, + 120, + 68, + 63, + 206, + 194, + 220, + 38, + 46, + ], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [ + 97, + 105, + 107, + 101, + 110, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 42, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ( + BoundedBytes( + BoundedBytes( + [ + 18, + 89, + 59, + 76, + 191, + 127, + 223, + 216, + 99, + 109, + 185, + 159, + 227, + 86, + 67, + 124, + 214, + 175, + 133, + 57, + 170, + 218, + 160, + 164, + 1, + 150, + 72, + 116, + ], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [ + 116, + 117, + 110, + 97, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100000000000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ( + BoundedBytes( + BoundedBytes( + [ + 12, + 142, + 175, + 73, + 12, + 83, + 175, + 191, + 39, + 227, + 216, + 74, + 59, + 87, + 218, + 81, + 251, + 175, + 229, + 170, + 120, + 68, + 63, + 206, + 194, + 220, + 38, + 46, + ], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [ + 99, + 97, + 114, + 100, + 97, + 110, + 111, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 104, + 173, + 84, + 179, + 168, + 18, + 77, + 159, + 229, + 202, + 170, + 242, + 1, + 26, + 133, + 215, + 32, + 150, + 230, + 150, + 162, + 251, + 61, + 127, + 134, + 196, + 23, + 23, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 42, + }, + ), + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [ + 12, + 142, + 175, + 73, + 12, + 83, + 175, + 191, + 39, + 227, + 216, + 74, + 59, + 87, + 218, + 81, + 251, + 175, + 229, + 170, + 120, + 68, + 63, + 206, + 194, + 220, + 38, + 46, + ], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [ + 97, + 105, + 107, + 101, + 110, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: true, + val: 13, + }, + ), + ), + ), + ), + ( + BoundedBytes( + BoundedBytes( + [ + 99, + 97, + 114, + 100, + 97, + 110, + 111, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ( + BoundedBytes( + BoundedBytes( + [ + 18, + 89, + 59, + 76, + 191, + 127, + 223, + 216, + 99, + 109, + 185, + 159, + 227, + 86, + 67, + 124, + 214, + 175, + 133, + 57, + 170, + 218, + 160, + 164, + 1, + 150, + 72, + 116, + ], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [ + 116, + 117, + 110, + 97, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100000000000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Array( + [], + ), + Map( + Def( + [], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Array( + [], + ), + Map( + Def( + [ + ( + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 12, + 142, + 175, + 73, + 12, + 83, + 175, + 191, + 39, + 227, + 216, + 74, + 59, + 87, + 218, + 81, + 251, + 175, + 229, + 170, + 120, + 68, + 63, + 206, + 194, + 220, + 38, + 46, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + ), + ( + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 18, + 89, + 59, + 76, + 191, + 127, + 223, + 216, + 99, + 109, + 185, + 159, + 227, + 86, + 67, + 124, + 214, + 175, + 133, + 57, + 170, + 218, + 160, + 164, + 1, + 150, + 72, + 116, + ], + ), + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 42, + }, + ), + ), + ), + ), + ], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [ + 146, + 57, + 24, + 228, + 3, + 191, + 67, + 195, + 75, + 78, + 246, + 180, + 142, + 178, + 238, + 4, + 186, + 190, + 209, + 115, + 32, + 216, + 209, + 185, + 255, + 154, + 208, + 134, + 232, + 111, + 68, + 236, + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + ), + ], + ), + ), + BoundedBytes( + BoundedBytes( + [ + 231, + 87, + 152, + 94, + 72, + 228, + 58, + 149, + 161, + 133, + 221, + 186, + 8, + 200, + 20, + 188, + 32, + 248, + 28, + 182, + 133, + 68, + 172, + 147, + 122, + 155, + 153, + 46, + 78, + 108, + 56, + 160, + ], + ), + ), + Map( + Def( + [], + ), + ), + Array( + [], + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 42, + }, + ), + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 18, + 89, + 59, + 76, + 191, + 127, + 223, + 216, + 99, + 109, + 185, + 159, + 227, + 86, + 67, + 124, + 214, + 175, + 133, + 57, + 170, + 218, + 160, + 164, + 1, + 150, + 72, + 116, + ], + ), + ), + ], + }, + ), + ], + }, +) diff --git a/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_simple_send.snap b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_simple_send.snap new file mode 100644 index 00000000..141419d6 --- /dev/null +++ b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_simple_send.snap @@ -0,0 +1,641 @@ +--- +source: crates/uplc/src/tx/script_context.rs +expression: script_context.to_plutus_data() +--- +Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 57, + 244, + 127, + 211, + 179, + 136, + 239, + 83, + 196, + 143, + 8, + 222, + 36, + 118, + 109, + 62, + 85, + 218, + 222, + 108, + 174, + 144, + 140, + 194, + 78, + 15, + 79, + 62, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + ], + ), + Array( + [], + ), + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 42, + }, + ), + ), + ), + Map( + Def( + [], + ), + ), + Array( + [], + ), + Map( + Def( + [], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Array( + [], + ), + Map( + Def( + [ + ( + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + ), + ], + ), + ), + Map( + Def( + [], + ), + ), + BoundedBytes( + BoundedBytes( + [ + 120, + 236, + 20, + 142, + 166, + 71, + 207, + 153, + 105, + 68, + 104, + 145, + 175, + 49, + 147, + 156, + 93, + 87, + 178, + 117, + 162, + 69, + 87, + 6, + 120, + 44, + 97, + 131, + 239, + 11, + 98, + 241, + ], + ), + ), + Map( + Def( + [], + ), + ), + Array( + [], + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, +) diff --git a/examples/acceptance_tests/script_context/v3/README.md b/examples/acceptance_tests/script_context/v3/README.md index ecbfb2b1..fd113b7f 100644 --- a/examples/acceptance_tests/script_context/v3/README.md +++ b/examples/acceptance_tests/script_context/v3/README.md @@ -31,12 +31,12 @@ for convenience. - [x] inputs - reference inputs - [x] none - - [ ] some + - [x] some - outputs - - [ ] none - - [ ] some + - [x] none + - [x] some - [x] fee - - [ ] mint + - [x] mint - certificates - [ ] none - some @@ -63,7 +63,7 @@ for convenience. - [x] none - [ ] some - [ ] redeemers - - [ ] datums + - [x] datums - votes - [ ] none - [ ] some @@ -78,27 +78,27 @@ for convenience. - [ ] without - Address - - [ ] type-0 (key | key) - - [ ] type-1 (script | key) + - [x] type-0 (key | key) + - [x] type-1 (script | key) - [ ] type-2 (key | script) - [ ] type-3 (script | script) - [ ] type-4 (key | ptr) - [ ] type-5 (script | ptr) - - [ ] type-6 (key | ø) + - [x] type-6 (key | ø) - [x] type-7 (key | ø) - Value - [x] only ada - - [ ] multi-assets + - [x] multi-assets - Output datum - - [ ] none - - [ ] hash + - [x] none + - [x] hash - [x] inline - Output script - [x] none - - [ ] inline + - [x] inline - Governance Action - parameter change @@ -167,10 +167,6 @@ for convenience. - [ ] with guardrail script - [ ] without guardrail script -- Value - - [x] pure ada - - [ ] native assets - - Credential - [ ] key - [x] script diff --git a/examples/acceptance_tests/script_context/v3/ctx/mint/tx.template b/examples/acceptance_tests/script_context/v3/ctx/mint/tx.template index d22c8f6e..1e54fcc7 100644 --- a/examples/acceptance_tests/script_context/v3/ctx/mint/tx.template +++ b/examples/acceptance_tests/script_context/v3/ctx/mint/tx.template @@ -6,9 +6,9 @@ , 1: [ { 0: h'6000000000000000000000000000000000000000000000000000000000' , 1: 1000000 - , 2: [1, 24(h'4463666F6F')] + , 2: [0, h'923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec'] } - , { 0: h'6000000000000000000000000000000000000000000000000000000000' + , { 0: h'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' , 1: [ 1000000 , { h'{{ mint.mint_1.hash }}': { h'74756e61': 100000000000000 } @@ -16,7 +16,7 @@ } ] } - , { 0: h'6000000000000000000000000000000000000000000000000000000000' + , { 0: h'100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' , 1: [ 1000000 , { h'{{ mint.mint_2.hash }}': { h'63617264616e6f': 1 } @@ -49,6 +49,10 @@ ] , 17: 1 + + , 18: + [ [h'0000000000000000000000000000000000000000000000000000000000000000', 0] + ] }, { 5: @@ -56,6 +60,14 @@ , [1, 1, 42, [1000000, 100000000]] ] + , 4: + [ 121([]) + ] + + , 7: + [ h'{{ mint.mint_1.cbor }}' + , h'{{ mint.mint_2.cbor }}' + ] }, diff --git a/examples/acceptance_tests/script_context/v3/plutus.json b/examples/acceptance_tests/script_context/v3/plutus.json index 01fa71bd..41662914 100644 --- a/examples/acceptance_tests/script_context/v3/plutus.json +++ b/examples/acceptance_tests/script_context/v3/plutus.json @@ -19,8 +19,8 @@ "$ref": "#/definitions/Void" } }, - "compiledCode": "587b0101003232323232323225333333008001153330033370e900018029baa001153330073006375400224a66600894452615330054911856616c696461746f722072657475726e65642066616c73650013656002002002002002002153300249010b5f746d70323a20566f696400165734ae7155ceaab9e5573eae91", - "hash": "12593b4cbf7fdfd8636db99fe356437cd6af8539aadaa0a401964874" + "compiledCode": "5910100101003232323232323232323232322533333300d00115332330063001300837540042a66601460126ea8008494ccc01cc8c8c8c8c8c8c8c8c8c8c928a99980899baf374c6602c66ec1301225820923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec004c0103d87980004bd6f7b630180b980c180c180c180c180c180c180c180c180c180c180a1baa3008301437540162930a9980924937657870656374205b5061697228766f69645f686173682c20766f6964295d203d3d20646963742e746f5f706169727328646174756d7329001653330103375e6e9ccc054c014cc055300127d8799f5820000000000000000000000000000000000000000000000000000000000000000000ff0033015300533015300448811c000000000000000000000000000000000000000000000000000000000033015374c6006904044bd1980aa60103d8798000330154c103d87a80004bd7025eb812f5c0602c602e60266ea8c01cc04cdd50050a4c2a66022921ff6578706563740a202020205b0a202020202020496e707574207b0a20202020202020206f75747075745f7265666572656e63653a204f75747075745265666572656e6365207b0a202020202020202020207472616e73616374696f6e5f69643a206e756c6c33322c0a202020202020202020206f75747075745f696e6465783a20302c0a20202020202020207d2c0a20202020202020206f75747075743a204f7574707574207b0a20202020202020202020616464726573733a2063726564656e7469616c2e66726f6d5f766572696669636174696f6e5f6b6579286e756c6c3238292c0a2020202020202020202076616c75653a2076616c75652e66726f766d5f6c6f76656c61636528315f3030305f303030292c0a20202020202020202020646174756d3a204e6f446174756d2c0a202020202020202020207265666572656e63655f7363726970743a204e6f6e652c0a20202020202020207d2c0a2020202020207d2c0a202020205d203d3d20696e707574730016533300f3375e6e9ccc050dd39980a1ba9005330144c1064561696b656e00330144c1012d004bd701980a1ba733014375200a66028981084763617264616e6f00330144c10101004bd701980a1ba733014375200e66028981054474756e6100330144c1091b00005af3107a4000004bd7025eb80dd399198008009bab3016301730173017301730133754600e60266ea8028894ccc05400452f5c0264666444646600200200644a66603600220062646603a6e9ccc074dd48031980e980d0009980e980d800a5eb80cc00c00cc07c008c074004dd7180a0009bab30150013300300330190023017001149854cc0412401a76578706563740a202020205b0a202020202020286f746865725f706f6c6963795f69642c202261696b656e222c202d3134292c0a202020202020286f746865725f706f6c6963795f69642c202263617264616e6f222c2031292c0a202020202020286f75725f706f6c6963795f69642c202274756e61222c20313030303030303030303030303030292c0a202020205d203d3d2076616c75652e666c617474656e286d696e7429001633232323232323232253330173370e600c00290030a99980b99baf300c3301c300c3301c300b48811c00000000000000000000000000000000000000000000000000000000003301c374c6014904044bd1980e260126d87a9f5820923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ecff003301c4c103d87a80004bd7025eb80cc0100052000153330173375e6018660386018660386600660169111c000000000000000000000000000000000000000000000000000000000048811c00000000000000000000000000000000000000000000000000000000003301c374c666600466660046014904044bd007a4410474756e610048202034a1f8af0b403522010561696b656e0048150cc071300103d87980003301c4c103d87a80004bd7025eb80cc0100052002153330173375e6018660386018660386600660186603866e9520023301c4c011e581c00000000000000000000000000000000000000000000000000000000004bd701980e260103d87a80004bd702451c00000000000000000000000000000000000000000000000000000000003301c374c66660046014904044bd006a450763617264616e6f0048008cc071300103d87980003301c4c122d8799f581c68ad54b3a8124d9fe5caaaf2011a85d72096e696a2fb3d7f86c41717ff004bd7025eb80cc0100052004149854cc0612401ff6578706563740a20202020536f6d65280a2020202020204f7574707574207b0a2020202020202020616464726573733a2063726564656e7469616c2e66726f6d5f736372697074286e756c6c3238290a202020202020202020207c3e2063726564656e7469616c2e776974685f64656c65676174696f6e5f6b6579286e756c6c3238292c0a202020202020202076616c75653a2076616c75652e66726f6d5f6c6f76656c61636528315f3030305f303030290a202020202020202020207c3e2076616c75652e616464286f746865725f706f6c6963795f69642c202263617264616e6f222c2031292c0a2020202020202020646174756d3a204e6f446174759a6d2c0a20202020202020207265666572656e63655f7363726970743a20536f6d65280a2020202020202020202023223638616435346233613831323464396665356361616166323031316138356437323039366536393661326662336437663836633431373137222c0a2020202020202020292c0a2020202020207d2c0a2020202029203d3d206c6973742e6174286f7574707574732c20322900161533018491ff6578706563740a20202020536f6d65280a2020202020204f7574707574207b0a2020202020202020616464726573733a2063726564656e7469616c2e66726f6d5f766572696669636174696f6e5f6b6579286e756c6c3238290a202020202020202020207c3e2063726564656e7469616c2e776974685f64656c65676174696f6e5f6b6579286e756c6c3238292c0a202020202020202076616c75653a2076616c75652e66726f6d5f6c6f76656c61636528315f3030305f303030290a202020202020202020207c3e2076616c75652e616464286f75725f706f6c6963795f69642c202274756e61222c20313030303030303030303030303030290a20202090202020202020207c3e2076616c75652e616464286f746865725f706f6c6963795f69642c202261696b656e222c203432292c0a2020202020202020646174756d3a204e6f446174756d2c0a20202020202020207265666572656e63655f7363726970743a204e6f6e652c0a2020202020207d2c0a2020202029203d3d206c6973742e6174286f7574707574732c20312900161533018491f46578706563740a20202020536f6d65280a2020202020204f7574707574207b0a2020202020202020616464726573733a2063726564656e7469616c2e66726f6d5f766572696669636174696f6e5f6b6579286e756c6c3238292c0a202020202020202076616c75653a2076616c75652e66726f6d5f6c6f76656c61636528315f3030305f303030292c0a2020202020202020646174756d3a20446174756d4861736828766f69645f68617368292c0a20202020202020207265666572656e63655f7363726970743a204e6f6e652c0a2020202020207d2c0a2020202029203d3d206c6973742e6174286f7574707574732c2030290016153301849120657870656374206c6973742e6c656e677468286f75747075747329203d3d2033001622225333019301400110041323233001001006225333020001133021337606ea4018dd3001a5eb7bdb1804c8c8c8c94ccc080cdc800500109981299bb037520146e9801c01454ccc080cdc78050010992999810980e18119baa001133026337606ea402cc09cc090dd50008020802192999810a9998128008a5114a0298103d87a80001301633026374c00297ae03233001001002225333026001133027337606ea402cdd400525eb7bdb1804c8c8c8c94ccc098cdc800780109981599bb0375201e6ea003801454ccc098cdc78078010992999813981118149baa00113302c337606ea4040c0b4c0a8dd5000802080219299981398110008a6103d87a80001301c3302c375000297ae03370000201c26605666ec0dd48011ba800133006006003375a60500066eb8c098008c0a8008c0a00044cc094cdd81ba9002374c0026600c00c0066eacc08800cdd7181000118120011811000991900118058009980f19bb037520046ea00052f5bded8c044601666036601a60326ea8008cc06cc02ccc06cc02ccc06cc02ccc06cdd4800a5eb812f5c097ae04bd701800800911299980c8010a60103d87a800013232533301730120031300c3301c0024bd70099980280280099b8000348004c07400cc06c008c004004894ccc05800452000133700900119801001180c800980080091299980a0008a4c264a66602a00229309919299980999b90375c602a60320086eb8c0540084cc014014cc06000800454cc051241326b65797320696e206173736f63696174697665206c697374206172656e277420696e20617363656e64696e67206f7264657200163019002301700130170013758600e60226ea8c014c044dd50041299980718048008a5eb7bdb1804c8c8cc0040052f5bded8c044a66602a00226602c66ec13001014000374c00697adef6c6013232323253330153372091010000213301a337609801014000374c00e00a2a66602a66e3d2210000213301a337609801014000374c00e00626603466ec0dd48011ba6001330060060033756602e0066eb8c054008c064008c05c004c8cc0040052f5bded8c044a66602800226602a66ec13001014000375000697adef6c60132323232533301433720910100002133019337609801014000375000e00a2a66602866e3d22100002133019337609801014000375000e00626603266ec0dd48011ba800133006006003375a602c0066eb8c050008c060008c0580048c008cc048c008cc048dd4800a5eb80cc04930103d87a80004bd701ba548000c94ccc03c0040244c8c94ccc04400402c54ccc044c0500044c8c94ccc03cc028c044dd5001099299999980c0010a999808180598091baa0021533301430133754004200201e01e01e01e01e01e6eb8c054c048dd500100698088019807801005980980118088009bab3010301130113011301130113011301130113011300d37546002601a6ea80108c040004c94ccc024c010c02cdd500089bae300f300c37540022a6601492120657870656374204d696e74696e6728706f6c6963795f696429203d20696e666f00163001300b37540044601c601e601e0022930a998042491856616c696461746f722072657475726e65642066616c73650013656003370e90000010010010010010a9980224810b5f746d70323a20566f69640016153300349139657870656374205b50616972284d696e74286f746865725f706f6c6963795f6964292c2064617461292c205f5d203d2072656465656d657273001615330024911265787065637420566f6964203d206461746100165734ae7155ceaab9e5573eae815d0aba257481", + "hash": "5b683a7bd4203e72b75c8f3d259a09389ecc8bf650dc729f920b899f" }, { "title": "mint.mint_2", diff --git a/examples/acceptance_tests/script_context/v3/test.sh b/examples/acceptance_tests/script_context/v3/test.sh index 183b8f73..98aaa6a3 100755 --- a/examples/acceptance_tests/script_context/v3/test.sh +++ b/examples/acceptance_tests/script_context/v3/test.sh @@ -58,17 +58,6 @@ done echo $RESOLVED_INPUTS | cbor-diag --to hex --from diag > ctx/$TITLE/resolved_inputs.cbor echo $TRANSACTION | cbor-diag --to hex --from diag > ctx/$TITLE/tx.cbor -# echo "TRANSACTION" -# cat ctx/$TITLE/tx.cbor - -# ogmios inspect transaction $(cat ctx/$TITLE/tx.cbor) | jq - -# echo -e "\n\nINPUTS" -# cat ctx/inputs.cbor -# -# echo -e "\n\nRESOLVED_INPUTS" -# cat ctx/$TITLE/resolved_inputs.cbor - $AIKEN tx simulate \ ctx/$TITLE/tx.cbor \ ctx/inputs.cbor \ diff --git a/examples/acceptance_tests/script_context/v3/validators/mint.ak b/examples/acceptance_tests/script_context/v3/validators/mint.ak index 4679f921..1959c9fe 100644 --- a/examples/acceptance_tests/script_context/v3/validators/mint.ak +++ b/examples/acceptance_tests/script_context/v3/validators/mint.ak @@ -1,18 +1,128 @@ -use aiken/dict +use aiken/dict.{Dict} +use aiken/list use aiken/transaction.{ - InlineDatum, Input, Output, OutputReference, ScriptContext, Spend, Spending, + DatumHash, Input, Mint, Minting, NoDatum, Output, OutputReference, + ScriptContext, ScriptInfo, ScriptPurpose, } -use aiken/transaction/credential.{Address, ScriptCredential} -use aiken/transaction/value +use aiken/transaction/credential +use aiken/transaction/value.{PolicyId, Value} + +const null28 = #"00000000000000000000000000000000000000000000000000000000" + +const null32 = + #"0000000000000000000000000000000000000000000000000000000000000000" + +const void_hash = + #"923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec" validator { fn mint_1(_tmp2: Void, ctx: ScriptContext) { + let our_policy_id = assert_script_info(ctx.info) + let other_policy_id = assert_redeemers(ctx.transaction.redeemers) + assert_outputs(ctx.transaction.outputs, our_policy_id, other_policy_id) + assert_mint(ctx.transaction.mint, our_policy_id, other_policy_id) + assert_reference_inputs(ctx.transaction.reference_inputs) + assert_datums(ctx.transaction.datums) True } } +fn assert_reference_inputs(inputs: List) -> Void { + expect + [ + Input { + output_reference: OutputReference { + transaction_id: null32, + output_index: 0, + }, + output: Output { + address: credential.from_verification_key(null28), + value: value.from_lovelace(1_000_000), + datum: NoDatum, + reference_script: None, + }, + }, + ] == inputs + Void +} + +fn assert_script_info(info: ScriptInfo) -> PolicyId { + expect Minting(policy_id) = info + policy_id +} + +fn assert_redeemers(redeemers: Pairs) -> PolicyId { + expect [Pair(Mint(other_policy_id), data), _] = redeemers + expect Void = data + other_policy_id +} + +fn assert_datums(datums: Dict) -> Void { + let void: Data = Void + expect [Pair(void_hash, void)] == dict.to_pairs(datums) + Void +} + +fn assert_outputs( + outputs: List, + our_policy_id: PolicyId, + other_policy_id: PolicyId, +) { + expect list.length(outputs) == 3 + + expect + Some( + Output { + address: credential.from_verification_key(null28), + value: value.from_lovelace(1_000_000), + datum: DatumHash(void_hash), + reference_script: None, + }, + ) == list.at(outputs, 0) + + expect + Some( + Output { + address: credential.from_verification_key(null28) + |> credential.with_delegation_key(null28), + value: value.from_lovelace(1_000_000) + |> value.add(our_policy_id, "tuna", 100000000000000) + |> value.add(other_policy_id, "aiken", 42), + datum: NoDatum, + reference_script: None, + }, + ) == list.at(outputs, 1) + + expect + Some( + Output { + address: credential.from_script(null28) + |> credential.with_delegation_key(null28), + value: value.from_lovelace(1_000_000) + |> value.add(other_policy_id, "cardano", 1), + datum: NoDatum, + reference_script: Some( + #"68ad54b3a8124d9fe5caaaf2011a85d72096e696a2fb3d7f86c41717", + ), + }, + ) == list.at(outputs, 2) + + Void +} + +fn assert_mint(mint: Value, our_policy_id: PolicyId, other_policy_id: PolicyId) { + expect + [ + (other_policy_id, "aiken", -14), + (other_policy_id, "cardano", 1), + (our_policy_id, "tuna", 100000000000000), + ] == value.flatten(mint) + Void +} + validator { - fn mint_2(_tmp2: Void, ctx: ScriptContext) { + fn mint_2(_tmp2: Void, _ctx: ScriptContext) { + trace @"_____mint_2_____" True } }