This Repository Contains the Source Code of a Lottery Program which is Programmed by Solidity and Deployed on Rinkeby and Binance Smart Chain Testnet.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Node v14.18.3
- NPM v6.14.10
- Ganache CLI v6.12.2 (ganache-core: 2.13.2)
- Truffle v5.4.16 (core: 5.4.16)
- Solidity v0.8.13 (solc-js)
- Web3.js v1.5.3
- truffle-hdwallet-provider v2.0.4
- OpenZeppelin v4.5.0
- ChainLink v0.4.0
- Truffle: To compile, test and migrate contracts.
- Solidity: To compile Solidity codes.
- Web3: To Connect on BlockChain.
- truffle-hdwallet-provider: Used to Manage connection to Wallet from Truffle.
- OpenZeppelin: For Increase Security of Smart Contracts.
- ChainLink: For Generating Random Number with ChainLink VRF v2 Library.
- Infura: For Deploying Smart Contract.
Clone this repository:
git clone https://github.com/baties/BSCLottery.git
Then Install all requisite npm packages (as listed in package.json
):
npm install
Launch Ganache:
ganache-cli
In a separate terminal window, Compile smart contracts:
truffle compile --all
This will create the smart contract artifacts in folder build\contracts
.
Migrate smart contracts to the locally running blockchain, ganache-cli:
truffle migrate --reset
Test smart contracts:
truffle test
All tests should pass.
In a separate terminal window, launch the DApp:
cd App/lottery
npm run dev
- Ethereum - Ethereum is a decentralized platform that runs smart contracts.
- Truffle Framework - Truffle is the most popular development framework for Ethereum with a mission to make your life a lot easier.
- ChainLink - Securely connect smart contracts with off-chain data and services.
- OpenZeppelin - The standard for secure blockchain applications.
- Solidity
- Ganache-cli
- Truffle
- VRF V2 :
- In the new Version The Project can not be built under Ganache local Development because of useing VRFv2 Which is not accessible outside Testnet.
- Please Replace the VRFv2 with randomGenerator to running The Test Module on local Development Platform without any problem.
- In the next Version The Test Module will be fully compatible with VRFv2.
- User identifies himself/herself with Metamask wallet.
- User can check his/her Balance in current Pot.
- User press Start to contribute in current Pot.
- User send some BNB(ETH) to the Smart Contract (Multiple of 0.01 BNB(ETH)).
- The Lottery Smart-Contract starts Lottery Process and choses the Winner of current Pot.
- The Winner Prize will be transfered to the Winner Wallet.
- The result will be shown to the all users.
-
Deployed The fifth Version with Truffle (Ver 0.52):
- LotteryGenerator : 0x8Ca9997FeeF619f0CcAf311a11A5cD304685709a
- LotteryCore : 0x61cBF84dA7494c50626DE9c89A65C59f639E8F22
- WeeklyLottery : 0x9a944147a2f241081991C9ba0A7b01977bD4043a
- MonthlyLottery : 0xDC2169250638b973C808BFa09D042C3Ab5Eb88d4
- LotteryLiquidityPool : 0x22515475372968c8536A0439885C99F91F30aE43
- LOtteryMultiSigWallet : 0x82B0f049AD24d10bc88d2dDd621fC8b69f55B778
-
Deployed The last Version with Truffle (Ver 0.70):
- LotteryGenerator : 0x533B955db066DB5F279afD6294f3270FE251720d
- LotteryCore : 0xDb0f3863e0a0DE52A671C9167743A7EEAfa74fB1
- WeeklyLottery : 0x641359EE070479cdb17e651464796546c3861F33
- MonthlyLottery : 0x01F34675892AA4CE12422dA8EC40D1AB67Ed671D
- LotteryLiquidityPool : 0xa47cBA0895334c0A84618729b8b5b18552853dC9
- LOtteryMultiSigWallet : 0x19b89C1eB0D0B5F1F9847c244c7ebEB059fA9811
-
Deployed the fourth Version with Truffle (Ver 0.41):
- LotteryGenerator : 0xf415f0c24cFA775d566De6B8c8Afe7098448FEfa
- LotteryCore : 0xc65d246f01EF7c04a95DD8429BbfA126d8272549
- WeeklyLottery : 0xc6e5ba1D46e7f7a1A674AC6979f9228f9CE9AA1D
- MonthlyLottery : 0xDc458c1968E40361E46E6FAa0f5E83f985058c3b
- LotteryLiquidityPool : 0xc52E5BC3D189c2f2621A3432e74787202b42D79A
- LOtteryMultiSigWallet : 0x32b02534dbDf25eF66e53C4c1501eF28aa9274a4
-
Deployed the last Version with Truffle (Ver 0.68):
- LotteryGenerator : 0x68DbB384580A0690b596D529a110b6eae8849E6a
- LotteryCore : 0xe0929aEF517b6E383e14585Ad39d1d94967ED639
- WeeklyLottery : 0xee9e2cdd2b433B88d6188641C85F87d6D658E794
- MonthlyLottery : 0xE928D1D1fEb0b6Ac8BC93c21a3a2B0A433F8f4b5
- LotteryLiquidityPool : 0xAed4A0BF40F525F3Db93FF0cFf389AE293082300
- LOtteryMultiSigWallet : 0x7AcA8025E7C6221526f16762eEF147fE79ACb652
- Supporting :
- If you like this repository and find it useful please give it a star and fork it if you want to develop your own version.
- Contribution :
- Any contribution will be accepted so please just send me a contribution request.
- ContactMe :
- you can send me any suggestion via this Email Address : abhari.batis@gmail.com