{"id":23624608,"url":"https://github.com/mgnfy-view/simple-token-wallet-challenge","last_synced_at":"2026-05-08T09:34:17.826Z","repository":{"id":268873246,"uuid":"905717689","full_name":"mgnfy-view/simple-token-wallet-challenge","owner":"mgnfy-view","description":"A simple token wallet featuring gasless transfers built for the Monad developers monthly coding challenge","archived":false,"fork":false,"pushed_at":"2024-12-26T16:39:02.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-18T05:35:10.970Z","etag":null,"topics":["anvil","blockchain","cryptocurrency","ecdsa-cryptography","eip712","erc20","ethereum","forge","foundry","monad","smart-contracts","solidity","testing"],"latest_commit_sha":null,"homepage":"","language":"Solidity","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/mgnfy-view.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-19T11:38:42.000Z","updated_at":"2024-12-26T16:39:05.000Z","dependencies_parsed_at":"2024-12-19T12:37:49.773Z","dependency_job_id":"9fac7008-e908-4f88-8745-31f8c893ac61","html_url":"https://github.com/mgnfy-view/simple-token-wallet-challenge","commit_stats":null,"previous_names":["mgnfy-view/simple-token-wallet-challenge"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mgnfy-view/simple-token-wallet-challenge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgnfy-view%2Fsimple-token-wallet-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgnfy-view%2Fsimple-token-wallet-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgnfy-view%2Fsimple-token-wallet-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgnfy-view%2Fsimple-token-wallet-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgnfy-view","download_url":"https://codeload.github.com/mgnfy-view/simple-token-wallet-challenge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgnfy-view%2Fsimple-token-wallet-challenge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32775026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["anvil","blockchain","cryptocurrency","ecdsa-cryptography","eip712","erc20","ethereum","forge","foundry","monad","smart-contracts","solidity","testing"],"created_at":"2024-12-27T21:15:09.995Z","updated_at":"2026-05-08T09:34:17.799Z","avatar_url":"https://github.com/mgnfy-view.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- PROJECT SHIELDS --\u003e\n\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![MIT License][license-shield]][license-url]\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003c!-- \u003ca href=\"https://github.com/mgnfy-view/simple-token-wallet-challenge\"\u003e\n    \u003cimg src=\"assets/icon.svg\" alt=\"Logo\" width=\"80\" height=\"80\"\u003e\n  \u003c/a\u003e --\u003e\n\n  \u003ch3 align=\"center\"\u003eSimple Token Wallet Challenge\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    A simple token wallet featuring gasless transfers built for the Monad developers monthly coding challenge\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/mgnfy-view/simple-token-wallet-challenge/issues/new?labels=bug\u0026template=bug-report---.md\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/mgnfy-view/simple-token-wallet-challenge/issues/new?labels=enhancement\u0026template=feature-request---.md\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#roadmap\"\u003eRoadmap\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n\n## About The Project\n\nThis is a simple token wallet contract that allows you to manage your tokens - depost, withdraw, transfer tokens, use token allowance provided to the wallet, and provide allowance to other addresses. Additionally, it uses EIP712 structured signatures to enable gas sponsorship for token transfers.\n\nCheck out the YouTube demo video [here](https://youtu.be/muZSof7q1L4).\n\n**Some design choices that were made include:**\n\n- Tracking token balances in mapping is gas inefficient. Also, if tokens are directly sent to the wallet without using the `deposit()` function, there will be a disparity between the actual balance held by the contract and the stored balance in the mapping. Thus, balaces are retrieved by querying the ERC20 token contract.\n- The native gas token is stored in the wrapped form (for example, ETH -\u003e WETH). When native token is sent to the contract, it is automatically wrapped in the `receive()` function. This choice allows us to use the ERC20 functions for the native token, reducing additional code required for native token handling, and effectively decreasing the contract size (and thus deployment costs).\n- Aside from simple deposits and withdrawals, the wallet also supports transferring tokens out to other addresses, and using token allowance provided to the wallet. This makes the wallet more feature-rich.\n- EIP712 signatures enable gasless transfers. The wallet owner can sign transactions for withdrawals, token transfers, and using allowance, and these can be relayed by anyone to the wallet. This enables gas sponsorship and easier onboarding.\n- Ownership of the wallet is transferrable.\n\n**Gas optimizations:**\n\n- Using custom errors instead of `require()` statements saves gas.\n- Using external functions over public functions saves gas.\n- Token balances are dynamically determined, saving gas (sstore, sload not required).\n- Using immutable and private variables. Getters have been written for private variables separately, saving a bit of gas.\n\n**Some security measures that were taken:**\n\n- Critical functions like `withdraw()`, `transferTokens()`, `transferTokensFrom()` are guarded by the `onlyOwner` modifier.\n- Nonce and deadline values are used for gasless transfers. Nonce prevents replay attacks, and deadline ensures that signatures are valid only for a predefined time interval.\n- Using Openzeppelin's well audited and battle tested contracts for verifying signatures, and handling wallet ownership.\n\nA sample deployment script has also been provided at `./script/DeploySimpleTokenWallet.s.sol`.\n\n### Built With\n\n- Solidity\n- Foundry\n\n\u003c!-- GETTING STARTED --\u003e\n\n## Getting Started\n\n### Prerequisites\n\nMake sure you have git, rust, and foundry installed and configured on your system.\n\n### Installation\n\nClone the repo,\n\n```shell\ngit clone https://github.com/mgnfy-view/simple-token-wallet-challenge.git\n```\n\ncd into the repo, and install the necessary dependencies\n\n```shell\ncd simple-token-wallet-challenge\nforge build\n```\n\nRun tests by executing\n\n```shell\nforge test\n```\n\nThat's it, you are good to go now!\n\n\u003c!-- ROADMAP --\u003e\n\n## Roadmap\n\n-   [x] Smart contract development\n-   [x] Unit tests\n-   [x] Write a good README.md\n\nSee the [open issues](https://github.com/mgnfy-view/simple-token-wallet-challenge/issues) for a full list of proposed features (and known issues).\n\n\u003c!-- CONTRIBUTING --\u003e\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nIf you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag \"enhancement\".\nDon't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\u003c!-- LICENSE --\u003e\n\n## License\n\nDistributed under the MIT License. See `LICENSE.txt` for more information.\n\n\u003c!-- CONTACT --\u003e\n\n## Reach Out\n\nHere's a gateway to all my socials, don't forget to hit me up!\n\n[![Linktree](https://img.shields.io/badge/linktree-1de9b6?style=for-the-badge\u0026logo=linktree\u0026logoColor=white)][linktree-url]\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n\n[contributors-shield]: https://img.shields.io/github/contributors/mgnfy-view/simple-token-wallet-challenge.svg?style=for-the-badge\n[contributors-url]: https://github.com/mgnfy-view/simple-token-wallet-challenge/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/mgnfy-view/simple-token-wallet-challenge.svg?style=for-the-badge\n[forks-url]: https://github.com/mgnfy-view/simple-token-wallet-challenge/network/members\n[stars-shield]: https://img.shields.io/github/stars/mgnfy-view/simple-token-wallet-challenge.svg?style=for-the-badge\n[stars-url]: https://github.com/mgnfy-view/simple-token-wallet-challenge/stargazers\n[issues-shield]: https://img.shields.io/github/issues/mgnfy-view/simple-token-wallet-challenge.svg?style=for-the-badge\n[issues-url]: https://github.com/mgnfy-view/simple-token-wallet-challenge/issues\n[license-shield]: https://img.shields.io/github/license/mgnfy-view/simple-token-wallet-challenge.svg?style=for-the-badge\n[license-url]: https://github.com/mgnfy-view/simple-token-wallet-challenge/blob/master/LICENSE.txt\n[linktree-url]: https://linktr.ee/mgnfy.view\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgnfy-view%2Fsimple-token-wallet-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgnfy-view%2Fsimple-token-wallet-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgnfy-view%2Fsimple-token-wallet-challenge/lists"}