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:
bid()
with101
<Balance>
<- Alice' top bid is 101
some time later, she callsbid()
again, with1000
\<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โ
- Alexander Gryaznov (@agryaznov)
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
Number | Deliverable | Specification |
---|---|---|
0a. | License | Apache 2.0 |
0b. | Documentation | Inline documentation (builds to cargo doc) + basic How-Tos explaining installation, deployment and usage of the contract |
0c. | Testing | Core functions are covered by unit tests, which serve both sustainability of code and providing another way of explaining its logic |
0d. | Docker | N/A for smart contracts |
1. โ | Start & close period | Create an auction mechanism that has a fixed start and end period |
2. โ | Accept bids | Any user can call the contract with a bid that is higher than the last highest bid |
3. โ | Find winner | Determine a winner at the close period |
4. | Embed reward logic | The 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. | Payout | A 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
Number | Deliverable | Specification |
---|---|---|
0a. | License | Apache 2.0 |
0b. | Documentation | Inline documentation (builds to cargo doc) + basic How-Tos explaining installation, deployment and usage of the contract |
0c. | Testing | Core functions are covered by unit tests, which serve both sustainability of code and providing another way of explaining its logic |
0d. | Docker | N/A for smart contracts |
0e. | Article | A blogpost and\or a workshop showing the smart contract features will be published |
1. | Retroactive close | At 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.
Number | Deliverable | Specification |
---|---|---|
0a. | License | Same 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 Basics | Learn the basic mechanincs of a candle auction |
2. | ยง ERC721 & DNS | Learn ERC721 and DNS contracts implementations in Ink! |
3. | ยง Cross-Contract Calls | Learn cross-contract communication patterns in Ink! |
4. | ยง Auction Set Up | Learn to deploy and to instantiate these contracts, to mint tokens, to register domain and to put them dowm to an auction |
5. | ยง Auction Run | Learn to place bids to an auction, to check its subject and status, to detect winner and to get payouts |
6. | ยง Contract Verification | Learn how to verify smart contract code on Polkadot parachain |
7. | ยง Add New Reward Contract | Learn to add a new type of auction subject and to plug-in it into our conract logic |
8. | ยง Change Randomness Source | Learn 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.