I'm working on a DAO and I need to make some kind of lottery on who get's the earnings for a certain round. To make this as honest of possible I was thinking about making a lottery where the probability is based on the number of DAO tokens the user has.
So lets say 3 users take part in the round. Let's call them Alice, Bob and Charlie. Alice has 100 DAO tokens, Bob has 50 and Charlie has 10;
Would I just pick a random number in the range of 1 to 160(the total amount in the round) and give Alice the round if it is 1-100 Bob if it is 101-150 and charlie if it is 151-160.
How do I get the DAO token balance from my seperate token contract?
And can this method handle large numbers of users without hitting the gas limit?