diff --git a/Cargo.lock b/Cargo.lock index 44113772..cbf666b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -712,6 +712,20 @@ dependencies = [ "soroban-sdk", ] +[[package]] +name = "phoenix-nft-auctions" +version = "1.0.0" +dependencies = [ + "soroban-sdk", +] + +[[package]] +name = "phoenix-nft-collections" +version = "1.0.0" +dependencies = [ + "soroban-sdk", +] + [[package]] name = "pkcs8" version = "0.10.2" diff --git a/contracts/auctions/Cargo.toml b/contracts/auctions/Cargo.toml new file mode 100644 index 00000000..8a08a19b --- /dev/null +++ b/contracts/auctions/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "phoenix-nft-auctions" +version = { workspace = true } +authors = ["Jakub "] +repository = { workspace = true } +edition = { workspace = true } +license = { workspace = true } + +[lib] +crate-type = ["cdylib"] + +[features] +testutils = ["soroban-sdk/testutils"] + +[dependencies] +soroban-sdk = { workspace = true } + +[dev_dependencies] +soroban-sdk = { workspace = true, features = ["testutils"] } diff --git a/contracts/auctions/Makefile b/contracts/auctions/Makefile new file mode 100644 index 00000000..1e1e69be --- /dev/null +++ b/contracts/auctions/Makefile @@ -0,0 +1,20 @@ +default: all + +all: lint build test + +test: build # because of token dependency + cargo test + +build: + cargo build --target wasm32-unknown-unknown --release + +lint: fmt clippy + +fmt: + cargo fmt --all + +clippy: build + cargo clippy --all-targets -- -D warnings + +clean: + cargo clean diff --git a/contracts/auctions/src/lib.rs b/contracts/auctions/src/lib.rs new file mode 100644 index 00000000..8802cd3c --- /dev/null +++ b/contracts/auctions/src/lib.rs @@ -0,0 +1,82 @@ +#![no_std] + +use soroban_sdk::{contract, Address, BytesN, Env, Vec}; + +#[derive(Clone)] +pub struct Auction { + pub id: u64, + pub item_address: Address, // Can be an NFT contract address or a collection contract address + pub seller: Address, + pub highest_bid: u64, + pub highest_bidder: Address, + pub buy_now_price: u64, + pub end_time: u64, + pub status: AuctionStatus, +} + +#[derive(Clone, PartialEq)] +pub enum AuctionStatus { + Active, + Ended, + Cancelled, +} + +#[contract] +pub struct MarketplaceContract; + +#[contractimpl] +impl MarketplaceContract { + fn generate_auction_id(env: &Env) -> u64 { + todo!() + } + + pub fn create_auction( + env: Env, + item_address: Address, + seller: Address, + buy_now_price: u64, + duration: u64, + ) -> Auction { + todo!() + } + + pub fn place_bid(env: Env, auction_id: u64, bidder: Address, bid_amount: u64) { + todo!() + } + + pub fn finalize_auction(env: Env, auction_id: u64) { + todo!() + } + + pub fn buy_now(env: Env, auction_id: u64, buyer: Address) { + todo!() + } + + fn distribute_funds(env: Env, auction: Auction) { + todo!() + } + + pub fn pause(env: Env) { + todo!() + } + + pub fn unpause(env: Env) { + todo!() + } + + pub fn get_auction(env: Env, auction_id: u64) -> Auction { + todo!() + } + + pub fn get_active_auctions(env: Env) -> Vec { + todo!() + } + + pub fn get_auctions_by_seller(env: Env, seller: Address) -> Vec { + todo!() + } + + pub fn get_highest_bid(env: Env, auction_id: u64) -> (u64, Address) { + todo!() + } +} diff --git a/contracts/collections/Cargo.toml b/contracts/collections/Cargo.toml new file mode 100644 index 00000000..f1f64bf5 --- /dev/null +++ b/contracts/collections/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "phoenix-nft-collections" +version = { workspace = true } +authors = ["Jakub "] +repository = { workspace = true } +edition = { workspace = true } +license = { workspace = true } + +[lib] +crate-type = ["cdylib"] + +[features] +testutils = ["soroban-sdk/testutils"] + +[dependencies] +soroban-sdk = { workspace = true } + +[dev_dependencies] +soroban-sdk = { workspace = true, features = ["testutils"] } diff --git a/contracts/collections/Makefile b/contracts/collections/Makefile new file mode 100644 index 00000000..1e1e69be --- /dev/null +++ b/contracts/collections/Makefile @@ -0,0 +1,20 @@ +default: all + +all: lint build test + +test: build # because of token dependency + cargo test + +build: + cargo build --target wasm32-unknown-unknown --release + +lint: fmt clippy + +fmt: + cargo fmt --all + +clippy: build + cargo clippy --all-targets -- -D warnings + +clean: + cargo clean diff --git a/contracts/collections/src/lib.rs b/contracts/collections/src/lib.rs new file mode 100644 index 00000000..85b33ae1 --- /dev/null +++ b/contracts/collections/src/lib.rs @@ -0,0 +1,43 @@ +#![no_std] + +use soroban_sdk::{contract, contractimpl, contracttype, Address, Env, Symbol, Vec}; + +#[derive(Clone)] +#[contracttype] +pub struct Collection { + pub id: u64, + pub name: Symbol, + pub description: Symbol, + pub creator: Address, + pub nft_contracts: Vec
, // List of NFT contract addresses +} + +#[contract] +pub struct CollectionContract; + +#[contractimpl] +impl CollectionContract { + fn generate_id(env: &Env) -> u64 { + todo!() + } + + pub fn initialize(env: Env, name: Symbol, description: Symbol, creator: Address) -> Collection { + todo!() + } + + pub fn add_nft(env: Env, collection_id: u64, nft_contract_address: Address) { + todo!() + } + + pub fn remove_nft(env: Env, collection_id: u64, nft_contract_address: Address) { + todo!() + } + + pub fn get_details(env: Env, collection_id: u64) -> Collection { + todo!() + } + + pub fn get_nfts(env: Env, collection_id: u64) -> Vec
{ + todo!() + } +} diff --git a/contracts/nft/src/lib.rs b/contracts/nft/src/lib.rs index 5fc9f6d3..63567659 100644 --- a/contracts/nft/src/lib.rs +++ b/contracts/nft/src/lib.rs @@ -1,11 +1,3 @@ #![no_std] -// mod admin; -// mod approval; -// mod balance; -mod contract; -// mod event; -mod interface; -// mod metadata; -// mod owner; -mod storage_types; +use soroban_sdk::{contract, Address, Bytes, Env, Symbol, Vec};