chore: convert gift card tutorial to v3
This commit is contained in:
parent
3521a8c921
commit
c87f459ce7
|
@ -17,8 +17,8 @@ type Action {
|
||||||
type SpendTokenName =
|
type SpendTokenName =
|
||||||
ByteArray
|
ByteArray
|
||||||
|
|
||||||
validator(creator: ByteArray) {
|
validator redeem(creator: ByteArray) {
|
||||||
fn redeem(
|
spend(
|
||||||
// Each spend input checks for a token name matching the datum being burned
|
// Each spend input checks for a token name matching the datum being burned
|
||||||
datum: SpendTokenName,
|
datum: SpendTokenName,
|
||||||
_r: Data,
|
_r: Data,
|
||||||
|
@ -47,7 +47,7 @@ validator(creator: ByteArray) {
|
||||||
) == -1
|
) == -1
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gift_card(rdmr: Action, ctx: ScriptContext) -> Bool {
|
mint(rdmr: Action, ctx: ScriptContext) -> Bool {
|
||||||
// get values from transaction and purpose
|
// get values from transaction and purpose
|
||||||
let ScriptContext { transaction, purpose } = ctx
|
let ScriptContext { transaction, purpose } = ctx
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ type Action {
|
||||||
Burn
|
Burn
|
||||||
}
|
}
|
||||||
|
|
||||||
validator(token_name: ByteArray, utxo_ref: OutputReference) {
|
validator gift_card(token_name: ByteArray, utxo_ref: OutputReference) {
|
||||||
fn gift_card(rdmr: Action, ctx: ScriptContext) -> Bool {
|
mint(rdmr: Action, ctx: ScriptContext) -> Bool {
|
||||||
let ScriptContext { transaction, purpose } = ctx
|
let ScriptContext { transaction, purpose } = ctx
|
||||||
|
|
||||||
expect tx.Mint(policy_id) = purpose
|
expect tx.Mint(policy_id) = purpose
|
||||||
|
@ -33,8 +33,8 @@ validator(token_name: ByteArray, utxo_ref: OutputReference) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validator(token_name: ByteArray, policy_id: ByteArray) {
|
validator redeem(token_name: ByteArray, policy_id: ByteArray) {
|
||||||
fn redeem(_d: Data, _r: Data, ctx: ScriptContext) -> Bool {
|
spend(_d: Data, _r: Data, ctx: ScriptContext) -> Bool {
|
||||||
let ScriptContext { transaction, .. } = ctx
|
let ScriptContext { transaction, .. } = ctx
|
||||||
|
|
||||||
let Transaction { mint, .. } = transaction
|
let Transaction { mint, .. } = transaction
|
||||||
|
|
Loading…
Reference in New Issue