├── .github └── workflows │ └── test.yaml ├── .gitignore ├── README.md ├── ape-config.yaml ├── app ├── .eslintrc.json ├── .gitignore ├── .npmrc ├── README.md ├── components │ ├── About.tsx │ ├── Commit.tsx │ ├── Connect.tsx │ ├── ContractInfo.tsx │ ├── Mint.tsx │ ├── Reveal.tsx │ ├── Success.tsx │ └── Tokens.tsx ├── config │ ├── abis │ │ └── commitReveal.ts │ └── contracts.ts ├── hooks │ ├── contracts.ts │ └── hasMounted.ts ├── next-env.d.ts ├── next.config.js ├── package.json ├── pages │ ├── _app.tsx │ └── index.tsx ├── postcss.config.js ├── styles │ └── globals.css ├── tailwind.config.js ├── tsconfig.json ├── utils │ └── index.ts └── yarn.lock ├── contracts ├── Base64.vy ├── CommitReveal.vy ├── CommitRevealMintable.vy ├── Metadata.sol ├── SafeReceiver.vy └── UnsafeReceiver.vy ├── scripts ├── __init__.py └── deploy.py ├── svg └── example.svg └── tests ├── __init__.py ├── conftest.py ├── test_base64.py ├── test_commit_reveal.py └── test_metadata.py /.github/workflows/test.yaml: -------------------------------------------------------------------------------- 1 | on: ["push", "pull_request"] 2 | 3 | name: Test 4 | 5 | jobs: 6 | functional: 7 | runs-on: ubuntu-latest 8 | if: ${{ false }} 9 | steps: 10 | - uses: actions/checkout@v2 11 | - uses: ApeWorX/github-action@v1 12 | - run: ape compile --size 13 | - run: ape test -s 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .build/ 2 | ape-nft-project/ 3 | 4 | # Byte-compiled / optimized / DLL files 5 | __pycache__/ 6 | *.py[cod] 7 | *$py.class 8 | 9 | # C extensions 10 | *.so 11 | 12 | # Distribution / packaging 13 | .Python 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | wheels/ 26 | pip-wheel-metadata/ 27 | share/python-wheels/ 28 | *.egg-info/ 29 | .installed.cfg 30 | *.egg 31 | MANIFEST 32 | 33 | # PyInstaller 34 | # Usually these files are written by a python script from a template 35 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 36 | *.manifest 37 | *.spec 38 | 39 | # Installer logs 40 | pip-log.txt 41 | pip-delete-this-directory.txt 42 | 43 | # Unit test / coverage reports 44 | htmlcov/ 45 | .tox/ 46 | .nox/ 47 | .coverage 48 | .coverage.* 49 | .cache 50 | nosetests.xml 51 | coverage.xml 52 | *.cover 53 | *.py,cover 54 | .hypothesis/ 55 | .pytest_cache/ 56 | 57 | # Translations 58 | *.mo 59 | *.pot 60 | 61 | # Django stuff: 62 | *.log 63 | local_settings.py 64 | db.sqlite3 65 | db.sqlite3-journal 66 | 67 | # Flask stuff: 68 | instance/ 69 | .webassets-cache 70 | 71 | # Scrapy stuff: 72 | .scrapy 73 | 74 | # Sphinx documentation 75 | docs/_build/ 76 | 77 | # PyBuilder 78 | target/ 79 | 80 | # Jupyter Notebook 81 | .ipynb_checkpoints 82 | 83 | # IPython 84 | profile_default/ 85 | ipython_config.py 86 | 87 | # pyenv 88 | .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 98 | __pypackages__/ 99 | 100 | # Celery stuff 101 | celerybeat-schedule 102 | celerybeat.pid 103 | 104 | # SageMath parsed files 105 | *.sage.py 106 | 107 | # Environments 108 | .env 109 | .venv 110 | env/ 111 | venv/ 112 | ENV/ 113 | env.bak/ 114 | venv.bak/ 115 | 116 | # Spyder project settings 117 | .spyderproject 118 | .spyproject 119 | 120 | # Rope project settings 121 | .ropeproject 122 | 123 | # mkdocs documentation 124 | /site 125 | 126 | # mypy 127 | .mypy_cache/ 128 | .dmypy.json 129 | dmypy.json 130 | 131 | # Pyre type checker 132 | .pyre/ 133 | .vscode/ 134 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Commit/Reveal 2 | 3 | Hashed onchain commitments, revealable NYE 2023. 4 | -------------------------------------------------------------------------------- /ape-config.yaml: -------------------------------------------------------------------------------- 1 | name: commit-reveal 2 | plugins: 3 | - name: vyper 4 | - name: solidity 5 | - name: alchemy 6 | - name: etherscan 7 | dependencies: 8 | - name: OpenZeppelin 9 | github: OpenZeppelin/openzeppelin-contracts 10 | version: "4.8.0" 11 | solidity: 12 | import_remapping: 13 | - "@openzeppelin=OpenZeppelin/v4.8.0/" 14 | -------------------------------------------------------------------------------- /app/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env.local 30 | .env.development.local 31 | .env.test.local 32 | .env.production.local 33 | 34 | # vercel 35 | .vercel 36 | 37 | # typescript 38 | *.tsbuildinfo 39 | -------------------------------------------------------------------------------- /app/.npmrc: -------------------------------------------------------------------------------- 1 | strict-peer-dependencies = false 2 | -------------------------------------------------------------------------------- /app/README.md: -------------------------------------------------------------------------------- 1 | This is a [RainbowKit](https://rainbowkit.com) + [wagmi](https://wagmi.sh) + [Next.js](https://nextjs.org/) project bootstrapped with [`create-rainbowkit`](https://github.com/rainbow-me/rainbowkit/tree/main/packages/create-rainbowkit). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | ``` 10 | 11 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 12 | 13 | You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. 14 | 15 | ## Learn More 16 | 17 | To learn more about this stack, take a look at the following resources: 18 | 19 | - [RainbowKit Documentation](https://rainbowkit.com) - Learn how to customize your wallet connection flow. 20 | - [wagmi Documentation](https://wagmi.sh) - Learn how to interact with Ethereum. 21 | - [Next.js Documentation](https://nextjs.org/docs) - Learn how to build a Next.js application. 22 | 23 | You can check out [the RainbowKit GitHub repository](https://github.com/rainbow-me/rainbowkit) - your feedback and contributions are welcome! 24 | 25 | ## Deploy on Vercel 26 | 27 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 28 | 29 | Check out the [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. 30 | -------------------------------------------------------------------------------- /app/components/About.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | function About() { 4 | return ( 5 |
6 |

Connect your wallet and select a 2023 commitment to reveal.

7 |

8 | You'll need to enter the exact text of your 9 | commitment message in order to reveal it. 10 |

11 |
12 | 18 | Created NYE 2022 by
@eth_call
19 |
20 |
21 |
22 | ); 23 | } 24 | 25 | export default About; 26 | -------------------------------------------------------------------------------- /app/components/Commit.tsx: -------------------------------------------------------------------------------- 1 | import { BytesLike, keccak256, toUtf8Bytes } from "ethers"; 2 | import React, { useState } from "react"; 3 | 4 | interface UploadProps { 5 | onCommitmentChange: (hash: BytesLike) => void; 6 | } 7 | 8 | function Upload({ onCommitmentChange }: UploadProps) { 9 | const [commitment, setCommitment] = useState(""); 10 | 11 | function handleChange(event: React.ChangeEvent) { 12 | if (event.target.value.length <= 256) { 13 | setCommitment(event.target.value); 14 | onCommitmentChange(keccak256(toUtf8Bytes(event.target.value))); 15 | } 16 | } 17 | 18 | return ( 19 |
20 |