Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a Confidential Single-Price Auction for Tokens with Sealed Bids using Zama's fhEVM #136

Open
zaccherinij opened this issue Dec 6, 2024 · 0 comments

Comments

@zaccherinij
Copy link
Collaborator

zaccherinij commented Dec 6, 2024

Overview

Create a Single Price auction for a quantity of tokens with sealed bids using Solidity and the FHEVM. The single price should be the lowest price from the bid required to purchase the last token sold.

Description

An auction owner can create/launch a Single-Price Auction for a quantity of assets (e.g. ERC20) to be sold using either ether or an ERC20 token.

Each participant, who wants to buy assets, can place an encrypted bid (the number of tokens to purchase and the price that each participant is willing to pay). The settlement price is the price at which the last token is bought. This price is paid by everyone regardless on the initial bids.

If the auction does not sell fully (e.g. no participant, not enough participant), it is up to the developer to decide what should be the best resolution mechanism (e.g. refund mechanism, execution at the lowest price).

Other corner/edge cases may include:

  • whether an address can participate more than once
  • whether a user can modify an existing bid before the auction end
  • how long the auction should last
  • how to determine the proper resolution if the two lowest bids are equal
  • how to prevent participation in an auction without the funds (i.e. the locking mechanism)

Tip

Design choices should be clearly documented. All corner/edge cases must be handled by the developer.

Example

Initialization: Alice creates an auction to sell 1,000,000 tokens in ether.

Bidding: Bob bids 0.000002 ether per token for 500,000 tokens, Carol bids 0.000008 ether per token for 600,000 tokens, David bids 0.00000000001 per token for 1,000,000 tokens.

Resolution: Carol gets 600,000 tokens, Bob gets 400,000 tokens (min((1,000,000 - 600,000), 500,000) = 400,000), David gets 0 token. The settlement price is 0.000001 ether. Alice collects 0.000002 * 1,000,000 = 2 ethers.

Judging criteria

  • Smart Contract: The smart contracts need to be written in Solidity running on the fhEVM with the Sepolia coprocessor. The code should be cleanly commented, with adherence (as close as possible) to the standard is important.
  • Testing: Testing smart contracts using hardhat is also highly recommended.
  • Deployment: The smart contract should be compatible with Sepolia (using the coprocessor).
  • Use of fhEVM: The contract should employ hidden information, showcasing the capabilities of the fhEVM. Care should be taken by the bounty hunter to decide which state variables to encrypt and which should stay unencrypted. Suggestions (non-exhaustive) of state variables to encrypt: transfer amounts, allowances, number of frozen tokens, identities such as country codes, etc.
  • Bonus points: Customization of the assets to be sold, a factory-model to create auctions, a small front-end using React (or another framework of your choice!).

Reward

🥇Best submission: up to $5,000

To be considered best submission, a solution must be efficient, effective and demonstrate a deep understanding of the core problem. Alongside the technical correctness, it should also be submitted with a clean code, clear explanations and a complete documentation.

🥈Second-best submission: up to $3,000

For a solution to be considered the second best submission, it should be both efficient and effective. The code should be neat and readable, while its documentation might not be as exhaustive as the best submission, it should cover the key aspects of the solution.

🥉Third-best submission: up to $2,000

The third best submission is one that presents a solution that effectively tackles the challenge at hand, even if it may have certain areas of improvement in terms of efficiency or depth of understanding. Documentation should be present, covering the essential components of the solution.

👉 Register

Step 1: Registration

Click here to register for the fhEVM Bounty. Fill out the registration form with your information. Once you fill out the form, you will receive a confirmation email with a link to the submission portal for when you are ready to submit your code.

Note

Check your spam folder in case you don't receive the confirmation email. If you haven't received it within 24 hour, please contact us by email at [email protected].

Step 2: Work on the Challenge

Read through the Bounty details and requirements carefully. Use the provided resources and create your own GitHub repository to store your code.
If you have any questions during your work, feel free to comment directly in the Bounty issue and our team will be happy to assist you.

Step 3: Submission

Once you have completed your work, upload your completed work to the submission portal using the link provided in the confirmation email.

Note

The deadline for submission is February, 9th 2025 (23:59, Anywhere On Earth). Late submissions will not be considered.

We wish you the best of luck with the challenge!

✅ Support

  • Comment on this issue with any questions regarding this bounty.
  • Email for private questions: [email protected]
  • Join the Zama community channels here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant