Lucky Stark is an innovative on-chain lottery platform that ensures fairness and transparency by leveraging Pragma's VRF (Verifiable Random Function) oracle for true randomness. Users can create or participate in a variety of lotteries, fostering a dynamic and engaging ecosystem.
Additionally, we are working on introducing 1-on-1 betting between users, built on top of Pragma's Optimistic Oracle. This feature guarantees secure, decentralized, and trustless interactions for competitive betting.
- True Randomness: Powered by Pragma's VRF oracle, ensuring fairness in all lotteries.
- Create & Join Lotteries: Users can easily create custom lotteries or join existing ones.
- 1-on-1 Betting (Future): Secure and transparent user-versus-user bets enabled by Pragma's Optimistic Oracle.
- Decentralized & Trustless: Built entirely on-chain to ensure transparency and security.
Lucky Stark aims to redefine how lotteries and peer-to-peer betting work in the decentralized space, ensuring fairness and trust at every step.
The Lucky Stark platform follows a clear and transparent workflow to ensure fairness in all lottery operations.
Before participating, users must register on the platform by calling the register_user
function. This step ensures a secure and personalized experience.
Lotteries can only be created through the Factory Contract, ensuring uniformity and accountability.
- Call the
create_lottery
function on the Factory Contract. - Specify:
- Token: The token to be used.
- Amount: The participation fee.
- Minimum Participants: The minimum number of participants required.
- The creator must send 0.02 ETH to cover the cost of the Pragma VRF oracle fees:
- Approximately 0.0003 ETH is used for the oracle.
- The remaining amount can be withdrawn after the lottery ends.
Once a lottery is created, it enters the Active state:
- Participants can:
- Enroll by paying the participation fee.
- Withdraw their enrollment while the lottery is active.
- Lottery Owner manages the lottery and monitors participant count.
The lottery owner can call the select_winner
function once the minimum number of participants is reached:
- Sends a request to the Pragma VRF Oracle for a random number.
- The Oracle responds by invoking the
receive_random_words
callback on the lottery contract. - The callback function:
- Distributes 99% of the total pool to the randomly selected winner.
- Retains 1% as platform fees.
- The lottery state transitions to Winner Selected.
After the winner is selected:
- The lottery creator can call the
withdraw_oracle_fees
function to reclaim the unused portion of the 0.02 ETH sent initially. - The lottery is officially closed.
- Active → Open for participant enrollment.
- Winner Selected → Winner determined and funds distributed.
- Closed → Final state after oracle fees withdrawal.
This workflow ensures fairness, transparency, and an enjoyable experience for all participants.
%%{init: {
'theme': 'dark',
'themeVariables': {
'primaryColor': '#2f2f2f',
'primaryTextColor': '#fff',
'primaryBorderColor': '#7C0000',
'lineColor': '#F8B229',
'secondaryColor': '#006100',
'tertiaryColor': '#2f2f2f',
'noteTextColor': '#fff',
'noteBkgColor': '#2f2f2f',
'noteBorderColor': '#6b6b6b',
'textColor': '#fff'
}
}}%%
stateDiagram-v2
[*] --> Registered: User registers on the platform
Registered --> Active: User creates a lottery via the Factory Contract
note right of Registered
Actions:
- Call create_lottery on Factory Contract
- Specify token, amount, and min participants
- Send 0.02 ETH for Oracle fees
end note
Active --> Active: Participants enroll/withdraw
note left of Active
Actions:
- Participants approve and pay fees to enroll
- Can withdraw while lottery is active
end note
Active --> WinnerSelected: Owner calls select_winner
note right of WinnerSelected
Actions:
- Oracle generates random number
- Callback selects winner
- 99% prize to winner, 1% platform fee
end note
WinnerSelected --> Closed: Owner withdraws unused Oracle fees
note left of Closed
Actions:
- Creator reclaims remaining of 0.02 ETH
end note
Closed --> [*]
Factory Address:
0x02f5814a6a3c29855972b58ae15f7ba2afa86ceb69a1f992a371e299402ca0d3
This is a decentralized betting contract using an Optimistic Oracle to settle disputes. Participants can create, accept, and settle bets, with disputes resolved through an Oracle-driven process.
- Create custom bets between two participants.
- Resolve disputes using an Optimistic Oracle.
- Secure funds through a bonded challenge mechanism.
- Retrieve details of bets and their status.
-
Create a Bet
- A user (
initiator
) proposes a bet against anopponent
. - Parameters:
- Opponent address
- Bet amount
- Currency (ERC20 token)
- Expiration time
- Liveness period (minimum 1 hour)
- The
initiator
transfers the bet amount to the contract.
- A user (
-
Accept the Bet
- The
opponent
accepts the proposed bet. - The
opponent
transfers the same bet amount to the contract.
- The
-
Claim Victory
- Either party can claim victory by providing a reason and a bond.
- The claim is sent to the Optimistic Oracle, starting the challenge period.
-
Dispute Victory
- The opposing party can dispute the claim during the challenge period.
- A bond is also required to initiate the dispute.
-
Settle the Bet
- After the challenge period ends, the Oracle determines the winner.
- Funds are transferred to the winner's address.
-
Retrieve Bet Details
- Check the details of a bet, including its status, participants, and settlement.
-
Check Minimum Bond
- Get the minimum bond amount for a specific currency.
%%{init: {
'theme': 'dark',
'themeVariables': {
'primaryColor': '#2f2f2f',
'primaryTextColor': '#fff',
'primaryBorderColor': '#7C0000',
'lineColor': '#F8B229',
'secondaryColor': '#006100',
'tertiaryColor': '#2f2f2f',
'noteTextColor': '#fff',
'noteBkgColor': '#2f2f2f',
'noteBorderColor': '#6b6b6b',
'textColor': '#fff'
}
}}%%
stateDiagram-v2
[*] --> Created: Initiator creates bet
note right of Created
Requires:
- Opponent address
- Bet amount
- Currency (ERC20)
- Expiration time
- Liveness period
end note
Created --> Active: Opponent accepts & transfers funds
Created --> Expired: Expiration time reached
Active --> Claimed: Party claims victory
note right of Claimed
Actions:
- Requires bond
- Starts challenge period
- Sent to Optimistic Oracle
end note
Claimed --> Disputed: Opposing party disputes
note right of Disputed
Actions:
- Requires bond
- During challenge period
end note
Claimed --> Settled: Challenge period ends
Disputed --> Settled: Oracle determines winner
Settled --> [*]: Funds transferred to winner
Expired --> [*]: Initiator can withdraw
state Checking {
Check_Details: View bet status
Check_Bond: Get minimum bond
}