Skip to main content

PancakeSwap Lottery - Web3 client

A Python client for accessing PancakeSwap Lottery smart contract information through Web3.py.

Install

pip install pancakeswap-lottery

Usage

from pancakeswap_lottery import Lottery

lottery = Lottery()
Current Lottery queries (realtime)
Past Lottery queries (using issue index)
Past Lottery queries (using tokenid)
Misc.

Current Lottery queries (realtime)

Issue Index

Current lottery round

>>> lottery.get_issue_index()
435

Total Amount

Total pot (CAKE) of current lottery round

>>> lottery.get_total_amount()
34977.25

Allocation

Prize pool allocation (percent)

>>> lottery.get_allocation()
{'1': 50, '2': 20, '3': 10}

Total Addresses

>>> lottery.get_total_addresses()
200

Drawed

True if currenty lottery round is drawed

>>> lottery.get_drawed()
False

Drawing Phase

True if currenty lottery round is in drawing phase

>>> lottery.get_drawing_phase()
False

Last Timestamp

>>> lottery.get_last_timestamp(epoch=False)
2021-03-27 11:38:49

Past Lottery queries (using issue index)

Total rewards

Total pot (CAKE)

>>> lottery.get_total_rewards(432)
51384.125

History Numbers

Winning numbers of lottery round

>>> lottery.get_history_numbers(432)
[2, 13, 7, 3]

History Amount

Numbers of tickets matched

>>> lottery.get_history_amount(432)
{'4': 1, '3': 34, '2': 718}

Matching Reward Amount

Numers of tickets matched a specified number

>>> lottery.get_matching_reward_amount(432, 3)
34

Past Lottery queries (using tokenid)

Lottery Numbers

Lottery numbers for a given ticket

>>> lottery.get_lottery_numbers(1328060)
[11, 5, 14, 6]

Reward View

Rewards for a given ticket

>>> lottery.get_reward_view(1328060)
0

Misc.

Max Number

>>> lottery.get_max_number()
14

Min Price

Price for one ticket (CAKE)

>>> lottery.get_min_price()
1

Cake

CAKE contract address

>>> lottery.get_cake()
0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82

LotteryNFT

PLT-token contract address

>>> lottery.get_lotteryNFT()
0x5e74094Cd416f55179DBd0E45b1a8ED030e396A1

Balance Of

Get total number of tickets bought by a given address

>>> lottery.get_balance_of("0xc13456A34305e9265E907F70f76B1BA6E2055c8B")
2673

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pancakeswap-lottery-0.1.2.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pancakeswap_lottery-0.1.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file pancakeswap-lottery-0.1.2.tar.gz.

File metadata

  • Download URL: pancakeswap-lottery-0.1.2.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.8.5 Linux/4.15.0-122-generic

File hashes

Hashes for pancakeswap-lottery-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f4107a163b860d1d3959c80030cfaf7b1fee9cd247aec111e128da8783a02b25
MD5 a828c043849cfafa2da9b1c57947d75c
BLAKE2b-256 6cb5a698d347594e38ad94c598d48e77dae21a7a6446b3b4194aa9c51807faed

See more details on using hashes here.

File details

Details for the file pancakeswap_lottery-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pancakeswap_lottery-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.8.5 Linux/4.15.0-122-generic

File hashes

Hashes for pancakeswap_lottery-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a3c81dd3c7862008e348b3c38661d8bacd1114bd397801fc2dde30097a6ab44
MD5 389c5505d2cc41a12b41322b580aa853
BLAKE2b-256 ae5e67edae829a5eaff1a7b95993ec648c08649974fb525e4910fa964fe13299

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page