This repository provides a DAI staking mechanism; whereby, the user receives KhyberToken as a reward for staking DAI in the contract. Furthermore, the user can purchase a KHRYSTAL NFT through the NFT factory named Khyber Crystal. The KhyberTokens are sent to a lottery pool inside the Lottery contract. Finally, each NFT includes a tokenId which acts as a lottery ticket. The lottery feature uses Chainlink's VRF to provide a verifiably random number. The winner receives the contents of the lottery pool.
P02T4.mp4
NodeJS and NPM >= 7.5.0
In directory root:
npm i
npx hardhat test
This dApp accepts DAI as its staking token; therefore, you'll need to acquire Kovan DAI if you deploy to Kovan (as it's preconfigured). To attain kDAI, you'll need to lock kETH in a Maker vault in exchange for kDAI.
- Network Provider
- Infura.io
- Alchemy.com
- MetaMask
- MetaMask.io
- Kovan DAI
- Kovan LINK
The Hardhat configuration file and scripts have been set up to deploy on the Kovan testnet. Use the .env_sample as a template for the requisite API_KEY and PRIVATE_KEY. Infura and Alchemy offer free API access to testnets and mainnet. Once you have an API endpoint and your private key from MetaMask, create a dotenv file within the KhyberFarm root:
touch .env
Populate the .env with your API_KEY and PRIVATE_KEY.
*If you're posting on GitHub, DO NOT FORGET to .gitignore the dotenv(.env) file!
Uncomment out the Kovan network details in hardhat.config.ts:
networks: {
kovan: {
gas: "auto",
gasPrice: "auto",
url: process.env.API_KEY_KOVAN,
accounts: [`0x${process.env.PRIVATE_KEY}`]
},
rinkeby: {
gas: "auto",
gasPrice: "auto",
url: process.env.API_KEY_RINKEBY,
accounts: [`0x${process.env.PRIVATE_KEY}`]
}
}
In the KhyberFarm root, run:
npx hardhat run scripts/deployFarm.ts --network rinkeby
- add connect wallet button
- modify contract so as to see nft on opensea