{"id":15681127,"url":"https://github.com/rubilmax/hardhat-deal","last_synced_at":"2025-04-19T11:57:38.870Z","repository":{"id":142926379,"uuid":"614373297","full_name":"Rubilmax/hardhat-deal","owner":"Rubilmax","description":"🎩🪄 Easily deal any amount of any ERC20 tokens to any account on the hardhat network","archived":false,"fork":false,"pushed_at":"2025-01-21T23:48:52.000Z","size":751,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T00:04:32.534Z","etag":null,"topics":["brute-force","deal","erc20","evm","hardhat","hardhat-network","hardhat-plugin","plugin","slot","smart-contract","storage","test","token"],"latest_commit_sha":null,"homepage":"https://github.com/Rubilmax/hardhat-deal","language":"TypeScript","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/Rubilmax.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-03-15T13:09:01.000Z","updated_at":"2024-10-22T07:47:57.000Z","dependencies_parsed_at":"2023-03-17T02:46:17.208Z","dependency_job_id":"9b730e2a-5709-436c-81bb-9c1f75c62a49","html_url":"https://github.com/Rubilmax/hardhat-deal","commit_stats":{"total_commits":57,"total_committers":3,"mean_commits":19.0,"dds":"0.26315789473684215","last_synced_commit":"048a49506392468395f375adb630d693ed53ce9f"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":"NomicFoundation/hardhat-ts-plugin-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Fhardhat-deal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Fhardhat-deal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Fhardhat-deal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Fhardhat-deal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rubilmax","download_url":"https://codeload.github.com/Rubilmax/hardhat-deal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249690358,"owners_count":21311308,"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":["brute-force","deal","erc20","evm","hardhat","hardhat-network","hardhat-plugin","plugin","slot","smart-contract","storage","test","token"],"created_at":"2024-10-03T16:49:33.594Z","updated_at":"2025-04-19T11:57:38.843Z","avatar_url":"https://github.com/Rubilmax.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hardhat-deal\n\n[![npm package][npm-img]][npm-url]\n[![Build Status][build-img]][build-url]\n[![Downloads][downloads-img]][downloads-url]\n[![Issues][issues-img]][issues-url]\n[![Commitizen Friendly][commitizen-img]][commitizen-url]\n[![Semantic Release][semantic-release-img]][semantic-release-url]\n\nThis plugin allows the developer to deal arbitrary amount of ERC20 tokens to any account on the hardhat network, to ease test development. The storage value of the mapping `balanceOf` is manipulated in order to manipulate the balance of the given user.\n\nThe plugin is shipped with a list of storage slots, which enable faster deals. Additionnally, the developer can provide a mapping of storage slots on custom ERC20s or edit the hardhat configuration on-the-fly (for example when deploying custom ERC20s during tests). If the ERC20 is not found in the configuration, the plugin automatically tries to brute-force the storage slot of the mapping `balanceOf`, and throws an error if it cannot.\n\n## Installation\n\n```bash\nnpm install hardhat-deal\n```\n\n```bash\nyarn add hardhat-deal\n```\n\nImport the plugin in your `hardhat.config.js`:\n\n```js\nrequire(\"hardhat-deal\");\n```\n\nOr if you are using TypeScript, in your `hardhat.config.ts`:\n\n```ts\nimport \"hardhat-deal\";\n```\n\n## Usage\n\n### Testing\n\n```typescript\nimport { deal } from \"hardhat-deal\";\n\nconst lusd = \"0x5f98805A4E8be255a32880FDeC7F6728C6568bA0\";\nconst user = \"0x7Ef4174aFdF4514F556439fa2822212278151Db6\";\nconst amount = \"10000000000000000000\"; // 10 LUSD\n\n// Deal 10 LUSD to the user\nawait deal(lusd, user, amount);\n\n// Optionnally provide a last parameter specifying how far to brute-force the storage slot (default: 12)\nawait deal(lusd, user, amount, 15);\n```\n\n### Standalone task\n\nThis plugin also provides a task `deal` that can be called with hardhat to deal ERC20 tokens on a separate hardhat node:\n\n```bash\nnpx hardhat deal \u003crecipient\u003e \u003cERC20 symbol or address\u003e \u003camount\u003e --network localhost\n```\n\nFor example:\n\n```bash\nnpx hardhat deal \u003crecipient\u003e WETH 2000000000000000000 --network localhost\n```\n\nRun `npx hardhat deal --help` to see the list of supported ERC20 symbols.\n\n## Configuration\n\nThis plugin extends `HardhatUserConfig` object with an optional `dealSlots` field, allowing one to customize the default storage slots used to deal ERC20 tokens, for faster usage (because the plugin no longer needs to brute-force the ERC20 storage slot).\n\nThis is an example of how to set it:\n\n```js\nmodule.exports = {\n  networks: {\n    // If using an external network, you can optionnally provide a custom rpc endpoint to manipulate the network's storage.\n    tenderly: {\n      rpcEndpoints: {\n        setStorageAt: \"tenderly_setStorageAt\",\n      },\n    },\n  },\n  dealSlots: {\n    \"0x5f98805A4E8be255a32880FDeC7F6728C6568bA0\": 2, // LUSD\n  },\n};\n```\n\n[build-img]: https://github.com/rubilmax/hardhat-deal/actions/workflows/release.yml/badge.svg\n[build-url]: https://github.com/rubilmax/hardhat-deal/actions/workflows/release.yml\n[downloads-img]: https://img.shields.io/npm/dt/hardhat-deal\n[downloads-url]: https://www.npmtrends.com/hardhat-deal\n[npm-img]: https://img.shields.io/npm/v/hardhat-deal\n[npm-url]: https://www.npmjs.com/package/hardhat-deal\n[issues-img]: https://img.shields.io/github/issues/rubilmax/hardhat-deal\n[issues-url]: https://github.com/rubilmax/hardhat-deal/issues\n[codecov-img]: https://codecov.io/gh/rubilmax/hardhat-deal/branch/main/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/rubilmax/hardhat-deal\n[semantic-release-img]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-release-url]: https://github.com/semantic-release/semantic-release\n[commitizen-img]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[commitizen-url]: http://commitizen.github.io/cz-cli/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubilmax%2Fhardhat-deal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubilmax%2Fhardhat-deal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubilmax%2Fhardhat-deal/lists"}