Giter Club home page Giter Club logo

auction-engine's Introduction

Auction engine

This project is for practicing and learning purposes only. It's been developed as final work for the Solidity programming course, dictated at https://ripiocredit.network/.

Features

The AuctionEngine contract allow users to create auctions for any ERC721 digital asset, and accept any ERC20 valid token in exchange for it.

Every auction will follow these rules:

  • In order to create an Auction, the sender of the transaction must be the owner of the digital asset that will take place in that auction. The owner must also approve the engine to transfer the asset before creating the Auction.

  • Auction creator will determine the startTime and startPrice during the creation.

  • Every time a bidder submits a new bid, tokens are transferred to the engine contract.

  • If a better bid is submitted, funds are transferred back to the previous bidder (if any), and funds from the new better bidder are, again, stored in the engine contract.

  • Auctions are only accepting bids while isFinished(auctionIndex) == false.

  • Once an Auction is over, both Auction creator and winner have the right to claim. Auction creator will claim the amount of tokens that won the auction, and Auction winner will claim the digital asset.

Testing

AuctionEngine contract is tested using the truffle framework, mocha library, and async await JS functions.

To run tests, make sure to have the proper dependencies installed, and run:

$ truffle test

Contract: AuctionEngine
  โœ“ initializes with empty list of auctions
  โœ“ should create an auction (181ms)
  โœ“ should not create auction if asset was not previously approved (68ms)
  โœ“ should not create auction if msg.sender is not the asset owner (88ms)
  โœ“ should bid and transfer tokens to the auction engine (271ms)
  โœ“ should transfer the asset to the winner and tokens to the creator when auction is claimed (1592ms)


6 passing (4s)

Final notes

The AuctionEngine contract has been deployed in the Ropsten Ethereum testing network, under this address: 0xd61f183ffadd5e0f5a1734e7d40724455a9e620a.

Feel free to interact with it, or check more details in the Etherscan overview: https://ropsten.etherscan.io/address/0xd61f183ffadd5e0f5a1734e7d40724455a9e620a

auction-engine's People

Contributors

martinzugnoni 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.