feat(aiken_stdlib): add script context type

This commit is contained in:
rvcas 2022-11-16 11:47:30 -05:00 committed by Lucas
parent 021237f265
commit 771e011630
4 changed files with 25 additions and 2 deletions

View File

@ -9,7 +9,7 @@ pub fn length(bytes: ByteArray) -> Int {
} }
pub fn is_empty(bytes: ByteArray) -> Bool { pub fn is_empty(bytes: ByteArray) -> Bool {
builtin.emptyByteArray(bytes) length(bytes) == 0
} }
pub fn concat(left front: ByteArray, right back: ByteArray) -> ByteArray { pub fn concat(left front: ByteArray, right back: ByteArray) -> ByteArray {

View File

@ -0,0 +1,17 @@
pub type ScriptContext(purpose) {
transaction: Transaction,
purpose: purpose,
}
pub type Transaction {
inputs: List(Nil),
outputs: List(Nil),
fee: Nil,
mint: Nil,
certificates: List(Nil),
withdrawals: List(Nil),
validity_range: Nil,
extra_signatories: Nil,
datums: List(Nil),
id: ByteArray,
}

View File

@ -0,0 +1,3 @@
pub type Mint {
currency_symbol: ByteArray,
}

View File

@ -1,3 +1,6 @@
pub fn spend(d: Nil, r: Nil, ctx: Nil) -> Bool { use aiken/context.{ScriptContext}
use aiken/context/mint.{Mint}
pub fn mint(d: Nil, r: Nil, ctx: ScriptContext(Mint)) -> Bool {
True True
} }