-1

I need to allocate a winner among the token holders. I want to keep the concept that the more tokens someone buys the more chance there will be that he will be the winner.

now lets say 960 tokens are sold in following manner: wallet A purchased 300 tokens wallet B purchased 20 tokens wallet C purchased 400 tokens wallet D purchased 240 tokens

total sold tokens = 960 total holders = 4

I will be choosing a random number between the range 1-960. Let's say choosen number is 80, this means wallet A is the winner because he owns first 300 tokens.

How shall I implement this with least gas cost?

  • You are asking for an entire solution. Try to implement it first and ask question on a specific part where you are facing problem. – Iftifar Taz 54 mins ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.