Skip to content

Commit 6c1230a

Browse files
committed
feat(dataset-marketplace): publish marketplace module and update enclave dependencies
1 parent 608de47 commit 6c1230a

5 files changed

Lines changed: 167 additions & 176 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Generated by Move
2+
# This file contains metadata about published versions of this package in different environments
3+
# This file SHOULD be committed to source control
4+
5+
[published.testnet]
6+
chain-id = "4c78adac"
7+
published-at = "0x74eda23e33024ab070531b6d40ed4ea45048e8e8ea93efa3c483c850496a6e85"
8+
original-id = "0x74eda23e33024ab070531b6d40ed4ea45048e8e8ea93efa3c483c850496a6e85"
9+
version = 1
10+
toolchain-version = "1.63.0"
11+
build-config = { flavor = "sui", edition = "2024" }
12+
upgrade-capability = "0x985025ce11ec1d5982d6ae42371be585b2c332bfae073dc4beb6330638db2ede"

move/dataset-marketplace/sources/marketplace.move

Lines changed: 120 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -3,124 +3,124 @@
33

44
/// Dataset Marketplace Module
55
/// Manages dataset listings, purchases, and access control
6-
module dataset_marketplace::marketplace {
7-
use sui::coin::{Self, Coin};
8-
use sui::sui::SUI;
9-
use sui::event;
10-
11-
// ============ Error codes ============
12-
const EInsufficientPayment: u64 = 0;
13-
const EDatasetNotFound: u64 = 1;
14-
const ENotSeller: u64 = 2;
15-
const EAlreadyPurchased: u64 = 3;
16-
17-
// ============ One-Time Witness ============
18-
public struct MARKETPLACE has drop {}
19-
20-
// ============ Structs ============
21-
22-
/// Dataset listing created by seller
23-
public struct DatasetListing has key, store {
24-
id: UID,
25-
seller: address,
26-
price: u64,
27-
blob_id: vector<u8>, // Walrus blob ID
28-
encrypted_object: vector<u8>, // Seal encrypted object (hex)
29-
name: vector<u8>,
30-
description: vector<u8>,
31-
preview_size: u64, // Bytes available for preview
32-
total_size: u64,
33-
}
34-
35-
/// Purchase receipt - proof that buyer paid for dataset
36-
public struct PurchaseReceipt has key, store {
37-
id: UID,
38-
dataset_id: ID,
39-
buyer: address,
40-
seller: address,
41-
price: u64,
42-
timestamp: u64,
43-
}
44-
45-
// ============ Events ============
46-
47-
public struct DatasetListed has copy, drop {
48-
dataset_id: ID,
49-
seller: address,
50-
price: u64,
51-
name: vector<u8>,
52-
}
53-
54-
public struct DatasetPurchased has copy, drop {
55-
dataset_id: ID,
56-
buyer: address,
57-
seller: address,
58-
price: u64,
59-
}
60-
61-
// ============ Functions ============
62-
63-
/// Create a new dataset listing
64-
public fun list_dataset(
65-
blob_id: vector<u8>,
66-
encrypted_object: vector<u8>,
67-
name: vector<u8>,
68-
description: vector<u8>,
69-
price: u64,
70-
preview_size: u64,
71-
total_size: u64,
72-
ctx: &mut TxContext,
73-
): DatasetListing {
74-
let listing = DatasetListing {
75-
id: object::new(ctx),
76-
seller: ctx.sender(),
77-
price,
78-
blob_id,
79-
encrypted_object,
80-
name,
81-
description,
82-
preview_size,
83-
total_size,
84-
};
85-
86-
event::emit(DatasetListed {
87-
dataset_id: object::id(&listing),
88-
seller: ctx.sender(),
89-
price,
90-
name,
91-
});
92-
93-
listing
94-
}
95-
96-
/// Purchase a dataset - creates receipt and transfers payment to seller
97-
public fun purchase_dataset(
98-
listing: &DatasetListing,
99-
payment: Coin<SUI>,
100-
clock: &sui::clock::Clock,
101-
ctx: &mut TxContext,
102-
): PurchaseReceipt {
103-
assert!(coin::value(&payment) >= listing.price, EInsufficientPayment);
104-
105-
// Transfer payment to seller
106-
transfer::public_transfer(payment, listing.seller);
107-
108-
let receipt = PurchaseReceipt {
109-
id: object::new(ctx),
110-
dataset_id: object::id(listing),
111-
buyer: ctx.sender(),
112-
seller: listing.seller,
113-
price: listing.price,
114-
timestamp: sui::clock::timestamp_ms(clock),
115-
};
116-
117-
event::emit(DatasetPurchased {
118-
dataset_id: object::id(listing),
119-
buyer: ctx.sender(),
120-
seller: listing.seller,
121-
price: listing.price,
122-
});
123-
124-
receipt
125-
}
6+
module dataset_marketplace::marketplace;
7+
8+
use sui::coin::{Self, Coin};
9+
use sui::event;
10+
use sui::sui::SUI;
11+
12+
// ============ Error codes ============
13+
const EInsufficientPayment: u64 = 0;
14+
// const EDatasetNotFound: u64 = 1;
15+
// const ENotSeller: u64 = 2;
16+
// const EAlreadyPurchased: u64 = 3;
17+
18+
// ============ One-Time Witness ============
19+
public struct MARKETPLACE has drop {}
20+
21+
// ============ Structs ============
22+
23+
/// Dataset listing created by seller
24+
public struct DatasetListing has key, store {
25+
id: UID,
26+
seller: address,
27+
price: u64,
28+
blob_id: vector<u8>, // Walrus blob ID
29+
encrypted_object: vector<u8>, // Seal encrypted object (hex)
30+
name: vector<u8>,
31+
description: vector<u8>,
32+
preview_size: u64, // Bytes available for preview
33+
total_size: u64,
34+
}
35+
36+
/// Purchase receipt - proof that buyer paid for dataset
37+
public struct PurchaseReceipt has key, store {
38+
id: UID,
39+
dataset_id: ID,
40+
buyer: address,
41+
seller: address,
42+
price: u64,
43+
timestamp: u64,
44+
}
45+
46+
// ============ Events ============
47+
48+
public struct DatasetListed has copy, drop {
49+
dataset_id: ID,
50+
seller: address,
51+
price: u64,
52+
name: vector<u8>,
53+
}
54+
55+
public struct DatasetPurchased has copy, drop {
56+
dataset_id: ID,
57+
buyer: address,
58+
seller: address,
59+
price: u64,
60+
}
61+
62+
// ============ Functions ============
63+
64+
/// Create a new dataset listing
65+
public fun list_dataset(
66+
blob_id: vector<u8>,
67+
encrypted_object: vector<u8>,
68+
name: vector<u8>,
69+
description: vector<u8>,
70+
price: u64,
71+
preview_size: u64,
72+
total_size: u64,
73+
ctx: &mut TxContext,
74+
): DatasetListing {
75+
let listing = DatasetListing {
76+
id: object::new(ctx),
77+
seller: ctx.sender(),
78+
price,
79+
blob_id,
80+
encrypted_object,
81+
name,
82+
description,
83+
preview_size,
84+
total_size,
85+
};
86+
87+
event::emit(DatasetListed {
88+
dataset_id: object::id(&listing),
89+
seller: ctx.sender(),
90+
price,
91+
name,
92+
});
93+
94+
listing
95+
}
96+
97+
/// Purchase a dataset - creates receipt and transfers payment to seller
98+
public fun purchase_dataset(
99+
listing: &DatasetListing,
100+
payment: Coin<SUI>,
101+
clock: &sui::clock::Clock,
102+
ctx: &mut TxContext,
103+
): PurchaseReceipt {
104+
assert!(coin::value(&payment) >= listing.price, EInsufficientPayment);
105+
106+
// Transfer payment to seller
107+
transfer::public_transfer(payment, listing.seller);
108+
109+
let receipt = PurchaseReceipt {
110+
id: object::new(ctx),
111+
dataset_id: object::id(listing),
112+
buyer: ctx.sender(),
113+
seller: listing.seller,
114+
price: listing.price,
115+
timestamp: sui::clock::timestamp_ms(clock),
116+
};
117+
118+
event::emit(DatasetPurchased {
119+
dataset_id: object::id(listing),
120+
buyer: ctx.sender(),
121+
seller: listing.seller,
122+
price: listing.price,
123+
});
124+
125+
receipt
126126
}

move/enclave/Move.lock

Lines changed: 21 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,23 @@
1-
# @generated by Move, please check-in and do not edit manually.
1+
# Generated by move; do not edit
2+
# This file should be checked in.
23

34
[move]
4-
version = 3
5-
manifest_digest = "41AB6AECB189C7722BFDBA15E0949F0C330F1B22816ECE2BC341B524EC541654"
6-
deps_digest = "F9B494B64F0615AED0E98FC12A85B85ECD2BC5185C22D30E7F67786BB52E507C"
7-
dependencies = [
8-
{ id = "Bridge", name = "Bridge" },
9-
{ id = "MoveStdlib", name = "MoveStdlib" },
10-
{ id = "Sui", name = "Sui" },
11-
{ id = "SuiSystem", name = "SuiSystem" },
12-
]
13-
14-
[[move.package]]
15-
id = "Bridge"
16-
source = { git = "https://github.com/MystenLabs/sui.git", rev = "61dcfdbe2ddc7ad05d27fc10cd09d4c6cc151acd", subdir = "crates/sui-framework/packages/bridge" }
17-
18-
dependencies = [
19-
{ id = "MoveStdlib", name = "MoveStdlib" },
20-
{ id = "Sui", name = "Sui" },
21-
{ id = "SuiSystem", name = "SuiSystem" },
22-
]
23-
24-
[[move.package]]
25-
id = "MoveStdlib"
26-
source = { git = "https://github.com/MystenLabs/sui.git", rev = "61dcfdbe2ddc7ad05d27fc10cd09d4c6cc151acd", subdir = "crates/sui-framework/packages/move-stdlib" }
27-
28-
[[move.package]]
29-
id = "Sui"
30-
source = { git = "https://github.com/MystenLabs/sui.git", rev = "61dcfdbe2ddc7ad05d27fc10cd09d4c6cc151acd", subdir = "crates/sui-framework/packages/sui-framework" }
31-
32-
dependencies = [
33-
{ id = "MoveStdlib", name = "MoveStdlib" },
34-
]
35-
36-
[[move.package]]
37-
id = "SuiSystem"
38-
source = { git = "https://github.com/MystenLabs/sui.git", rev = "61dcfdbe2ddc7ad05d27fc10cd09d4c6cc151acd", subdir = "crates/sui-framework/packages/sui-system" }
39-
40-
dependencies = [
41-
{ id = "MoveStdlib", name = "MoveStdlib" },
42-
{ id = "Sui", name = "Sui" },
43-
]
44-
45-
[move.toolchain-version]
46-
compiler-version = "1.61.2"
47-
edition = "2024.beta"
48-
flavor = "sui"
49-
50-
[env]
51-
52-
[env.testnet]
53-
chain-id = "4c78adac"
54-
original-published-id = "0x8ecf22e78c90c3e32833d76d82415d7e4227ea370bec4efdad4c4830cbda9e49"
55-
latest-published-id = "0x8ecf22e78c90c3e32833d76d82415d7e4227ea370bec4efdad4c4830cbda9e49"
56-
published-version = "1"
5+
version = 4
6+
7+
[pinned.testnet.MoveStdlib]
8+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "22f9fc9781732d651e18384c9a8eb1dabddf73a6" }
9+
use_environment = "testnet"
10+
manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363"
11+
deps = {}
12+
13+
[pinned.testnet.Sui]
14+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "22f9fc9781732d651e18384c9a8eb1dabddf73a6" }
15+
use_environment = "testnet"
16+
manifest_digest = "7AFB66695545775FBFBB2D3078ADFD084244D5002392E837FDE21D9EA1C6D01C"
17+
deps = { MoveStdlib = "MoveStdlib" }
18+
19+
[pinned.testnet.enclave]
20+
source = { root = true }
21+
use_environment = "testnet"
22+
manifest_digest = "5745706258F61D6CE210904B3E6AE87A73CE9D31A6F93BE4718C442529332A87"
23+
deps = { std = "MoveStdlib", sui = "Sui" }

move/enclave/Published.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Generated by Move
2+
# This file contains metadata about published versions of this package in different environments
3+
# This file SHOULD be committed to source control
4+
5+
[published.testnet]
6+
chain-id = "4c78adac"
7+
published-at = "0x326f02d5a0f1d17ea8aaef75e17f9b86f3eef1f63e66304a3f9d26f1edaad58a"
8+
original-id = "0x326f02d5a0f1d17ea8aaef75e17f9b86f3eef1f63e66304a3f9d26f1edaad58a"
9+
version = 1
10+
toolchain-version = "1.63.0"
11+
build-config = { flavor = "sui", edition = "2024" }
12+
upgrade-capability = "0x06075fdad74a3e234a5a0fde2dd21bebd32d42ede29cf23c5179c89f9fdd687d"

src/nautilus-server/src/apps/dataset-marketplace/seal_config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Seal configuration for dataset marketplace enclave
2-
#
2+
#
33
# IMPORTANT: After deploying move/dataset-marketplace, update package_id below
44
# with the published package ID from `sui client publish` output.
55

@@ -18,4 +18,4 @@ public_keys:
1818
# REPLACE THIS with your deployed dataset_marketplace package ID
1919
# Run: cd move/dataset-marketplace && sui client publish
2020
# Then copy the package ID from output
21-
package_id: "0x0000000000000000000000000000000000000000000000000000000000000000"
21+
package_id: "0x74eda23e33024ab070531b6d40ed4ea45048e8e8ea93efa3c483c850496a6e85"

0 commit comments

Comments
 (0)