Build on Internet Computer with ICP Rust CDK
In this final project, you will be building a basic Auction smart contract. In this contract, users will be able to:
• List Items
• Bid for an item
• Update the listing of an item
• Stop the listing of an item
Listing and Bidding: Users will be able to list an item, similar to creating a proposal in our previous project. After listing the item, other users can bid for it. Bids will be held in a StableBTreeMap, allowing visibility into which principal bid how much, akin to the voted vector in the Proposal project.
Editing and Stopping Listings: The owner of the item can edit the listing or stop the process at any time. When the process is stopped, the highest bidder will become the owner of the item. You can create a specific field called new_owner in the Item struct (feel free to choose any name for the struct and field).
Item Management: You will maintain a list of items (similar to proposals). Implement the necessary query methods to retrieve a specific item, a list of items, the length of items listed on the contract, the item sold for the most, and the item that has been bid on the most.
Security Checks: Implement basic security checks to ensure that only the owner of the listing can update or stop it.
Optional Enhancements:
• Front-End Development: Optionally, you can create a front end for your smart contract.
• Working with Tokens: While the contract does not have to work with tokens, and you can accept bids as parameters, we highly recommend learning how to work with tokens (self-learning is essential for your future development). You may create an additional method where the owner of the item can claim their new item by spending the amount of token that they have proposed. This is not mandatory but will enhance your knowledge on the subject.
Testing Requirements: Ensure to include comprehensive test cases to validate the correctness of your code.
Conclusion: Whether you are a beginner or an experienced programmer, practice is key, and working on this project can be tremendously rewarding. Thank you for sparing your time reading this document, and happy coding ⌨️!
Project
Comments
You need to enroll in the course to be able to comment!