{"id":21015073,"url":"https://github.com/frefrik/pancakeswap-lottery","last_synced_at":"2025-05-15T05:31:41.795Z","repository":{"id":48770038,"uuid":"352055007","full_name":"frefrik/pancakeswap-lottery","owner":"frefrik","description":"🥞 A Python client for accessing PancakeSwap Lottery smart contract information through Web3.py ","archived":false,"fork":false,"pushed_at":"2024-11-11T19:31:38.000Z","size":1164,"stargazers_count":42,"open_issues_count":2,"forks_count":16,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-28T14:46:19.091Z","etag":null,"topics":["cake","lottery","pancakeswap","smart-contract","web3","web3py"],"latest_commit_sha":null,"homepage":"https://frefrik.github.io/pancakeswap-lottery","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frefrik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-27T11:25:37.000Z","updated_at":"2025-04-03T11:10:26.000Z","dependencies_parsed_at":"2022-08-26T20:45:42.603Z","dependency_job_id":null,"html_url":"https://github.com/frefrik/pancakeswap-lottery","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frefrik%2Fpancakeswap-lottery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frefrik%2Fpancakeswap-lottery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frefrik%2Fpancakeswap-lottery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frefrik%2Fpancakeswap-lottery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frefrik","download_url":"https://codeload.github.com/frefrik/pancakeswap-lottery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254282032,"owners_count":22045078,"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":["cake","lottery","pancakeswap","smart-contract","web3","web3py"],"created_at":"2024-11-19T10:08:36.562Z","updated_at":"2025-05-15T05:31:36.782Z","avatar_url":"https://github.com/frefrik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PancakeSwap Lottery 🥞 - Web3 client\n\n![PyPI version](https://img.shields.io/pypi/v/pancakeswap-lottery)\n![PyPI downloads](https://img.shields.io/pypi/dm/pancakeswap-lottery)\n![Licence](https://img.shields.io/github/license/frefrik/pancakeswap-lottery)\n![Python version](https://img.shields.io/pypi/pyversions/pancakeswap-lottery)\n\nA Python client for accessing [PancakeSwap Lottery](https://pancakeswap.finance/lottery) smart contract information through [Web3.py](https://github.com/ethereum/web3.py).\n\n---\n\n**Documentation**: https://frefrik.github.io/pancakeswap-lottery\n\n**Examples**: https://frefrik.github.io/pancakeswap-lottery/guide/examples\n\n**Source Code**: https://github.com/frefrik/pancakeswap-lottery\n\n**PyPI**: https://pypi.org/project/pancakeswap-lottery\n\n---\n\n## Installation\nInstall from [PyPI](https://pypi.org/project/pancakeswap-lottery/):\n```\npip install pancakeswap-lottery\n```\n\n## Usage\n```python\nfrom pancakeswap_lottery import LotteryV2\n\nlottery = LotteryV2()\n\n# Current lottery round number\ncurrent_round = lottery.current_round()\n\n# Current ticket id\nticketid = lottery.current_ticket()\n\n# Status of lottery round\nstatus = lottery.status()\n\n# Lottery draw date and time of lottery round\ndraw_date = lottery.draw_date()\n\n# Ticket price in CAKE\nticket_price = lottery.ticket_price()\n\n# Total prize pool of lottery round in CAKE\nprize_pool = lottery.prize_pool()\n\n# Prize pool allocation in CAKE\nallocation = lottery.prize_pool_allocation()\n\n# Total number of tickets in lottery round\ntotal_tickets = lottery.total_tickets(lotteryround=23)\n\n# Winning numbers for lottery round\nwinning_numbers = lottery.winning_numbers(lotteryround=16)\n\n# Get lottery winnings (CAKE) for a given address and round\naddress_winnings = lottery.address_winnings(address=\"0x621D6ee5FA9634d86396C13fAaD6A7827606A6d7\", lotteryround=16)\n\n# Get lottery winnings (CAKE) for a given ticket and round\nticket_winnings = lottery.ticket_winnings(lotteryround=10, ticketid=158408)\n\n# Number of winners per prize bracket\nwinners = lottery.winners_per_bracket(lotteryround=16)\n\n# Amount of CAKE won per ticket in each prize bracket\ncake_per_bracket = lottery.cake_per_bracket(lotteryround=16)\n\n# Percentage probability of winning the lottery\nwinning_probability = lottery.winning_probability()\n\n# Data from historic lottery rounds can also be pulled\nstatus = lottery.status(lotteryround=10)\ndraw_date = lottery.draw_date(lotteryround=10)\nticket_price = lottery.ticket_price(lotteryround=10)\nprize_pool = lottery.prize_pool(lotteryround=10)\nallocation = lottery.prize_pool_allocation(lotteryround=10)\n```\n\n### Response previews\n```python\n\u003e\u003e\u003e lottery.current_round()\n20\n\n\u003e\u003e\u003e lottery.current_ticket()\n1124981\n\n\u003e\u003e\u003e lottery.status()\nOpen\n\n\u003e\u003e\u003e lottery.draw_date()\n2021-07-12 20:00:00\n\n\u003e\u003e\u003e lottery.ticket_price()\n0.32\n\n\u003e\u003e\u003e lottery.prize_pool()\n63024\n\n\u003e\u003e\u003e lottery.prize_pool_allocation()\n{'match_1': 630, 'match_2': 1891, 'match_3': 3781, 'match_4': 6302, 'match_5': 12605, 'match_6': 25210, 'burn': 12605}\n\n\u003e\u003e\u003e lottery.total_tickets(lotteryround=23)\n14253\n\n\u003e\u003e\u003e lottery.ticket_winnings(lotteryround=15, ticketid=567093)\n865.536634168\n\n\u003e\u003e\u003e lottery.address_winnings(\"0x621D6ee5FA9634d86396C13fAaD6A7827606A6d7\", lotteryround=16)\n{'tickets': 8, 'ticketids': [634970, 634971, 634972, 634973, 634974, 634975, 634976, 634977], 'winning_tickets': [634970, 634971]}\n\n \u003e\u003e\u003e lottery.winning_numbers(lotteryround=16)\n743350\n\n\u003e\u003e\u003e lottery.winners_per_bracket(lotteryround=16)\n{'match_1': 19133, 'match_2': 1921, 'match_3': 188, 'match_4': 21, 'match_5': 1, 'match_6': 1}\n\n\u003e\u003e\u003e lottery.cake_per_bracket(lotteryround=16)\n{'match_1': 0, 'match_2': 3, 'match_3': 62, 'match_4': 925, 'match_5': 38843, 'match_6': 77687}\n\n\u003e\u003e\u003e lottery.winning_probability()\n{'match_1': 10.0, 'match_2': 1.0, 'match_3': 0.1, 'match_4': 0.01, 'match_5': 0.001, 'match_6': 0.0001}\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eLottery V1\u003c/summary\u003e\n\n## Usage (Lottery V1)\n```python\nfrom pancakeswap_lottery import Lottery\n\nlottery = Lottery()\n\n# Current lottery round\nissue_index = lottery.get_issue_index()\n\n# Total pot (CAKE) of current lottery round\ntotal_amount = lottery.get_total_amount()\n\n# Prize pool allocation (percent)\nallocation = lottery.get_allocation()\n\n# Total addresses\ntotal_addresses = lottery.get_total_addresses()\n\n# Drawed \ndrawed = lottery.get_drawed()\n\n# Drawing phase\ndrawing_phase = lottery.get_drawing_phase()\n\n# Last timestamp\ntimestamp = lottery.get_last_timestamp(epoch=False)\n\n# Date and time of lottery round\nlottery_date = lottery.get_lottery_date(432)\n\n# Total rewards of lottery round\ntotal_rewards = lottery.get_total_rewards(432)\n\n# Winning numbers of lottery round\nhistory_numbers = lottery.get_history_numbers(432)\n\n# Numbers of tickets matched\nhistory_amount = lottery.get_history_amount(432)\n\n# Numers of tickets matched a specified number\nmatching_reward_amount = lottery.get_matching_reward_amount(432, 3)\n\n# Lottery numbers for a given ticket\nlottery_numbers = lottery.get_lottery_numbers(1328060)\n\n# Rewards for a given ticket\nreward_view = lottery.get_reward_view(1328060)\n\n# Max number\nmax_number = lottery.get_max_number()\n\n# CAKE contract address\ncake_contract = lottery.get_cake()\n\n# PLT-token contract address\nlottery_contract = lottery.get_lotteryNFT()\n\n# Total number of tickets bought by a given address\nbalance = lottery.get_balance_of(\"0xc13456A34305e9265E907F70f76B1BA6E2055c8B\")\n```\n\n### Response previews (Lottery V1)\n```python\n\u003e\u003e\u003e lottery.get_issue_index()\n435\n\n\u003e\u003e\u003e lottery.get_total_amount()\n34977.25\n\n\u003e\u003e\u003e lottery.get_allocation()\n{'1': 50, '2': 20, '3': 10}\n\n\u003e\u003e\u003e lottery.get_total_addresses()\n200\n\n\u003e\u003e\u003e lottery.get_drawed()\nFalse\n\n\u003e\u003e\u003e lottery.get_drawing_phase()\nFalse\n\n\u003e\u003e\u003e lottery.get_last_timestamp(epoch=False)\n2021-03-27 11:38:49\n\n\u003e\u003e\u003e lottery.get_lottery_date(432)\n2021-03-26 02:00:00+00:00\n\n\u003e\u003e\u003e lottery.get_total_rewards(432)\n51384.125\n\n\u003e\u003e\u003e lottery.get_history_numbers(432)\n[2, 13, 7, 3]\n\n\u003e\u003e\u003e lottery.get_history_amount(432)\n{'4': 1, '3': 34, '2': 718}\n\n\u003e\u003e\u003e lottery.get_matching_reward_amount(432, 3)\n34\n\n\u003e\u003e\u003e lottery.get_lottery_numbers(1328060)\n[11, 5, 14, 6]\n\n\u003e\u003e\u003e lottery.get_reward_view(1328060)\n0\n\n\u003e\u003e\u003e lottery.get_max_number()\n14\n\n\u003e\u003e\u003e lottery.get_min_price()\n1\n\n\u003e\u003e\u003e lottery.get_cake()\n0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82\n\n\u003e\u003e\u003e lottery.get_lotteryNFT()\n0x5e74094Cd416f55179DBd0E45b1a8ED030e396A1\n\n\u003e\u003e\u003e lottery.get_balance_of(\"0xc13456A34305e9265E907F70f76B1BA6E2055c8B\")\n2673\n```\n\u003c/details\u003e\n\n## Donate\nIf you found this library useful and want to support my work feel free to donate a small amount 🙏🏻\n\n- 🥞 CAKE: 0xCFad66049e2C9Bc28647B2e2e3449B6B7C602d42\n- Ξ ETH: 0x7E916c46157f012Fb8dece4A042Dc603e8d627Df\n- ₿ BTC: bc1qgn2mdf5wsxft33s3ea8sh060y85mzntzs8cuu7\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n\n## Disclaimer\n\nThis project is not affiliated with the PancakeSwap team.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrefrik%2Fpancakeswap-lottery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrefrik%2Fpancakeswap-lottery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrefrik%2Fpancakeswap-lottery/lists"}