{"id":19102815,"url":"https://github.com/naszam/maker-badges","last_synced_at":"2025-04-30T16:26:41.605Z","repository":{"id":43117108,"uuid":"258615712","full_name":"naszam/maker-badges","owner":"naszam","description":"Non-transferable Badges for Maker Ecosystem Activity @makerdao @ETHGlobal","archived":false,"fork":false,"pushed_at":"2022-09-10T18:18:50.000Z","size":7683,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-19T06:57:06.386Z","etag":null,"topics":["erc-721","ethereum","maker-badges","makerdao","solidity","zeppelin"],"latest_commit_sha":null,"homepage":"https://mkrbadges.on.fleek.co","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naszam.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}},"created_at":"2020-04-24T20:21:14.000Z","updated_at":"2022-09-01T21:05:44.000Z","dependencies_parsed_at":"2023-01-18T03:15:21.682Z","dependency_job_id":null,"html_url":"https://github.com/naszam/maker-badges","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naszam%2Fmaker-badges","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naszam%2Fmaker-badges/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naszam%2Fmaker-badges/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naszam%2Fmaker-badges/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naszam","download_url":"https://codeload.github.com/naszam/maker-badges/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251741326,"owners_count":21636226,"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":["erc-721","ethereum","maker-badges","makerdao","solidity","zeppelin"],"created_at":"2024-11-09T03:57:14.156Z","updated_at":"2025-04-30T16:26:41.578Z","avatar_url":"https://github.com/naszam.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![#ubuntu 20.04.3](https://img.shields.io/badge/ubuntu-v20.04.3-orange?style=plastic)](https://wiki.ubuntu.com/Releases)\n[![#node 16.13.1](https://img.shields.io/badge/node-v16.13.1-blue?style=plastic)](https://github.com/nvm-sh/nvm#installation-and-update)\n[![built-with openzeppelin](https://img.shields.io/badge/built%20with-OpenZeppelin-3677FF?style=plastic)](https://docs.openzeppelin.com/)\n[![#solc 0.8.9](https://img.shields.io/badge/solc-v0.8.9-brown?style=plastic)](https://github.com/ethereum/solidity/releases/tag/v0.8.9)\n[![#testnet sokol](https://img.shields.io/badge/testnet-Sokol-grey?style=plastic\u0026logo=Ethereum)](#development-deployments)\n[![#license AGPLv3](https://img.shields.io/badge/license-AGPLv3-purple?style=plastic)](https://www.gnu.org/licenses/agpl-3.0)\n\n[![Lint](https://github.com/naszam/maker-badges/actions/workflows/lint.yml/badge.svg)](https://github.com/naszam/maker-badges/actions/workflows/lint.yml)\n[![Slither](https://github.com/naszam/maker-badges/actions/workflows/slither.yml/badge.svg)](https://github.com/naszam/maker-badges/actions/workflows/slither.yml)\n[![Tests](https://github.com/naszam/maker-badges/actions/workflows/tests.yml/badge.svg)](https://github.com/naszam/maker-badges/actions/workflows/tests.yml)\n[![Echidna](https://github.com/naszam/maker-badges/actions/workflows/echidna.yml/badge.svg)](https://github.com/naszam/maker-badges/actions/workflows/echidna.yml)\n\n[![#ETHGlobal HackMoney](https://img.shields.io/badge/ETHGlobal-HackMoney-blueviolet?style=for-the-badge\u0026logo=atom\u0026labelColor=5fc5a6)](https://hackathon.money/)\n\n\u003cimg src=\"Badges.png\" width=\"30%\"\u003e\n\n# Maker Badges\n\n\u003e Non-transferable Badges for Maker Ecosystem Activity\n\nAn incentive protocol to enhance activity on MakerDAO Ecosystem\n\n## Mentors\n\n- Mariano Conti, [@nanexcool](https://github.com/nanexcool)\n- Josh Crites, [@critesjosh](https://github.com/critesjosh)\n- Yannis Stamelakos, [@i-stam](https://github.com/i-stam)\n- Dror Tirosh (OpenGSN), [@drortirosh](https://github.com/drortirosh)\n\n[Demo](https://youtu.be/oZhXjtDnKBM)  \n[HackMoney](https://hack.ethglobal.co/showcase/metabadges-recJS9yRU2zu4rksZ)\n\n## Sections\n\n- [Building Blocks](#building-blocks)\n- [Setup](#setup)\n- [Deploy](#deploy)\n- [Interface](#interface)\n- [Backend](#backend)\n- [About](#about)\n\n# Building Blocks\n\n![Smart Contracts Flow-Chart](MakerBadges.png)\n\n### [Dai GraphQL](https://developer.makerdao.com/dai/1/graphql/)\n\n\u003e Dai GraphQL to check for activities on MakerDAO ecosystem\n\nTo enable MakerBadges to check off-chain for activities on MakerDAO ecosystem we're using the following MakerDAO DSS\nContracts:\n\n- **Pot**: to check if a user has accrued 1 or more Dai from DSR.\n- **Dai**: to check if a user has sent 10 or 20 Dai.\n- **Chief**: to check if a user has voted in Executive Spells or Governance Polls.\n- **Flip**: to check if a user has bidden or won Collateral Auctions.\n- **Cat**: to check if a user have bitten an unsafe vault.\n\n### [BadgeRoles](./contracts/BadgeRoles.sol)\n\n\u003e BadgeRoles Access Management for Default Admin, Admin, Templater and Pauser Role\n\nBadgeRoles inherits the OpenZeppelin AccessControl.sol, allowing the owner of the contract to be set as Default Admin,\nAdmin, Pauser and also as Templater, to add an Admin via **addAdmin** and remove an Admin via **removeAdmin** functions\nas well as to add a Templater via **addTemplater** and remove a Templater via **removeTemplater** functions.\n\n### [MakerBadges](./contracts/MakerBadges.sol)\n\n\u003e MakerBadges to manage Templates and activate Non-transferable Badges for redeemers\n\nTo enable MakerBadges to verify redeemers checked off-chain for activities on MakerDAO ecosystem, when they try to\nredeem their Badge, we query the Dai GraphQL, and we generate a Merkle Tree of off-chain checked redeemers for each\nBadge Template.\n\nIn particular, we'll use:\n\n- **verify** to verify redeemers checked off-chain, using a proof (generated from the Merkle Tree for each redeemer).\n\nMakerBadges let the admin to set (via **setRootHashes**) an array of root hashes, called **roots**, ordered by template\nId to allow redemeers checked off-chain for activities via TheGraph on the frontend, and stored into a Merkle Tree, to\nredeem Badges.\n\nA Merkle Tree is generated for every Badge Template and the root hash is then updated by the admin of MakerBadges on a\nweekly/monthly basis to allow batches of redeemers to redeem Badges.\n\nMakerBadges inherits BadgeRoles, allowing a Templater to create a new template via **createTemplate** specifying name,\ndescription and image. A Templater can also update the template info via **updateTemplate**.\n\nGetter functions are implemented to get template metadata via **templates** and the current number of templates via\n**getTemplateCount**.\n\nIt also inherits ERC721, where the **\\_transfer** has been overridden to implement the non-transferable feature,\nallowing redeemers checked off-chain to redeem a Badge for a specific activity on MakerDAO ecosystem via\n**activateBadge** that will verify if the caller is a redeemer and then will allow the caller to mint a new\nNon-transferable Maker Badge with tokenURI stored on IPFS (eg. \"ipfs-hash.json\").\n\n**templateQuantities** getter function is implemented to get the number of badges activated for each template.\n\nTo avoid that a redeemer could activate the same Badge twice, the **tokenId** is generated via **\\_getTokenId\"** that\nconcatenates the **redeemer** address and the **templateId** to get a unique hard-coded identifier. The **\\_mint**\nfunction will check then if the tokenId already exists (= already minted) and if not mint a new Badge.\n\n**getBadgeRedeemer** and **getBadgeTemplate** getter functions are implemented to get the redeemer address and\n**templateId** hard-coded inside the specified **tokenId**.\n\nFinally **setBaseURI** is added to allow the default admin to set a new baseURI.\n\nDuring deployment the contract sets the following ERC721 metadata:\n\n- name: \"MakerBadges\"\n- symbol: \"MAKER\"\n- baseURI: \"https://badges.makerdao.com/token/\"\n\n# Setup\n\nClone this GitHub repository.\n\n## Steps to compile and test\n\n- Local dependencies:\n  - HardHat\n  - TypeChain\n  - OpenZeppelin Contracts\n  - Ethers\n  - Waffle\n  - Solhint\n  - Solcover\n  - Prettier\n  ```sh\n  $ yarn install\n  ```\n- Global dependencies:\n  - Slither (optional):\n  ```sh\n  $ git clone https://github.com/crytic/slither.git \u0026\u0026 cd slither\n  $ sudo python3 setup.py install\n  ```\n  - MythX CLI (optional):\n  ```sh\n  $ git clone git://github.com/dmuhs/mythx-cli \u0026\u0026 cd mythx-cli\n  $ sudo python setup.py install\n  ```\n  - Echidna (optional):  \n    [binaries](https://github.com/crytic/echidna/releases)\n\n## Running the project with local test network\n\n- Compile the smart contracts using HardHat with the following command:\n  ```sh\n  $ yarn build\n  ```\n- Deploy the smart contracts locally with the following commands:\n  ```sh\n  $ yarn dev\n  ```\n  in a separate terminal:\n  ```sh\n  $ yarn deploy:local\n  ```\n- Test the smart contracts using Waffle \u0026 Ethers with Fixtures:\n  ```sh\n  $ yarn test\n  ```\n- Analyze the smart contracts using Slither with the following command (optional):\n  ```sh\n  $ slither .\n  ```\n- Analyze the smart contracts using MythX CLI with the following command (optional):\n  ```sh\n  $ mythx analyze\n  ```\n- Analyze the smart contracts using Echidna with the following command (optional):\n  ```sh\n  $ echidna-test . --contract BadgeRolesEchidnaTest --config echidna.config.yml\n  ```\n\n# Deploy\n\n## Deploy on Sokol Testnet\n\n- Get an Ethereum Account on Metamask.\n- On the landing page, click “Get Chrome Extension.”\n- Add mnemonic to MNEMONIC .env file.\n- Add deployer address to DEPLOYER_ADDRESS .env file.\n- Add Sokol as custom RPC via [Chainlist](https://chainlist.org/).\n- Get some test ether from a [Sokol's faucet](https://faucet.poa.network/).\n- Uncomment the following lines in hardhat.config.ts:\n\n  ```\n  //if (!process.env.MNEMONIC) throw new Error('Please set your MNEMONIC in a .env file');\n  //const mnemonic = process.env.MNEMONIC as string;\n\n  //if (!process.env.DEPLOYER_ADDRESS) throw new Error(\"Please set your DEPLOYER_ADDRESS in a .env file\")\n  ```\n\n- Replace the following with `mnemonic: mnemonic`:\n\n  ```\n  mnemonic: \"test test test test test test test test test test test junk\"\n  ```\n\n- Deploy MakerBadges on Sokol via the following command:\n  ```sh\n  $ yarn deploy:sokol\n  ```\n- Flatten MakerBadges to verify on [Blockscout](https://blockscout.com/poa/sokol/):\n  ```\n  yarn flatten\n  ```\n\n## Development Deployments\n\n### Sokol\n\n**MinimalForwarder**\n[0xB27bC0B1eCa340a4579642E8ab3D76F6A5815303](https://blockscout.com/poa/sokol/address/0xB27bC0B1eCa340a4579642E8ab3D76F6A5815303/contracts)\n\n**MakerBadges:**\n[0xD0d0d3A2E1c574D8eFb7c902C6Adf788F684d3B5](https://blockscout.com/poa/sokol/address/0xD0d0d3A2E1c574D8eFb7c902C6Adf788F684d3B5/contracts)\n\n# Interface\n\n- [Frontend](https://github.com/scottrepreneur/maker-badges/tree/master/packages/frontend)\n\n# Backend\n\n- [Merkle Service](https://github.com/scottrepreneur/maker-badges/tree/master/packages/api)\n\n# About\n\n## Inspiration \u0026 References\n\n- [open-proofs](https://github.com/rrecuero/open-proofs)\n- [ERC1238](https://github.com/ethereum/EIPs/issues/1238)\n- [ERC721](https://eips.ethereum.org/EIPS/eip-721)\n- [POAP](https://www.poap.xyz/)\n- [MakerDAO](https://makerdao.com/en/)\n- [Chai](https://chai.money/about.html)\n- [aztec-airdrop](https://github.com/nanexcool/aztec-airdrop)\n\n## CDIPs\n\n- CDIP [18](https://github.com/makerdao/community/issues/537)\n- CDIP [29](https://github.com/makerdao/community/issues/721)\n- CDIP [38](https://github.com/makerdao/community/issues/1180)\n\n## Authors\n\nProject created by [Nazzareno Massari](https://nazzarenomassari.com) and Scott Herren.  \nMakerDAOx and UI by [Josi](https://twitter.com/0xO0O0)  \nA special thanks for support to [Gonzalo Balabasquer](https://github.com/gbalabasquer).  \nSecurity Check by [Scott Bigelow](https://github.com/epheph)  \nMakerDAO Badge Illustrations by [Richard Rosa](https://www.artstation.com/artwork/oAJeVq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaszam%2Fmaker-badges","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaszam%2Fmaker-badges","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaszam%2Fmaker-badges/lists"}