Smart Contracts
The PUR marketplace smart contracts are publicly shared, ensuring transparency and reliability for the community. Below, you can find the links to our smart contracts.
Marketplace Contract
Our marketplace contract handles the core functionalities of the PUR marketplace, including listing NFTs, managing sales, and handling transactions.
Functions
constructor
- Description: Initializes the smart contract during deployment. Sets the marketplace fee and owner.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
_onlyOwner
- Description: Checks if the caller is the owner of the contract.
- Parameters: None
- Returns:
bool
- true if the caller is the owner
_hasCollection
- Description: Checks if a collection exists.
- Parameters:
collectionAddress
- the address of the collection- Returns:
bool
- true if the collection exists
_keyGenerator
- Description: Generates a key for the sell offer.
- Parameters:
address
tokenID
- Returns:
string
- the generated key
_getNFTOwner
- Description: Checks the owner of an NFT.
- Parameters:
address
tokenID
- Returns:
string
- the address of the NFT owner
calculateMarketplaceFee
- Description: Calculates the marketplace fee.
- Parameters:
amount
- the transaction amount- Returns:
u64
- the calculated fee
sellOffer
- Description: Adds a new sell offer.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
removeSellOffer
- Description: Removes an existing sell offer.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
buyOffer
- Description: Executes a direct buy offer.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
autonomousDeleteOffer
- Description: Automatically deletes a sell offer when it expires.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
adminAddCollection
- Description: Allows the owner to add a collection for listing.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
adminDeleteCollection
- Description: Allows the owner to remove an existing collection.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
adminChangeMarketplaceOwner
- Description: Allows the owner to change the marketplace owner.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
adminSendCoins
- Description: Allows the owner to send coins to an address.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
adminDeleteOffer
- Description: Allows the owner to delete a sell offer.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
adminRemoveBid
- Description: Allows the owner to remove a bid.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
adminChangeMarketplaceFee
- Description: Allows the owner to change the marketplace fee.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
upgradeSmartContract
- Description: Allows the owner to upgrade the smart contract code.
- Parameters:
newBytecode
- new bytecode- Returns: void
Bids Contract
The bids feature allows users to place and manage bids on NFTs. This contract handles all bid-related actions, ensuring a smooth and secure bidding process.
Functions
_bidKeyGenerator
- Description: Generates a key for a bid.
- Parameters:
collectionAddress
tokenID
bidder
- Returns:
string
- the generated key
resetBids
- Description: Resets all bids for a given NFT.
- Parameters:
collectionAddress
tokenID
tokenBuyer
- The address of the buyer who won the bid. If this is an empty string, all bids will be refunded.- Returns: void
placeBid
- Description: Allows a user to place a bid on an NFT.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
removeBid
- Description: Allows a user to remove their bid.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void
acceptBid
- Description: Allows the NFT owner to accept a bid.
- Parameters:
binaryArgs
- serialized StaticArray- Returns: void