{"id":21171823,"url":"https://github.com/ileskov/lottery","last_synced_at":"2025-07-22T10:33:06.572Z","repository":{"id":46145172,"uuid":"515109728","full_name":"ILESKOV/Lottery","owner":"ILESKOV","description":"Lottery contract with VRF2 Contract is using VRFv2 for generating random numbers.","archived":false,"fork":false,"pushed_at":"2022-10-19T22:45:11.000Z","size":997,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-06T03:50:56.264Z","etag":null,"topics":["blockchain","defi","erc20-token","erc721","ethereum","nft","smart-contracts","solidity"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ILESKOV.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-18T09:06:51.000Z","updated_at":"2023-02-15T16:26:19.000Z","dependencies_parsed_at":"2023-01-20T15:46:16.899Z","dependency_job_id":null,"html_url":"https://github.com/ILESKOV/Lottery","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ILESKOV%2FLottery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ILESKOV%2FLottery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ILESKOV%2FLottery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ILESKOV%2FLottery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ILESKOV","download_url":"https://codeload.github.com/ILESKOV/Lottery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225587735,"owners_count":17492633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","defi","erc20-token","erc721","ethereum","nft","smart-contracts","solidity"],"created_at":"2024-11-20T16:12:37.918Z","updated_at":"2024-11-20T16:12:38.597Z","avatar_url":"https://github.com/ILESKOV.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ♠ Lottery ♣\n\u003e Lottery contract with VRF2\n\u003e Contract is using VRFv2 for generating random numbers. Therefore, for the correct operation of the contract, it is necessary to create subscription on \u003e https://vrf.chain.link/goerli for rinkeby testnet or https://vrf.chain.link/mainnet for mainnet, replenish the balance of LINK and add contract address as a consumer\n\n## 📁 Table of Contents\n* [General Info](#-general-information)\n* [Technologies Used](#-technologies-used)\n* [Features](#-features)\n* [Requirements For Initial Setup](#-requirements-for-initial-setup)\n* [Setup](#-setup)\n* [Contact](#-contact)\n\n\n\n## 🚩 General Information\n- Owner(admin) of the contract can start/end lottery\n- Every user can participate and price of ticket is based on LOT ERC20 tokens. Each ticket represents itself an ERC721 token\n- After owner end lottery, the winner will be picked using randomness from Chainlink VRFv2 Coordinator\n\n \n## 💻 Technologies Used\n- Chainlink VRFv2\n- hh coverage\n- slither\n- docgen\n\n## 🌟 Features\n- Trully random contract(Ideally for lottery)\n- Ticket price is based LOT tokens\n- The contract has been properly reviewed.\n\n## 👀 Requirements For Initial Setup\n- Install [NodeJS](https://nodejs.org/en/), should work with any node version below 16.16.0\n- Install [Hardhat](https://hardhat.org/)\n\n## 📟 Setup\n### 1. 💾 Clone/Download the Repository\n### 2. 📦 Install Dependencies:\n```\n$ cd lottery_file\n$ npm install\n```\n\n### 3. 🔍  .env environment variables required to set up\nCreate .env file inside project folder\n- You can get your ethereum or testnet API key [here](https://infura.io/dashboard/ethereum),[here](https://www.alchemy.com) or any other service that allow you to connect to the nodes\n- You can get your private key from your wallet (Don't share your private key with untrusted parties) \n- Subscription id can be obtained here after creation of subscription [here](https://vrf.chain.link)\n- Key Hash and address of vrf coordinator can be obtained from here [here](https://docs.chain.link/docs/vrf-contracts) Just choose network and copy:)\n- You can get your etherscan API -key [here](https://etherscan.io/myapikey).\n- LOT_ADDRESS be available after deploying contracts\n```\nGOERLI_API = \u003cGoerli API key\u003e\nMAINNET_API = \u003cEthereum mainnet API key\u003e\nPRIVATE_KEY = \u003cPrivate key of your wallet u want to deploy contracts from\u003e\nETHERSCAN_KEY = \u003cEtherscan API key in order to verify your contracts\u003e\nSUBSCRIPTION_ID = \u003cVRFv2 subcription id\u003e\nKEY_HASH = \u003cKey Hash\u003e\nAGGREGATOR = \u003cAggregator address(depends on network)\u003e\nVRF_COORDINATOR = \u003cVRF coordinator address(depends on network)\u003e\nPERCENT_WINNER = \u003cPercent of total collected funds of lottery winner will receive(PERCENT_WINNER+PERCENT_OWNER must be 100)\u003e\nPERCENT_OWNER = \u003cPercent of total collected funds of lottery winner will receive(PERCENT_WINNER+PERCENT_OWNER must be 100)\u003e\nTICKET_PRICE = \u003cPrice in LOT tokens in order to participate in Lottery\u003e\n```\n\u003c!--![Example screenshot](./helpers/Screenshot8.png)--\u003e\n\n### 4. ⚠️ Run Tests\n```\n$ npm run test\n```\n\n```\n$ npm run coverage\n```\n\n### 5. 🚀 Deploy to GORELI or Mainnet\n```\n$ npm run deploy:goerli\n``` \n```\n$ npm run deploy:polygon\n``` \n```\n$ npm run deploy:mainnet\n``` \n### Note:\ndeploy.ts implements the verification script and you don't need to complete any additional steps in order to verify the contract.\n\n\n## 💬 Contact\nCreated by [@LESKOV](https://www.linkedin.com/in/ivan-leskov-4b5664189/) - feel free to contact me!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fileskov%2Flottery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fileskov%2Flottery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fileskov%2Flottery/lists"}