Skip to content

Commit

Permalink
Remove triple comments in some places
Browse files Browse the repository at this point in the history
  • Loading branch information
Quantumplation committed Jan 16, 2024
1 parent e534652 commit 0d73169
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions validators/order.ak
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,26 @@ validator(stake_script_hash: Hash<Blake2b_224, Script>) {
fn spend(datum: Data, redeemer: OrderRedeemer, ctx: ScriptContext) -> Bool {
when redeemer is {
Cancel -> {
/// We only expect the datum here, to avoid any related costs in the other branch, which doesn't need it
// We only expect the datum here, to avoid any related costs in the other branch, which doesn't need it
expect datum: OrderDatum = datum
/// Defer to sundae.multisig
// Defer to sundae.multisig
multisig.satisfied(
datum.owner,
ctx.transaction.extra_signatories,
ctx.transaction.validity_range,
)
}
Scoop -> {
/// Assume that the stake_script_hash is the first withdrawal in the list
/// Since the ledger doesn't reorder withdrawals (TODO: confirm this!!)
/// If we ever have other withdrawals (for example, additional constraints enforced by a different order)
/// then that script can look for the appropriate one, and we can just ensure this one is first in the list.
// Assume that the stake_script_hash is the first withdrawal in the list
// Since the ledger doesn't reorder withdrawals (TODO: confirm this!!)
// If we ever have other withdrawals (for example, additional constraints enforced by a different order)
// then that script can look for the appropriate one, and we can just ensure this one is first in the list.
expect [head] = dict.to_list(ctx.transaction.withdrawals)
when head is {
/// We match against the script hash like this to ignore the withdrawal amount
/// TODO: we could make this more efficient by CBOR encoding the `Inline(ScriptCredential())` into the `stake_script_hash` redeemer
/// and just doing a direct equaltiy comparison. Since this runs for each order, this could represent significant savings!
// We match against the script hash like this to ignore the withdrawal amount
// TODO: we could make this more efficient by CBOR encoding the `Inline(ScriptCredential())` into the `stake_script_hash` parameter
// or perhaps even the whole withdrawal list to compare it all at once!
// and just doing a direct equaltiy comparison. Since this runs for each order, this could represent significant savings!
(Inline(ScriptCredential(script)), _) -> script == stake_script_hash
_ -> False
}
Expand Down

0 comments on commit 0d73169

Please sign in to comment.