{"_id":"@defi-wonderland/smock-foundry","_rev":"22-bea91934e250b76ff4f1a355b0e7880e","name":"@defi-wonderland/smock-foundry","dist-tags":{"canary":"0.0.0-5dcfec28","latest":"1.5.0"},"versions":{"0.0.0-938f7c58":{"name":"@defi-wonderland/smock-foundry","version":"0.0.0-938f7c58","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@0.0.0-938f7c58","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"870c8b967195ebd737062e1612c2bca742a86512","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-0.0.0-938f7c58.tgz","fileCount":39,"integrity":"sha512-/beXcLQEQ9ze1mtPhq43sE1AxvgjoKp8hT0r+81okig0yYSkhQ92Ct06R4N2ip736dVjs4QAWV3UqOvP2m7nPg==","signatures":[{"sig":"MEUCIBpIIp7d008w7JUwqV72hIsAcrfboKeHiEOS0gdyiz1CAiEAm86L5seZ0rUXmWbRnK50wUn75U3kSPgNZhTLBlZniYU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67475},"main":"dist/run.js","types":"dist/run.d.ts","gitHead":"938f7c587e56da06e9366a0161e3324f821bbeab","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","release":"yarn build && yarn changeset publish","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","mock-gen":"ts-node src/run.ts mock-gen","lint:check":"yarn lint:ts-logic && forge fmt check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"8.19.4","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"16.20.2","dependencies":{"yargs":"17.7.2","prettier":"^3.0.3","handlebars":"4.7.7","@defi-wonderland/solidity-utils":"0.0.0-4298c6c6"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"^8.0.3","mocha":"10.2.0","sinon":"15.1.0","eslint":"8.40.0","nodemon":"2.0.22","ts-node":"10.9.1","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"^17.0.24","tsconfig-paths":"4.2.0","@changesets/cli":"^2.26.1","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_0.0.0-938f7c58_1700648354238_0.6858653021530607","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@defi-wonderland/smock-foundry","version":"1.0.2","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@1.0.2","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"13711085df171c6722338c70aef91e9b2b3aa201","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-1.0.2.tgz","fileCount":39,"integrity":"sha512-y31RkDC0ECe4G2bhGINgzM3gskLCJgTV2OQm2i1EcXyPr6KsECdB+GecZIlQ/xeutxGHThMKnMW4tD3DP22zFQ==","signatures":[{"sig":"MEUCIQCwqcPdbSpf/ah96QsuZoainUG70rDVXq4F6jf9Z+6BVQIgO52Y2Sbnsw2P3b9UjuHevzOUkCbpbWxtRQ99pLhS4DA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67466},"main":"dist/run.js","types":"dist/run.d.ts","gitHead":"6eed9e27d3cf88e7e0862b8bd34e982b1d2f7fd1","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","release":"yarn build && yarn changeset publish","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","mock-gen":"ts-node src/run.ts mock-gen","lint:check":"yarn lint:ts-logic && forge fmt check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"8.19.4","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"16.20.2","dependencies":{"yargs":"17.7.2","prettier":"^3.0.3","handlebars":"4.7.7","@defi-wonderland/solidity-utils":"0.0.0-4298c6c6"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"^8.0.3","mocha":"10.2.0","sinon":"15.1.0","eslint":"8.40.0","nodemon":"2.0.22","ts-node":"10.9.1","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"^17.0.24","tsconfig-paths":"4.2.0","@changesets/cli":"^2.26.1","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_1.0.2_1700657015210_0.11465025728863121","host":"s3://npm-registry-packages"}},"0.0.0-abba1221":{"name":"@defi-wonderland/smock-foundry","version":"0.0.0-abba1221","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@0.0.0-abba1221","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"8bdfb7fa8b8fabbb572c7497a1d8b4c4081ed719","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-0.0.0-abba1221.tgz","fileCount":40,"integrity":"sha512-lakV9KdUmuqd76LRqefAbQwwbiW+ceQHLFLkRigIhz4uvM8LfZoKSS/X7R0a0qyiT6K7KMMjZvc32UqY0k0eFA==","signatures":[{"sig":"MEUCIEOiauH6CkS6tEeokyXVK0YIzljn/hmt6KsNVpF3q+a3AiEAullRP5X6+z80vcHDjxfvcpzUmU0a2f0bpwVMTklk+58=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68046},"main":"dist/run.js","types":"dist/run.d.ts","readme":"[![Version](https://img.shields.io/npm/v/@defi-wonderland/smock-foundry?label=Version)](https://www.npmjs.com/package/@defi-wonderland/smock-foundry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/defi-wonderland/prophet-sdk/blob/main/LICENSE)\n\n# Smock Foundry\nA plugin for [foundry](https://github.com/foundry-rs/foundry) that automatically generates Solidity mocks for every contract in your project.\n\n## Features\n\n- Get rid of your folder of \"mock\" contracts and **just use\n  foundry**.\n- Keep your tests **simple** with straightforward mock functions.\n- Mock up external calls and internal variables in a beautiful and orderly fashion.\n\n## Installation\n\nYou can install the plugin via yarn:\n\n```bash\nyarn add @defi-wonderland/smock-foundry --save-dev\n```\n\n## Basic Usage\n\n### Creating mocks\n\nTo generate the mock contracts all you have to do is run:\n\n```bash\nyarn smock-foundry --contracts path/to/contracts\n```\n\nThe `smock-foundry` command accepts the following options:\n\nOption      | Default                           | Notes\n------------|-----------------------------------|-------\n`contracts` | —                                 | The path to the solidity contracts to mock\n`out`       | `./out`                           | The path that has the compiled artifacts\n`genDir`    | `./solidity/test/mock-contracts`  | The path to the generated mock contracts\n`ignore`    | []                                | A list of directories to ignore, e.g. `--ignore libraries`\n\n### Using mocks\n\nLet's say you have a `Greeter` contract in your project at `contracts/Greeter.sol`:\n\n```solidity\ncontract Greeter {\n  string internal _greeting;\n\n  constructor(string memory greeting) {\n    _greeting = greeting;\n  }\n\n  function greet() public view returns (string memory) {\n    return _greeting;\n  }\n}\n```\n\nAfter running the generator, you will have a mock contract located at `${genDir}/contracts/MockGreeter.sol`:\n\n```solidity\ncontract MockGreeter is Greeter {\n  function mock_call_greet(string memory __greeting) external {\n    // Mocks the greet() function calls\n  }\n\n  function set__greeting(string memory greeting) public {\n    // Sets the value of `greeting`\n  }\n}\n```\n\nThe next step would be importing the mock contract in your unit tests, deploying it and allowing it to use the cheatcodes, specifically `vm.mockCall`.\n\n```solidity\nimport 'forge-std/Test.sol';\n\nimport { MockGreeter } from '/path/to/mock-contracts/MockGreeter.sol';\nimport { MockHelper } from '/path/to/mock-contracts/MockHelper.sol';\n\ncontract BaseTest is Test, MockHelpers {\n  MockGreeter public greeter;\n\n  function setUp() public {\n    // The `deployMock` call is equivalent to\n    // greeter = new MockGreeter('Hello');\n    // label(address(greeter, 'Greeter');\n    // vm.allowCheatcodes(address(greeter);\n\n    greeter = deployMock(\n      'Greeter',\n      type(Greeter).creationCode,\n      abi.encode('Hello')\n    );\n  }\n}\n```\n\nThen enjoy the wonders of mocking:\n\n```solidity\n// Mock the `greet` function to return 'Holá' instead of 'Hello'\ngreeter.mock_call_greet('Holá');\n\n// Or you can achieve the same by setting the internal variable\ngreeter.set__greeting('Holá');\n```\n\n### Gotchas\n\n- Please, note that if you want to mock `internal` functions, you **must** make them `virtual`. The tool will not generate mocks for internal functions that are not virtual.\n- Cannot `set` private variables and mock private functions.\n- If you have a contract named `Helper`, you can avoid the name collision like so:\n\n```solidity\nimport { MockHelper } from '/path/to/mock-contracts/contracts/MockHelper.sol';\nimport { MockHelper as FoundryMockHelper } from '/path/to/mock-contracts/MockHelper.sol';\n\ncontract BaseTest is Test, FoundryMockHelper {\n  // You get the idea\n}\n```\n\n## Release\n\nWe use changesets to mark packages for new releases. When merging commits to the dev branch you MUST include a changeset file if your change would require that a new version of a package be released.\n\nTo add a changeset, run the command `yarn changeset` in the root of this repo. You will be presented with a small prompt to select the packages to be released, the scope of the release (major, minor, or patch), and the reason for the release. Comments within changeset files will be automatically included in the changelog of the package.\n\n# Licensing\n\nThe primary license for Smock Foundry is MIT, see [`LICENSE`](./LICENSE).\n\n# Contributors\n\nMaintained with love by [Wonderland](https://defi.sucks). Made possible by viewers like you.\n","gitHead":"abba1221c6ad7a743d653dca17a4b49506ab0bad","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","release":"yarn build && yarn changeset publish","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","mock-gen":"ts-node src/run.ts mock-gen","lint:check":"yarn lint:ts-logic && forge fmt check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"8.19.4","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"16.20.2","dependencies":{"yargs":"17.7.2","prettier":"^3.0.3","handlebars":"4.7.7","@defi-wonderland/solidity-utils":"0.0.0-4298c6c6"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"4.3.7","husky":"^8.0.3","mocha":"10.2.0","sinon":"15.1.0","eslint":"8.40.0","nodemon":"2.0.22","ts-node":"10.9.1","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"^17.0.24","tsconfig-paths":"4.2.0","@changesets/cli":"^2.26.1","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_0.0.0-abba1221_1700659577752_0.3375330375179162","host":"s3://npm-registry-packages"}},"0.0.0-101373b9":{"name":"@defi-wonderland/smock-foundry","version":"0.0.0-101373b9","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@0.0.0-101373b9","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"bea4013f4698a9b7ed397920de3b377a20b68935","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-0.0.0-101373b9.tgz","fileCount":40,"integrity":"sha512-4QKnMi2gmNcu1jrCdby3grqPdjBAsI+HzN6BZtRz0qXVyZUbuoQL4+7D0RJo7Gvjh6akgq/9UvoeEAWB2G2eRQ==","signatures":[{"sig":"MEYCIQCQqmB0eePk3s/6bg5mCOiPRzGA2w6+HNgbHX/wYoeR7QIhAK/AEf/ycUtlqqabqVoBlF+Ti0gxksnoVY7jYLPkgPW4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68304},"main":"dist/run.js","types":"dist/run.d.ts","readme":"[![Version](https://img.shields.io/npm/v/@defi-wonderland/smock-foundry?label=Version)](https://www.npmjs.com/package/@defi-wonderland/smock-foundry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/defi-wonderland/prophet-sdk/blob/main/LICENSE)\n\n# Smock Foundry\nA plugin for [foundry](https://github.com/foundry-rs/foundry) that automatically generates Solidity mocks for every contract in your project.\n\n## Features\n\n- Get rid of your folder of \"mock\" contracts and **just use\n  foundry**.\n- Keep your tests **simple** with straightforward mock functions.\n- Mock up external calls and internal variables in a beautiful and orderly fashion.\n\n## Installation\n\nYou can install the plugin via yarn:\n\n```bash\nyarn add @defi-wonderland/smock-foundry --save-dev\n```\n\n## Basic Usage\n\n### Creating mocks\n\nTo generate the mock contracts all you have to do is run:\n\n```bash\nyarn smock-foundry --contracts path/to/contracts\n```\n\nThe `smock-foundry` command accepts the following options:\n\nOption      | Default                           | Notes\n------------|-----------------------------------|-------\n`contracts` | —                                 | The path to the solidity contracts to mock\n`out`       | `./out`                           | The path that has the compiled artifacts\n`mocks `    | `./solidity/test/mocks`           | The path to the generated mock contracts\n`ignore`    | []                                | A list of directories to ignore, e.g. `--ignore libraries`\n\n### Using mocks\n\nLet's say you have a `Greeter` contract in your project at `contracts/Greeter.sol`:\n\n```solidity\ncontract Greeter {\n  string internal _greeting;\n\n  constructor(string memory greeting) {\n    _greeting = greeting;\n  }\n\n  function greet() public view returns (string memory) {\n    return _greeting;\n  }\n}\n```\n\nAfter running the generator, you will have a mock contract located at `${genDir}/contracts/MockGreeter.sol`:\n\n```solidity\ncontract MockGreeter is Greeter {\n  function mock_call_greet(string memory __greeting) external {\n    // Mocks the greet() function calls\n  }\n\n  function set__greeting(string memory greeting) public {\n    // Sets the value of `greeting`\n  }\n}\n```\n\nThe next step would be importing the mock contract in your unit tests, deploying it and allowing it to use the cheatcodes, specifically `vm.mockCall`.\n\n```solidity\nimport 'forge-std/Test.sol';\n\nimport { MockGreeter } from '/path/to/mocks/contracts/MockGreeter.sol';\nimport { SmockHelper } from '/path/to/mocks/SmockHelper.sol';\n\ncontract BaseTest is Test, SmockHelper {\n  MockGreeter public greeter;\n\n  function setUp() public {\n    // The `deployMock` call is equivalent to\n    // greeter = new MockGreeter('Hello');\n    // label(address(greeter, 'Greeter');\n    // vm.allowCheatcodes(address(greeter);\n\n    greeter = deployMock(\n      'Greeter',\n      type(Greeter).creationCode,\n      abi.encode('Hello')\n    );\n  }\n}\n```\n\nThen enjoy the wonders of mocking:\n\n```solidity\n// Mock the `greet` function to return 'Holá' instead of 'Hello'\ngreeter.mock_call_greet('Holá');\n\n// Or you can achieve the same by setting the internal variable\ngreeter.set__greeting('Holá');\n```\n\n### Gotchas\n\n- Please, note that if you want to mock `internal` functions, you **must** make them `virtual`. The tool will not generate mocks for internal functions that are not virtual.\n- Cannot `set` private variables and mock private functions.\n- Mocking of structs containing mappings is not supported.\n\n## Release\n\nWe use changesets to mark packages for new releases. When merging commits to the dev branch you MUST include a changeset file if your change would require that a new version of a package be released.\n\nTo add a changeset, run the command `yarn changeset` in the root of this repo. You will be presented with a small prompt to select the packages to be released, the scope of the release (major, minor, or patch), and the reason for the release. Comments within changeset files will be automatically included in the changelog of the package.\n\n# Licensing\n\nThe primary license for Smock Foundry is MIT, see [`LICENSE`](./LICENSE).\n\n# Contributors\n\nMaintained with love by [Wonderland](https://defi.sucks). Made possible by viewers like you.\n","gitHead":"101373b938ba10c4d785495d85387ddd7095c280","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","prepare":"husky install","release":"yarn build && yarn changeset publish","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","mock-gen":"ts-node src/run.ts mock-gen","lint:check":"yarn lint:ts-logic && forge fmt check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","postinstall":"husky install","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"8.19.4","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"16.20.2","dependencies":{"yargs":"17.7.2","prettier":"^3.0.3","handlebars":"4.7.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"4.3.7","husky":"^8.0.3","mocha":"10.2.0","sinon":"15.1.0","eslint":"8.40.0","nodemon":"2.0.22","ts-node":"10.9.1","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"^17.0.24","tsconfig-paths":"4.2.0","@changesets/cli":"^2.26.1","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_0.0.0-101373b9_1701797767482_0.07842757640876519","host":"s3://npm-registry-packages"}},"0.0.0-2ac8342c":{"name":"@defi-wonderland/smock-foundry","version":"0.0.0-2ac8342c","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@0.0.0-2ac8342c","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"2214c121288bfd8a1c95281d8893426b04994163","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-0.0.0-2ac8342c.tgz","fileCount":40,"integrity":"sha512-S2iAhrf8m0sSiW/vOZ3E3pa1n38oPy3lat+tjvk+ER/QKF73Azdxy4pp9g95/hj9mvHmR4xT/ZOC+YZLcmNCUA==","signatures":[{"sig":"MEQCICprWLl7KeeJCtLb4LYzWDUAjKAU1DAutD7pp5PV8vVSAiBt7Q78cx6THXhpliX7BDL/DaTVj3CZ6VdjchuatmDyFg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68236},"main":"dist/run.js","types":"dist/run.d.ts","readme":"[![Version](https://img.shields.io/npm/v/@defi-wonderland/smock-foundry?label=Version)](https://www.npmjs.com/package/@defi-wonderland/smock-foundry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/defi-wonderland/prophet-sdk/blob/main/LICENSE)\n\n# Smock Foundry\nA plugin for [foundry](https://github.com/foundry-rs/foundry) that automatically generates Solidity mocks for every contract in your project.\n\n## Features\n\n- Get rid of your folder of \"mock\" contracts and **just use\n  foundry**.\n- Keep your tests **simple** with straightforward mock functions.\n- Mock up external calls and internal variables in a beautiful and orderly fashion.\n\n## Installation\n\nYou can install the plugin via yarn:\n\n```bash\nyarn add @defi-wonderland/smock-foundry --save-dev\n```\n\n## Basic Usage\n\n### Creating mocks\n\nTo generate the mock contracts all you have to do is run:\n\n```bash\nyarn smock-foundry --contracts path/to/contracts\n```\n\nThe `smock-foundry` command accepts the following options:\n\nOption      | Default                           | Notes\n------------|-----------------------------------|-------\n`contracts` | —                                 | The path to the solidity contracts to mock\n`out`       | `./out`                           | The path that has the compiled artifacts\n`mocks `    | `./solidity/test/mocks`           | The path to the generated mock contracts\n`ignore`    | []                                | A list of directories to ignore, e.g. `--ignore libraries`\n\n### Using mocks\n\nLet's say you have a `Greeter` contract in your project at `contracts/Greeter.sol`:\n\n```solidity\ncontract Greeter {\n  string internal _greeting;\n\n  constructor(string memory greeting) {\n    _greeting = greeting;\n  }\n\n  function greet() public view returns (string memory) {\n    return _greeting;\n  }\n}\n```\n\nAfter running the generator, you will have a mock contract located at `${genDir}/contracts/MockGreeter.sol`:\n\n```solidity\ncontract MockGreeter is Greeter {\n  function mock_call_greet(string memory __greeting) external {\n    // Mocks the greet() function calls\n  }\n\n  function set__greeting(string memory greeting) public {\n    // Sets the value of `greeting`\n  }\n}\n```\n\nThe next step would be importing the mock contract in your unit tests, deploying it and allowing it to use the cheatcodes, specifically `vm.mockCall`.\n\n```solidity\nimport 'forge-std/Test.sol';\n\nimport { MockGreeter } from '/path/to/mocks/contracts/MockGreeter.sol';\nimport { SmockHelper } from '/path/to/mocks/SmockHelper.sol';\n\ncontract BaseTest is Test, SmockHelper {\n  MockGreeter public greeter;\n\n  function setUp() public {\n    // The `deployMock` call is equivalent to\n    // greeter = new MockGreeter('Hello');\n    // label(address(greeter, 'Greeter');\n    // vm.allowCheatcodes(address(greeter);\n\n    greeter = deployMock(\n      'Greeter',\n      type(Greeter).creationCode,\n      abi.encode('Hello')\n    );\n  }\n}\n```\n\nThen enjoy the wonders of mocking:\n\n```solidity\n// Mock the `greet` function to return 'Holá' instead of 'Hello'\ngreeter.mock_call_greet('Holá');\n\n// Or you can achieve the same by setting the internal variable\ngreeter.set__greeting('Holá');\n```\n\n### Gotchas\n\n- Please, note that if you want to mock `internal` functions, you **must** make them `virtual`. The tool will not generate mocks for internal functions that are not virtual.\n- Cannot `set` private variables and mock private functions.\n- Mocking of structs containing mappings is not supported.\n\n## Release\n\nWe use changesets to mark packages for new releases. When merging commits to the dev branch you MUST include a changeset file if your change would require that a new version of a package be released.\n\nTo add a changeset, run the command `yarn changeset` in the root of this repo. You will be presented with a small prompt to select the packages to be released, the scope of the release (major, minor, or patch), and the reason for the release. Comments within changeset files will be automatically included in the changelog of the package.\n\n# Licensing\n\nThe primary license for Smock Foundry is MIT, see [`LICENSE`](./LICENSE).\n\n# Contributors\n\nMaintained with love by [Wonderland](https://defi.sucks). Made possible by viewers like you.\n","gitHead":"2ac8342c582d11831a7546f69faad200afeffc51","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","release":"yarn build && yarn changeset publish","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","mock-gen":"ts-node src/run.ts mock-gen","lint:check":"yarn lint:ts-logic && forge fmt check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"8.19.4","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"16.20.2","dependencies":{"yargs":"17.7.2","prettier":"^3.0.3","handlebars":"4.7.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"4.3.7","husky":"^8.0.3","mocha":"10.2.0","sinon":"15.1.0","eslint":"8.40.0","nodemon":"2.0.22","ts-node":"10.9.1","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"^17.0.24","tsconfig-paths":"4.2.0","@changesets/cli":"^2.26.1","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_0.0.0-2ac8342c_1701798295528_0.8835072833016382","host":"s3://npm-registry-packages"}},"0.0.0-b0da78f2":{"name":"@defi-wonderland/smock-foundry","version":"0.0.0-b0da78f2","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@0.0.0-b0da78f2","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"1d07ed104bf96f5fce9aefd364c00e384b376e5d","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-0.0.0-b0da78f2.tgz","fileCount":40,"integrity":"sha512-Le7cPIuQeAL/kTve5LwJSbLN/xTh6qkOb9ggNoTHGxhBmSKqDmUr3qwsLveewBiSJGYA6CHDst7KxSxJIHr/rA==","signatures":[{"sig":"MEUCIQDopg7UuZ3YqFF90Sb1nd4VBAtA9LHpPDKksA0c39j6HAIgXoOx4FaFLqTo2kY/y3GY7mdjXpf6A3LHfh+JHPqKdoI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":69089},"main":"dist/run.js","types":"dist/run.d.ts","readme":"[![Version](https://img.shields.io/npm/v/@defi-wonderland/smock-foundry?label=Version)](https://www.npmjs.com/package/@defi-wonderland/smock-foundry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/defi-wonderland/prophet-sdk/blob/main/LICENSE)\n\n# Smock Foundry\nA plugin for [foundry](https://github.com/foundry-rs/foundry) that automatically generates Solidity mocks for every contract in your project.\n\n## Features\n\n- Get rid of your folder of \"mock\" contracts and **just use\n  foundry**.\n- Keep your tests **simple** with straightforward mock functions.\n- Mock up external calls and internal variables in a beautiful and orderly fashion.\n\n## Installation\n\nYou can install the plugin via yarn:\n\n```bash\nyarn add @defi-wonderland/smock-foundry --save-dev\n```\n\n## Basic Usage\n\n### Creating mocks\n\nTo generate the mock contracts all you have to do is run:\n\n```bash\nyarn smock-foundry --contracts path/to/contracts\n```\n\nThe `smock-foundry` command accepts the following options:\n\nOption      | Default                           | Notes\n------------|-----------------------------------|-------\n`contracts` | —                                 | The path to the solidity contracts to mock\n`out`       | `./out`                           | The path that has the compiled artifacts\n`mocks `    | `./solidity/test/smock`           | The path to the generated mock contracts\n`ignore`    | []                                | A list of directories to ignore, e.g. `--ignore libraries`\n\n### Using mocks\n\nLet's say you have a `Greeter` contract in your project at `contracts/Greeter.sol`:\n\n```solidity\ncontract Greeter {\n  string internal _greeting;\n\n  constructor(string memory greeting) {\n    _greeting = greeting;\n  }\n\n  function greet() public view returns (string memory) {\n    return _greeting;\n  }\n}\n```\n\nAfter running the generator, you will have a mock contract located at `${genDir}/contracts/MockGreeter.sol`:\n\n```solidity\ncontract MockGreeter is Greeter {\n  function mock_call_greet(string memory __greeting) external {\n    // Mocks the greet() function calls\n  }\n\n  function set__greeting(string memory greeting) public {\n    // Sets the value of `greeting`\n  }\n}\n```\n\nThe next step would be importing the mock contract in your unit tests, deploying it and allowing it to use the cheatcodes, specifically `vm.mockCall`.\n\n```solidity\nimport 'forge-std/Test.sol';\n\nimport { MockGreeter } from '/path/to/smock/contracts/MockGreeter.sol';\nimport { SmockHelper } from '/path/to/smock/SmockHelper.sol';\n\ncontract BaseTest is Test, SmockHelper {\n  MockGreeter public greeter;\n\n  function setUp() public {\n    // The `deployMock` call is equivalent to\n    // greeter = new MockGreeter('Hello');\n    // label(address(greeter, 'Greeter');\n    // vm.allowCheatcodes(address(greeter);\n\n    greeter = deployMock(\n      'Greeter',\n      type(Greeter).creationCode,\n      abi.encode('Hello')\n    );\n  }\n}\n```\n\nThen enjoy the wonders of mocking:\n\n```solidity\n// Mock the `greet` function to return 'Hola' instead of 'Hello'\ngreeter.mock_call_greet('Hola');\n\n// Or you can achieve the same by setting the internal variable\ngreeter.set__greeting('Hola');\n```\n\n### Gotchas\n\n- Please, note that if you want to mock `internal` functions, you **must** make them `virtual`. The tool will not generate mocks for internal functions that are not virtual.\n- Cannot `set` private variables and mock private functions.\n- Mocking of structs containing mappings is not supported.\n\n## Release\n\nWe use changesets to mark packages for new releases. When merging commits to the dev branch you MUST include a changeset file if your change would require that a new version of a package be released.\n\nTo add a changeset, run the command `yarn changeset` in the root of this repo. You will be presented with a small prompt to select the packages to be released, the scope of the release (major, minor, or patch), and the reason for the release. Comments within changeset files will be automatically included in the changelog of the package.\n\n# Licensing\n\nThe primary license for Smock Foundry is MIT, see [`LICENSE`](./LICENSE).\n\n# Contributors\n\nMaintained with love by [Wonderland](https://defi.sucks). Made possible by viewers like you.\n","gitHead":"b0da78f2f9a2bfb2bca822dfadd6cd8e17ed25d3","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","prepare":"husky install","release":"yarn build && yarn changeset publish","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","mock-gen":"ts-node src/run.ts mock-gen","lint:check":"yarn lint:ts-logic && forge fmt check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","postinstall":"husky install","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"8.19.4","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"16.20.2","dependencies":{"yargs":"17.7.2","prettier":"^3.0.3","handlebars":"4.7.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"4.3.7","husky":"^8.0.3","mocha":"10.2.0","sinon":"15.1.0","eslint":"8.40.0","nodemon":"2.0.22","ts-node":"10.9.1","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"^17.0.24","tsconfig-paths":"4.2.0","@changesets/cli":"^2.26.1","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_0.0.0-b0da78f2_1701864672618_0.0808596666241721","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"@defi-wonderland/smock-foundry","version":"1.0.4","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@1.0.4","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"117f070904c12863523e6e98684d76744d6cf5c0","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-1.0.4.tgz","fileCount":40,"integrity":"sha512-OCUL3AsXD/FnLJIbxJ0OchAaz7XMRnsxajXTMRY2/Jxs/B7a4KlElJfHOFtRLIQcS0SqkspakvY5XXZS3iie4Q==","signatures":[{"sig":"MEQCIDwQuumCtv6s88LjuUX8YPNkL7lfAxOaj4SzRniJuM64AiAmvn+b83C23S5BFrhq4+qAR6yeksotpjtl2pQydnfn5w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68815},"main":"dist/run.js","types":"dist/run.d.ts","gitHead":"188a52e7a07ae1e0de68b7690d0b657f8ecf3dde","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","mock-gen":"ts-node src/run.ts mock-gen","lint:check":"yarn lint:ts-logic && forge fmt check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"9.8.1","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"18.18.2","dependencies":{"yargs":"17.7.2","prettier":"^3.0.3","handlebars":"4.7.7"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"^8.0.3","mocha":"10.2.0","sinon":"15.1.0","eslint":"8.40.0","nodemon":"2.0.22","ts-node":"10.9.1","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"^17.0.24","tsconfig-paths":"4.2.0","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_1.0.4_1701983095819_0.16728939229007844","host":"s3://npm-registry-packages"}},"0.0.0-431a1580":{"name":"@defi-wonderland/smock-foundry","version":"0.0.0-431a1580","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@0.0.0-431a1580","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"c753b3738d6014f1d74beb18b2744d37bf0d944e","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-0.0.0-431a1580.tgz","fileCount":40,"integrity":"sha512-xMWErIn0NcrXO1gI1oD2ZkxYmPy70x8ZDzVfDIxmI72RuOX4SHYKFw36YTkW4N4pd413eaw4oV1IepRNd3qWDA==","signatures":[{"sig":"MEYCIQCeqLIyfwANNUWHNWYqCPUvrFoC8YkRutYABg7LrjchEgIhAPQGYuVm6B2/+OiIQlmYQLe+jy6fY7PEtDMLd7dxUpzW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70063},"main":"dist/run.js","types":"dist/run.d.ts","readme":"[![Version](https://img.shields.io/npm/v/@defi-wonderland/smock-foundry?label=Version)](https://www.npmjs.com/package/@defi-wonderland/smock-foundry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/defi-wonderland/prophet-sdk/blob/main/LICENSE)\n\n# Smock Foundry\nA plugin for [foundry](https://github.com/foundry-rs/foundry) that automatically generates Solidity mocks for every contract in your project.\n\n## Features\n\n- Get rid of your folder of \"mock\" contracts and **just use\n  foundry**.\n- Keep your tests **simple** with straightforward mock functions.\n- Mock up external calls and internal variables in a beautiful and orderly fashion.\n\n## Installation\n\nYou can install the plugin via yarn:\n\n```bash\nyarn add @defi-wonderland/smock-foundry --save-dev\n```\n\n## Basic Usage\n\n### Creating mocks\n\nTo generate the mock contracts all you have to do is run:\n\n```bash\nyarn smock-foundry --contracts path/to/contracts\n```\n\nThe `smock-foundry` command accepts the following options:\n\nOption      | Default                           | Notes\n------------|-----------------------------------|-------\n`contracts` | —                                 | The path to the solidity contracts to mock\n`out`       | `./out`                           | The path that has the compiled artifacts\n`mocks `    | `./solidity/test/smock`           | The path to the generated mock contracts\n`ignore`    | []                                | A list of directories to ignore, e.g. `--ignore libraries`\n\n### Using mocks\n\nLet's say you have a `Greeter` contract in your project at `contracts/Greeter.sol`:\n\n```solidity\ncontract Greeter {\n  string internal _greeting;\n\n  constructor(string memory greeting) {\n    _greeting = greeting;\n  }\n\n  function greet() public view returns (string memory) {\n    return _greeting;\n  }\n}\n```\n\nAfter running the generator, you will have a mock contract located at `${genDir}/contracts/MockGreeter.sol`:\n\n```solidity\ncontract MockGreeter is Greeter {\n  function mock_call_greet(string memory __greeting) external {\n    // Mocks the greet() function calls\n  }\n\n  function set__greeting(string memory greeting) public {\n    // Sets the value of `greeting`\n  }\n}\n```\n\nThe next step would be importing the mock contract in your unit tests, deploying it and allowing it to use the cheatcodes, specifically `vm.mockCall`.\n\n```solidity\nimport 'forge-std/Test.sol';\n\nimport { MockGreeter } from '/path/to/smock/contracts/MockGreeter.sol';\nimport { SmockHelper } from '/path/to/smock/SmockHelper.sol';\n\ncontract BaseTest is Test, SmockHelper {\n  MockGreeter public greeter;\n\n  function setUp() public {\n    // The `deployMock` call is equivalent to\n    // greeter = new MockGreeter('Hello');\n    // label(address(greeter, 'Greeter');\n    // vm.allowCheatcodes(address(greeter);\n\n    greeter = deployMock(\n      'Greeter',\n      type(Greeter).creationCode,\n      abi.encode('Hello')\n    );\n  }\n}\n```\n\nThen enjoy the wonders of mocking:\n\n```solidity\n// Mock the `greet` function to return 'Hola' instead of 'Hello'\ngreeter.mock_call_greet('Hola');\n\n// Or you can achieve the same by setting the internal variable\ngreeter.set__greeting('Hola');\n```\n\n### Gotchas\n\n- Please, note that if you want to mock `internal` functions, you **must** make them `virtual`. The tool will not generate mocks for internal functions that are not virtual.\n- Cannot `set` private variables and mock private functions.\n- Mocking of structs containing mappings is not supported.\n\n# Licensing\n\nThe primary license for Smock Foundry is MIT, see [`LICENSE`](./LICENSE).\n\n# Contributors\n\nMaintained with love by [Wonderland](https://defi.sucks). Made possible by viewers like you.\n","gitHead":"431a1580dcb927ca02c6f320e4051af096ef159c","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","mock-gen":"ts-node src/run.ts mock-gen","lint:check":"yarn lint:ts-logic && forge fmt check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"10.2.3","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"18.19.0","dependencies":{"yargs":"17.7.2","prettier":"^3.0.3","handlebars":"4.7.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"4.3.7","husky":"^8.0.3","mocha":"10.2.0","sinon":"15.1.0","eslint":"8.40.0","nodemon":"2.0.22","ts-node":"10.9.1","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"^17.0.24","tsconfig-paths":"4.2.0","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_0.0.0-431a1580_1702492555954_0.6712295592307704","host":"s3://npm-registry-packages"}},"0.0.0-ddb009d7":{"name":"@defi-wonderland/smock-foundry","version":"0.0.0-ddb009d7","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@0.0.0-ddb009d7","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"460dc8d63098e477bdf255a69277f3c726a14eda","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-0.0.0-ddb009d7.tgz","fileCount":40,"integrity":"sha512-6niIoh5TZL1MoJo8tr0XWi9j4F3jsdl5eHuiUzpUm+SB1doFO5T4eXfOKhGsggb/HXKV6PMmXp7lhaVMTa+Kiw==","signatures":[{"sig":"MEUCIA7yF1wUD1FRVTe6rwHo1hwbcE//fH5GE5QPYIXOoJ7QAiEA+BxjFOBSkzp0EQLd4JdJkzvQy2xa70NyHDRivi7ZL8c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70143},"main":"dist/run.js","types":"dist/run.d.ts","readme":"[![Version](https://img.shields.io/npm/v/@defi-wonderland/smock-foundry?label=Version)](https://www.npmjs.com/package/@defi-wonderland/smock-foundry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/defi-wonderland/prophet-sdk/blob/main/LICENSE)\n\n# Smock Foundry\nA plugin for [foundry](https://github.com/foundry-rs/foundry) that automatically generates Solidity mocks for every contract in your project.\n\n## Features\n\n- Get rid of your folder of \"mock\" contracts and **just use\n  foundry**.\n- Keep your tests **simple** with straightforward mock functions.\n- Mock up external calls and internal variables in a beautiful and orderly fashion.\n\n## Installation\n\nYou can install the plugin via yarn:\n\n```bash\nyarn add @defi-wonderland/smock-foundry --save-dev\n```\n\n## Basic Usage\n\n### Creating mocks\n\nTo generate the mock contracts all you have to do is run:\n\n```bash\nyarn smock-foundry --contracts path/to/contracts\n```\n\nThe `smock-foundry` command accepts the following options:\n\nOption      | Default                           | Notes\n------------|-----------------------------------|-------\n`contracts` | —                                 | The path to the solidity contracts to mock\n`out`       | `./out`                           | The path that has the compiled artifacts\n`mocks `    | `./solidity/test/smock`           | The path to the generated mock contracts\n`ignore`    | []                                | A list of directories to ignore, e.g. `--ignore libraries`\n\n### Using mocks\n\nLet's say you have a `Greeter` contract in your project at `contracts/Greeter.sol`:\n\n```solidity\ncontract Greeter {\n  string internal _greeting;\n\n  constructor(string memory greeting) {\n    _greeting = greeting;\n  }\n\n  function greet() public view returns (string memory) {\n    return _greeting;\n  }\n}\n```\n\nAfter running the generator, you will have a mock contract located at `${genDir}/contracts/MockGreeter.sol`:\n\n```solidity\ncontract MockGreeter is Greeter {\n  function mock_call_greet(string memory __greeting) external {\n    // Mocks the greet() function calls\n  }\n\n  function set__greeting(string memory greeting) public {\n    // Sets the value of `greeting`\n  }\n}\n```\n\nThe next step would be importing the mock contract in your unit tests, deploying it and allowing it to use the cheatcodes, specifically `vm.mockCall`.\n\n```solidity\nimport 'forge-std/Test.sol';\n\nimport { MockGreeter } from '/path/to/smock/contracts/MockGreeter.sol';\nimport { SmockHelper } from '/path/to/smock/SmockHelper.sol';\n\ncontract BaseTest is Test, SmockHelper {\n  MockGreeter public greeter;\n\n  function setUp() public {\n    // The `deployMock` call is equivalent to\n    // greeter = new MockGreeter('Hello');\n    // label(address(greeter, 'Greeter');\n    // vm.allowCheatcodes(address(greeter);\n\n    greeter = deployMock(\n      'Greeter',\n      type(Greeter).creationCode,\n      abi.encode('Hello')\n    );\n  }\n}\n```\n\nThen enjoy the wonders of mocking:\n\n```solidity\n// Mock the `greet` function to return 'Hola' instead of 'Hello'\ngreeter.mock_call_greet('Hola');\n\n// Or you can achieve the same by setting the internal variable\ngreeter.set__greeting('Hola');\n```\n\n### Gotchas\n\n- Please, note that if you want to mock `internal` functions, you **must** make them `virtual`. The tool will not generate mocks for internal functions that are not virtual.\n- Cannot `set` private variables and mock private functions.\n- Mocking of structs containing mappings is not supported.\n\n# Licensing\n\nThe primary license for Smock Foundry is MIT, see [`LICENSE`](./LICENSE).\n\n# Contributors\n\nMaintained with love by [Wonderland](https://defi.sucks). Made possible by viewers like you.\n","gitHead":"ddb009d7a270e84471adc9d4b83e46ebc16b645e","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","mock-gen":"ts-node src/run.ts mock-gen","lint:check":"yarn lint:ts-logic && forge fmt check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"10.2.3","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"18.19.0","dependencies":{"yargs":"17.7.2","prettier":"^3.0.3","handlebars":"4.7.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"4.3.7","husky":"^8.0.3","mocha":"10.2.0","sinon":"15.1.0","eslint":"8.40.0","nodemon":"2.0.22","ts-node":"10.9.1","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"^17.0.24","tsconfig-paths":"4.2.0","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_0.0.0-ddb009d7_1702901455637_0.5590520489251838","host":"s3://npm-registry-packages"}},"1.0.6":{"name":"@defi-wonderland/smock-foundry","version":"1.0.6","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@1.0.6","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"25cef951d3ab4d038581a64d9d7cb55538bee53e","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-1.0.6.tgz","fileCount":44,"integrity":"sha512-TEvPrkTBao1bMUnmIasBPdDQ46AC/pUFVrcvtvJ9Mc3krZkeZWGP+UDW786B9lGoGWkXFTWoiR6fZuoekczM1w==","signatures":[{"sig":"MEUCIEYW/qjOk8QSrXqEo3fpco2pvb+cOk0neT23LDxiOwgwAiEAh1lEQjUA5Kz0ZEibVa9LNtz1V5GTl8K8MNFAx42D5VM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70276},"main":"dist/run.js","types":"dist/run.d.ts","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","lint:check":"yarn lint:ts-logic && forge fmt --check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"description":"Smock-style mocks for Foundry projects","directories":{},"licenseText":"The MIT License (MIT)\nCopyright © 2023 Wonderland\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"dependencies":{"yargs":"17.7.2","handlebars":"4.7.7"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"8.0.3","mocha":"10.2.0","eslint":"8.40.0","ts-node":"10.9.1","prettier":"3.0.3","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"17.0.24","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_1.0.6_1703084059970_0.5646786099844838","host":"s3://npm-registry-packages"}},"1.0.7":{"name":"@defi-wonderland/smock-foundry","version":"1.0.7","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@1.0.7","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"cc46943b45d09cbff95cc5865417fd7950a805ff","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-1.0.7.tgz","fileCount":44,"integrity":"sha512-2FssWH+sLpv1+Q0+Yi/7dMqjQ0hvHX3bDNOCc8o1tVbXv1iiv7v7L1QzGni9I4LgshrSlc4drZlt9x+dyi3LYw==","signatures":[{"sig":"MEYCIQCSi0T0nBsGNZI/RInFGNjpfyT+YW+2NLV4wbQ0PRt4jAIhAOKUTRlZKhv8MsPKMwI+2hBuyjoq9JV0a17qnD0JnGpk","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70476},"main":"dist/run.js","types":"dist/run.d.ts","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","lint:check":"yarn lint:ts-logic && forge fmt --check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"description":"Smock-style mocks for Foundry projects","directories":{},"licenseText":"The MIT License (MIT)\nCopyright © 2023 Wonderland\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"dependencies":{"yargs":"17.7.2","handlebars":"4.7.7"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"8.0.3","mocha":"10.2.0","eslint":"8.40.0","ts-node":"10.9.1","prettier":"3.0.3","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"17.0.24","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_1.0.7_1704460253221_0.6187597037576904","host":"s3://npm-registry-packages"}},"0.0.0-2b4aa816":{"name":"@defi-wonderland/smock-foundry","version":"0.0.0-2b4aa816","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@0.0.0-2b4aa816","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"70be37ecad675bd7bf546a507f43f851b8d96f39","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-0.0.0-2b4aa816.tgz","fileCount":40,"integrity":"sha512-YhWpK8EityPZ6/iNtdJYcjbZswCEyrxYknbdbIB15IXAtZcps77xrgXnvLfD0kcCbwgikJ44qfaFtN8uaZtK/Q==","signatures":[{"sig":"MEUCIGcrpIxQRo7j3EqUD1Ukg4x3ooa5MEUzJhTK7V0rAjprAiEAzp4PgcdRnqPiOhkeIWqtRFMdkm/tZ5d91hVtGOz9v0E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70366},"main":"dist/run.js","types":"dist/run.d.ts","readme":"[![Version](https://img.shields.io/npm/v/@defi-wonderland/smock-foundry?label=Version)](https://www.npmjs.com/package/@defi-wonderland/smock-foundry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/defi-wonderland/prophet-sdk/blob/main/LICENSE)\n\n# Smock Foundry\nA plugin for [foundry](https://github.com/foundry-rs/foundry) that automatically generates Solidity mocks for every contract in your project.\n\n## Features\n\n- Get rid of your folder of \"mock\" contracts and **just use\n  foundry**.\n- Keep your tests **simple** with straightforward mock functions.\n- Mock up external calls and internal variables in a beautiful and orderly fashion.\n\n## Installation\n\nYou can install the plugin via yarn:\n\n```bash\nyarn add @defi-wonderland/smock-foundry --save-dev\n```\n\n## Basic Usage\n\n### Creating mocks\n\nTo generate the mock contracts all you have to do is run:\n\n```bash\nyarn smock-foundry --contracts path/to/contracts\n```\n\nThe `smock-foundry` command accepts the following options:\n\nOption      | Default                           | Notes\n------------|-----------------------------------|-------\n`contracts` | —                                 | The path to the solidity contracts to mock\n`out`       | `./out`                           | The path that has the compiled artifacts\n`mocks `    | `./solidity/test/smock`           | The path to the generated mock contracts\n`ignore`    | []                                | A list of directories to ignore, e.g. `--ignore libraries`\n\nBe sure to `gitignore` the generated smock directory.\n\n### Using mocks\n\nLet's say you have a `Greeter` contract in your project at `contracts/Greeter.sol`:\n\n```solidity\ncontract Greeter {\n  string internal _greeting;\n\n  constructor(string memory greeting) {\n    _greeting = greeting;\n  }\n\n  function greet() public view returns (string memory) {\n    return _greeting;\n  }\n}\n```\n\nAfter running the generator, you will have a mock contract located at `${genDir}/contracts/MockGreeter.sol`:\n\n```solidity\ncontract MockGreeter is Greeter {\n  function mock_call_greet(string memory __greeting) external {\n    // Mocks the greet() function calls\n  }\n\n  function set__greeting(string memory greeting) public {\n    // Sets the value of `greeting`\n  }\n}\n```\n\nThe next step would be importing the mock contract in your unit tests, deploying it and allowing it to use the cheatcodes, specifically `vm.mockCall`.\n\n```solidity\nimport 'forge-std/Test.sol';\n\nimport { MockGreeter } from '/path/to/smock/contracts/MockGreeter.sol';\nimport { SmockHelper } from '/path/to/smock/SmockHelper.sol';\n\ncontract BaseTest is Test, SmockHelper {\n  MockGreeter public greeter;\n\n  function setUp() public {\n    // The `deployMock` call is equivalent to\n    // address _greeterAddress = address(new MockGreeter('Hello'));\n    // vm.label(_greeterAddress, 'Greeter');\n    // vm.allowCheatcodes(_greeterAddress);\n    // return _greeterAddress;\n\n    greeter = MockGreeter(\n      deployMock('Greeter', type(Greeter).creationCode, abi.encode('Hello'))\n    );\n  }\n}\n```\n\nThen enjoy the wonders of mocking:\n\n```solidity\n// Mock the `greet` function to return 'Hola' instead of 'Hello'\ngreeter.mock_call_greet('Hola');\n\n// Or you can achieve the same by setting the internal variable\ngreeter.set__greeting('Hola');\n```\n\n### Gotchas\n\n- Please, note that if you want to mock `internal` functions, you **must** make them `virtual`. The tool will not generate mocks for internal functions that are not virtual.\n- Cannot set `private` variables and mock `private` functions.\n- Mocking of structs containing mappings is not supported.\n\n# Licensing\n\nThe primary license for Smock Foundry is MIT, see [`LICENSE`](./LICENSE).\n\n# Contributors\n\nMaintained with love by [Wonderland](https://defi.sucks). Made possible by viewers like you.\n","gitHead":"2b4aa81622614fa7bfa80138e0491966f4630cc9","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","lint:check":"yarn lint:ts-logic && forge fmt --check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"10.2.3","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"18.19.0","dependencies":{"yargs":"17.7.2","handlebars":"4.7.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"4.3.7","husky":"8.0.3","mocha":"10.2.0","eslint":"8.40.0","ts-node":"10.9.1","prettier":"3.0.3","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"17.0.24","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_0.0.0-2b4aa816_1705044705875_0.4839261602041769","host":"s3://npm-registry-packages"}},"0.0.0-5dcfec28":{"name":"@defi-wonderland/smock-foundry","version":"0.0.0-5dcfec28","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@0.0.0-5dcfec28","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bugs":{"url":"https://github.com/defi-wonderland/smock-foundry/issues"},"bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"cf641b9395ca823024f50ba1491fd19f2321eb24","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-0.0.0-5dcfec28.tgz","fileCount":30,"integrity":"sha512-YGEP86leluyj7iGXb0x0OWq1RdykivB3+/HaBBxPxz4o6mYGsFJ/VA9UF5Lw20tLTlFu8TjfDhZRlcH9fHak4w==","signatures":[{"sig":"MEUCIQCYTn+Dbzn0OTjzmW4rzTSvtiW6fa/Z/jk1+j6VCRS53gIgVfSYwlywBe3fgSvnFWQhcadX/d/GU80QRtWF3LMFJfo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63229},"main":"dist/run.js","types":"dist/run.d.ts","readme":"[![Version](https://img.shields.io/npm/v/@defi-wonderland/smock-foundry?label=Version)](https://www.npmjs.com/package/@defi-wonderland/smock-foundry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/defi-wonderland/prophet-sdk/blob/main/LICENSE)\n\n# Smock Foundry\nA plugin for [foundry](https://github.com/foundry-rs/foundry) that automatically generates Solidity mocks for every contract in your project.\n\n## Features\n\n- Get rid of your folder of \"mock\" contracts and **just use\n  foundry**.\n- Keep your tests **simple** with straightforward mock functions.\n- Mock up external calls and internal variables in a beautiful and orderly fashion.\n\n## Installation\n\nYou can install the plugin via yarn:\n\n```bash\nyarn add @defi-wonderland/smock-foundry --save-dev\n```\n\n## Basic Usage\n\n### Creating mocks\n\nTo generate the mock contracts all you have to do is run:\n\n```bash\nyarn smock-foundry --contracts path/to/contracts\n```\n\nThe `smock-foundry` command accepts the following options:\n\nOption      | Default                           | Notes\n------------|-----------------------------------|-------\n`contracts` | —                                 | The path to the solidity contracts to mock\n`out`       | `./out`                           | The path that has the compiled artifacts\n`mocks `    | `./solidity/test/smock`           | The path to the generated mock contracts\n`ignore`    | []                                | A list of directories to ignore, e.g. `--ignore libraries`\n\nBe sure to `gitignore` the generated smock directory.\n\n### Using mocks\n\nLet's say you have a `Greeter` contract in your project at `contracts/Greeter.sol`:\n\n```solidity\ncontract Greeter {\n  string internal _greeting;\n\n  constructor(string memory greeting) {\n    _greeting = greeting;\n  }\n\n  function greet() public view returns (string memory) {\n    return _greeting;\n  }\n}\n```\n\nAfter running the generator, you will have a mock contract located at `${genDir}/contracts/MockGreeter.sol`:\n\n```solidity\ncontract MockGreeter is Greeter {\n  function mock_call_greet(string memory __greeting) external {\n    // Mocks the greet() function calls\n  }\n\n  function set__greeting(string memory greeting) public {\n    // Sets the value of `greeting`\n  }\n}\n```\n\nThe next step would be importing the mock contract in your unit tests, deploying it and allowing it to use the cheatcodes, specifically `vm.mockCall`.\n\n```solidity\nimport 'forge-std/Test.sol';\n\nimport { MockGreeter } from '/path/to/smock/contracts/MockGreeter.sol';\nimport { SmockHelper } from '/path/to/smock/SmockHelper.sol';\n\ncontract BaseTest is Test, SmockHelper {\n  MockGreeter public greeter;\n\n  function setUp() public {\n    // The `deployMock` call is equivalent to\n    // address _greeterAddress = address(new MockGreeter('Hello'));\n    // vm.label(_greeterAddress, 'Greeter');\n    // vm.allowCheatcodes(_greeterAddress);\n    // return _greeterAddress;\n\n    greeter = MockGreeter(\n      deployMock('Greeter', type(Greeter).creationCode, abi.encode('Hello'))\n    );\n  }\n}\n```\n\nThen enjoy the wonders of mocking:\n\n```solidity\n// Mock the `greet` function to return 'Hola' instead of 'Hello'\ngreeter.mock_call_greet('Hola');\n\n// Or you can achieve the same by setting the internal variable\ngreeter.set__greeting('Hola');\n```\n\n### Gotchas\n\n- Please, note that if you want to mock `internal` functions, you **must** make them `virtual`. The tool will not generate mocks for internal functions that are not virtual.\n- Cannot set `private` variables and mock `private` functions.\n- Mocking of structs containing mappings is not supported.\n\n# Licensing\n\nThe primary license for Smock Foundry is MIT, see [`LICENSE`](./LICENSE).\n\n# Contributors\n\nMaintained with love by [Wonderland](https://defi.sucks). Made possible by viewers like you.\n","gitHead":"5dcfec286d6a7763baa336eae5ca5e9650122162","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","lint:check":"yarn lint:ts-logic && forge fmt --check","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"_npmVersion":"10.2.4","description":"Smock-style mocks for Foundry projects","directories":{},"lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"_nodeVersion":"18.19.1","dependencies":{"yargs":"17.7.2","fast-glob":"3.3.2","handlebars":"4.7.7","solc-typed-ast":"18.1.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"4.3.7","husky":"8.0.3","mocha":"10.2.0","eslint":"8.40.0","ts-node":"10.9.1","prettier":"3.0.3","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"17.0.24","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_0.0.0-5dcfec28_1710427766857_0.46390575061335504","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@defi-wonderland/smock-foundry","version":"1.1.0","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@1.1.0","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"d2af0d21673966f4e92d57539ba7965a1d0d27a1","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-1.1.0.tgz","fileCount":35,"integrity":"sha512-ACEIWVBO86ZezF9iXLSAc2rpD1zRd4myqDPNN6WJYOY+S2omhM0WjxKPlRx584n2ax9EMsTOFLjQrSTpj8Zv4Q==","signatures":[{"sig":"MEUCICvNkpXQ8WGOpJF84ZkRw2/jmd5rB4D7ibSP/bg7sg3pAiEA6tLYEc7NkxsQ5R5QISzfMOn4waiU7udk3lbD0u8PSDE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63679},"main":"dist/run.js","types":"dist/run.d.ts","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && yarn smock-test && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","lint:check":"yarn lint:ts-logic && forge fmt --check","smock-test":"node dist/run.js --contracts solidity --mocks solidity/test/smock --ignore solidity/test","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"description":"Smock-style mocks for Foundry projects","directories":{},"licenseText":"The MIT License (MIT)\nCopyright © 2023 Wonderland\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"dependencies":{"yargs":"17.7.2","fast-glob":"3.3.2","handlebars":"4.7.7","solc-typed-ast":"18.1.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"8.0.3","mocha":"10.2.0","eslint":"8.40.0","ts-node":"10.9.1","prettier":"3.0.3","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"17.0.24","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_1.1.0_1712559949732_0.722124733809856","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@defi-wonderland/smock-foundry","version":"1.2.0","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@1.2.0","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"40390e67b940cf42a63a578433fdaa39103ce969","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-1.2.0.tgz","fileCount":35,"integrity":"sha512-SqFONA72DRkHW1ZGJH1LlUI370rvEGHEZV8/ydjY+NSNhiHEUdcMba9EgVsbL7yST430CfF+ZjYfyKtWQ18Pkw==","signatures":[{"sig":"MEYCIQCHdBxkfL+F1ljR65ruxoC87VJVfqWgjhLDsc+R84FhggIhANfjdPDNGXJ6ofU63xXTLYvFE8CuDARp6iehd5+kxRz/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70734},"main":"dist/run.js","types":"dist/run.d.ts","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && yarn smock-test && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","lint:check":"yarn lint:ts-logic && forge fmt --check","smock-test":"node dist/run.js --contracts solidity --mocks solidity/test/smock --ignore solidity/test","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"description":"Smock-style mocks for Foundry projects","directories":{},"licenseText":"The MIT License (MIT)\nCopyright © 2023 Wonderland\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"dependencies":{"yargs":"17.7.2","fast-glob":"3.3.2","handlebars":"4.7.7","solc-typed-ast":"18.1.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"8.0.3","mocha":"10.2.0","eslint":"8.40.0","ts-node":"10.9.1","prettier":"3.0.3","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"17.0.24","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_1.2.0_1712923620413_0.7356842252983842","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"@defi-wonderland/smock-foundry","version":"1.3.0","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@1.3.0","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"b2a57071412918d1d6a2c85085a6b2ed49f78b22","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-1.3.0.tgz","fileCount":35,"integrity":"sha512-h5f0Cs9U/TUblH07mxhwVipAOR6v9BhePsmbahb24oX/zcFSQc68Mei7bjtNWGACB07QnZKxE6bVE8IrlocI9g==","signatures":[{"sig":"MEUCIQDtnvuenX8zgnrK+39Txt3NhlWrtex8P72b3fL16992jgIgI2Zzx0VjDrU2p5NjM7XXcGYOutj1RUvtG8JT4Eqpfg0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":79538},"main":"dist/run.js","types":"dist/run.d.ts","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && yarn smock-test && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","lint:check":"yarn lint:ts-logic && forge fmt --check","smock-test":"node dist/run.js --contracts solidity --mocks solidity/test/smock --ignore solidity/test","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"description":"Smock-style mocks for Foundry projects","directories":{},"licenseText":"The MIT License (MIT)\nCopyright © 2023 Wonderland\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"dependencies":{"yargs":"17.7.2","fast-glob":"3.3.2","handlebars":"4.7.7","solc-typed-ast":"18.1.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"8.0.3","mocha":"10.2.0","eslint":"8.40.0","ts-node":"10.9.1","prettier":"3.0.3","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"17.0.24","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_1.3.0_1713351102025_0.16654138681456154","host":"s3://npm-registry-packages"}},"1.4.0":{"name":"@defi-wonderland/smock-foundry","version":"1.4.0","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@1.4.0","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"42694c3e70840b139e5b0984b9c9802230787418","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-1.4.0.tgz","fileCount":36,"integrity":"sha512-SlhiBamV1ttJY/RyczJ6JmfM8FTjW6llnxe+dBCz8/ZVNw0DhUprzh3ibnd2lp3wVrrzNDO+jn+oQtuMoL16WQ==","signatures":[{"sig":"MEQCIAjvN2RkUdL2pV2u4kY66yy5OoWVcYth1UGL1HXFNEpgAiByV8+quiaDnEYNS3zUXmOtdTV+2FjTDwhchrVA0rgn5A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82537},"main":"dist/run.js","types":"dist/run.d.ts","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && yarn smock-test && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","lint:check":"yarn lint:ts-logic && forge fmt --check","smock-test":"node dist/run.js --contracts solidity --mocks solidity/test/smock --ignore solidity/test","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"description":"Smock-style mocks for Foundry projects","directories":{},"licenseText":"The MIT License (MIT)\nCopyright © 2023 Wonderland\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"dependencies":{"yargs":"17.7.2","fast-glob":"3.3.2","handlebars":"4.7.7","solc-typed-ast":"18.1.3"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"8.0.3","mocha":"10.2.0","eslint":"8.40.0","ts-node":"10.9.1","prettier":"3.0.3","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"17.0.24","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_1.4.0_1713977451209_0.9911974994934014","host":"s3://npm-registry-packages"}},"1.5.0":{"name":"@defi-wonderland/smock-foundry","version":"1.5.0","author":{"name":"Wonderland"},"license":"MIT","_id":"@defi-wonderland/smock-foundry@1.5.0","maintainers":[{"name":"wonderland-bot","email":"wonderland@defi.sucks"},{"name":"gas1cent","email":"gas1cent@defi.sucks"},{"name":"0xng","email":"ng@defi.sucks"},{"name":"0xgorilla","email":"0xGorilla@defi.sucks"},{"name":"kelvinfichter","email":"kelvinfichter@gmail.com"},{"name":"wei3erhase","email":"wei3erhase@defi.sucks"},{"name":"enderman0x","email":"enderman0x@defi.sucks"}],"homepage":"https://github.com/defi-wonderland/smock-foundry#readme","bin":{"smock-foundry":"dist/run.js"},"dist":{"shasum":"e0f91cb40a1805644fbe1bcec8bbb6556d72253c","tarball":"https://registry.npmjs.org/@defi-wonderland/smock-foundry/-/smock-foundry-1.5.0.tgz","fileCount":35,"integrity":"sha512-GjMc8Tgg+jBzV0zp00WTSlExptthocrnE3FY58Zm4Li+jWwrphKRflGRf4F65f1t976SNIW63mleWJViFa4mRA==","signatures":[{"sig":"MEUCIQCcbdtKaicHDoGfTCfBqyh4WnekD1+L0wb0L42HcM2N0wIgXOHzHbdCzAmF0yVvWQdUqUsas7y2EoLCxIU3/VjYjpg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":85493},"main":"dist/run.js","types":"dist/run.d.ts","scripts":{"test":"forge build --skip test && cross-env mocha 'test/**/*.spec.ts' && yarn smock-test && forge test","build":"rm -rf dist && tsc -p tsconfig.json && node copy-templates.js","lint:fix":"sort-package-json && forge fmt && yarn lint:ts-logic --fix","lint:check":"yarn lint:ts-logic && forge fmt --check","smock-test":"node dist/run.js --contracts solidity --mocks solidity/test/smock --ignore solidity/test","test:mocha":"cross-env mocha 'test/**/*.spec.ts'","lint:ts-logic":"eslint ./src/**/*.ts"},"_npmUser":{"name":"wonderland-bot","email":"wonderland@defi.sucks"},"repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"description":"Smock-style mocks for Foundry projects","directories":{},"licenseText":"The MIT License (MIT)\nCopyright © 2023 Wonderland\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","lint-staged":{"*.ts":"eslint ./src/**/*.ts","package.json":"sort-package-json","*.{js,css,md,ts,sol}":"forge fmt"},"dependencies":{"yargs":"17.7.2","fast-glob":"3.3.2","handlebars":"4.7.7","solc-typed-ast":"18.1.3"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","husky":"8.0.3","mocha":"10.2.0","eslint":"8.40.0","ts-node":"10.9.1","prettier":"3.0.3","cross-env":"7.0.3","typescript":"5.0.4","@types/chai":"4.3.5","@types/node":"20.2.3","lint-staged":"10","@types/mocha":"10.0.1","@types/yargs":"17.0.24","@commitlint/cli":"17.0.3","@types/fs-extra":"11.0.1","chai-as-promised":"7.1.1","sort-package-json":"2.4.1","@types/chai-as-promised":"7.1.5","@typescript-eslint/parser":"5.59.6","@commitlint/config-conventional":"17.0.3","@typescript-eslint/eslint-plugin":"5.59.6"},"_npmOperationalInternal":{"tmp":"tmp/smock-foundry_1.5.0_1714564128909_0.10553945153978006","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-11-22T10:19:14.161Z","modified":"2025-07-25T08:28:30.068Z","0.0.0-938f7c58":"2023-11-22T10:19:14.392Z","1.0.2":"2023-11-22T12:43:35.377Z","0.0.0-abba1221":"2023-11-22T13:26:17.914Z","0.0.0-101373b9":"2023-12-05T17:36:07.653Z","0.0.0-2ac8342c":"2023-12-05T17:44:55.744Z","0.0.0-b0da78f2":"2023-12-06T12:11:12.839Z","1.0.4":"2023-12-07T21:04:56.040Z","0.0.0-431a1580":"2023-12-13T18:35:56.108Z","0.0.0-ddb009d7":"2023-12-18T12:10:55.926Z","1.0.6":"2023-12-20T14:54:20.133Z","1.0.7":"2024-01-05T13:10:53.374Z","0.0.0-2b4aa816":"2024-01-12T07:31:46.028Z","0.0.0-5dcfec28":"2024-03-14T14:49:27.061Z","1.1.0":"2024-04-08T07:05:49.899Z","1.2.0":"2024-04-12T12:07:00.579Z","1.3.0":"2024-04-17T10:51:42.193Z","1.4.0":"2024-04-24T16:50:51.383Z","1.5.0":"2024-05-01T11:48:49.104Z"},"author":{"name":"Wonderland"},"license":"MIT","homepage":"https://github.com/defi-wonderland/smock-foundry#readme","repository":{"url":"git+https://github.com/defi-wonderland/smock-foundry.git","type":"git"},"description":"Smock-style mocks for Foundry projects","maintainers":[{"email":"gori@wonderland.xyz","name":"0xgorilla"},{"email":"alice@wonderland.xyz","name":"wonderland-bot"},{"email":"turtlemoji@protonmail.com","name":"turtlemoji"}],"readme":"[![Version](https://img.shields.io/npm/v/@defi-wonderland/smock-foundry?label=Version)](https://www.npmjs.com/package/@defi-wonderland/smock-foundry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/defi-wonderland/smock-foundry/blob/dev/LICENSE)\n\n# Smock Foundry\n\nA plugin for [foundry](https://github.com/foundry-rs/foundry) that automatically generates Solidity mocks for every contract in your project.\n\n## Features\n\n- Get rid of your folder of \"mock\" contracts and **just use\n  foundry**.\n- Keep your tests **simple** with straightforward mock functions.\n- Mock up external calls and internal variables in a beautiful and orderly fashion.\n\n## Installation\n\nYou can install the plugin via yarn:\n\n```bash\nyarn add @defi-wonderland/smock-foundry --save-dev\n```\n\n## Basic Usage\n\n### Creating mocks\n\nTo generate the mock contracts all you have to do is run:\n\n```bash\nyarn smock-foundry --contracts solidity/contracts\n```\n\nThe `smock-foundry` command accepts the following options:\n\n| Option      | Default        | Notes                                                      |\n| ----------- | -------------- | ---------------------------------------------------------- |\n| `contracts` | —              | The path to the solidity contracts to mock                 |\n| `root`      | `.`            | The path to the root of the project                        |\n| `mocks `    | `./test/smock` | The path to the generated mock contracts                   |\n| `ignore`    | []             | A list of directories to ignore, e.g. `--ignore libraries` |\n\nBe sure to `gitignore` the generated smock directory.\n\n### Using mocks\n\nLet's say you have a `Greeter` contract in your project at `contracts/Greeter.sol`:\n\n```solidity\ncontract Greeter {\n  string internal _greeting;\n\n  constructor(string memory greeting) {\n    _greeting = greeting;\n  }\n\n  function greet() public view returns (string memory) {\n    return _greeting;\n  }\n}\n```\n\nAfter running the generator, you will have a mock contract located at `${mocks}/contracts/MockGreeter.sol`:\n\n```solidity\ncontract MockGreeter is Greeter {\n  function mock_call_greet(string memory __greeting) external {\n    // Mocks the greet() function calls\n  }\n\n  function set__greeting(string memory greeting) public {\n    // Sets the value of `greeting`\n  }\n}\n```\n\nThe next step would be importing the mock contract in your unit tests, deploying it and allowing it to use the cheatcodes, specifically `vm.mockCall`.\n\n```solidity\nimport 'forge-std/Test.sol';\n\nimport { MockGreeter } from '/path/to/smock/contracts/MockGreeter.sol';\nimport { SmockHelper } from '/path/to/smock/SmockHelper.sol';\n\ncontract BaseTest is Test, SmockHelper {\n  MockGreeter public greeter;\n\n  function setUp() public {\n    // The `deployMock` call is equivalent to\n    // address _greeterAddress = address(new MockGreeter('Hello'));\n    // vm.label(_greeterAddress, 'Greeter');\n    // vm.allowCheatcodes(_greeterAddress);\n    // return _greeterAddress;\n\n    greeter = MockGreeter(\n      deployMock('Greeter', type(Greeter).creationCode, abi.encode('Hello'))\n    );\n  }\n}\n```\n\nThen enjoy the wonders of mocking:\n\n```solidity\n// Mock the `greet` function to return 'Hola' instead of 'Hello'\ngreeter.mock_call_greet('Hola');\n\n// Or you can achieve the same by setting the internal variable\ngreeter.set__greeting('Hola');\n```\n\n### Gotchas\n\n- Please, note that if you want to mock `internal` functions, you **must** make them `virtual`. The tool will not generate mocks for internal functions that are not virtual.\n- Cannot set `private` variables and mock `private` functions.\n- Mocking of structs containing mappings is not supported.\n- Mocking of multi-dimensional arrays of structs is not supported.\n\n# Licensing\n\nThe primary license for Smock Foundry is MIT, see [`LICENSE`](./LICENSE).\n\n# Contributors\n\nMaintained with love by [Wonderland](https://defi.sucks). Made possible by viewers like you.\n","readmeFilename":"README.md"}