Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexandergw/raffle-contracts
EVM Solidity raffle games with definable ERC20 token for tickets, custom parameters, and optional ERC20, ERC721, ERC1155 prize pots
https://github.com/alexandergw/raffle-contracts
blockchain erc1155 erc20 erc721 ethereum raffle-game solidity solidity-contracts
Last synced: 7 days ago
JSON representation
EVM Solidity raffle games with definable ERC20 token for tickets, custom parameters, and optional ERC20, ERC721, ERC1155 prize pots
- Host: GitHub
- URL: https://github.com/alexandergw/raffle-contracts
- Owner: AlexanderGW
- License: mit
- Created: 2021-12-20T21:43:58.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-16T20:21:29.000Z (about 2 years ago)
- Last Synced: 2024-04-14T03:10:32.088Z (9 months ago)
- Topics: blockchain, erc1155, erc20, erc721, ethereum, raffle-game, solidity, solidity-contracts
- Language: JavaScript
- Homepage:
- Size: 263 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Blockchain raffle (Solidity EVM contracts)
## Warning: These contracts have not been audited. I am not responsible for any loss of funds or damages incurred.
# How does it work?
### Allows the running of lottery games with `startGame()`, where players acquire tickets with `gameToken` (ERC20), at `gameTicketPrice`, with a total of `gameMaxPlayers`, playing up to `gameMaxTicketsPlayer` each. Players can `buyTicket()` at `_numberOfTickets`.### Player's `gameToken` are transfered to the contract, the winner receives the total `_pot` of all player `gameToken` on contract, and any additional game pots defined with `addGamePotERC20Asset()`, `addGamePotERC721Asset()` or `addGamePotERC1155Asset()`, in `endGame()`. Minus `gameFeePercent` (hundredth) fee to `gameFeeAddress`.
#### Caveat
Ideally needs a keeper bot to make frequent irregular calls of `Oracle.feedRandomness(uint256)`, to make it difficult to determine game outcomes.## Requirements
### Tools
`npm install -g solc truffle`### Configuration
Truffle `optimizer` **MUST** be `true`, in order to compile these contracts. Use a low `run` value, to compile faster in testing scenarios.## Local development
`npm install`## Testing
`truffle test`## A Next.js front-end
https://github.com/AlexanderGW/raffle-nextjs