https://github.com/seanmayer/auction-smart-contract
Blockchain - Creating an auction smart contract on Ethereum network.
https://github.com/seanmayer/auction-smart-contract
blockchain ethereum
Last synced: 3 months ago
JSON representation
Blockchain - Creating an auction smart contract on Ethereum network.
- Host: GitHub
- URL: https://github.com/seanmayer/auction-smart-contract
- Owner: seanmayer
- Created: 2021-11-03T06:28:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-24T19:06:51.000Z (over 1 year ago)
- Last Synced: 2025-01-16T03:49:49.896Z (4 months ago)
- Topics: blockchain, ethereum
- Language: Solidity
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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 amountTimestamps
- 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 endsWithdrawal 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.