Skip to main content

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

Project description

PancakeSwap Lottery - Web3 client

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

Documentation

from pancakeswap_lottery import Lottery

lottery = Lottery()

Current lottery

get_issue_index

>>> lottery.get_issue_index()
435

get_total_amount (Prize pool)

>>> lottery.get_total_amount()
34977.25

get_allocation (Prize pool allocation)

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

get_total_addresses

>>> lottery.get_total_addresses()
200

get_drawed

>>> lottery.get_drawed()
False

get_drawing_phase

>>> lottery.get_drawing_phase()
False

get_last_timestamp

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

Past lotteries (with issue index)

get_total_rewards (Prize pool)

>>> lottery.get_total_rewards(432)
51384.125

get_history_numbers

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

get_history_amount (Numers of tickets matched)

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

get_matching_reward_amount

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

Past lotteries (with tokenid)

get_lottery_numbers

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

get_reward_view

>>> lottery.get_reward_view(1328060)
0

Lottery metadata

get_max_number

>>> lottery.get_max_number()
14

get_min_price

>>> lottery.get_min_price()
1

Other

get_cake (CAKE contract address)

>>> lottery.get_cake()
0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82

get_lotteryNFT (PLT-token contract address)

>>> lottery.get_lotteryNFT()
0x5e74094Cd416f55179DBd0E45b1a8ED030e396A1

get_balance_of(address)

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

Project details


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.0.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

pancakeswap_lottery-0.1.0-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page