Crates.io | stargaze-marketplace-v2 |
lib.rs | stargaze-marketplace-v2 |
version | 0.1.0 |
source | src |
created_at | 2024-02-01 18:33:02.953408 |
updated_at | 2024-02-01 18:33:02.953408 |
description | Stargaze Marketplace V2 Smart Contract |
homepage | https://stargaze.zone |
repository | https://github.com/public-awesome/marketplace |
max_upload_size | |
id | 1123437 |
size | 519,156 |
The Stargaze NFT auction happens as a perpetual auction. Asks and bids have time limits set by governance.
Anyone can call the SetBid
method and make an offer on any listed NFT. The funds are sent to the marketplace contract which serves as an escrow.
Bidders can remove their bids and reclaim their funds with RemoveBid
. When a bid is removed, its deposit is refunded. New bids automatically remove and refund previous bids.
The NFT owner can at any point pick a bid they like and call the AcceptBid
method, which will transfer both the funds and the NFT.
Optionally, the NFT owner can set an ask price with the SetAsk
method. If an ask is set, any bid that meets the ask requirements is automatically accepted and transferred to the bidder. The owner can remove the ask with RemoveAsk
.
When a bid is accepted, both the payment and NFT are automatically transferred. Payment is split up and distributed according to royalties specified when the NFT was minted.
In order to accept a bid or set an asking price, the owner needs to grant approval to the marketplace contract for transferring the NFT. This can be done with an NFT's Approve
method for each NFT, or by using ApproveAll
for all NFTs in the collection.
You will need Rust 1.44.1+ with wasm32-unknown-unknown
target installed.
You can run unit tests on this via:
cargo test
Once you are happy with the content, you can compile it to wasm via:
RUSTFLAGS='-C link-arg=-s' cargo wasm
cp ../../target/wasm32-unknown-unknown/release/sg_marketplace.wasm .
ls -l sg_marketplace.wasm
sha256sum sg_marketplace.wasm
Or for a production-ready (optimized) build, run the build command in the repository root: https://github.com/CosmWasm/cosmwasm-plus#compiling.