Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
HQ20 Classifieds
copy icon
HQ20
• version 1.0.0
ERC20
ERC721
Sale
Marketplace

HQ20 Classifieds

Implements the classifieds board market. The market will be governed by an ERC20 token as currency, and an ERC721 token that represents the ownership of the items being traded. Only ads for selling items are implemented. The item tokenization is responsibility of the ERC721 contract which should encode any item details.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

HQ20

Recent Use

🍞 0x9C6D downloaded

Last Publish

10/17/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
getTrade(uint256) :
This function retrieves the details of a trade from the trades mapping. It takes a uint256 _trade as an input parameter, which is used to look up the trade in the trades mapping. The function then returns the address of the poster, the item being traded, the price of the item, and the status of the trade as a tuple. (autogenerated documentation)
openTrade(uint256,uint256) :
This function allows a user to open a trade on the blockchain. It takes two parameters, _item and _price, and uses the itemToken contract to transfer the item from the user to the contract. It then stores the trade information in the trades array, and increments the tradeCounter. Finally, it emits a TradeStatusChange event with the tradeCounter and the status "Open". (autogenerated documentation)
executeTrade(uint256) :
This function executes a trade between two parties. It takes in a trade ID as an argument and checks if the trade is in an "Open" status. If it is, it transfers the currency from the buyer to the seller and the item from the contract to the buyer. Finally, it updates the trade status to "Executed" and emits an event to notify of the status change. (autogenerated documentation)
cancelTrade(uint256) :
This function allows the poster of a trade to cancel the trade. It requires that the sender of the transaction is the poster of the trade and that the trade is still open. It then transfers the item associated with the trade back to the poster and sets the status of the trade to "Cancelled". Finally, it emits an event to indicate that the status of the trade has changed. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i HQ20-Classifieds
copy icon

Recent Use

🍞 0x9C6D downloaded

Last Publish

10/17/2022

Version

1.0.0

Creator

HQ20

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.