GithubHelp home page GithubHelp logo

contracts's Introduction

Waffle

Waffle is a simple primitive for NFT raffles inspired by Jon Itzler.

  1. NFT Owners can specify the number of available raffle slots, and price per slot.
  2. Entrants can deposit and withdraw until all slots are filled.
  3. Owners can raffle the NFT and select a winner at any point (slots filled or not).

Additionally:

  1. Owners can delete a raffle so long as a winner hasn't been selected.

Run locally

Edit the necessary RPC endpoints and private keys in hardhat.config.js. It is recommended to run the test suite against Chainlink's Kovan or Rinkeby deployments, to remove the need to simulate Chainlink VRF responses.

# Install dependencies
npm install

# Run tests
npx hardhat test

Status

  • Base Waffle.sol contract
  • Base WaffleFactory.sol contract
  • Testing suite

Architecture

Waffle.sol is a full-fledged raffle system that enables the deposit, withdrawal, and post-raffle disbursement of an ERC721 NFT. Randomness during winner selection is guaranteed through the use of a Chainlink VRF oracle.

WaffleFactory.sol is the factory deployed for child Waffle.sol instances. It simplifies the deployment of a raffle and ensures that deployers pre-fund Waffle.sol instances with the LINK necessary to retrieve a random result from the Chainlink oracle.

Extensions + Limitations

  1. Extension: Can include an automatic raffle timestamp to force a raffle to occur, regardless of whether a NFT owner chooses or not. Or, can remove the ability to delete a raffle.
  2. Limitation: When too many slots are filled, you can hit the upper limit for gas on successive transfer calls when deleting a raffle.

Credits

Freepik for the icon.

contracts's People

Contributors

anish-agnihotri 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.