feat: wrap up adding uplc builtins for now
This commit is contained in:
8
examples/sample/src/sample/context.ak
Normal file
8
examples/sample/src/sample/context.ak
Normal file
@@ -0,0 +1,8 @@
|
||||
pub type ScriptContext(purpose) {
|
||||
tx_info: TxInfo,
|
||||
script_purpose: purpose
|
||||
}
|
||||
|
||||
pub type TxInfo {
|
||||
idk: Int
|
||||
}
|
||||
7
examples/sample/src/sample/mint.ak
Normal file
7
examples/sample/src/sample/mint.ak
Normal file
@@ -0,0 +1,7 @@
|
||||
use sample/context
|
||||
|
||||
pub type Mint {
|
||||
currency_symbol: ByteArray
|
||||
}
|
||||
|
||||
pub type ScriptContext = context.ScriptContext(Mint)
|
||||
7
examples/sample/src/sample/spend.ak
Normal file
7
examples/sample/src/sample/spend.ak
Normal file
@@ -0,0 +1,7 @@
|
||||
use sample/context
|
||||
|
||||
pub type Spend {
|
||||
idk: Int
|
||||
}
|
||||
|
||||
pub type ScriptContext = context.ScriptContext(Spend)
|
||||
@@ -1,13 +0,0 @@
|
||||
use aiken/builtin.{addInteger}
|
||||
|
||||
pub type ScriptContext {
|
||||
idk: Int
|
||||
}
|
||||
|
||||
pub fn append(a: ByteArray, b: ByteArray) -> ByteArray {
|
||||
todo
|
||||
}
|
||||
|
||||
pub fn add(a, b) {
|
||||
addInteger(a, b)
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
use sample
|
||||
use sample/syntax.{append}
|
||||
use sample/mint
|
||||
use sample/spend
|
||||
|
||||
pub type Datum {
|
||||
something: String,
|
||||
@@ -10,13 +10,7 @@ pub type Redeemer {
|
||||
Sell
|
||||
}
|
||||
|
||||
pub fn validate(datum: Datum, rdmr: Redeemer, ctx: sample.ScriptContext) -> Bool {
|
||||
let thing = if True {
|
||||
3
|
||||
} else {
|
||||
"thing"
|
||||
}
|
||||
|
||||
pub fn spend(datum: Datum, rdmr: Redeemer, ctx: spend.ScriptContext) -> Bool {
|
||||
when rdmr is {
|
||||
Buy -> True
|
||||
Sell -> datum.something == "Aiken"
|
||||
|
||||
Reference in New Issue
Block a user