/auction-dapp

https://gitcoin.co/issue/Polkadot-Network/hello-world-by-polkadot/2/100023928

Primary LanguageJavaScript

Polkadot Hackathon

Intro

This is a simple auction written as an ink contract and deployed as a webassembly script on to a locally running substrate node, it is deployed along with a simple front-end which enables creating auctions and bidding on items.

The dApp will accept bids until the bidding time has passed, at which point no more bids will be accepted. Losing bids can be reclaimed at any time, and the winning bid can be claimed/transferred only once the auction has ended.

New auctions can only be started once the previous auction has ended.

Installation

$ cd substrate-front-end-template
$ yarn install
$ cd ..
$ cd substrate-node-template
$ WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo build --release

Running the node and the front-end and uploading the contract (auction.wasm)

$ ./target/release/node-template --dev
$ cd ..
$ cd ./substrate-front-end-template
$ yarn start

Evidence of successful deployment and function

Live example: https://gdixon.github.io/auction-dapp/ (first visit https://178.128.45.229 and add an exception for the ssl certificate)

Upload contract to local substrate node via polkadot.js.org/apps/

Auction Component implemented on substrate-front-end-template

Deploy new auction via the dApp (with Alice as the beneficiary and a 100 second run-time)

Make some bids (alice stash = 1, bob = 2, bob stash = 5)

Auction ends

Alice calls complete and claims the highest_bid

Losers reclaim their funds