Skip to main content

Candle Auctions on Ink!

  • Team Name: @agryaznov
  • Payment Address: (DAI) 0x3ef892235Ca80B537f5916E208d8C612EA55aC69
  • Level: 1

Project Overview ๐Ÿ“„โ€‹

This application is submitted in response to the following RFP.

Overviewโ€‹

  • An Ink! smart contract that handles a candle auction mechanism.
  • I follow up the Substrate & Polkadot technology from the first sub0 conference back then in 2019.
    (See my blogpost on that topic btw)
  • Started getting my hands dirty with it some time ago.
  • Just want to implement some useful stuff.

Project Detailsโ€‹

Project is a Work in Progress.
Please have a look at the project's Github repo for details and cargo doc documentation.

Main design considerations to date are following:

  • Contract logic is heavily inspired by parachain auction implementation.
  • Auction is initialized by setting Opening\Ending periods in block numbers.
    // example of an auction schedule:
    // [1][2][3][4][5][6][7][8][9][10][11][12][13]
    // | opening | ending |
  • The contract accepts payments and records participants` balances.
  • Bids storage is a HashMap which stores only a top bid per user, therefore serving as users` balances ledger.
  • In order to make candle logic possible, we also store winning_data in featured StorageVec which holds bids for every sample.
  • Sample is a number of consequent blocks identifying a time interval inside Ending Period.
    In PoC version, sample equals to a single block. This will be enhanced later to be a configurable parameter.
  • The winning sample (i.e. in which candle "went out") will be randomly selected retrospectively after Ending period ends.
  • Bids are made by transferring an amount to increment current bidder's balance which effectively equals her top bid at any point of time.

    E.g. Alice making calls:

    1. bid() with 101 <Balance> <- Alice' top bid is 101
      some time later, she calls
    2. bid() again, with 1000 \<Balance\> <- Alice' top bid now is 1101 (not 1000)

See current project status below.

Ecosystem Fitโ€‹

(quote from the RFP):

Auctions will come in handy for various types of applications, but especially for NFTs.

The idea behind this proposal is to create an ink! smart contract that is able to run a candle auction mechanism. This will be known to Polkadot followers from the parachain auction mechanism. One of the advantages of the candle mechanism is that it incentivises bidders to submit their true bids early, thus leading to more optimal market.

Rather than restricting the use of candle auctions to parachain slot allocation only, users should be able to utilise it for other needs, e.g. auctioning off their NFTs.

Team ๐Ÿ‘ฅโ€‹

Team membersโ€‹

Contactโ€‹

  • Contact Email: hi ๐Ÿถ agryaznov.com
  • Website: agryaznov.com

Team's experienceโ€‹

I do programming for the most part of my life.
My professional career started at Intel in 2007 with implementing icc compiler benchmarking tools. A lot of projects have been done since then, including an academic course on Decentralized Applications on Ethereum platform at Innopolis University in 2017.

Team Code Reposโ€‹

Team LinkedIn Profilesโ€‹

Development Status ๐Ÿ“–โ€‹

โœ”๏ธ PoC is implemented (~75% completeness of the Milestone-1).
Please see the project's Github repo ๐Ÿ‘ˆ
which contains both sources and documentation.

Development Roadmap ๐Ÿ”ฉโ€‹

(This is taken as_is from the RFP, as I agree with it)

  • Total Estimated Duration: 1 month
  • Full-time equivalent (FTE): 1

Milestone 1 - Basic auctionโ€‹

  • Estimated Duration: 3 weeks
  • Costs: 7500 DAI
NumberDeliverableSpecification
0a.LicenseApache 2.0
0b.DocumentationInline documentation (builds to cargo doc) + basic How-Tos explaining installation, deployment and usage of the contract
0c.TestingCore functions are covered by unit tests, which serve both sustainability of code and providing another way of explaining its logic
0d.DockerN/A for smart contracts
1. โœ…Start & close periodCreate an auction mechanism that has a fixed start and end period
2. โœ…Accept bidsAny user can call the contract with a bid that is higher than the last highest bid
3. โœ…Find winnerDetermine a winner at the close period
4.Embed reward logicThe contract creator should set logic that will be executable by the winner. Such call logic should accept optional parameters. This logic should be set at the start and be immutable henceforth
5.PayoutA winner should be able to make a call, with an arbitrary number of parameters, to the reward/payout method. The contract would then pass the arguments to whichever logic is encoded as the reward (and e.g. send tokens)

Milestone 2 - Random closeโ€‹

  • Estimated Duration: 1 week
  • Costs: 2500 DAI
NumberDeliverableSpecification
0a.LicenseApache 2.0
0b.DocumentationInline documentation (builds to cargo doc) + basic How-Tos explaining installation, deployment and usage of the contract
0c.TestingCore functions are covered by unit tests, which serve both sustainability of code and providing another way of explaining its logic
0d.DockerN/A for smart contracts
0e.ArticleA blogpost and\or a workshop showing the smart contract features will be published
1.Retroactive closeAt the close block, rather than announcing the highest bidder at that point, the contract should randomly determine a block in the past (between start & end blocks) and calculate the highest bidder at that block to be the winner
2.Randomness source (optional)Randomness source should be configurable (e.g. from hash of the block in the relay chain, from a randomness beacon parachain etc.)

Milestone 3 - Substrate.dev Workshopโ€‹

  • Estimated Duration: 1.5 weeks
  • Costs: 3000 DAI

A comprehensive tutorial\workshop to be added to Substrate Developer Hub.

NumberDeliverableSpecification
0a.LicenseSame as substrate-docs or Apache 2.0. The delivery will be either merged into substrate-docs and inherit license from it, or published under Apache 2.0 as part of a separate repo
1.ยง Candle Auction BasicsLearn the basic mechanincs of a candle auction
2.ยง ERC721 & DNSLearn ERC721 and DNS contracts implementations in Ink!
3.ยง Cross-Contract CallsLearn cross-contract communication patterns in Ink!
4.ยง Auction Set UpLearn to deploy and to instantiate these contracts, to mint tokens, to register domain and to put them dowm to an auction
5.ยง Auction RunLearn to place bids to an auction, to check its subject and status, to detect winner and to get payouts
6.ยง Contract VerificationLearn how to verify smart contract code on Polkadot parachain
7.ยง Add New Reward ContractLearn to add a new type of auction subject and to plug-in it into our conract logic
8.ยง Change Randomness SourceLearn to set another on-chain randomness source for our candle

Future Plansโ€‹

  • I would be happy to gather feedback from folks using the contract and to enhance it to better fit the real needs.
  • Specific UI template for dealing with this contract could be implemented.

Additional Information โž•โ€‹

How did you hear about the Grants Program?

I came across its repository while surfing Parity's and W3F resources on Github.