owned this note
owned this note
Published
Linked with GitHub
# [MAKER] ERC721 Token Smart Contract Domain Community Assessment
## General Information
* **Symbol:** MAKER
* **Name:** MakerBadges
* **BaseURI:** https://badges.makerdao.com/token/
* **Network:** Kovan
* **Address(es):**
* BadgeFactory: [0xed3B09C5946d5fb2A2EA0dA18a151312668573eb](https://kovan.etherscan.io/address/0xdb535Ac94F0e12737f8685667d75a1d740d98599#code)
* MakerBadges: [0x3237066162023416C1C4eD19c64b8c6956599bCA](https://kovan.etherscan.io/address/0x3237066162023416C1C4eD19c64b8c6956599bCA#code)
* **Deployment Date:** Feb-05-2021 04:43:24 PM +UTC
* **Project website:** https://github.com/naszam/maker-badges/blob/biconomy/README.md
* **Github repository:** https://github.com/naszam/maker-badges
* **Can use existing MCD collateral type adapter?** TBD
## Risk Summary
* **Does the contract implement the ERC721 token standards?**
Yes, the contract implements all the required ERC721 functions.
* **Risk analysis:** LOW
## Technical Information
* **Compiler version:** v0.6.12+commit.27d51765
* **Overflow checks:** Yes, the contract inherits SafeMath uint256 Library from OpenZeppelin
* **Upgradeable contract patterns:** No
* **Meta Transaction:** Yes, Trusted Forwarder (OpenGSNv2/Biconomy)
* **IPFS:** Yes
* **Access control or restriction lists:** Default Admin, Admin, Templater, Pauser
* **Non-standard features or behaviors:** EIP-1238 (Non-Transferable Token, Badge) by overriding transfer functions.
## Formal Verification Considerations:
* **Does transfer have simple semantics?** Yes (Disabled)
* **Does transferFrom have simple semantics?** Yes (Disabled)
* **Can balances be arbitrarily modified by some actor?** No
* **Are there any external calls?** Yes
## Testnet Information
**Kovan:** `0xdb535Ac94F0e12737f8685667d75a1d740d98599`
MAKER networks deployment information:
https://github.com/naszam/maker-badges/tree/biconomy#development-deployments
## Contract Logic Summary
At its core the implementation is a standard erc721 contract which overrides transfer functions to comply with the eip1238.
It also use MerkleProof OZ Library for Off-chain checked challenges (Merkle Drop). TokenId is generated by concatenating the templateId and redeemer address (Augur Twist).
## Administrative Addresses
Below is a list of addresses related to token management:
**Deployer (EOA):**
`0xF5f7393dbE345f566b5A6580c2455Bdcdd134A95`
**Default Admin (EOA):**
`0xF5f7393dbE345f566b5A6580c2455Bdcdd134A95`
**Admin (EOA):**
`0xF5f7393dbE345f566b5A6580c2455Bdcdd134A95`
**Templater (EOA):**
`0xF5f7393dbE345f566b5A6580c2455Bdcdd134A95`
**Pauser (EOA):**
`0xF5f7393dbE345f566b5A6580c2455Bdcdd134A95`
**Important Notes:**
* Default Admin, Templater and Pauser roles will be granted to a Gnosis Safe Multisig on Mainnet :wink:
* Admin will be granted to a Relay on OZ Defender :rocket:
**On-chain Challenges:**
* MakerBadges: [0x3237066162023416C1C4eD19c64b8c6956599bCA](https://kovan.etherscan.io/address/0x3237066162023416C1C4eD19c64b8c6956599bCA)
## Contract Risk Summary
This is a low risk contract. The ERC721 functions are implemented to the industry standard. The contract overrides \_transfer function to comply with the EIP-1238. A number of extra functions are also implemented as it's a Merkle Drop contract.
## Supporting Materials
https://github.com/naszam/maker-badges/tree/biconomy
https://eips.ethereum.org/EIPS/eip-721
https://github.com/ethereum/EIPs/issues/1238
[Maker Badges Template List](https://hackmd.io/@LrwsLn1JT0GJeQ-igQnNpA/SysMhpxCv)
## Tests
![](https://i.imgur.com/AJxk6Rp.png)
![](https://i.imgur.com/ptTjxsQ.png)
![](https://i.imgur.com/cknS74t.png)
## Slither ERC721 Check
```
# Check BadgeFactory
## Check functions
[✓] totalSupply() is present
[✓] totalSupply() -> () (correct return value)
[✓] totalSupply() is view
[✓] balanceOf(address) is present
[✓] balanceOf(address) -> () (correct return value)
[✓] balanceOf(address) is view
[ ] transfer(address,uint256) is missing
[✓] transferFrom(address,address,uint256) is present
[ ] transferFrom(address,address,uint256) -> () should return bool
[✓] Transfer(address,address,uint256) is emitted
[✓] approve(address,uint256) is present
[ ] approve(address,uint256) -> () should return bool
[✓] Approval(address,address,uint256) is emitted
[ ] allowance(address,address) is missing
[✓] name() is present
[✓] name() -> () (correct return value)
[✓] name() is view
[✓] symbol() is present
[✓] symbol() -> () (correct return value)
[✓] symbol() is view
[ ] decimals() is missing (optional)
## Check events
[✓] Transfer(address,address,uint256) is present
[✓] parameter 0 is indexed
[✓] parameter 1 is indexed
[✓] Approval(address,address,uint256) is present
[✓] parameter 0 is indexed
[✓] parameter 1 is indexed
[ ] BadgeFactory is not protected for the ERC20 approval race condition
```
## Architecture Diagram
![](https://i.imgur.com/YUkidSl.png)
## Inheritance Diagram
![](https://i.imgur.com/RT8M1CG.png)
## Sūrya's Description Report
### Files Description Table
| File Name | SHA-1 Hash |
|-------------|--------------|
| contracts/MakerBadges.sol | 155e161790d244814fdd847d8c2eaa9750e35c5d |
| contracts/BadgeRoles.sol | 955d767356756887ad285ec3ee851dd9381bce37 |
| contracts/BadgeFactory.sol | cad1fe0d326720d6ee80c7fa224062878dac63c0 |
### Contracts Description Table
| Contract | Type | Bases | | |
|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:|
| └ | **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
||||||
| **ChaiLike** | Interface | |||
| └ | dai | External ❗️ | 🛑 |NO❗️ |
||||||
| **DSChiefLike** | Interface | |||
| └ | votes | External ❗️ | |NO❗️ |
||||||
| **VoteProxyLike** | Interface | |||
| └ | cold | External ❗️ | |NO❗️ |
| └ | hot | External ❗️ | |NO❗️ |
||||||
| **FlipperLike** | Interface | |||
| └ | bids | External ❗️ | |NO❗️ |
||||||
| **MakerBadges** | Implementation | AccessControl, Pausable, BaseRelayRecipient |||
| └ | <Constructor> | Public ❗️ | 🛑 |NO❗️ |
| └ | <Fallback> | External ❗️ | 🛑 |NO❗️ |
| └ | chaiChallenge | External ❗️ | 🛑 | whenNotPaused |
| └ | chiefChallenge | External ❗️ | 🛑 | whenNotPaused |
| └ | robotChallenge | External ❗️ | 🛑 | whenNotPaused |
| └ | flipperChallenge | External ❗️ | 🛑 | whenNotPaused |
| └ | verify | External ❗️ | | whenNotPaused |
| └ | pause | External ❗️ | 🛑 |NO❗️ |
| └ | unpause | External ❗️ | 🛑 |NO❗️ |
| └ | versionRecipient | External ❗️ | |NO❗️ |
| └ | getTrustedForwarder | External ❗️ | |NO❗️ |
| └ | _msgSender | Internal 🔒 | | |
| └ | _msgData | Internal 🔒 | | |
||||||
| **BadgeRoles** | Implementation | AccessControl, Pausable, BaseRelayRecipient |||
| └ | <Constructor> | Public ❗️ | 🛑 |NO❗️ |
| └ | addAdmin | External ❗️ | 🛑 |NO❗️ |
| └ | removeAdmin | External ❗️ | 🛑 |NO❗️ |
| └ | addTemplater | External ❗️ | 🛑 |NO❗️ |
| └ | removeTemplater | External ❗️ | 🛑 |NO❗️ |
| └ | pause | External ❗️ | 🛑 |NO❗️ |
| └ | unpause | External ❗️ | 🛑 |NO❗️ |
| └ | versionRecipient | External ❗️ | |NO❗️ |
| └ | getTrustedForwarder | External ❗️ | |NO❗️ |
| └ | _msgSender | Internal 🔒 | | |
| └ | _msgData | Internal 🔒 | | |
||||||
| **MakerBadgesLike** | Interface | |||
| └ | verify | External ❗️ | |NO❗️ |
||||||
| **BadgeFactory** | Implementation | BadgeRoles, ERC721 |||
| └ | <Constructor> | Public ❗️ | 🛑 | ERC721 BadgeRoles |
| └ | <Fallback> | External ❗️ | 🛑 |NO❗️ |
| └ | setBaseURI | External ❗️ | 🛑 |NO❗️ |
| └ | setRootHashes | External ❗️ | 🛑 | whenNotPaused |
| └ | createTemplate | External ❗️ | 🛑 | whenNotPaused |
| └ | updateTemplate | External ❗️ | 🛑 | whenNotPaused |
| └ | getTemplatesCount | External ❗️ | | whenNotPaused |
| └ | activateBadge | External ❗️ | 🛑 | whenNotPaused |
| └ | getBadgeRedeemer | External ❗️ | | whenNotPaused |
| └ | getBadgeTemplate | External ❗️ | | whenNotPaused |
| └ | _transfer | Internal 🔒 | 🛑 | |
| └ | _msgSender | Internal 🔒 | | |
| └ | _msgData | Internal 🔒 | | |
| └ | _getTokenId | Private 🔐 | | |
| └ | _unpackTokenId | Private 🔐 | | |
| └ | _mintWithTokenURI | Private 🔐 | 🛑 | |
### Legend
| Symbol | Meaning |
|:--------:|-----------|
| 🛑 | Function can modify state |
| 💵 | Function is payable |