Skip to content

A yield farming application with integrated NFT factory and lottery

Notifications You must be signed in to change notification settings

andrew-fleming/pmkn-farm

Repository files navigation

Pmkn Farm

Screen Shot 2021-06-22 at 12 27 31 PM

This repository provides a DAI staking mechanism; whereby, the user receives PmknToken as a reward for staking DAI in the contract. Further, the user can purchase a JACK NFT through the NFT factory named JackOLantern. The PmknTokens 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.

Prerequisites

NodeJS and NPM >= 7.5.0

Installation

In directory root:

npm i

Testing

npx hardhat test

Deployment

Prerequisites

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.

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 PmknFarm 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,
        accounts: [`0x${process.env.PRIVATE_KEY}`]
    }
  }

In the PmknFarm root, run:

npx hardhat run scripts/deployFarm.ts --network kovan