Raffle3D just launched
Banking on the ecosystem of POWH3D, I decided to create a lottery system where buying ticket(s) grants you a lifetime chance of winning when your number is drawn. Your tickets are valid EACH draw!
The code is auditable:
https://etherscan.io/address/0x989eb9629225b8c06997ef0577cc08535fd789f9#code
Short Concept explanation:
- buying a ticket => P3D tokens are bought with the eth
- P3D divs fill the rafflepot and jackpot
- When the rafflepot hits > 0.103 eth a new draw can be started
- anyone can start a draw and validate one to get the 0.003 validation reward
- 0.1 eth will be paid to the rafflewinner!
- change your vanity so people know your vanity when you win, this eth will be used to spice the rafflepot
- every drawing there is a chance you get the additional jackpot! => 1 in 1000 chance when it draws 777.
UI inbound!
KOTCH UI guy is considering building a propper UI for the lottery
but for now let's go to the basics on etherscan for getting you started! :D
Buying tickets 0.01 eth per peice
you can buy any amount of tickets if the gas block limit will allow it. but usually you just buy a few:
in masternode you can put your own address or if your generous you'll put someones who does have a P3D masternode.
The masternode bonus is intended for the UI builder to get a payout for building an awesome UI.
If you check your transaction you'll see that 100% of your eth is put towwards buying P3D. other peoples activety in the P3D ecosystem will fuel the div pot you can fetch so our lottery raffle's pot gets filled.
Fetching the divs!
First we're going to read the contract to see how big the divs are we can pull to our rafflepot.
notice that this amount is displayed in wei. An aweomse UI would display it in eth.
Let's fetch it with the fetchdivs function:
90% will be added to the rafflepot
9% will be added to the jackpot
1% is set aside as dev fee anyone can disburse to my dev fee sharing contract.
you can check how big current rafflepot and jackpot is:
Starting a draw and collecting the bounty
you can start a new draw for a winner when the rafflepot is >= 0.103 eth
validate the draw:
This is where we actually know the winner and the eth get's send. you get 0.003 eth for validating a tx.
Be warned though there are bots scanning the eth place and as soon as they see your tx they try to scoop the 0.003 eth. which makes your tx result in a fail. but the winner will be vallidated!.
checking results of past draws:
A is drawblock set by the start raffle function
B is amount of lots sold at the point of the starting of the draw
C is the lotnumber that won (first lot sold has number 0, 2nd one has number 1, etc)
D is the result of jackpotdraw => when it hits 777 jackpot is awarded
E is the address that won the draw
since there was only 1 lot sold in the first draw I had a 100% chance of winning it.
you might have a question on how the rafflepot was filled without P3D.
read on.
Changing your vanity fills the rafflepot
I changed my vanity and filled the first draw as an example.
UI devs can spice up the scene with the peoples vanity.
you can see each address vanity at:
How is the winner determined?
where the drawblock is a future blockhash no one knows what it will be, set at the startdraw tx and the validationtx calculates the modulus operator spread accros the number of tickets sold attime of the draw start.
This should be a fair draw. (untill proven otherwise)
selling 90% of 1% dev fee.
This is one of the games the dev fee disburses profits from to the div contract I created in an effort to crowdfund myself into coding full time dapps.
check it out at:https://etherscan.io/address/0xfaae60f2ce6491886c9f7c9356bd92f688ca66a1#code
I hope you enjoy the lifetime possebillity of winning a lottery raffle where your tickets never expire!
I coded this contract to the best of my abillities and am not liable for any bugs the contract may hold. I'm a hobbyist coder till hopefully the crowdfunding from the div contract get's big enough for me to go full time.
Thank you for reading.
UI builders: build a UI and reap MN P3D rewards from each ticket sale!
PS: I am not affiliated with TEAM JUST in any way. This is not a TEAM JUST production.
@spielley this is awesome. This will certainly help with P3D adoption and I will do my part to help pass along the great opportunity. All the best on your journey to becoming a full-time dev!
Good luck with this... sounds interesting. I will into this later though.
Absolutely love the idea, very well thought through! This is exactly, what will make P3D an absolute powerhouse! Awesome job, mate!
What do you think, would it be possible, that "inventor" or TJ would audit the code to find possible exploits? If it`s flawless, I really think this may be a very succesful project for both the raffle and P3D.
Inventor is a verry busy man, I was lucky enough he found the time to audit my king of the crypto hill game contract some time ago. had some chats with him about the most obvious exploits out there.
Imo there should not be an exploit that I know of atm. The language is verry tricky sometimes so you never know. I hope Inventor will see what I created and take it upon himself again to check it out if he wants to.
Yup, I have no idea, how time consuming is auditing a code, but it is sure we dont want to distract Inventor creating new official TJ game. Let`s see, how things develope for Raffle.
Can you give the link for King of the hill game? Also you dont have a link to the raffle game in your post, could be a good idea to add one.
Raffle: https://www.webaccep.com/p3d/raffle3d/play
(wasn't ready at time of publishing)
kotch: https://kotch.dvx.me/#/
have fun!
And auditing other peoples codde is verry time consuming, I tried it with simple dap of the sac3d, which is a decent gambling game. But it took me more time then I'd like to before I was able to say I was okay with the code he wrote. (https://sacrific3d.stronghand.me/)