{"id":21361106,"url":"https://github.com/kaymen99/kryptopunks-nft-staking-dapp","last_synced_at":"2025-07-13T02:32:04.787Z","repository":{"id":55551623,"uuid":"521792269","full_name":"kaymen99/KryptoPunks-nft-staking-dapp","owner":"kaymen99","description":"KryptoPunks NFTs staking dapp built on the polygon network","archived":false,"fork":false,"pushed_at":"2023-10-24T11:44:44.000Z","size":849,"stargazers_count":26,"open_issues_count":0,"forks_count":43,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-12-19T16:05:50.086Z","etag":null,"topics":["etherjs","farming","hardhat","nft-staking","nfts","reactjs","solidity","staking","staking-app"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaymen99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-08-05T22:36:55.000Z","updated_at":"2023-12-18T16:02:58.000Z","dependencies_parsed_at":"2023-01-11T15:38:42.088Z","dependency_job_id":"9b00bcc2-1a18-49d0-a997-0fe8d2aad6d9","html_url":"https://github.com/kaymen99/KryptoPunks-nft-staking-dapp","commit_stats":{"total_commits":92,"total_committers":1,"mean_commits":92.0,"dds":0.0,"last_synced_commit":"6a159e8c5c46d3ec4e07dd8d3725480547bbf757"},"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2FKryptoPunks-nft-staking-dapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2FKryptoPunks-nft-staking-dapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2FKryptoPunks-nft-staking-dapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2FKryptoPunks-nft-staking-dapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaymen99","download_url":"https://codeload.github.com/kaymen99/KryptoPunks-nft-staking-dapp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225850273,"owners_count":17534067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["etherjs","farming","hardhat","nft-staking","nfts","reactjs","solidity","staking","staking-app"],"created_at":"2024-11-22T06:08:38.775Z","updated_at":"2024-11-22T06:08:39.383Z","avatar_url":"https://github.com/kaymen99.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv id=\"top\"\u003e\u003c/div\u003e\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n\n# KryptoPunks NFT Staking Dapp\n\nThis is a modern NFT project, the dapp allows users to mint their KryptoPunks NFT and stake them to receive staking rewards in the form of our own ERC20 token named  KryptoPunkToken (KPT).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Dark\" src=\"https://user-images.githubusercontent.com/83681204/185254772-40163a1d-3481-4519-b936-b5093c71e097.png\" width=\"100%\"\u003e\n\u003c/p\u003e\n\n### Built With\n\n* [Solidity](https://docs.soliditylang.org/)\n* [Hardhat](https://hardhat.org/getting-started/)\n* [React.js](https://reactjs.org/)\n* [ethers.js](https://docs.ethers.io/v5/)\n* [web3modal](https://github.com/Web3Modal/web3modal)\n* [material ui](https://mui.com/getting-started/installation/)\n\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#project-structure\"\u003eProject structure\u003c/a\u003e\n     \u003cul\u003e\n       \u003cli\u003e\u003ca href=\"#smart-contracts\"\u003eSmart Contracts\u003c/a\u003e\u003c/li\u003e\n       \u003cli\u003e\u003ca href=\"#user-interface\"\u003eUser interface\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#how-to-run\"\u003eHow to Run\u003c/a\u003e\n      \u003cul\u003e\n       \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n       \u003cli\u003e\u003ca href=\"#contracts\"\u003eContracts\u003c/a\u003e\u003c/li\u003e\n       \u003cli\u003e\u003ca href=\"#front-end\"\u003eFront-end\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\n\u003c!-- PROJECT STRUCTURE --\u003e\n\n## Project Structure\n\n### Smart contracts\n\nThe contracts development and testing is done using the Hardhat framework in the smart_contracts folder, for this project there are 3 main contracts :\n      \u003cul\u003e\n       \u003cli\u003e\u003cb\u003eKryptoPunks.sol :\u003c/b\u003e\u003c/li\u003e\nThis is the NFT collection contract, i used the ERC721A standard because it has lower gas usage for multiple NFT mint in the same transaction, the contract will allow user to mint items from the collection which are allowed to be staked in the NFT vault.\n       \u003cli\u003e\u003cb\u003eKryptoPunksToken.sol :\u003c/b\u003e\u003c/li\u003e\nThe KryptoPunksToken or KPT is the ERC20 token used for distributing staking rewards, it's completly controlled by the stakingVault contract which is the only address allowed to mint new tokens to stakers.\n       \u003cli\u003e\u003cb\u003eNFTStakingVault.sol :\u003c/b\u003e\u003c/li\u003e\nThe staking vault contract is at the center of this application, it allows users to stake their KryptoPunks items and calculate the KPT rewards accumulated for each item based on the staking period. When a user wants to unstake or claim the accrued rewards from his NFTs, the contract is responsible for minting the KPT tokens to the user by calling the KryptoPunksToken contract.\n      \u003c/ul\u003e\n\n\u003cb\u003eThe architecture of the application\u003c/b\u003e is illustrated in the diagram below :\n\n![staking](https://user-images.githubusercontent.com/83681204/185807295-76ab7ea9-3f46-49bb-bf26-c43fa9de7002.png)\n\n### User interface\n   \nThe front end is built with React JS, it allows users to mint new KryptoPunks nfts and stake them in the vault for receiving KPT rewards over time, the app also give a simple admin dashboard for setting minting prices and maximum NFTs minted per tx.\n\nThe front-end is built using the following libraries:\n      \u003cul\u003e\n        \u003cli\u003e\u003cb\u003eEthers.js:\u003c/b\u003e used as interface between the UI and the deployed smart contract\u003c/li\u003e\n        \u003cli\u003e\u003cb\u003eWeb3modal:\u003c/b\u003e for conecting to Metamask\u003c/li\u003e\n        \u003cli\u003e\u003cb\u003e@reduxjs/toolkit \u0026 redux-persist:\u003c/b\u003e for managing the app states (account, balance, blockchain) \u003c/li\u003e\n        \u003cli\u003e\u003cb\u003eMaterial UI:\u003c/b\u003e used for react components and styles \u003c/li\u003e    \n      \u003c/ul\u003e\n      \nThe home page is a modern NFT landing page that explains the KryptoPunks project and it's progression roadmap :\n\n![Capture d’écran 2022-08-17 à 22 36 18](https://user-images.githubusercontent.com/83681204/185249401-0c9ee430-3e8a-46d7-949f-48113f434ceb.png)\n\nThe mint page allows user to mint new KryptoPunks and it contains all the information about the NFT collection (total supply, minting cost,...), and the details about the nfts held by the user (items owned, items staked, total reward accumulated,...).\n\n![Capture d’écran 2022-08-17 à 22 48 18](https://user-images.githubusercontent.com/83681204/185249853-36e1c15f-4f26-4aea-a060-604cb56cc52f.png)\n\nOn this page the user also finds a list of all the items he owns, which can be directly staked \u0026 unstaked from there and claim the reward that was accrued :\n\n![Capture d’écran 2022-08-17 à 22 48 36](https://user-images.githubusercontent.com/83681204/185250186-07ff0242-0c6b-4ff9-9d7a-f9433b85f70f.png)\n\nThe dashboard can only be accessed by the nft contract owner from the account window by clicking on the account button in the top of the page, it gives the owner the possibility of withdraw the contract balance, changing nft minting parametres or changing contract state (paused):\n\n![Capture d’écran 2022-08-17 à 22 49 01](https://user-images.githubusercontent.com/83681204/185250309-9166ae4d-8bbb-422f-99d1-4ed9c41d46a5.png)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- USAGE GUIDE --\u003e\n## How to Run\n\n### Prerequisites\n\nPlease install or have installed the following:\n* [nodejs](https://nodejs.org/en/download/) and [yarn](https://classic.yarnpkg.com/en/)\n* [MetaMask](https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn) Chrome extension installed in your browser\n* [Ganache](https://trufflesuite.com/ganache/) for local smart contracts deployement and testing.\n\nClone this repo with the command :\n   ```sh\n   git clone https://github.com/kaymen99/KryptoPunks-nft-staking-dapp.git\n   cd KryptoPunks-nft-staking-dapp\n   ```\n\n### Contracts\n\nAs mentioned before the contracts are developed with the Hardhat framework, before deploying them you must first install the required dependancies by running :\n   ```sh\n   cd smart_contracts\n   yarn\n   ```\n   \nNext you need to setup the environement variables in the .env file, this are used when deploying the contracts :\n\n   ```sh\n    POLYGONSCAN_API_KEY = 'your polygonscan api key'\n    POLYGON_RPC_URL=\"Your polygon RPC url from alchemy or infura\"\n    MUMBAI_RPC_URL=\"Your mumbai RPC url from alchemy or infura\"\n    PRIVATE_KEY=\"your private key\"\n   ```\n* \u003cb\u003eNOTE :\u003c/b\u003e Only the private key is needed when deploying to the ganache network, the others variables are for deploying to the testnets or real networks and etherscan api key is for verifying your contracts on polygon etherscan.\n\nAfter going through all the configuration step, you'll need to deploy the 3 contracts to the ganache network by running: \n   ```sh\n   yarn deploy --network ganache\n   ```\nThis will create a config.js file and an artifacts folder and transfer them to the src folder to enable the interaction between the contract and the UI\n\n* \u003cb\u003eIMPORTANT :\u003c/b\u003e I used the ganache network for development purposes only, you can choose another testnet or real network if you want, for that you need to add it to the hardhat.config file for example for the mumbai testnet: \n\n   ```sh\n   mumbai: {\n      url: MUMBAI_RPC_URL,\n      accounts: [process.env.PRIVATE_KEY],\n      chainId: 80001,\n    }\n   ```\n\nIf you want to test the vault/NFT contracts or the staking process, you can do it by running:\n   ```sh\n   yarn test\n   ```\n### Front end\n\nTo start the user interface just run the following commands :\n   ```sh\n   cd front-end\n   yarn\n   yarn start\n   ```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- Contact --\u003e\n## Contact\n\nIf you have any question or problem running this project just contact me: aymenMir1001@gmail.com\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See `LICENSE.txt` for more information.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaymen99%2Fkryptopunks-nft-staking-dapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaymen99%2Fkryptopunks-nft-staking-dapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaymen99%2Fkryptopunks-nft-staking-dapp/lists"}