fix: withdraw kinda
This commit is contained in:
parent
f86d550ca0
commit
be7c0c8012
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1723741708, nanos_since_epoch = 340365000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"]
|
||||
"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1723751815, nanos_since_epoch = 69229000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[
|
||||
{ 0: h'30{{ withdraw.spend.hash }}{{ withdraw.spend.hash }}'
|
||||
{ 0: h'30{{ withdraw.thing_spend.hash }}{{ withdraw.thing_spend.hash }}'
|
||||
, 1: 1000000
|
||||
, 2: [1, 24(h'd87980')]
|
||||
, 3: 24(h'8203{{ withdraw.spend.cbor }}')
|
||||
, 3: 24(h'8203{{ withdraw.thing_spend.cbor }}')
|
||||
}
|
||||
]
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
, 5:
|
||||
{ h'E000000000000000000000000000000000000000000000000000000000': 14
|
||||
, h'F0{{ withdraw.withdraw.hash }}': 0
|
||||
, h'F0{{ withdraw.thing_withdraw.hash }}': 0
|
||||
}
|
||||
|
||||
, 14:
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,8 +2,7 @@ use aiken/collection/dict
|
|||
use cardano/assets
|
||||
use cardano/credential.{Address, Script}
|
||||
use cardano/transaction.{
|
||||
InlineDatum, Input, Output, OutputReference, ScriptContext, ScriptInfo,
|
||||
ScriptPurpose, Spend, Spending, Transaction,
|
||||
InlineDatum, Input, Output, OutputReference, ScriptPurpose, Spend, Transaction,
|
||||
}
|
||||
|
||||
validator simple_spend {
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
use aiken/collection/list
|
||||
use aiken/interval
|
||||
use cardano/credential.{Address, Inline, Pointer, Script, VerificationKey}
|
||||
use cardano/transaction.{ScriptContext, Withdrawing}
|
||||
use cardano/credential.{
|
||||
Address, Credential, Inline, Pointer, Script, VerificationKey,
|
||||
}
|
||||
use cardano/transaction.{Transaction}
|
||||
|
||||
const only0s = #"00000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
const only1s = #"11111111111111111111111111111111111111111111111111111111"
|
||||
|
||||
validator {
|
||||
fn spend(_tmp0: Void, _tmp1: Void, _ctx: Data) {
|
||||
validator thing {
|
||||
spend(_datum: Option<Void>, _rdmr: Void, _oref: Data, _tx: Data) {
|
||||
True
|
||||
}
|
||||
|
||||
fn withdraw(_tmp0: Void, ctx: ScriptContext) {
|
||||
expect Withdrawing(Script(my_script_hash)) = ctx.info
|
||||
withdraw(_rdmr: Void, credential: Credential, transaction: Transaction) {
|
||||
expect Script(my_script_hash) = credential
|
||||
|
||||
expect
|
||||
interval.entirely_before(1596059092000) == ctx.transaction.validity_range
|
||||
expect interval.entirely_before(1596059092000) == transaction.validity_range
|
||||
|
||||
let addresses = list.map(ctx.transaction.outputs, fn(out) { out.address })
|
||||
let addresses = list.map(transaction.outputs, fn(out) { out.address })
|
||||
|
||||
expect
|
||||
Some(
|
||||
|
@ -45,8 +46,12 @@ validator {
|
|||
) == list.at(addresses, 2)
|
||||
|
||||
expect
|
||||
[Pair(Script(my_script_hash), 0), Pair(VerificationKey(only0s), 14)] == ctx.transaction.withdrawals
|
||||
[Pair(Script(my_script_hash), 0), Pair(VerificationKey(only0s), 14)] == transaction.withdrawals
|
||||
|
||||
True
|
||||
}
|
||||
|
||||
else(_ctx) {
|
||||
fail
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue