Giter VIP home page Giter VIP logo

auction-smart-contract's Introduction

Auction Smart Contract

Smart Contract for Decentralised Auction, similar to Ebay

  • The Auction has an owner (the seller), a start and an end date;
  • The owner can cancel the auction, or finalise the auction after its end time
  • People are sending ETH by calling a function called placeBid()
    • The sender's address and the value sent to the auction will be stored in the mapping variable called bids;
  • Users are incentivised to bid the maximum amount
    • Although they are bound to the full amount
    • The contract will be able to automatically bid up to a given amount
  • The highestBindingBid is the selling price
  • The highestBidder the person who won the auction
  • When auction completes, the owner gets the highestBindingBid
    • Everybody else withdraws their amount

Timestamps

  • Timestamp with used for startBlock and endBlock
  • Using the block number to calculate the time because it is safer
  • It is noted that the Ethereum block time is roughly 15 seconds
    • Meaning that a new block is created and added to the blockchain
  • Based on the blocktime we can calculate when the auction starts and ends

Withdrawal Pattern

  • We do not proactively send back the funds to users that did not win the auction. We will use the "withdrawal pattern" instead.
  • We should only send ETH to a user when he explicitly requests it
  • This is the "withdrawal" pattern and this enables the contract from avoiding re-entrace attacks that could induce unexpected behaviours, including financial loss for users.

auction-smart-contract's People

Contributors

seanmayer avatar

Stargazers

Leigh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.