diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 415f750..7843355 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,11 +9,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.7 - - uses: aiken-lang/setup-aiken@v0.1.0 + - uses: aiken-lang/setup-aiken@v1 with: - version: v1.0.28-alpha + version: v1.1.0 - run: aiken fmt --check - run: aiken c -D diff --git a/aiken.lock b/aiken.lock index 17ac365..2b68af7 100644 --- a/aiken.lock +++ b/aiken.lock @@ -3,57 +3,47 @@ [[requirements]] name = "aiken-lang/stdlib" -version = "1.9.0" +version = "v2" source = "github" [[requirements]] name = "aiken-extra/auxlib" -version = "2.190.202405" -source = "github" - -[[requirements]] -name = "aiken-extra/string_util" -version = "3.190.202405" +version = "2.200.202409" source = "github" [[requirements]] name = "aiken-extra/time_util" -version = "5.190.202405" +version = "5.200.202409" source = "github" [[requirements]] name = "aiken-extra/tx_util" -version = "1.190.202405" +version = "1.200.202409" source = "github" [[packages]] name = "aiken-lang/stdlib" -version = "1.9.0" +version = "v2" requirements = [] source = "github" [[packages]] name = "aiken-extra/auxlib" -version = "2.190.202405" -requirements = [] -source = "github" - -[[packages]] -name = "aiken-extra/string_util" -version = "3.190.202405" +version = "2.200.202409" requirements = [] source = "github" [[packages]] name = "aiken-extra/time_util" -version = "5.190.202405" +version = "5.200.202409" requirements = [] source = "github" [[packages]] name = "aiken-extra/tx_util" -version = "1.190.202405" +version = "1.200.202409" requirements = [] source = "github" [etags] +"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1725504669, nanos_since_epoch = 165477303 }, "d79382d2b6ecb3aee9b0755c31d8a5bbafe88a7b3706d7fb8a52fd4d05818501"] diff --git a/aiken.toml b/aiken.toml index dd7db55..dfbdb38 100644 --- a/aiken.toml +++ b/aiken.toml @@ -1,5 +1,5 @@ name = "ariady-putra/morbid" -version = "0.2.202405" +version = "0.2.202409" license = "Apache-2.0" description = "An Aiken contract for project 'ariady-putra/morbid'" @@ -10,25 +10,20 @@ platform = "github" [[dependencies]] name = "aiken-lang/stdlib" -version = "1.9.0" +version = "v2" source = "github" [[dependencies]] name = "aiken-extra/auxlib" -version = "2.190.202405" -source = "github" - -[[dependencies]] -name = "aiken-extra/string_util" -version = "3.190.202405" +version = "2.200.202409" source = "github" [[dependencies]] name = "aiken-extra/time_util" -version = "5.190.202405" +version = "5.200.202409" source = "github" [[dependencies]] name = "aiken-extra/tx_util" -version = "1.190.202405" +version = "1.200.202409" source = "github" diff --git a/docs/css/index.css b/docs/css/index.css index e50ac52..bc52e8d 100644 --- a/docs/css/index.css +++ b/docs/css/index.css @@ -5,7 +5,7 @@ --search-width: 680px; --header-height: 60px; --hash-offset: calc(var(--header-height) * 1.67); - --sidebar-width: 240px; + --sidebar-width: 260px; --gap: 24px; --small-gap: calc(var(--gap) / 2); --tiny-gap: calc(var(--small-gap) / 2); @@ -29,6 +29,13 @@ --color-table-border: #ea76cb; --color-code-background: #dce0e8; + /* Blockquote tags */ + --color-note: #0984e3; + --color-tip: #00b894; + --color-important: #e84393; + --color-warning: #f9ca24; + --color-caution: #e17055; + /* etc */ --nav-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1); --shadow: @@ -60,6 +67,15 @@ html { scroll-padding-top: var(--hash-offset); } +.tippy-box { + background-color: var(--color-text); + color: var(--color-background); +} + +.tippy-arrow { + color: var(--color-text); +} + a, a:visited { color: var(--color-link); @@ -281,11 +297,13 @@ p code { /* Module doc */ .module-name > a, +.module-heading > a, .module-member-kind > a { color: inherit; } .module-name > a:hover, +.module-heading > a:hover, .module-member-kind > a:hover { text-decoration: none; } @@ -303,10 +321,7 @@ p code { font-size: 0.95rem; max-height: calc(100vh - var(--header-height)); overflow-y: auto; - overscroll-behavior: contain; - padding-top: var(--gap); - padding-bottom: var(--gap); - padding-left: var(--gap); + padding: var(--gap) var(--small-gap); position: fixed; top: var(--header-height); transition: transform 0.5s ease; @@ -315,11 +330,14 @@ p code { height: 100%; display: flex; flex-direction: column; + overflow-x: hidden; + word-break: normal; } .sidebar h2 { margin: 0; - color: var(--color-link-accent); + color: var(--color-text); + font-size: 1.75em; } .sidebar h3.modules-prefix { @@ -340,17 +358,9 @@ p code { .sidebar li { line-height: 1.2; margin-bottom: 4px; -} - -.sidebar ul li a > strong { - font-weight: 900; - color: var(--color-link); -} - -.sidebar ul li a > strong::before { - font-size: 0.75em; - content: 'ᐅ '; - padding-right: 0.1rem; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .sidebar .sidebar-toggle { @@ -407,6 +417,10 @@ body.drawer-open .label-closed { .module-member-kind { font-size: 2rem; +} + +.module-heading, +.module-member-kind { color: var(--color-text); } @@ -457,6 +471,22 @@ body.drawer-open .label-closed { margin: 0 0 0 var(--small-gap); } +a.member-source, +a.member-source:hover, +a.member-source:visited { + text-decoration: none; + color: var(--color-text-accent); +} + +a.member-source::before { + content: '{ ... }'; + transition: all 0.5s ease-out; +} + +a.member-source:hover::before { + content: '{ view source }'; +} + /* Custom type constructors */ .constructor-list { @@ -498,22 +528,51 @@ body.drawer-open .label-closed { .constructor-item-docs { margin-left: var(--large-gap); margin-bottom: var(--gap); +} + +.constructor-item-docs > p { padding-left: 1.5rem; - margin-top: -1em; } -.constructor-item-docs::before { +.constructor-item-docs > p:first-child { + padding-top: 0.5rem; +} + +.constructor-item-docs > p:first-child::before { content: '↳'; position: relative; margin-left: -1.5rem; - top: 1.5em; color: var(--color-background-accent); + width: 1.5rem; + display: inline-block; +} + +.constructor-item-docs hr { + color: var(--color-text-accent); +} + +.constructor-item-docs hr:last-child { + display: none; } .constructor-item-docs p { margin: 0; } +.constructor-item-docs h4 { + margin-bottom: 1rem; + display: inline-block; +} + +.constructor-item-docs h4 > code { + padding: 0.5rem; +} + +.constructor-item-docs h4 ~ p { + padding-left: 0.5rem; + display: inline-block; +} + .constructor-name { box-shadow: unset; margin: 0; @@ -1037,3 +1096,155 @@ body.theme-dark { padding-top: 0; } } + +.sidebar li[data-indent] { + margin-bottom: unset; + display: flex; + flex-direction: row; + color: var(--color-background-accent); +} + +.sidebar li[data-indent] span, +.sidebar li[data-indent] a { + display: flex; + width: 100%; + position: relative; + left: -0.5rem; + padding-left: 0.75rem; +} + +.sidebar li[data-indent] a:hover, +.sidebar li[data-current] a, +.sidebar li[data-current] a:visited { + padding-right: 0.25rem; + text-decoration: none; + color: var(--color-text-accent); + background: + linear-gradient( + 115deg, + transparent 0.5rem, + var(--color-background-accent) 0.5rem + ); +} + +.sidebar li[data-indent="0"] { + font-size: 1.1em; +} + +.sidebar li[data-indent="0"]:not(first-child) { + margin-top: 0.5rem; +} + +.sidebar li[data-indent]::before { + content: '/'; + font-size: 1.05em; + font-family: monospace; + padding-left: 0.25rem; + letter-spacing: -0.1rem; + padding-left: 4rem; + display: flex; + color: var(--color-background-accent); +} + +.sidebar li[data-indent="0"]::before { display: none; } +.sidebar li[data-indent="1"]::before { padding-left: 1rem; } +.sidebar li[data-indent="2"]::before { padding-left: 2rem; } +.sidebar li[data-indent="3"]::before { padding-left: 3rem; } + +.sidebar li[data-heading] > a, +.sidebar li[data-heading] > a:visited, +.sidebar li[data-heading] { + font-weight: bold; + font-size: 1em; + color: var(--color-text); +} + +.sidebar li[data-heading="1"] { + margin-top: 1.5rem; + font-size: 1.4em; +} + +.sidebar li[data-heading="2"] { + margin-top: 1rem; + font-size: 1.2em; +} + +.sidebar li[data-heading="3"] { + margin-top: 0.75rem; + font-size: 1.1em; +} + +.sidebar li[data-heading="4"] { + margin-top: 0.5rem; + font-size: 1.1em; +} + +.sidebar li[data-heading]:first-child { + margin-top: 0; +} + +/* Blockquote tags */ + +blockquote.markdown-alert-note { + --color-alert: var(--color-note); + --text-alert: "Note"; +} + +blockquote.markdown-alert-tip { + --color-alert: var(--color-tip); + --text-alert: "Tip"; +} + + +blockquote.markdown-alert-important { + --color-alert: var(--color-important); + --text-alert: "Important"; +} + + +blockquote.markdown-alert-warning { + --color-alert: var(--color-warning); + --text-alert: "Warning"; +} + + +blockquote.markdown-alert-caution { + --color-alert: var(--color-caution); + --text-alert: "Caution"; +} + +blockquote.markdown-alert-note, +blockquote.markdown-alert-tip, +blockquote.markdown-alert-important, +blockquote.markdown-alert-warning, +blockquote.markdown-alert-caution { + border-left: 4px solid var(--color-alert); + padding-left: 1rem; + margin: 0; +} + +blockquote.markdown-alert-note > span.icon-group > svg.icon, +blockquote.markdown-alert-tip > span.icon-group > svg.icon, +blockquote.markdown-alert-important > span.icon-group > svg.icon, +blockquote.markdown-alert-warning > span.icon-group > svg.icon, +blockquote.markdown-alert-caution > span.icon-group > svg.icon { + width: 1em; + height: 1em; + display: inline-block; + position: relative; + top: 0.15rem; + margin-right: 0.25rem; +} + +blockquote.markdown-alert-note > span.icon-group, +blockquote.markdown-alert-tip > span.icon-group, +blockquote.markdown-alert-important > span.icon-group, +blockquote.markdown-alert-warning > span.icon-group, +blockquote.markdown-alert-caution > span.icon-group { + font-weight: bold; + font-variant: small-caps; + color: var(--color-alert); + display: inline-block; + width: 100%; + padding-bottom: 0.5rem; +} diff --git a/docs/index.html b/docs/index.html index 84a571d..7161751 100644 --- a/docs/index.html +++ b/docs/index.html @@ -7,8 +7,8 @@ - - + + - + + - - + + + + - + + \ No newline at end of file diff --git a/docs/morbid/action.html b/docs/morbid/action.html index 3ceddb5..bb6b838 100644 --- a/docs/morbid/action.html +++ b/docs/morbid/action.html @@ -7,8 +7,8 @@ - - + + - + + - - + + + + - + + \ No newline at end of file diff --git a/docs/morbid/alias.html b/docs/morbid/alias.html index bf8a8af..3e0ced5 100644 --- a/docs/morbid/alias.html +++ b/docs/morbid/alias.html @@ -7,8 +7,8 @@ - - + + - + + - - + + + + - + + \ No newline at end of file diff --git a/docs/morbid/constant.html b/docs/morbid/constant.html index 347bc3b..7f8df1a 100644 --- a/docs/morbid/constant.html +++ b/docs/morbid/constant.html @@ -7,8 +7,8 @@ - - + + - + + - - + + + + - + + \ No newline at end of file diff --git a/docs/morbid/locker.html b/docs/morbid/locker.html index 78f4eae..1572cde 100644 --- a/docs/morbid/locker.html +++ b/docs/morbid/locker.html @@ -7,8 +7,8 @@ - - + + - + + - - + + + + - + + \ No newline at end of file diff --git a/docs/search-data.js b/docs/search-data.js index 03d89ba..4d61511 100644 --- a/docs/search-data.js +++ b/docs/search-data.js @@ -1 +1 @@ -window.Aiken.initSearch([{"doc":"morbid/action","title":"Action","content":"Action {\n DelayUnlock\n UnlockChest\n}\n\nDelayUnlock\n Delay chest unlocking deadline by showing the `ChestKey` token(s)\nUnlockChest\n Anyone can unlock the chest when the deadline has passed.","url":"morbid/action.html#Action"},{"doc":"morbid/action","title":"morbid/action","content":"","url":"morbid/action.html"},{"doc":"morbid/alias","title":"FlattenValue","content":"FlattenValue = (PolicyId, AssetName, Qty)\n\n","url":"morbid/alias.html#FlattenValue"},{"doc":"morbid/alias","title":"FlattenValues","content":"FlattenValues = List<FlattenValue>\n\n","url":"morbid/alias.html#FlattenValues"},{"doc":"morbid/alias","title":"PubKeyHash","content":"PubKeyHash = Hash<Blake2b_224, VerificationKey>\n\n","url":"morbid/alias.html#PubKeyHash"},{"doc":"morbid/alias","title":"Qty","content":"Qty = Int\n\n","url":"morbid/alias.html#Qty"},{"doc":"morbid/alias","title":"TxHash","content":"TxHash = Hash<Blake2b_256, Transaction>\n\n","url":"morbid/alias.html#TxHash"},{"doc":"morbid/alias","title":"ValidatorHash","content":"ValidatorHash = Hash<Blake2b_224, Script>\n\n","url":"morbid/alias.html#ValidatorHash"},{"doc":"morbid/alias","title":"morbid/alias","content":"","url":"morbid/alias.html"},{"doc":"morbid/constant","title":"chest_key","content":"chest_key: ByteArray = "ChestKey"\n Used as the token name. Attach metadata when minting\n to keep details such as chest name and address.\n\n Give access for delaying the chest unlocking deadline\n to anyone by sending them the `ChestKey` token.","url":"morbid/constant.html#chest_key"},{"doc":"morbid/constant","title":"morbid/constant","content":"","url":"morbid/constant.html"},{"doc":"morbid/locker","title":"mint_chest","content":"mint_chest(\n chest_name: AssetName,\n utxo_ref: OutputReference,\n redeemer: Void,\n context: ScriptContext,\n) -> Bool\n","url":"morbid/locker.html#mint_chest"},{"doc":"morbid/locker","title":"validate","content":"validate(\n chest_name: AssetName,\n policy_id: PolicyId,\n datum: Data,\n redeemer: Action,\n context: ScriptContext,\n) -> Bool\n When delaying unlock of a UTxO, the transaction must include any `ChestKey`\n token(s) signed by the holder(s) (it will be used to be matched against the\n `ChestLock`), the sum of input and output assets must be balance,\n and it must re-send the `ChestLock` NFT with a new deadline as the datum.\n When unlocking the chest of a UTxO, the transaction validity range must be\n after the deadline.","url":"morbid/locker.html#validate"},{"doc":"morbid/locker","title":"morbid/locker","content":"","url":"morbid/locker.html"}]); \ No newline at end of file +window.Aiken.initSearch([{"doc":"morbid/locker","title":"validate","content":"validate(\n chest_name: AssetName,\n policy_id: PolicyId,\n datum: Data,\n redeemer: Action,\n context: ScriptContext,\n) -> Bool\n When delaying unlock of a UTxO, the transaction must include any `ChestKey`\n token(s) signed by the holder(s) (it will be used to be matched against the\n `ChestLock`), the sum of input and output assets must be balance,\n and it must re-send the `ChestLock` NFT with a new deadline as the datum.\n When unlocking the chest of a UTxO, the transaction validity range must be\n after the deadline.","url":"morbid/locker.html#validate"},{"doc":"morbid/locker","title":"mint_chest","content":"mint_chest(\n chest_name: AssetName,\n utxo_ref: OutputReference,\n redeemer: Void,\n context: ScriptContext,\n) -> Bool\n","url":"morbid/locker.html#mint_chest"},{"doc":"morbid/locker","title":"morbid/locker","content":"","url":"morbid/locker.html"},{"doc":"morbid/alias","title":"FlattenValue","content":"FlattenValue = (PolicyId, AssetName, Qty)\n\n","url":"morbid/alias.html#FlattenValue"},{"doc":"morbid/alias","title":"FlattenValues","content":"FlattenValues = List<FlattenValue>\n\n","url":"morbid/alias.html#FlattenValues"},{"doc":"morbid/alias","title":"PubKeyHash","content":"PubKeyHash = Hash<Blake2b_224, VerificationKey>\n\n","url":"morbid/alias.html#PubKeyHash"},{"doc":"morbid/alias","title":"Qty","content":"Qty = Int\n\n","url":"morbid/alias.html#Qty"},{"doc":"morbid/alias","title":"TxHash","content":"TxHash = Hash<Blake2b_256, Transaction>\n\n","url":"morbid/alias.html#TxHash"},{"doc":"morbid/alias","title":"ValidatorHash","content":"ValidatorHash = Hash<Blake2b_224, Script>\n\n","url":"morbid/alias.html#ValidatorHash"},{"doc":"morbid/alias","title":"morbid/alias","content":"","url":"morbid/alias.html"},{"doc":"morbid/action","title":"Action","content":"Action {\n DelayUnlock\n UnlockChest\n}\n\nDelayUnlock\n Delay chest unlocking deadline by showing the `ChestKey` token(s)\nUnlockChest\n Anyone can unlock the chest when the deadline has passed.","url":"morbid/action.html#Action"},{"doc":"morbid/action","title":"morbid/action","content":"","url":"morbid/action.html"},{"doc":"morbid/constant","title":"chest_key","content":"chest_key: ByteArray = "ChestKey"\n Used as the token name. Attach metadata when minting\n to keep details such as chest name and address.\n\n Give access for delaying the chest unlocking deadline\n to anyone by sending them the `ChestKey` token.","url":"morbid/constant.html#chest_key"},{"doc":"morbid/constant","title":"morbid/constant","content":"","url":"morbid/constant.html"}]); \ No newline at end of file diff --git a/lib/morbid/alias.ak b/lib/morbid/alias.ak index c484822..5aa50b4 100644 --- a/lib/morbid/alias.ak +++ b/lib/morbid/alias.ak @@ -1,7 +1,6 @@ -use aiken/hash.{Blake2b_224, Blake2b_256, Hash} -use aiken/transaction.{Transaction} -use aiken/transaction/credential.{Script, VerificationKey} -use aiken/transaction/value.{AssetName, PolicyId} +use aiken/crypto.{Blake2b_224, Blake2b_256, Hash, Script, VerificationKey} +use cardano/assets.{AssetName, PolicyId} +use cardano/transaction.{Transaction} pub type Qty = Int diff --git a/lib/morbid/constant.ak b/lib/morbid/constant.ak index 1d5f931..ebe971d 100644 --- a/lib/morbid/constant.ak +++ b/lib/morbid/constant.ak @@ -1,4 +1,4 @@ -use aiken/transaction/value.{AssetName} +use cardano/assets.{AssetName} /// Used as the token name. Attach metadata when minting /// to keep details such as chest name and address. diff --git a/lib/morbid/locker.ak b/lib/morbid/locker.ak index 4b43575..e71d0c4 100644 --- a/lib/morbid/locker.ak +++ b/lib/morbid/locker.ak @@ -1,24 +1,19 @@ use aiken/builtin.{fst_pair} -use aiken/dict -use aiken/list.{ +use aiken/collection/dict +use aiken/collection/list.{ all, any, filter, filter_map, find, has, map, reduce, unique, unzip, } -use aiken/time.{PosixTime} -use aiken/transaction.{ - Datum, InlineDatum, Mint, OutputReference, ScriptContext, ScriptPurpose, Spend, -} -use aiken/transaction/credential.{ - Address, Credential, ScriptCredential, VerificationKeyCredential, -} -use aiken/transaction/value.{ - AssetName, PolicyId, flatten, flatten_with, from_minted_value, merge, - quantity_of, tokens, zero, -} use auxlib/logics.{all_true} +use cardano/address.{Address, Credential, Script, VerificationKey} +use cardano/assets.{ + AssetName, PolicyId, flatten, flatten_with, merge, quantity_of, tokens, +} +use cardano/script_context.{Minting, ScriptContext, ScriptInfo, Spending} +use cardano/transaction.{Datum, InlineDatum, OutputReference} use morbid/action.{Action, DelayUnlock, UnlockChest} use morbid/alias.{FlattenValues, Qty, ValidatorHash} use morbid/constant.{chest_key} -use string_util/cbor.{print} +use time_util/time.{PosixTime} use time_util/unsafe/bound as unsafe_unwrap /// When delaying unlock of a UTxO, the transaction must include any `ChestKey` @@ -34,8 +29,8 @@ pub fn validate( redeemer action: Action, context ctx: ScriptContext, ) -> Bool { - expect Spend(_): ScriptPurpose = ctx.purpose - trace print("MaybeDeadline", maybe_deadline) + expect Spending { .. }: ScriptInfo = ctx.info + trace @"MaybeDeadline": maybe_deadline when action is { DelayUnlock -> ctx |> validate_delay_unlock(policy_id, chest_lock) UnlockChest -> ctx |> validate_unlock_chest(policy_id, chest_lock) @@ -48,8 +43,8 @@ pub fn mint_chest( redeemer action: Void, context ctx: ScriptContext, ) { - expect Mint(policy_id): ScriptPurpose = ctx.purpose - trace print("Redeemer", action) + expect Minting(policy_id): ScriptInfo = ctx.info + trace @"Redeemer": action ctx |> validate_mint_chest(utxo_ref, policy_id, chest_lock) } @@ -173,12 +168,6 @@ fn all_values_has_value( all_values_has_value? } -// /// Deprecated: Just use (_ == _)? directly. -// /// Must not drain: Must be equal. -// fn must_be_equal(l, r) { -// (l == r)? -// } - // ///////////////////////////////////// HELPER FUNCTIONS ///////////////////////////////////// // // This section contains the functions to support the validation functions // @@ -187,17 +176,15 @@ fn minted_values_of( policy_id: PolicyId, ) -> Pairs { ctx.transaction.mint - |> from_minted_value() |> tokens(policy_id) |> dict.to_pairs() } /// (1) TxOuts must contain `ChestLock` with the specified Policy ID and Chest Name and its -/// `address.payment_credential` must be of type `ScriptCredential`, and contain the +/// `address.payment_credential` must be of type `Script`, and contain the /// deadline datum with a future value. /// PS: It is, however, possible that the script address of the output (destination) is not -/// the address of the chest. Since there is no way of knowing the runtime value of the -/// chest address beforehand. But there is no incentive for the chest creator to do so. +/// the address of the chest. But there is no incentive for the chest creator to do so. fn send_chest_lock( ctx: ScriptContext, policy_id: PolicyId, @@ -215,21 +202,21 @@ fn is_not_drained(ctx: ScriptContext) -> Bool { let txn = ctx.transaction // Anonymous fn to filter out non script addresses: - let script_address = + let is_script_address = fn(address: Address) { when address.payment_credential is { - ScriptCredential(_) -> True - VerificationKeyCredential(_) -> False + Script(_) -> True + VerificationKey(_) -> False } } // Anonymous fn to collect values only from script address: let value_of_script_address = fn(output: transaction.Output) { - if output.address |> script_address() { + if output.address |> is_script_address() { output.value } else { - zero() + assets.zero } } @@ -246,11 +233,11 @@ fn is_not_drained(ctx: ScriptContext) -> Bool { |> unzip() expect [input_script_address] = input_address - |> filter(script_address) + |> filter(is_script_address) |> unique() let input_value = input_value - |> reduce(zero(), merge) + |> reduce(assets.zero, merge) |> flatten() // (Output Values, Output Address): @@ -260,11 +247,11 @@ fn is_not_drained(ctx: ScriptContext) -> Bool { |> unzip() expect [output_script_address] = output_address - |> filter(script_address) + |> filter(is_script_address) |> unique() let output_value = output_value - |> reduce(zero(), merge) + |> reduce(assets.zero, merge) |> flatten() // Return: @@ -291,8 +278,8 @@ fn into_script_deadline( } } when output.address.payment_credential is { - VerificationKeyCredential(_) -> None - ScriptCredential(script_address) -> + VerificationKey(_) -> None + Script(script_address) -> when output.value |> flatten_with(filter_chest_lock) is { // there must be at max 1 Chest Lock: [_] -> @@ -312,7 +299,7 @@ fn into_script_deadline( /// (1) TxIns must contain `ChestLock` with the specified Policy ID and Chest Name, and contain the deadline datum. /// (2) TxOuts must contain `ChestLock` with the same Policy ID and Chest Name, and contain the deadline datum with a newer value. -/// (3) `address.payment_credential` of (1) and (2) must be `ScriptCredential`, same value, and there's only 1 unique script address. +/// (3) `address.payment_credential` of (1) and (2) must be `Script`, same value, and there's only 1 unique script address. /// (unique input==output script address validation has been done during drain validation) /// (4) TxRefIns must contain `ChestKey` and its `address.payment_credential` must exist in `extra_signatories` fn resend_chest_lock( @@ -379,8 +366,8 @@ fn resend_chest_lock( fn unwrap_credential(credential: Credential) -> ByteArray { when credential is { - VerificationKeyCredential(pub_key_hash) -> pub_key_hash - ScriptCredential(validator_hash) -> validator_hash + VerificationKey(pub_key_hash) -> pub_key_hash + Script(validator_hash) -> validator_hash } } @@ -401,7 +388,7 @@ fn unlock_after_deadline( ) expect InlineDatum(datum): Datum = input.output.datum expect deadline: PosixTime = datum - (unsafe_unwrap.finite_start_of(txn.validity_range) > deadline)? + (unsafe_unwrap.finite_start_of(txn.validity_range) >= deadline)? } // ///////////////////////////////////// UTILITY FUNCTIONS ///////////////////////////////////// // // This section contains support function(s) not specific to the contract // diff --git a/lib/morbid/tests.ak b/lib/morbid/tests.ak index 506b42f..e87c755 100644 --- a/lib/morbid/tests.ak +++ b/lib/morbid/tests.ak @@ -1,34 +1,33 @@ //// ``` //// ┍━ morbid/tests ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -//// │ PASS [mem: 2612028, cpu: 1538917279] mint_chest +//// │ PASS [mem: 2323978, cpu: 685174685] mint_chest //// │ · with traces -//// │ | ScriptContext: "d8799fd8799f9fd8799fd8799fd8799f46547848617368ff00ffd8799fd8799fd8799f4c436865737443726561746f72ffd87a80ffa140a1401a0280de80d87980d87a80ffffff809fd8799fd8799fd87a9f4c436865737441646472657373ffd87a80ffa240a1401a016e360048506f6c6963794944a14943686573744c6f636b01d87b9f05ffd87a80ffffa140a1401a001e8480a240a1400048506f6c6963794944a24843686573744b65790a4943686573744c6f636b0180a0d8799fd8799fd87a9f01ffd87a80ffd8799fd87b80d87a80ffff80a0a0d8799f40ffffd8799f48506f6c6963794944ffff" -//// │ | Redeemer: "d87980" -//// │ PASS [mem: 4259291, cpu: 2452512520] validate_delay_unlock +//// │ | ScriptContext: 121([_ 121([_ [_ 121([_ 121([_ h'547848617368', 0]), 121([_ 121([_ 121([_ h'436865737443726561746F72']), 122([])]), {_ h'': {_ h'': 42000000 } }, 121([]), 122([])])])], [], [_ 121([_ 121([_ 122([_ h'436865737441646472657373']), 122([])]), {_ h'': {_ h'': 24000000 }, h'506F6C6963794944': {_ h'43686573744C6F636B': 1 } }, 123([_ 5]), 122([])])], 2000000, {_ h'506F6C6963794944': {_ h'43686573744B6579': 10, h'43686573744C6F636B': 1 } }, [], {}, 121([_ 121([_ 122([_ 1]), 122([])]), 121([_ 123([]), 122([])])]), [], {}, {}, h'', {}, [], 122([]), 122([])]), 121([]), 121([_ h'506F6C6963794944'])]) +//// │ | Redeemer: 121([]) +//// │ PASS [mem: 3892044, cpu: 1147079914] validate_delay_unlock //// │ · with traces -//// │ | ScriptContext: "d8799fd8799f9fd8799fd8799fd8799f58284368657374416464726573735f4f6c6443686573744c6f636b446561646c696e655f547848617368ff00ffd8799fd8799fd87a9f4c436865737441646472657373ffd87a80ffa240a1401a016e360048506f6c6963794944a14943686573744c6f636b01d87b9f05ffd87a80ffffff9fd8799fd8799fd8799f5543686573744b6579486f6c6465725f547848617368ff00ffd8799fd8799fd8799f4e43686573744b6579486f6c646572ffd87a80ffa240a1401a0280de8048506f6c6963794944a14843686573744b65790ad87980d87a80ffffff9fd8799fd8799fd87a9f4c436865737441646472657373ffd87a80ffa240a1401a016e360048506f6c6963794944a14943686573744c6f636b01d87b9f0affd87a80ffffa140a1401a001e8480a140a1400080a0d8799fd8799fd87a9f02ffd87a80ffd8799fd87b80d87a80ffff9f4e43686573744b6579486f6c646572ffa0a0d8799f40ffffd87a9fd8799fd8799f40ff00ffffff" -//// │ | MaybeDeadline: "d87980" -//// │ PASS [mem: 4959345, cpu: 2866289407] invalidate_delay_unlock_with_imbalance_assets +//// │ | ScriptContext: 121([_ 121([_ [_ 121([_ 121([_ h'4368657374416464726573735F4F6C6443686573744C6F636B446561646C696E655F547848617368', 0]), 121([_ 121([_ 122([_ h'436865737441646472657373']), 122([])]), {_ h'': {_ h'': 24000000 }, h'506F6C6963794944': {_ h'43686573744C6F636B': 1 } }, 123([_ 5]), 122([])])])], [_ 121([_ 121([_ h'43686573744B6579486F6C6465725F547848617368', 0]), 121([_ 121([_ 121([_ h'43686573744B6579486F6C646572']), 122([])]), {_ h'': {_ h'': 42000000 }, h'506F6C6963794944': {_ h'43686573744B6579': 10 } }, 121([]), 122([])])])], [_ 121([_ 121([_ 122([_ h'436865737441646472657373']), 122([])]), {_ h'': {_ h'': 24000000 }, h'506F6C6963794944': {_ h'43686573744C6F636B': 1 } }, 123([_ 10]), 122([])])], 2000000, {}, [], {}, 121([_ 121([_ 122([_ 2]), 122([])]), 121([_ 123([]), 122([])])]), [_ h'43686573744B6579486F6C646572'], {}, {}, h'', {}, [], 122([]), 122([])]), 121([]), 122([_ 121([_ h'', 0]), 122([])])]) +//// │ | MaybeDeadline: 121([]) +//// │ PASS [mem: 4605772, cpu: 1358545301] invalidate_delay_unlock_with_imbalance_assets //// │ · with traces -//// │ | ScriptContext: "d8799fd8799f9fd8799fd8799fd8799f58284368657374416464726573735f4f6c6443686573744c6f636b446561646c696e655f547848617368ff00ffd8799fd8799fd87a9f4c436865737441646472657373ffd87a80ffa440a1401a016e360048506f6c6963794944a14943686573744c6f636b0149547265617375726531a1434e46540149547265617375726532a145546f6b656e1864d87b9f05ffd87a80ffffff9fd8799fd8799fd8799f5543686573744b6579486f6c6465725f547848617368ff00ffd8799fd8799fd8799f4e43686573744b6579486f6c646572ffd87a80ffa240a1401a0280de8048506f6c6963794944a14843686573744b65790ad87980d87a80ffffff9fd8799fd8799fd87a9f4c436865737441646472657373ffd87a80ffa440a1401a016e360048506f6c6963794944a14943686573744c6f636b0149547265617375726531a1434e46540149547265617375726532a145546f6b656e184bd87b9f0affd87a80ffffa140a1401a001e8480a140a1400080a0d8799fd8799fd87b80d87a80ffd8799fd87980d87a80ffff9f4e43686573744b6579486f6c646572ffa0a0d8799f40ffffd87a9fd8799fd8799f40ff00ffffff" -//// │ | MaybeDeadline: "d87980" +//// │ | ScriptContext: 121([_ 121([_ [_ 121([_ 121([_ h'4368657374416464726573735F4F6C6443686573744C6F636B446561646C696E655F547848617368', 0]), 121([_ 121([_ 122([_ h'436865737441646472657373']), 122([])]), {_ h'': {_ h'': 24000000 }, h'506F6C6963794944': {_ h'43686573744C6F636B': 1 }, h'547265617375726531': {_ h'4E4654': 1 }, h'547265617375726532': {_ h'546F6B656E': 100 } }, 123([_ 5]), 122([])])])], [_ 121([_ 121([_ h'43686573744B6579486F6C6465725F547848617368', 0]), 121([_ 121([_ 121([_ h'43686573744B6579486F6C646572']), 122([])]), {_ h'': {_ h'': 42000000 }, h'506F6C6963794944': {_ h'43686573744B6579': 10 } }, 121([]), 122([])])])], [_ 121([_ 121([_ 122([_ h'436865737441646472657373']), 122([])]), {_ h'': {_ h'': 24000000 }, h'506F6C6963794944': {_ h'43686573744C6F636B': 1 }, h'547265617375726531': {_ h'4E4654': 1 }, h'547265617375726532': {_ h'546F6B656E': 75 } }, 123([_ 10]), 122([])])], 2000000, {}, [], {}, 121([_ 121([_ 123([]), 122([])]), 121([_ 121([]), 122([])])]), [_ h'43686573744B6579486F6C646572'], {}, {}, h'', {}, [], 122([]), 122([])]), 121([]), 122([_ 121([_ h'', 0]), 122([])])]) +//// │ | MaybeDeadline: 121([]) //// │ | all_values_has_value ? False //// │ | not_drained ? False -//// │ PASS [mem: 2306959, cpu: 1388950384] validate_unlock_chest +//// │ PASS [mem: 2059586, cpu: 604424085] validate_unlock_chest //// │ · with traces -//// │ | ScriptContext: "d8799fd8799f9fd8799fd8799fd8799f534368657374416464726573735f547848617368ff00ffd8799fd8799fd87a9f4c436865737441646472657373ffd87a80ffa240a1401a016e360048506f6c6963794944a14943686573744c6f636b01d87b9f0affd87a80ffffff809fd8799fd8799fd8799f4d4368657374556e6c6f636b6572ffd87a80ffa140a1401a016e3600d87980d87a80ffffa140a1401a001e8480a140a1400080a0d8799fd8799fd87a9f14ffd87a80ffd8799fd87b80d87a80ffff80a0a0d8799f40ffffd87a9fd8799fd8799f40ff00ffffff" -//// │ | MaybeDeadline: "d87980" -//// ┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4 tests | 4 passed | 0 failed +//// │ | ScriptContext: 121([_ 121([_ [_ 121([_ 121([_ h'4368657374416464726573735F547848617368', 0]), 121([_ 121([_ 122([_ h'436865737441646472657373']), 122([])]), {_ h'': {_ h'': 24000000 }, h'506F6C6963794944': {_ h'43686573744C6F636B': 1 } }, 123([_ 10]), 122([])])])], [], [_ 121([_ 121([_ 121([_ h'4368657374556E6C6F636B6572']), 122([])]), {_ h'': {_ h'': 24000000 } }, 121([]), 122([])])], 2000000, {}, [], {}, 121([_ 121([_ 122([_ 20]), 122([])]), 121([_ 123([]), 122([])])]), [], {}, {}, h'', {}, [], 122([]), 122([])]), 121([]), 122([_ 121([_ h'', 0]), 122([])])]) +//// │ | MaybeDeadline: 121([]) +//// ┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4 tests | 4 passed | 0 failed //// ``` -use aiken/interval.{after, empty} -use aiken/transaction.{InlineDatum, NoDatum, OutputReference, TransactionId} -use aiken/transaction/credential.{from_script, from_verification_key} -use aiken/transaction/value.{from_asset, merge, to_minted_value} +use aiken/interval.{after} +use cardano/address.{from_script, from_verification_key} +use cardano/assets.{from_asset, merge} +use cardano/transaction.{InlineDatum, NoDatum, OutputReference} use morbid/action.{DelayUnlock, UnlockChest} use morbid/constant use morbid/locker -use string_util/cbor.{print} use tx_util/builder.{ add_asset_to_tx_output, add_signatory, add_tx_input, add_tx_output, add_tx_ref_input, build_txn_context, mint_assets, new_tx_input, new_tx_output, @@ -43,9 +42,9 @@ test mint_chest() { let chest_name = "ChestLock" let chest_lock = policy_id |> from_asset(chest_name, 1) let chest_key = policy_id |> from_asset(constant.chest_key, 10) - let minted_assets = merge(chest_lock, chest_key) |> to_minted_value() + let minted_assets = merge(chest_lock, chest_key) let tx_hash = "TxHash" - let utxo_ref = OutputReference(TransactionId(tx_hash), 0) + let utxo_ref = OutputReference(tx_hash, 0) let tx_in = new_tx_input( tx_hash, @@ -68,7 +67,7 @@ test mint_chest() { |> add_tx_output(tx_out) // Trace: - trace print("ScriptContext", tx) + trace @"ScriptContext": tx // Assert: locker.mint_chest(chest_name, utxo_ref, Void, tx) @@ -109,7 +108,7 @@ test validate_delay_unlock() { ) |> add_asset_to_tx_output(chest_lock) let tx = - after(now) // empty() is also allowed + after(now) // `interval.empty` is also allowed |> build_txn_context() |> add_tx_ref_input(tx_ref_in) |> add_tx_input(tx_in) @@ -117,7 +116,7 @@ test validate_delay_unlock() { |> add_signatory("ChestKeyHolder") // Trace: - trace print("ScriptContext", tx) + trace @"ScriptContext": tx // Assert: locker.validate(chest_name, policy_id, Void, DelayUnlock, tx) @@ -164,15 +163,14 @@ test invalidate_delay_unlock_with_imbalance_assets() { |> add_asset_to_tx_output(treasure_1) // |> add_asset_to_tx_output(treasure_2) |> add_asset_to_tx_output(treasure_2_partial) let tx = - empty() - |> build_txn_context() + build_txn_context(interval.empty) |> add_tx_ref_input(tx_ref_in) |> add_tx_input(tx_in) |> add_tx_output(tx_out) |> add_signatory("ChestKeyHolder") // Trace: - trace print("ScriptContext", tx) + trace @"ScriptContext": tx // Assert: !locker.validate(chest_name, policy_id, Void, DelayUnlock, tx) @@ -202,7 +200,7 @@ test validate_unlock_chest() { |> add_tx_output(tx_out) // Trace: - trace print("ScriptContext", tx) + trace @"ScriptContext": tx // Assert: locker.validate(chest_name, policy_id, Void, UnlockChest, tx) diff --git a/plutus.json b/plutus.json index 8aed448..938405e 100644 --- a/plutus.json +++ b/plutus.json @@ -2,17 +2,17 @@ "preamble": { "title": "ariady-putra/morbid", "description": "An Aiken contract for project 'ariady-putra/morbid'", - "version": "0.2.202405", - "plutusVersion": "v2", + "version": "0.2.202409", + "plutusVersion": "v3", "compiler": { "name": "Aiken", - "version": "v1.0.28-alpha+unknown" + "version": "v1.1.0+unknown" }, "license": "Apache-2.0" }, "validators": [ { - "title": "morbid.mint_chest", + "title": "morbid.mint_chest.mint", "redeemer": { "title": "redeemer", "schema": { @@ -23,21 +23,40 @@ { "title": "utxo_ref", "schema": { - "$ref": "#/definitions/aiken~1transaction~1OutputReference" + "$ref": "#/definitions/cardano~1transaction~1OutputReference" } }, { "title": "chest_name", "schema": { - "$ref": "#/definitions/ByteArray" + "$ref": "#/definitions/AssetName" } } ], - "compiledCode": "590644010000323232323232322232232322533300832323232533300c3007300d3754002264646464a66602600229404c94ccc0500045280a99980a180b80089919299980999198008009bac300b301637546016602c6ea8034894ccc060004528099299980b19baf300d30183754603600402a29444cc00c00c004c06c00454ccc04cc8c8cc004004cc064010cc06400d2f5bded8c044a66603200229404c94ccc05ccdd79ba63301b301c0024bd6f7b6301ba63301b0044bd6f7b6300a51133003003001301c001337606ea4041300101010015333013323300100133018003330180024bd6f7b63011299980c0008a5013253330163371e6eb8c05cc06c00922010843686573744b65790014a22660060060026036002264646464a666034603a004266e20c8c94ccc064c030c068dd5000899299980d19299980f180e8008a99980d9807180e0008a511533301b3016301c00114a02c2c6ea8c048c070dd50018800899b8000148008dd6980f180d9baa00116300f301a375400264664464a666036602c00220062a666036601c0022006200460366ea8c94ccc06cc0580045300103d87980001533301b300700114c0103d87b80001533301b533301b32533301f301e0011533301c300f301d00114a22a666038602e603a00229405858dd51809980e9baa003132533301f301e0011533301c300f301d00114a22a666038602e603a00229405858dd51809980e9baa002133301b32533301f301e0011533301c300f301d00114a22a666038602e603a00229405858dd51809980e9baa0024a09445300103d87a80001533301b32533301f301e0011533301c300f301d00114a22a666038602e603a00229405858dd51809980e9baa00314c103d87b800014c103d8798000301b3754664464a66603a60300022a66603a6030603c6ea80085300103d87a800014c103d87980001533301d30090011533301d3009301e3754004298103d87a800014c103d87b800013232533301f301a00114c0103d87b80001533301f300b00114c0103d87980001325333020337100060022980103d8798000153330203370e0060022980103d87a800014c103d87b8000375a604860426ea8010c07cdd50019bad3022301f3754006603a6ea8008c044c070dd50011808980e1baa001300f301a3754002602060346ea8004c070c074c074c074c074c074c074c074c064dd50021bad301c301d001163758603600264660020026eb0c030c060dd500191299980d0008a5eb804c8c94ccc064c030c068dd500089980200200109980e980f180d9baa001330040040023232533301a3015301b37540022980103d87a800013232533301f00114c0103d87a80001533301f3022001132533301d3009301e37540022601e660426e9ccc084dd4801998109811180f9baa0014bd7025eb80530103d87a80003012301e37540082980103d87a8000323300100137566028603c6ea8010894ccc08000452f5c0264666444646600200200644a66604c002200626466644464a666050603660526ea800440084cc0b0c0b4c0a8dd50008012999813a99981399b8f00901b153330273371e0060482603400429405280980c998159ba73302b3752012660566ea400ccc0ad3010101004bd7025eb805300103d87a8000375c604a0026eb4c098004cc00c00cc0a8008c0a0004dd7180f8009bab30200013300300330240023022001375c603e60386ea8004c040c06cdd51808180d9baa001301d002301d001370e90021805180a9baa00c14a02940528180b801180b0010a503016001325333010300330113754002297adef6c6013756602a60246ea8004c8cc004004c8cc004004dd5980b180b980b980b980b98099baa30083013375401444a66602a002297adef6c60132323232533301633722910100002153330163371e9101000021003100513301a337606ea4008dd3000998030030019bab3017003375c602a0046032004602e00244a666028002298103d87a80001323232325333015337220120042a66602a66e3c0240084c01ccc064dd3000a5eb80530103d87a80001330060060033756602c0066eb8c050008c060008c058004dd2a40006e1d2002375c6022601c6ea800458c00cc034dd50021180818089808800918078009180718078008a4c26cac64a66600e600460100022a66601460120022930b0b1baa002370e90001bae0015734aae7555cf2ab9f5740ae855d11", - "hash": "805acdbfa5e74fc24d5c2056b6bd22d049e77379fe0cfb465726c86c" + "compiledCode": "5905ab01010032323232323232223225333005323232323253323300b3001300c3754004264666464644464a666024601060266ea80044c8c8c94ccc060004528099299980c8008a5015333019301c00113232533301832330010013758601860366ea8c030c06cdd500491299980e8008a50132533301b3375e601c603a6ea8c08000806852889980180180098100008a99980c1919198008009980f0021980f001a5eb7bdb180894ccc078004528099299980e19baf374c66040604200497adef6c60374c6604000897adef6c6014a2266006006002604200266ec0dd480aa610101001533301832330010013301d0033301d0024bd6f7b63011299980e8008a50132533301b3371e6eb8c070c08000922010843686573744b65790014a22660060060026040002264646464a66603e6044004266e20c8c94ccc078c02cc07cdd5000899299980f980618101baa3013302137540062002266e000052002375a604660406ea800458c040c07cdd5000991991192999810180b00088018a99981018068008801880118101baa325333020301600114c0103d879800015333020300700114c0103d87b8000153330205333020300d30213754602860446ea800c4c034c084dd5180a18111baa0021333020300d30213754602860446ea80092825114c103d87a800015333020300d30213754602860446ea800c5300103d87b800014c103d879800030203754664464a66604460300022a666044603060466ea80085300103d87a800014c103d879800015333022300900115333022300930233754004298103d87a800014c103d87b8000132325333024301a00114c0103d87b800015333024300b00114c0103d87980001325333025337100060022980103d8798000153330253370e0060022980103d87a800014c103d87b8000375a6052604c6ea8010c090dd50019bad30273024375400660446ea8008c048c084dd5001180918109baa0013010301f37540026022603e6ea8004c084c088c088c088c088c088c088c088c078dd50021bad30213022001163758604000264660020026eb0c034c074dd500191299980f8008a5eb804c8c94ccc078c02cc07cdd5000899802002001099811181198101baa001330040040023232533301f3015302037540022980103d87a800013232533302400114c0103d87a800015333024302700113253330223009302337540022602e6604c6e9ccc098dd480199813181398121baa0014bd7025eb80530103d87a80003013302337540082980103d87a800032330010013756602a60466ea8010894ccc09400452f5c0264666444646600200200644a666056002200626466644464a66605a6034605c6ea800440084cc0c4c0c8c0bcdd50008012999816299981619b8f00901a1533302c3371e00605226032004294052809810998181ba7330303752012660606ea400ccc0c13010101004bd7025eb805300103d87a8000375c60540026eb4c0ac004cc00c00cc0bc008c0b4004dd718120009bab30250013300300330290023027001375c604860426ea8004c044c080dd5180898101baa00130220023022001370e90021805980d1baa00814a02940528180e001180d8010a50301b001325333015300230163754002297adef6c60137566034602e6ea8004c8cc004004dd5980d180d980d980d980d980b9baa30083017375400a44a666032002298103d87a8000132323232533301a337220100042a66603466e3c0200084c03ccc078dd3000a5eb80530103d87a8000133006006003375660360066eb8c064008c074008c06c004dc3a40046eb8c05cc050dd50008b180198099baa001230143015301500123013001230123013001533300c3002300d37540082a66601e601c6ea80105261616300133010006330104c0103d8798000330103001330103011300e375400697ae04bd701ba548000dc3a40002c601c601e004601a002601a0046016002600e6ea800452613656375c002ae6955ceaab9e5573eae815d0aba21", + "hash": "c77d21495e51ef284a4a1ee9377fcd0a8e544572089f6db75be3e1f7" }, { - "title": "morbid.validate", + "title": "morbid.mint_chest.else", + "parameters": [ + { + "title": "utxo_ref", + "schema": { + "$ref": "#/definitions/cardano~1transaction~1OutputReference" + } + }, + { + "title": "chest_name", + "schema": { + "$ref": "#/definitions/AssetName" + } + } + ], + "compiledCode": "5905ab01010032323232323232223225333005323232323253323300b3001300c3754004264666464644464a666024601060266ea80044c8c8c94ccc060004528099299980c8008a5015333019301c00113232533301832330010013758601860366ea8c030c06cdd500491299980e8008a50132533301b3375e601c603a6ea8c08000806852889980180180098100008a99980c1919198008009980f0021980f001a5eb7bdb180894ccc078004528099299980e19baf374c66040604200497adef6c60374c6604000897adef6c6014a2266006006002604200266ec0dd480aa610101001533301832330010013301d0033301d0024bd6f7b63011299980e8008a50132533301b3371e6eb8c070c08000922010843686573744b65790014a22660060060026040002264646464a66603e6044004266e20c8c94ccc078c02cc07cdd5000899299980f980618101baa3013302137540062002266e000052002375a604660406ea800458c040c07cdd5000991991192999810180b00088018a99981018068008801880118101baa325333020301600114c0103d879800015333020300700114c0103d87b8000153330205333020300d30213754602860446ea800c4c034c084dd5180a18111baa0021333020300d30213754602860446ea80092825114c103d87a800015333020300d30213754602860446ea800c5300103d87b800014c103d879800030203754664464a66604460300022a666044603060466ea80085300103d87a800014c103d879800015333022300900115333022300930233754004298103d87a800014c103d87b8000132325333024301a00114c0103d87b800015333024300b00114c0103d87980001325333025337100060022980103d8798000153330253370e0060022980103d87a800014c103d87b8000375a6052604c6ea8010c090dd50019bad30273024375400660446ea8008c048c084dd5001180918109baa0013010301f37540026022603e6ea8004c084c088c088c088c088c088c088c088c078dd50021bad30213022001163758604000264660020026eb0c034c074dd500191299980f8008a5eb804c8c94ccc078c02cc07cdd5000899802002001099811181198101baa001330040040023232533301f3015302037540022980103d87a800013232533302400114c0103d87a800015333024302700113253330223009302337540022602e6604c6e9ccc098dd480199813181398121baa0014bd7025eb80530103d87a80003013302337540082980103d87a800032330010013756602a60466ea8010894ccc09400452f5c0264666444646600200200644a666056002200626466644464a66605a6034605c6ea800440084cc0c4c0c8c0bcdd50008012999816299981619b8f00901a1533302c3371e00605226032004294052809810998181ba7330303752012660606ea400ccc0c13010101004bd7025eb805300103d87a8000375c60540026eb4c0ac004cc00c00cc0bc008c0b4004dd718120009bab30250013300300330290023027001375c604860426ea8004c044c080dd5180898101baa00130220023022001370e90021805980d1baa00814a02940528180e001180d8010a50301b001325333015300230163754002297adef6c60137566034602e6ea8004c8cc004004dd5980d180d980d980d980d980b9baa30083017375400a44a666032002298103d87a8000132323232533301a337220100042a66603466e3c0200084c03ccc078dd3000a5eb80530103d87a8000133006006003375660360066eb8c064008c074008c06c004dc3a40046eb8c05cc050dd50008b180198099baa001230143015301500123013001230123013001533300c3002300d37540082a66601e601c6ea80105261616300133010006330104c0103d8798000330103001330103011300e375400697ae04bd701ba548000dc3a40002c601c601e004601a002601a0046016002600e6ea800452613656375c002ae6955ceaab9e5573eae815d0aba21", + "hash": "c77d21495e51ef284a4a1ee9377fcd0a8e544572089f6db75be3e1f7" + }, + { + "title": "morbid.validate.spend", "datum": { "title": "datum", "schema": { @@ -54,22 +73,46 @@ { "title": "policy_id", "schema": { - "$ref": "#/definitions/ByteArray" + "$ref": "#/definitions/PolicyId" } }, { "title": "chest_name", "schema": { - "$ref": "#/definitions/ByteArray" + "$ref": "#/definitions/AssetName" } } ], - "compiledCode": "590bf001000032323232323232232232223232322533300b3232323232323232323232323232323232323232533301f301730203754602860426ea805454ccc07cc060c080dd500c8a99980f9919191919191929998149816001099191919192999817181880109929998161980b0030008a9998161980b000803099baf00700214a02940c050ccc04800d2f5bded8c00262c605e002601c660346eb0c0b8c0bc008024dd618168009805198049bac30163029375401000c601e66601a00697adef6c6000e16302a0013009330153758605260540040086eb0c0a0004c014cc010dd6180b18121baa0032300230183025375400246604c6e994ccc088c008c058c090dd500089bab301730243754002297adef6c603302630163024375400297ae025333021301930223754602a60466ea80045288a5030133021375402a2646464a66604a6050004264646464a6660526058004264a66604ea66604e66e3c014dd71816001099b8800400114a0264a66605600229404c8cc004004008894ccc0b4004528899299981599b8848000c0b0dd518180010998018018008a50303000132330010013758603a60546ea8024894ccc0b000452f5c026464a666056604660586ea80044cc0100100084cc0bcccc0accdc42400060586ea8c0c0c0b4dd5000a6103d87a80004c0103d87980003300400400232533302e3301b37566040605a6ea80048894ccc0b94ccc0b8cdc7801816099b8f00248810843686573744b65790014a026036660646e9ccc0c8dd4801998191ba900233032375000297ae04bd700a60103d87a800014c103d87a8000130183302f33302b3322323300100100322533303200114a0264a66606066e3cdd7181a8010020a5113300300300130350013758606060626062606260626062606260626062605a6ea8030c94ccc0b0c094c0b4dd500089bae3031302e375400226eb8c0c4c0b8dd5000980f98169baa301f302d3754002980103d87a80004c0103d87980004bd70180f98161baa302f002302f00114a06eb4c0acc0b000458dd61815000998079bac30133026375400a46660220020460426eb4c0a0c0a4008dd718138008b1bac30260013300b3758602860446ea80048ccc034c058c08cdd500080f80e980998109baa01514a026464a666042603460446ea80044c94ccc088c040c08cdd5000899b88375a604e60486ea8004c8c94ccc090c070c094dd5000899299981299299981498140008a999813180f18138008a5115333026301f302700114a02c2c6ea8c068c09cdd50018800899b8000148008dd6981498131baa0011630173025375400264664464a66604c603e00220062a66604c603c00220062004604c6ea8c94ccc098c07c0045300103d879800015333026301400114c0103d87b800015333026533302632533302a302900115333027301f302800114a22a66604e6040605000229405858dd5180d98141baa003132533302a302900115333027301f302800114a22a66604e6040605000229405858dd5180d98141baa002133302632533302a302900115333027301f302800114a22a66604e6040605000229405858dd5180d98141baa0024a09445300103d87a80001533302632533302a302900115333027301f302800114a22a66604e6040605000229405858dd5180d98141baa00314c103d87b800014c103d879800030263754664464a66605060420022a666050604260526ea80085300103d87a800014c103d879800015333028301600115333028301630293754004298103d87a800014c103d87b800013232533302a302300114c0103d87b80001533302a301800114c0103d8798000132533302b337100060022980103d87980001533302b3370e0060022980103d87a800014c103d87b8000375a605e60586ea8010c0a8dd50019bad302d302a375400660506ea8008c064c09cdd5001180c98139baa0013017302537540026030604a6ea8004c09cc0a0c0a0c0a0c0a0c0a0c0a0c0a0c090dd50018b180818119baa301630233754604c60466ea800458c8cc004004dd6180a98119baa00222533302500114c0103d87a8000132325333024301c325333025301d302637540022900009bad302a3027375400264a66604a603a604c6ea80045300103d87a8000132330010013756605660506ea8008894ccc0a8004530103d87a8000132323232533302b3372204e0042a66605666e3c09c0084c060cc0bcdd4000a5eb80530103d87a8000133006006003375a60580066eb8c0a8008c0b8008c0b0004c8cc004004dd5980d18139baa301a3027375400644a666052002298103d87a8000132323232533302a337220500042a66605466e3c0a00084c05ccc0b8dd3000a5eb80530103d87a8000133006006003375660560066eb8c0a4008c0b4008c0ac0044c044cc0a00092f5c02660080080026052004604e002602660426ea80545888c8cc00400400c894ccc09400452f5c026604c6e9cc00cc09c004cc008008c0a0004c004004894ccc08400452f5c210180008101800009919198121ba73302430250023758604a002660486e9ccc090c094c098008dd618129813000a5eb80cc00c00cc094008dd61811800980080091299980f8008a5eb804c8cc084004cc00c00ccc038c08c0088ccc078cdd78008012504a2604200244464666002002008006444a66604400420022666006006604a004660080026eacc09000888c8ccc00400400c0088894ccc08000840044c8ccc010010c09000ccc88c8cc004004014894ccc0940044cc098cdd81ba9004374c00697adef6c6013232323253330263372001000426605466ec0dd48041ba6007005153330263371e010004264a66604e604060506ea80044cc0accdd81ba9009302c30293754002008200864a66604ea66605400229445280a6103d87a8000130143302b374c00297ae032333001001008002222533302c0021001132333004004303000333223233001001005225333031001133032337606ea4010dd4001a5eb7bdb1804c8c8c8c94ccc0c8cdc800400109981b19bb037520106ea001c01454ccc0c8cdc780400109929998199816181a1baa001133037337606ea4024c0e0c0d4dd5000802080219299981998160008a60103d87a80001302033037375000297ae03370000e00226606c66ec0dd48011ba800133006006003375a60660066eb8c0c4008c0d4008c0cc004dd718158009bad302c001302e00213302a337606ea4008dd3000998030030019bab3027003375c604a0046052004604e0026eb8c07c004dd5981000098110011199805000a5eb80888ccc038008004888cc088dd3998111ba9006330223752006660446ea00092f5c000244646600200200644a66603a00229444c94ccc06cc8c8cc004004018894ccc084004528099299980f99baf3024002374e00829444cc00c00c004c090004dd618100010998018018008a50302000122323300100100322533301c00114bd7009919299980d9809980e1baa00113300400400213301f3020301d3754002660080080046008603e004603e00244464a666030602260326ea8004530103d87a800013232533301d00114c0103d87a80001533301d3020001132533301b3009301c3754002260106603e6e9ccc07cdd48019980f9810180e9baa0014bd7025eb80530103d87a80003009301c375400c2980103d87a8000330093756601c60366ea80148894ccc0714ccc070cdc78018038a99980e19b8f0020061301400114a029404c024cc080dd3998101ba90033302037520046604098010101004bd7025eb805300103d87a8000375c603a60346ea8004c02cc064dd51805980c9baa003374a90001b87480108c05cc060c06000488ccc0100092f5c044466601000400244464a666032602260346ea800440084cc074c078c06cdd500080119980380300180111191980080080191299980b0008a5eb804c8c94ccc054c0140084cc064008cc0100100044cc010010004c068008c060004888c8cc004004010894ccc05800440104c8ccc010dd7180a8009bab301600133003003301a002301800122232330010010042253330150011004132333004375c60280026eb4c054004cc00c00cc064008c05c0048c0480048c044c0480045261365632533300a30030011533300d300c37540082930b0a99980518010008a99980698061baa00414985858c028dd50019b8748008dc3a40006eb8004dd7000ab9a5573aaae7955cfaba05742ae89", - "hash": "88b3a54497d81c8aedb8eb57441b74ee31a7c1a2bfb010a0f15f6926" + "compiledCode": "590bc90101003232323232323223223225333006323232323253323300c3001300d37540042646464646464a66602460060022a66602a60286ea8024540085854ccc048c01c00454ccc054c050dd50048a8010b0b18091baa00815333010300130113754004264666464646464646464646464646464646464646444a66604c6036604e6ea8c03cc0a0dd50008a999813180b98139baa01d1533302632323232323232533303030330021323232323253330353038002132533303333018006001153330333301800100613375e00e0042940528180b19980a001a5eb7bdb18005458c0d8004c040cc06cdd6181a981b0010049bac3034001300c3300b3758602e60606ea8020018c044ccc03c00d2f5bded8c00202c606200260166602c6eb0c0c0c0c4008010dd618178009803998031bac3017302b375400646004603260586ea80048cc0b4dd329998149801180b98159baa00113756603060566ea800452f5bded8c06605a602e60566ea80052f5c04a666050603a60526ea8c058c0a8dd50008a5114a0602860506ea80044c8c8c94ccc0b0c0bc0084c8c8c8c94ccc0c0c0cc0084c94ccc0b94ccc0b8cdc78029bae303300213371000800229404c94ccc0c80045280991980080080111299981a0008a511325333032302730333754606e0042660060060022940c0dc004c8cc004004dd6180f18189baa00922533303300114bd70099192999819181398199baa001133004004002133036333032302730333754606e60686ea800530103d87a80004c0103d8798000330040040023253330353301c3756604260686ea80048894ccc0d54ccc0d4cdc7801819899b8f00248810843686573744b65790014a02604a660726e9ccc0e4dd48019981c9ba900233039375000297ae04bd700a60103d87a800014c103d87a800013022330363330323322323300100100322533303900114a0264a66606e66e3cdd7181e0010020a51133003003001303c0013758606e6070607060706070607060706070607060686ea8030c94ccc0ccc090c0d0dd500089bae30383035375400226eb8c0e0c0d4dd50009810181a1baa302030343754002980103d87a80004c0103d87980004bd70181018199baa3036002303600114a06eb4c0c8c0cc00458dd61818800998089bac3014302d375400a46660260020540506eb4c0bcc0c0008dd718170008b1bac302d0013300d3758602a60526ea80048ccc03cc05cc0a8dd5000813012180a18141baa00114a026464a666050603260526ea80044c94ccc0a4c044c0a8dd5000899b89375a605c60566ea8004c8c94ccc0acc080c0b0dd50008992999816181098169baa301b302e37540062002266e000052002375a6060605a6ea800458c060c0b0dd5000991991192999816980f00088018a99981698110008801880118169baa32533302d301e00114c0103d87980001533302d301500114c0103d87b80001533302d533302d3022302e37546038605e6ea800c4c088c0b8dd5180e18179baa002133302d3022302e37546038605e6ea80092825114c103d87a80001533302d3022302e37546038605e6ea800c5300103d87b800014c103d8798000302d3754664464a66605e60400022a66605e604060606ea80085300103d87a800014c103d87980001533302f30170011533302f301730303754004298103d87a800014c103d87b8000132325333031302200114c0103d87b800015333031301900114c0103d87980001325333032337100060022980103d8798000153330323370e0060022980103d87a800014c103d87b8000375a606c60666ea8010c0c4dd50019bad303430313754006605e6ea8008c068c0b8dd5001180d18171baa0013018302c3754002603260586ea8004c0b8c0bcc0bcc0bcc0bcc0bcc0bcc0bcc0acdd50018b180898151baa3017302a3754605a60546ea800458c8cc004004dd6180b18151baa00222533302c00114c0103d87a800013232533302b302032533302c3021302d37540022900009bad3031302e375400264a6660586042605a6ea80045300103d87a80001323300100137566064605e6ea8008894ccc0c4004530103d87a800013232323253330323372205c0042a66606466e3c0b80084c088cc0d8dd4000a5eb80530103d87a8000133006006003375a60660066eb8c0c4008c0d4008c0cc004c8cc004004dd5980d98171baa301b302e375400644a666060002298103d87a800013232323253330313372205e0042a66606266e3c0bc0084c084cc0d4dd3000a5eb80530103d87a8000133006006003375660640066eb8c0c0008c0d0008c0c80044c06ccc0bc0092f5c02660080080026060004605c002602860506ea80045888c8cc00400400c894ccc0a800452f5c02660566e9cc00cc0b0004cc008008c0b4004c004004894ccc09800452f5c210180008101800009919198149ba733029302a00237586054002660526e9ccc0a4c0a8c0ac008dd618151815800a5eb80cc00c00cc0a8008dd6181400098008009129998120008a5eb804c8cc098004cc00c00ccc034c0a00088ccc08ccdd78008012504a2604c00244464666002002008006444a66604e004200226660060066054004660080026eacc0a400888c8ccc00400400c0088894ccc09400840044c8ccc010010c0a400ccc88c8cc004004014894ccc0a80044cc0accdd81ba9004374c00697adef6c60132323232533302b3372001000426605e66ec0dd48041ba60070051533302b3371e010004264a666058603a605a6ea80044cc0c0cdd81ba90093031302e3754002008200864a666058a66605e00229445280a6103d87a80001301c33030374c00297ae03233300100100800222253330310021001132333004004303500333223233001001005225333036001133037337606ea4010dd4001a5eb7bdb1804c8c8c8c94ccc0dccdc800400109981d99bb037520106ea001c01454ccc0dccdc7804001099299981c1814981c9baa00113303c337606ea4024c0f4c0e8dd5000802080219299981c18148008a60103d87a8000130283303c375000297ae03370000e00226607666ec0dd48011ba800133006006003375a60700066eb8c0d8008c0e8008c0e0004dd718180009bad3031001303300213302f337606ea4008dd3000998030030019bab302c003375c6054004605c00460580026eb8c090004dd5981280098138011199804800a5eb80888ccc034008004888cc09cdd3998139ba90063302737520066604e6ea00092f5c000244646600200200644a66604400229444c94ccc080c8c8cc004004018894ccc098004528099299981219baf3029002374e00829444cc00c00c004c0a4004dd618128010998018018008a50302500122323300100100322533302100114bd70099192999810180a98109baa0011330040040021330243025302237540026600800800460086048004604800244464a66603a601c603c6ea8004530103d87a800013232533302200114c0103d87a8000153330223025001132533302030083021375400226020660486e9ccc090dd480199812181298111baa0014bd7025eb80530103d87a800030083021375400c2980103d87a8000330083756601a60406ea80148894ccc0854ccc084cdc78018038a99981099b8f0020061301600114a029404c044cc094dd3998129ba90033302537520046604a98010101004bd7025eb805300103d87a8000375c6044603e6ea8004c028c078dd51805180f1baa003370e90021180e980f180f0009119980200125eb80888ccc020008004888c94ccc07cc050c080dd50008801099811981218109baa00100233300700600300222323300100100322533301c00114bd7009919299980d980280109980f801198020020008998020020009810001180f000911191980080080211299980e00088020991998021bae301b00137566038002660060066040004603c002444646600200200844a66603600220082646660086eb8c068004dd6980d80099801801980f801180e8009180c0009180b980c000980b18099baa00330013301500a33015008330153374a90011980a8021980a801a5eb812f5c06e95200016370e90001809980a001180900098071baa002370e90010b1807980800118070009807001180600098041baa00114984d958dd70009bae0015734aae7555cf2ab9f5740ae855d101", + "hash": "0878bcef7565f5949485dba4d500d5a748e080eaf7b13b9f2707eb44" + }, + { + "title": "morbid.validate.else", + "parameters": [ + { + "title": "policy_id", + "schema": { + "$ref": "#/definitions/PolicyId" + } + }, + { + "title": "chest_name", + "schema": { + "$ref": "#/definitions/AssetName" + } + } + ], + "compiledCode": "590bc90101003232323232323223223225333006323232323253323300c3001300d37540042646464646464a66602460060022a66602a60286ea8024540085854ccc048c01c00454ccc054c050dd50048a8010b0b18091baa00815333010300130113754004264666464646464646464646464646464646464646444a66604c6036604e6ea8c03cc0a0dd50008a999813180b98139baa01d1533302632323232323232533303030330021323232323253330353038002132533303333018006001153330333301800100613375e00e0042940528180b19980a001a5eb7bdb18005458c0d8004c040cc06cdd6181a981b0010049bac3034001300c3300b3758602e60606ea8020018c044ccc03c00d2f5bded8c00202c606200260166602c6eb0c0c0c0c4008010dd618178009803998031bac3017302b375400646004603260586ea80048cc0b4dd329998149801180b98159baa00113756603060566ea800452f5bded8c06605a602e60566ea80052f5c04a666050603a60526ea8c058c0a8dd50008a5114a0602860506ea80044c8c8c94ccc0b0c0bc0084c8c8c8c94ccc0c0c0cc0084c94ccc0b94ccc0b8cdc78029bae303300213371000800229404c94ccc0c80045280991980080080111299981a0008a511325333032302730333754606e0042660060060022940c0dc004c8cc004004dd6180f18189baa00922533303300114bd70099192999819181398199baa001133004004002133036333032302730333754606e60686ea800530103d87a80004c0103d8798000330040040023253330353301c3756604260686ea80048894ccc0d54ccc0d4cdc7801819899b8f00248810843686573744b65790014a02604a660726e9ccc0e4dd48019981c9ba900233039375000297ae04bd700a60103d87a800014c103d87a800013022330363330323322323300100100322533303900114a0264a66606e66e3cdd7181e0010020a51133003003001303c0013758606e6070607060706070607060706070607060686ea8030c94ccc0ccc090c0d0dd500089bae30383035375400226eb8c0e0c0d4dd50009810181a1baa302030343754002980103d87a80004c0103d87980004bd70181018199baa3036002303600114a06eb4c0c8c0cc00458dd61818800998089bac3014302d375400a46660260020540506eb4c0bcc0c0008dd718170008b1bac302d0013300d3758602a60526ea80048ccc03cc05cc0a8dd5000813012180a18141baa00114a026464a666050603260526ea80044c94ccc0a4c044c0a8dd5000899b89375a605c60566ea8004c8c94ccc0acc080c0b0dd50008992999816181098169baa301b302e37540062002266e000052002375a6060605a6ea800458c060c0b0dd5000991991192999816980f00088018a99981698110008801880118169baa32533302d301e00114c0103d87980001533302d301500114c0103d87b80001533302d533302d3022302e37546038605e6ea800c4c088c0b8dd5180e18179baa002133302d3022302e37546038605e6ea80092825114c103d87a80001533302d3022302e37546038605e6ea800c5300103d87b800014c103d8798000302d3754664464a66605e60400022a66605e604060606ea80085300103d87a800014c103d87980001533302f30170011533302f301730303754004298103d87a800014c103d87b8000132325333031302200114c0103d87b800015333031301900114c0103d87980001325333032337100060022980103d8798000153330323370e0060022980103d87a800014c103d87b8000375a606c60666ea8010c0c4dd50019bad303430313754006605e6ea8008c068c0b8dd5001180d18171baa0013018302c3754002603260586ea8004c0b8c0bcc0bcc0bcc0bcc0bcc0bcc0bcc0acdd50018b180898151baa3017302a3754605a60546ea800458c8cc004004dd6180b18151baa00222533302c00114c0103d87a800013232533302b302032533302c3021302d37540022900009bad3031302e375400264a6660586042605a6ea80045300103d87a80001323300100137566064605e6ea8008894ccc0c4004530103d87a800013232323253330323372205c0042a66606466e3c0b80084c088cc0d8dd4000a5eb80530103d87a8000133006006003375a60660066eb8c0c4008c0d4008c0cc004c8cc004004dd5980d98171baa301b302e375400644a666060002298103d87a800013232323253330313372205e0042a66606266e3c0bc0084c084cc0d4dd3000a5eb80530103d87a8000133006006003375660640066eb8c0c0008c0d0008c0c80044c06ccc0bc0092f5c02660080080026060004605c002602860506ea80045888c8cc00400400c894ccc0a800452f5c02660566e9cc00cc0b0004cc008008c0b4004c004004894ccc09800452f5c210180008101800009919198149ba733029302a00237586054002660526e9ccc0a4c0a8c0ac008dd618151815800a5eb80cc00c00cc0a8008dd6181400098008009129998120008a5eb804c8cc098004cc00c00ccc034c0a00088ccc08ccdd78008012504a2604c00244464666002002008006444a66604e004200226660060066054004660080026eacc0a400888c8ccc00400400c0088894ccc09400840044c8ccc010010c0a400ccc88c8cc004004014894ccc0a80044cc0accdd81ba9004374c00697adef6c60132323232533302b3372001000426605e66ec0dd48041ba60070051533302b3371e010004264a666058603a605a6ea80044cc0c0cdd81ba90093031302e3754002008200864a666058a66605e00229445280a6103d87a80001301c33030374c00297ae03233300100100800222253330310021001132333004004303500333223233001001005225333036001133037337606ea4010dd4001a5eb7bdb1804c8c8c8c94ccc0dccdc800400109981d99bb037520106ea001c01454ccc0dccdc7804001099299981c1814981c9baa00113303c337606ea4024c0f4c0e8dd5000802080219299981c18148008a60103d87a8000130283303c375000297ae03370000e00226607666ec0dd48011ba800133006006003375a60700066eb8c0d8008c0e8008c0e0004dd718180009bad3031001303300213302f337606ea4008dd3000998030030019bab302c003375c6054004605c00460580026eb8c090004dd5981280098138011199804800a5eb80888ccc034008004888cc09cdd3998139ba90063302737520066604e6ea00092f5c000244646600200200644a66604400229444c94ccc080c8c8cc004004018894ccc098004528099299981219baf3029002374e00829444cc00c00c004c0a4004dd618128010998018018008a50302500122323300100100322533302100114bd70099192999810180a98109baa0011330040040021330243025302237540026600800800460086048004604800244464a66603a601c603c6ea8004530103d87a800013232533302200114c0103d87a8000153330223025001132533302030083021375400226020660486e9ccc090dd480199812181298111baa0014bd7025eb80530103d87a800030083021375400c2980103d87a8000330083756601a60406ea80148894ccc0854ccc084cdc78018038a99981099b8f0020061301600114a029404c044cc094dd3998129ba90033302537520046604a98010101004bd7025eb805300103d87a8000375c6044603e6ea8004c028c078dd51805180f1baa003370e90021180e980f180f0009119980200125eb80888ccc020008004888c94ccc07cc050c080dd50008801099811981218109baa00100233300700600300222323300100100322533301c00114bd7009919299980d980280109980f801198020020008998020020009810001180f000911191980080080211299980e00088020991998021bae301b00137566038002660060066040004603c002444646600200200844a66603600220082646660086eb8c068004dd6980d80099801801980f801180e8009180c0009180b980c000980b18099baa00330013301500a33015008330153374a90011980a8021980a801a5eb812f5c06e95200016370e90001809980a001180900098071baa002370e90010b1807980800118070009807001180600098041baa00114984d958dd70009bae0015734aae7555cf2ab9f5740ae855d101", + "hash": "0878bcef7565f5949485dba4d500d5a748e080eaf7b13b9f2707eb44" } ], "definitions": { + "AssetName": { + "title": "AssetName", + "dataType": "bytes" + }, "ByteArray": { + "title": "ByteArray", "dataType": "bytes" }, "Data": { @@ -79,9 +122,12 @@ "Int": { "dataType": "integer" }, + "PolicyId": { + "title": "PolicyId", + "dataType": "bytes" + }, "Void": { "title": "Unit", - "description": "The nullary constructor.", "anyOf": [ { "dataType": "constructor", @@ -90,7 +136,7 @@ } ] }, - "aiken/transaction/OutputReference": { + "cardano/transaction/OutputReference": { "title": "OutputReference", "description": "An `OutputReference` is a unique reference to an output on-chain. The `output_index`\n corresponds to the position in the output list of the transaction (identified by its id)\n that produced that output", "anyOf": [ @@ -101,7 +147,7 @@ "fields": [ { "title": "transaction_id", - "$ref": "#/definitions/aiken~1transaction~1TransactionId" + "$ref": "#/definitions/ByteArray" }, { "title": "output_index", @@ -111,23 +157,6 @@ } ] }, - "aiken/transaction/TransactionId": { - "title": "TransactionId", - "description": "A unique transaction identifier, as the hash of a transaction body. Note that the transaction id\n isn't a direct hash of the `Transaction` as visible on-chain. Rather, they correspond to hash\n digests of transaction body as they are serialized on the network.", - "anyOf": [ - { - "title": "TransactionId", - "dataType": "constructor", - "index": 0, - "fields": [ - { - "title": "hash", - "$ref": "#/definitions/ByteArray" - } - ] - } - ] - }, "morbid/action/Action": { "title": "Action", "anyOf": [ diff --git a/validators/morbid.ak b/validators/morbid.ak index 235204c..cd7043a 100644 --- a/validators/morbid.ak +++ b/validators/morbid.ak @@ -19,21 +19,43 @@ //// //// Jakarta 2024 //// -//// _(re-compiled using `aiken v1.0.28-alpha`)_ +//// _(re-compiled using `aiken v1.1.0`)_ -use aiken/transaction.{OutputReference, ScriptContext} -use aiken/transaction/value.{AssetName, PolicyId} +use cardano/assets.{AssetName, PolicyId} +use cardano/script_context.{Minting, ScriptContext, Spending} +use cardano/transaction.{OutputReference, Transaction} use morbid/action.{Action} use morbid/locker -validator(utxo_ref: OutputReference, chest_name: AssetName) { - fn mint_chest(redeemer: Void, context: ScriptContext) { +validator mint_chest(utxo_ref: OutputReference, chest_name: AssetName) { + mint(redeemer: Void, policy_id: PolicyId, transaction: Transaction) { + let info = Minting(policy_id) + let context = ScriptContext(transaction, redeemer, info) + chest_name |> locker.mint_chest(utxo_ref, redeemer, context) } + + else(_) { + fail + } } -validator(policy_id: PolicyId, chest_name: AssetName) { - fn validate(datum: Data, redeemer: Action, context: ScriptContext) -> Bool { - chest_name |> locker.validate(policy_id, datum, redeemer, context) +validator validate(policy_id: PolicyId, chest_name: AssetName) { + spend( + datum: Option, + redeemer: Action, + output_reference: OutputReference, + transaction: Transaction, + ) { + expect Some(data) = datum + + let info = Spending(output_reference, datum) + let context = ScriptContext(transaction, redeemer, info) + + chest_name |> locker.validate(policy_id, data, redeemer, context) + } + + else(_) { + fail } }