Skip to content

Commit

Permalink
finish switching spend validator to depend on withdraw validator
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroProofs committed Oct 18, 2023
1 parent 4fc0554 commit a3cda57
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions validators/hard_fork.ak
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ type LockActionType {
AfterForkLock(OutputReference)
}

type ForkAction {
}

type NftForkAction {
Initialize
Lock {
Expand Down Expand Up @@ -113,21 +110,20 @@ validator(
}
}

fn fork(datum: ForkDatum, _redeemer, ctx: ScriptContext) -> Bool {
fn fork(_datum: Data, _redeemer, ctx: ScriptContext) -> Bool {
let ScriptContext { transaction, purpose } = ctx

expect tx.Spend(own_ref) = purpose

let Transaction { inputs, mint, outputs, reference_inputs, .. } =
transaction

let mint = value.from_minted_value(mint)
let Transaction { inputs, withdrawals, .. } = transaction

let own_input = utils.find_input_resolved(inputs, own_ref)

expect ScriptCredential(own_policy) = own_input.address.payment_credential
expect ScriptCredential(withdraw_key) = own_input.address.payment_credential

let own_withdrawal = Inline(ScriptCredential(withdraw_key))

True
dict.has_key(withdrawals, own_withdrawal)
}
}
// when redeemer is {
Expand Down

0 comments on commit a3cda57

Please sign in to comment.