pancakeswap / lottery-contract

MIT License
83 stars 192 forks source link

Lottery Ticket Generation #10

Closed jdimodugno closed 3 years ago

jdimodugno commented 3 years ago

After buying some tickets, I've noticed that one number of a ticket was repeated. After checking this file: Lottery.sol

  1. Shouldn't the Buy method check and avoid repeated items on the ticket?
  2. Shouldn't the Buy method be called inside MultiBuy?

image

Thanks.

ArtemKolichenkov commented 3 years ago
  1. Why would there be logic to avoid repeated numbers? Tickets can have repeated numbers just like the winning combination can have it. You can get a ticket with numbers [5,5,5,5] and then with 4-match if winning numbers are [5,5,5,5]
  2. There is duplication in the code yes, that would be good to refactor, BUT - PR #5 touches multiBuy a bit now to support batch minting. So once it lands buy and multiBuy will be quite different 🙂