feat: wrap up adding uplc builtins for now

This commit is contained in:
rvcas
2022-10-25 14:52:29 -04:00
committed by Lucas
parent d5d2ba9cd7
commit 819256df99
12 changed files with 222 additions and 110 deletions

View File

@@ -0,0 +1,8 @@
pub type ScriptContext(purpose) {
tx_info: TxInfo,
script_purpose: purpose
}
pub type TxInfo {
idk: Int
}

View File

@@ -0,0 +1,7 @@
use sample/context
pub type Mint {
currency_symbol: ByteArray
}
pub type ScriptContext = context.ScriptContext(Mint)

View File

@@ -0,0 +1,7 @@
use sample/context
pub type Spend {
idk: Int
}
pub type ScriptContext = context.ScriptContext(Spend)

View File

@@ -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)
}

View File

@@ -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"