@meshsdk/contract 1.6.0-alpha.20 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +37 -0
- package/dist/index.d.cts +739 -0
- package/dist/index.d.ts +739 -0
- package/dist/index.js +37 -0
- package/package.json +23 -7
- package/src/common.ts +0 -186
- package/src/coupon-bond-guaranteed/aiken-workspace/readme.md +0 -0
- package/src/coupon-bond-guaranteed/offchain.ts +0 -3
- package/src/coupon-bond-guaranteed/readme.md +0 -3
- package/src/escrow/aiken-workspace/aiken.lock +0 -26
- package/src/escrow/aiken-workspace/aiken.toml +0 -19
- package/src/escrow/aiken-workspace/lib/escrow/types.ak +0 -21
- package/src/escrow/aiken-workspace/lib/escrow/validators/escrow.ak +0 -122
- package/src/escrow/aiken-workspace/plutus.json +0 -238
- package/src/escrow/aiken-workspace/readme.md +0 -55
- package/src/escrow/aiken-workspace/validators/escrow.ak +0 -9
- package/src/escrow/aiken-workspace/validators/tests/escrow.ak +0 -462
- package/src/escrow/index.ts +0 -1
- package/src/escrow/offchain.ts +0 -254
- package/src/escrow/readme.md +0 -38
- package/src/giftcard/aiken-workspace/aiken.lock +0 -26
- package/src/giftcard/aiken-workspace/aiken.toml +0 -19
- package/src/giftcard/aiken-workspace/plutus.json +0 -138
- package/src/giftcard/aiken-workspace/readme.md +0 -55
- package/src/giftcard/aiken-workspace/validators/oneshot.ak +0 -173
- package/src/giftcard/index.ts +0 -1
- package/src/giftcard/offchain.ts +0 -184
- package/src/giftcard/readme.md +0 -36
- package/src/hello-world/aiken-workspace/README.md +0 -19
- package/src/hello-world/aiken-workspace/aiken.lock +0 -15
- package/src/hello-world/aiken-workspace/aiken.toml +0 -14
- package/src/hello-world/aiken-workspace/contract.md +0 -27
- package/src/hello-world/aiken-workspace/plutus.json +0 -69
- package/src/hello-world/aiken-workspace/validators/hello_world.ak +0 -24
- package/src/hello-world/index.ts +0 -1
- package/src/hello-world/offchain.ts +0 -24
- package/src/hello-world/readme.md +0 -1
- package/src/index.ts +0 -6
- package/src/marketplace/aiken-workspace/aiken.lock +0 -26
- package/src/marketplace/aiken-workspace/aiken.toml +0 -19
- package/src/marketplace/aiken-workspace/lib/marketplace/types.ak +0 -15
- package/src/marketplace/aiken-workspace/lib/marketplace/validators/marketplace.ak +0 -52
- package/src/marketplace/aiken-workspace/plutus.json +0 -204
- package/src/marketplace/aiken-workspace/readme.md +0 -55
- package/src/marketplace/aiken-workspace/validators/marketplace.ak +0 -14
- package/src/marketplace/aiken-workspace/validators/tests/marketplace.ak +0 -218
- package/src/marketplace/index.ts +0 -1
- package/src/marketplace/offchain.ts +0 -248
- package/src/marketplace/readme.md +0 -45
- package/src/payment-splitter/aiken-workspace/aiken.lock +0 -15
- package/src/payment-splitter/aiken-workspace/aiken.toml +0 -14
- package/src/payment-splitter/aiken-workspace/plutus.json +0 -83
- package/src/payment-splitter/aiken-workspace/validators/payment-splitter.ak +0 -329
- package/src/payment-splitter/index.ts +0 -1
- package/src/payment-splitter/offchain.ts +0 -143
- package/src/payment-splitter/readme.md +0 -100
- package/src/swap/aiken-workspace/aiken.lock +0 -26
- package/src/swap/aiken-workspace/aiken.toml +0 -19
- package/src/swap/aiken-workspace/plutus.json +0 -208
- package/src/swap/aiken-workspace/readme.md +0 -55
- package/src/swap/aiken-workspace/validators/swap.ak +0 -188
- package/src/swap/index.ts +0 -1
- package/src/swap/offchain.ts +0 -139
- package/src/swap/readme.md +0 -35
- package/src/vesting/aiken-workspace/README.md +0 -24
- package/src/vesting/aiken-workspace/aiken.lock +0 -26
- package/src/vesting/aiken-workspace/aiken.toml +0 -19
- package/src/vesting/aiken-workspace/lib/vesting/types.ak +0 -8
- package/src/vesting/aiken-workspace/lib/vesting/validators/vesting.ak +0 -19
- package/src/vesting/aiken-workspace/plutus.json +0 -67
- package/src/vesting/aiken-workspace/validators/tests/vesting.ak +0 -108
- package/src/vesting/aiken-workspace/validators/vesting.ak +0 -9
- package/src/vesting/index.ts +0 -1
- package/src/vesting/offchain.ts +0 -117
- package/src/vesting/readme.md +0 -36
- package/tsconfig.json +0 -5
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# This file was generated by Aiken
|
|
2
|
-
# You typically do not need to edit this file
|
|
3
|
-
|
|
4
|
-
[[requirements]]
|
|
5
|
-
name = "aiken-lang/stdlib"
|
|
6
|
-
version = "1.9.0"
|
|
7
|
-
source = "github"
|
|
8
|
-
|
|
9
|
-
[[packages]]
|
|
10
|
-
name = "aiken-lang/stdlib"
|
|
11
|
-
version = "1.9.0"
|
|
12
|
-
requirements = []
|
|
13
|
-
source = "github"
|
|
14
|
-
|
|
15
|
-
[etags]
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
name = "meshjs/aiken"
|
|
2
|
-
version = "0.0.0"
|
|
3
|
-
license = "Apache-2.0"
|
|
4
|
-
description = "Aiken on MeshJS"
|
|
5
|
-
|
|
6
|
-
[repository]
|
|
7
|
-
user = "jingles"
|
|
8
|
-
project = "test1"
|
|
9
|
-
platform = "github"
|
|
10
|
-
|
|
11
|
-
[[dependencies]]
|
|
12
|
-
name = "aiken-lang/stdlib"
|
|
13
|
-
version = "1.9.0"
|
|
14
|
-
source = "github"
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
```
|
|
3
|
-
use aiken/hash.{Blake2b_224, Hash}
|
|
4
|
-
use aiken/list
|
|
5
|
-
use aiken/transaction.{ScriptContext}
|
|
6
|
-
use aiken/transaction/credential.{VerificationKey}
|
|
7
|
-
|
|
8
|
-
type Datum {
|
|
9
|
-
owner: Hash<Blake2b_224, VerificationKey>,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type Redeemer {
|
|
13
|
-
msg: ByteArray,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
validator {
|
|
17
|
-
fn hello_world(datum: Datum, redeemer: Redeemer, context: ScriptContext) -> Bool {
|
|
18
|
-
let must_say_hello =
|
|
19
|
-
redeemer.msg == "Hello, World!"
|
|
20
|
-
|
|
21
|
-
let must_be_signed =
|
|
22
|
-
list.has(context.transaction.extra_signatories, datum.owner)
|
|
23
|
-
|
|
24
|
-
must_say_hello && must_be_signed
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
```
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"preamble": {
|
|
3
|
-
"title": "meshjs/aiken",
|
|
4
|
-
"description": "Aiken on MeshJS",
|
|
5
|
-
"version": "0.0.0",
|
|
6
|
-
"plutusVersion": "v2",
|
|
7
|
-
"compiler": {
|
|
8
|
-
"name": "Aiken",
|
|
9
|
-
"version": "v1.0.29-alpha+unknown"
|
|
10
|
-
},
|
|
11
|
-
"license": "Apache-2.0"
|
|
12
|
-
},
|
|
13
|
-
"validators": [
|
|
14
|
-
{
|
|
15
|
-
"title": "hello_world.hello_world",
|
|
16
|
-
"datum": {
|
|
17
|
-
"title": "datum",
|
|
18
|
-
"schema": {
|
|
19
|
-
"$ref": "#/definitions/hello_world~1Datum"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"redeemer": {
|
|
23
|
-
"title": "redeemer",
|
|
24
|
-
"schema": {
|
|
25
|
-
"$ref": "#/definitions/hello_world~1Redeemer"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"compiledCode": "58e901000032323232323223223225333006323253330083371e6eb8c008c028dd5002a4410d48656c6c6f2c20576f726c642100100114a06644646600200200644a66601c00229404c94ccc030cdc79bae301000200414a226600600600260200026eb0c02cc030c030c030c030c030c030c030c030c024dd5180098049baa002375c600260126ea80188c02c0045261365653330043370e900018029baa001132325333009300b002149858dd7180480098031baa0011653330023370e900018019baa0011323253330073009002149858dd7180380098021baa001165734aae7555cf2ab9f5742ae881",
|
|
29
|
-
"hash": "c1fe430f19ac248a8a7ea47db106002c4327e542c3fdc60ad6481103"
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
"definitions": {
|
|
33
|
-
"ByteArray": {
|
|
34
|
-
"dataType": "bytes"
|
|
35
|
-
},
|
|
36
|
-
"hello_world/Datum": {
|
|
37
|
-
"title": "Datum",
|
|
38
|
-
"anyOf": [
|
|
39
|
-
{
|
|
40
|
-
"title": "Datum",
|
|
41
|
-
"dataType": "constructor",
|
|
42
|
-
"index": 0,
|
|
43
|
-
"fields": [
|
|
44
|
-
{
|
|
45
|
-
"title": "owner",
|
|
46
|
-
"$ref": "#/definitions/ByteArray"
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
"hello_world/Redeemer": {
|
|
53
|
-
"title": "Redeemer",
|
|
54
|
-
"anyOf": [
|
|
55
|
-
{
|
|
56
|
-
"title": "Redeemer",
|
|
57
|
-
"dataType": "constructor",
|
|
58
|
-
"index": 0,
|
|
59
|
-
"fields": [
|
|
60
|
-
{
|
|
61
|
-
"title": "msg",
|
|
62
|
-
"$ref": "#/definitions/ByteArray"
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
use aiken/hash.{Blake2b_224, Hash}
|
|
2
|
-
use aiken/list
|
|
3
|
-
use aiken/transaction.{ScriptContext}
|
|
4
|
-
use aiken/transaction/credential.{VerificationKey}
|
|
5
|
-
|
|
6
|
-
type Datum {
|
|
7
|
-
owner: Hash<Blake2b_224, VerificationKey>,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type Redeemer {
|
|
11
|
-
msg: ByteArray,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
validator {
|
|
15
|
-
fn hello_world(datum: Datum, redeemer: Redeemer, context: ScriptContext) -> Bool {
|
|
16
|
-
let must_say_hello =
|
|
17
|
-
redeemer.msg == "Hello, World!"
|
|
18
|
-
|
|
19
|
-
let must_be_signed =
|
|
20
|
-
list.has(context.transaction.extra_signatories, datum.owner)
|
|
21
|
-
|
|
22
|
-
must_say_hello && must_be_signed
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/hello-world/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './offchain';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BuiltinByteString, ConStr0, Integer } from "@meshsdk/common";
|
|
2
|
-
import { UTxO } from "@meshsdk/core";
|
|
3
|
-
import { applyParamsToScript } from "@meshsdk/core-csl";
|
|
4
|
-
|
|
5
|
-
import { MeshTxInitiator, MeshTxInitiatorInput } from "../common";
|
|
6
|
-
import blueprint from "./aiken-workspace/plutus.json";
|
|
7
|
-
|
|
8
|
-
export type HelloWorldDatum = ConStr0<
|
|
9
|
-
[Integer, BuiltinByteString, BuiltinByteString]
|
|
10
|
-
>;
|
|
11
|
-
|
|
12
|
-
export const MeshHelloWorldBlueprint = blueprint;
|
|
13
|
-
|
|
14
|
-
export class MeshHelloWorldContract extends MeshTxInitiator {
|
|
15
|
-
scriptCbor = applyParamsToScript(blueprint.validators[0]!.compiledCode, []);
|
|
16
|
-
|
|
17
|
-
constructor(inputs: MeshTxInitiatorInput) {
|
|
18
|
-
super(inputs);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getUtxoByTxHash = async (txHash: string): Promise<UTxO | undefined> => {
|
|
22
|
-
return await this._getUtxoByTxHash(this.scriptCbor, txHash);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Hello World Contract
|
package/src/index.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# This file was generated by Aiken
|
|
2
|
-
# You typically do not need to edit this file
|
|
3
|
-
|
|
4
|
-
[[requirements]]
|
|
5
|
-
name = "aiken-lang/stdlib"
|
|
6
|
-
version = "1.9.0"
|
|
7
|
-
source = "github"
|
|
8
|
-
|
|
9
|
-
[[requirements]]
|
|
10
|
-
name = "sidan-lab/aiken-utils"
|
|
11
|
-
version = "0.1.6-beta"
|
|
12
|
-
source = "github"
|
|
13
|
-
|
|
14
|
-
[[packages]]
|
|
15
|
-
name = "aiken-lang/stdlib"
|
|
16
|
-
version = "1.9.0"
|
|
17
|
-
requirements = []
|
|
18
|
-
source = "github"
|
|
19
|
-
|
|
20
|
-
[[packages]]
|
|
21
|
-
name = "sidan-lab/aiken-utils"
|
|
22
|
-
version = "0.1.6-beta"
|
|
23
|
-
requirements = []
|
|
24
|
-
source = "github"
|
|
25
|
-
|
|
26
|
-
[etags]
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
name = "meshjs/marketplace"
|
|
2
|
-
version = "0.0.0"
|
|
3
|
-
license = "Apache-2.0"
|
|
4
|
-
description = "Aiken contracts for project 'meshjs/marketplace'"
|
|
5
|
-
|
|
6
|
-
[repository]
|
|
7
|
-
user = "meshjs"
|
|
8
|
-
project = "marketplace"
|
|
9
|
-
platform = "github"
|
|
10
|
-
|
|
11
|
-
[[dependencies]]
|
|
12
|
-
name = "aiken-lang/stdlib"
|
|
13
|
-
version = "1.9.0"
|
|
14
|
-
source = "github"
|
|
15
|
-
|
|
16
|
-
[[dependencies]]
|
|
17
|
-
name = "sidan-lab/aiken-utils"
|
|
18
|
-
version = "0.1.6-beta"
|
|
19
|
-
source = "github"
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
use aiken/transaction.{ScriptContext, Spend, find_input}
|
|
2
|
-
use aiken/transaction/credential.{Address}
|
|
3
|
-
use aiken/transaction/value.{from_lovelace, lovelace_of}
|
|
4
|
-
use marketplace/types.{Buy, Close, MarketplaceDatum, MarketplaceRedeemer}
|
|
5
|
-
use sidan_utils/address.{address_pub_key}
|
|
6
|
-
use sidan_utils/extra_signatories.{key_signed}
|
|
7
|
-
use sidan_utils/inputs.{inputs_at}
|
|
8
|
-
use sidan_utils/value.{get_all_value_to, value_geq} as sidan_value
|
|
9
|
-
|
|
10
|
-
pub fn marketplace_logic(
|
|
11
|
-
owner: Address,
|
|
12
|
-
fee_percentage_basis_point: Int,
|
|
13
|
-
datum: MarketplaceDatum,
|
|
14
|
-
redeemer: MarketplaceRedeemer,
|
|
15
|
-
ctx: ScriptContext,
|
|
16
|
-
) -> Bool {
|
|
17
|
-
when ctx.purpose is {
|
|
18
|
-
Spend(utxo) ->
|
|
19
|
-
when redeemer is {
|
|
20
|
-
Buy -> {
|
|
21
|
-
expect Some(own_input) = find_input(ctx.transaction.inputs, utxo)
|
|
22
|
-
let own_address = own_input.output.address
|
|
23
|
-
let is_only_one_input_from_script =
|
|
24
|
-
when inputs_at(ctx.transaction.inputs, own_address) is {
|
|
25
|
-
[_] -> True
|
|
26
|
-
_ -> False
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let is_proceed_paid =
|
|
30
|
-
get_all_value_to(ctx.transaction.outputs, datum.seller)
|
|
31
|
-
|> value_geq(
|
|
32
|
-
from_lovelace(
|
|
33
|
-
datum.price + lovelace_of(own_input.output.value),
|
|
34
|
-
),
|
|
35
|
-
)
|
|
36
|
-
let is_fee_paid =
|
|
37
|
-
get_all_value_to(ctx.transaction.outputs, owner)
|
|
38
|
-
|> value_geq(
|
|
39
|
-
from_lovelace(
|
|
40
|
-
datum.price * fee_percentage_basis_point / 10000,
|
|
41
|
-
),
|
|
42
|
-
)
|
|
43
|
-
is_only_one_input_from_script && is_fee_paid && is_proceed_paid
|
|
44
|
-
}
|
|
45
|
-
Close -> {
|
|
46
|
-
expect Some(pub_key) = address_pub_key(datum.seller)
|
|
47
|
-
key_signed(ctx.transaction.extra_signatories, pub_key)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
_ -> False
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"preamble": {
|
|
3
|
-
"title": "meshjs/marketplace",
|
|
4
|
-
"description": "Aiken contracts for project 'meshjs/marketplace'",
|
|
5
|
-
"version": "0.0.0",
|
|
6
|
-
"plutusVersion": "v2",
|
|
7
|
-
"compiler": {
|
|
8
|
-
"name": "Aiken",
|
|
9
|
-
"version": "v1.0.29-alpha+unknown"
|
|
10
|
-
},
|
|
11
|
-
"license": "Apache-2.0"
|
|
12
|
-
},
|
|
13
|
-
"validators": [
|
|
14
|
-
{
|
|
15
|
-
"title": "marketplace.marketplace",
|
|
16
|
-
"datum": {
|
|
17
|
-
"title": "datum",
|
|
18
|
-
"schema": {
|
|
19
|
-
"$ref": "#/definitions/marketplace~1types~1MarketplaceDatum"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"redeemer": {
|
|
23
|
-
"title": "redeemer",
|
|
24
|
-
"schema": {
|
|
25
|
-
"$ref": "#/definitions/marketplace~1types~1MarketplaceRedeemer"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"parameters": [
|
|
29
|
-
{
|
|
30
|
-
"title": "owner",
|
|
31
|
-
"schema": {
|
|
32
|
-
"$ref": "#/definitions/aiken~1transaction~1credential~1Address"
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"title": "fee_percentage_basis_point",
|
|
37
|
-
"schema": {
|
|
38
|
-
"$ref": "#/definitions/Int"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"compiledCode": "59082f01000032323232323232223223232322322533300b3232323232323232325333014300e30153754002264a66602a6020602c6ea80344c94ccc058c044c05cdd50008991919299980c99299980e8008a501533301d302000114a22940cc88c8cc00400400c894ccc08000452f5c026464a66603e66ebcc048c084dd5180898109baa00200513302300233004004001133004004001302400230220013758601860366ea8c030c06cdd50079806180d9baa300b301b37540062a6660320022004294052819803998049bac3008301a3754601660346ea803805cc018cdc199b82375a601460346ea805005520a09c0133006330083758600e60326ea8c028c064dd50069805180c9baa0133005337006eb4c024c064dd50099998059bab300930193754601260326ea8005220100488100301b301837540022c64660020026eb0c024c060dd51804980c1baa00c22533301a00114c0103d87a80001323253330193375e601860366ea80080144c038cc0740092f5c0266008008002603c0046038002264a66602c6022602e6ea80044cc88c8cc00400400c894ccc074004528099299980d99b8f375c604000400829444cc00c00c004c080004dd6180d980e180e180e180e180e180e180e180e180c1baa3009301837540186eb8c06cc060dd50008b19299980b1808980b9baa0011300b3301a301b3018375400297ae014c0103d87a80003008301737546010602e6ea8044c064c058dd50008a503005301537540124a666026601c002297adef6c6013232330010014bd6f7b63011299980c80089980d19bb04c01014000374c00697adef6c60132323232533301a3372091010000213301e337609801014000374c00e00a2a66603466e3d2210000213301e337609801014000374c00e00626603c66ec0dd48011ba600133006006003375660360066eb8c064008c074008c06c004c8cc0040052f5bded8c044a66603000226603266ec13001014000375000697adef6c6013232323253330193372091010000213301d337609801014000375000e00a2a66603266e3d2210000213301d337609801014000375000e00626603a66ec0dd48011ba800133006006003375a60340066eb8c060008c070008c06800488c8cc004004c8cc00400400c894ccc06400452f5c0264666444646600200200644a66603e0022006264660426e9ccc084dd480319810980f00099810980f800a5eb80cc00c00cc08c008c084004dd7180c0009bab301900133003003301d002301b00122533301800114a2264a66602c6466e24dd698038009998058031bae300a001375c60120026eb0c06c0084cc00c00c004528180d8009180b180b980b80091191980080080191299980b0008a5eb7bdb1804cc894ccc054cdd79804180b9baa0020051323330010010023756601060306ea800c8894ccc06c00840044c8ccc010010c07c00ccc88c8cc004004014894ccc0800044cc084cdd81ba9004374c00697adef6c6013232323253330213372001000426604a66ec0dd48041ba6007005153330213371e010004264a666044603a60466ea80044cc098cdd81ba9009302730243754002008200864a666044a66604a00229445280a6103d87a80001301733026374c00297ae03233300100100800222253330270021001132333004004302b0033322323300100100522533302c00113302d337606ea4010dd4001a5eb7bdb1804c8c8c8c94ccc0b4cdc800400109981899bb037520106ea001c01454ccc0b4cdc78040010992999817181498179baa001133032337606ea4024c0ccc0c0dd5000802080219299981718148008a60103d87a80001302333032375000297ae03370000e00226606266ec0dd48011ba800133006006003375a605c0066eb8c0b0008c0c0008c0b8004dd718130009bad30270013029002133025337606ea4008dd3000998030030019bab3022003375c6040004604800460440026eb8c068004dd5980d800980e8010800980c00099801001180c8009180a180a80091809800911192999808180518089baa0011480004dd6980a98091baa001325333010300a301137540022980103d87a8000132330010013756602c60266ea8008894ccc054004530103d87a80001323232325333016337220100042a66602c66e3c0200084c02ccc068dd4000a5eb80530103d87a8000133006006003375a602e0066eb8c054008c064008c05c004c8cc004004010894ccc0500045300103d87a80001323232325333015337220100042a66602a66e3c0200084c028cc064dd3000a5eb80530103d87a80001330060060033756602c0066eb8c050008c060008c058004dd2a400029309b2b19299980518028008a99980698061baa00214985854ccc028c01000454ccc034c030dd50010a4c2c2c60146ea8004c94ccc020c00cc024dd5002099191919191919192999809980b00109924ca666020601660226ea801c4c8c8c8c94ccc05cc0680084c8c926325333016301100113232533301b301e002132498c94ccc064c0500044c8c94ccc078c0840084c926301400116301f001301b37540042a66603260260022646464646464a666044604a0042930b1bad30230013023002375a604200260420046eb4c07c004c06cdd50010b180c9baa00116301c001301837540062a66602c60200022a66603260306ea800c526161630163754004601a0062c60300026030004602c00260246ea801c5858dd7180a000980a0011bae30120013012002375a60200026020004601c00260146ea8010588c94ccc024c0100044c8c94ccc038c04400852616375c601e00260166ea800854ccc024c00c0044c8c94ccc038c04400852616375c601e00260166ea800858c024dd50009b8748008dc3a40006eb40055cd2ab9d5573caae7d5d02ba157441",
|
|
43
|
-
"hash": "cd144c1e18d8e44dfeacb018a2795d17d7c30574a427eb2aa2dbc87c"
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
"definitions": {
|
|
47
|
-
"ByteArray": {
|
|
48
|
-
"dataType": "bytes"
|
|
49
|
-
},
|
|
50
|
-
"Int": {
|
|
51
|
-
"dataType": "integer"
|
|
52
|
-
},
|
|
53
|
-
"Option$aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
|
|
54
|
-
"title": "Optional",
|
|
55
|
-
"anyOf": [
|
|
56
|
-
{
|
|
57
|
-
"title": "Some",
|
|
58
|
-
"description": "An optional value.",
|
|
59
|
-
"dataType": "constructor",
|
|
60
|
-
"index": 0,
|
|
61
|
-
"fields": [
|
|
62
|
-
{
|
|
63
|
-
"$ref": "#/definitions/aiken~1transaction~1credential~1Referenced$aiken~1transaction~1credential~1Credential"
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"title": "None",
|
|
69
|
-
"description": "Nothing.",
|
|
70
|
-
"dataType": "constructor",
|
|
71
|
-
"index": 1,
|
|
72
|
-
"fields": []
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
"aiken/transaction/credential/Address": {
|
|
77
|
-
"title": "Address",
|
|
78
|
-
"description": "A Cardano `Address` typically holding one or two credential references.\n\n Note that legacy bootstrap addresses (a.k.a. 'Byron addresses') are\n completely excluded from Plutus contexts. Thus, from an on-chain\n perspective only exists addresses of type 00, 01, ..., 07 as detailed\n in [CIP-0019 :: Shelley Addresses](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0019/#shelley-addresses).",
|
|
79
|
-
"anyOf": [
|
|
80
|
-
{
|
|
81
|
-
"title": "Address",
|
|
82
|
-
"dataType": "constructor",
|
|
83
|
-
"index": 0,
|
|
84
|
-
"fields": [
|
|
85
|
-
{
|
|
86
|
-
"title": "payment_credential",
|
|
87
|
-
"$ref": "#/definitions/aiken~1transaction~1credential~1Credential"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"title": "stake_credential",
|
|
91
|
-
"$ref": "#/definitions/Option$aiken~1transaction~1credential~1Referenced$aiken~1transaction~1credential~1Credential"
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
]
|
|
96
|
-
},
|
|
97
|
-
"aiken/transaction/credential/Credential": {
|
|
98
|
-
"title": "Credential",
|
|
99
|
-
"description": "A general structure for representing an on-chain `Credential`.\n\n Credentials are always one of two kinds: a direct public/private key\n pair, or a script (native or Plutus).",
|
|
100
|
-
"anyOf": [
|
|
101
|
-
{
|
|
102
|
-
"title": "VerificationKeyCredential",
|
|
103
|
-
"dataType": "constructor",
|
|
104
|
-
"index": 0,
|
|
105
|
-
"fields": [
|
|
106
|
-
{
|
|
107
|
-
"$ref": "#/definitions/ByteArray"
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"title": "ScriptCredential",
|
|
113
|
-
"dataType": "constructor",
|
|
114
|
-
"index": 1,
|
|
115
|
-
"fields": [
|
|
116
|
-
{
|
|
117
|
-
"$ref": "#/definitions/ByteArray"
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
},
|
|
123
|
-
"aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
|
|
124
|
-
"title": "Referenced",
|
|
125
|
-
"description": "Represent a type of object that can be represented either inline (by hash)\n or via a reference (i.e. a pointer to an on-chain location).\n\n This is mainly use for capturing pointers to a stake credential\n registration certificate in the case of so-called pointer addresses.",
|
|
126
|
-
"anyOf": [
|
|
127
|
-
{
|
|
128
|
-
"title": "Inline",
|
|
129
|
-
"dataType": "constructor",
|
|
130
|
-
"index": 0,
|
|
131
|
-
"fields": [
|
|
132
|
-
{
|
|
133
|
-
"$ref": "#/definitions/aiken~1transaction~1credential~1Credential"
|
|
134
|
-
}
|
|
135
|
-
]
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"title": "Pointer",
|
|
139
|
-
"dataType": "constructor",
|
|
140
|
-
"index": 1,
|
|
141
|
-
"fields": [
|
|
142
|
-
{
|
|
143
|
-
"title": "slot_number",
|
|
144
|
-
"$ref": "#/definitions/Int"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"title": "transaction_index",
|
|
148
|
-
"$ref": "#/definitions/Int"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"title": "certificate_index",
|
|
152
|
-
"$ref": "#/definitions/Int"
|
|
153
|
-
}
|
|
154
|
-
]
|
|
155
|
-
}
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
"marketplace/types/MarketplaceDatum": {
|
|
159
|
-
"title": "MarketplaceDatum",
|
|
160
|
-
"anyOf": [
|
|
161
|
-
{
|
|
162
|
-
"title": "MarketplaceDatum",
|
|
163
|
-
"dataType": "constructor",
|
|
164
|
-
"index": 0,
|
|
165
|
-
"fields": [
|
|
166
|
-
{
|
|
167
|
-
"title": "seller",
|
|
168
|
-
"$ref": "#/definitions/aiken~1transaction~1credential~1Address"
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
"title": "price",
|
|
172
|
-
"$ref": "#/definitions/Int"
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
"title": "policy",
|
|
176
|
-
"$ref": "#/definitions/ByteArray"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"title": "tokenName",
|
|
180
|
-
"$ref": "#/definitions/ByteArray"
|
|
181
|
-
}
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
]
|
|
185
|
-
},
|
|
186
|
-
"marketplace/types/MarketplaceRedeemer": {
|
|
187
|
-
"title": "MarketplaceRedeemer",
|
|
188
|
-
"anyOf": [
|
|
189
|
-
{
|
|
190
|
-
"title": "Buy",
|
|
191
|
-
"dataType": "constructor",
|
|
192
|
-
"index": 0,
|
|
193
|
-
"fields": []
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
"title": "Close",
|
|
197
|
-
"dataType": "constructor",
|
|
198
|
-
"index": 1,
|
|
199
|
-
"fields": []
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# marketplace
|
|
2
|
-
|
|
3
|
-
Write validators in the `validators` folder, and supporting functions in the `lib` folder using `.ak` as a file extension.
|
|
4
|
-
|
|
5
|
-
For example, as `validators/always_true.ak`
|
|
6
|
-
|
|
7
|
-
```gleam
|
|
8
|
-
validator {
|
|
9
|
-
fn spend(_datum: Data, _redeemer: Data, _context: Data) -> Bool {
|
|
10
|
-
True
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Building
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
aiken build
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Testing
|
|
22
|
-
|
|
23
|
-
You can write tests in any module using the `test` keyword. For example:
|
|
24
|
-
|
|
25
|
-
```gleam
|
|
26
|
-
test foo() {
|
|
27
|
-
1 + 1 == 2
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
To run all tests, simply do:
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
aiken check
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
To run only tests matching the string `foo`, do:
|
|
38
|
-
|
|
39
|
-
```sh
|
|
40
|
-
aiken check -m foo
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Documentation
|
|
44
|
-
|
|
45
|
-
If you're writing a library, you might want to generate an HTML documentation for it.
|
|
46
|
-
|
|
47
|
-
Use:
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
aiken docs
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Resources
|
|
54
|
-
|
|
55
|
-
Find more on the [Aiken's user manual](https://aiken-lang.org).
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
use aiken/transaction.{ScriptContext}
|
|
2
|
-
use aiken/transaction/credential.{Address}
|
|
3
|
-
use marketplace/types.{MarketplaceDatum, MarketplaceRedeemer}
|
|
4
|
-
use marketplace/validators/marketplace.{marketplace_logic}
|
|
5
|
-
|
|
6
|
-
validator(owner: Address, fee_percentage_basis_point: Int) {
|
|
7
|
-
fn marketplace(
|
|
8
|
-
datum: MarketplaceDatum,
|
|
9
|
-
redeemer: MarketplaceRedeemer,
|
|
10
|
-
ctx: ScriptContext,
|
|
11
|
-
) {
|
|
12
|
-
marketplace_logic(owner, fee_percentage_basis_point, datum, redeemer, ctx)
|
|
13
|
-
}
|
|
14
|
-
}
|