{"_id":"@bananapus/nana-address-registry","name":"@bananapus/nana-address-registry","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@bananapus/nana-address-registry","version":"0.0.1","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Bananapus/nana-address-registry.git"},"scripts":{"test":"forge test","test:fork":"FOUNDRY_PROFILE=CI forge test","coverage:integration":"forge coverage --match-path \"./src/*.sol\" --report lcov --report summary","deploy:ethereum-mainnet":"source .env && forge script Deploy --chain-id 1 --rpc-url $RPC_ETHEREUM_MAINNET --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY --interactives 1 --sender $SENDER_ETHEREUM_MAINNET -vvv","deploy:ethereum-sepolia":"source .env && forge script Deploy --chain-id 11155111 --rpc-url $RPC_ETHEREUM_SEPOLIA --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY --interactives 1 --sender $SENDER_ETHEREUM_SEPOLIA -vvv","deploy:optimism-mainnet":"source .env && forge script Deploy --chain-id 420 --rpc-url $RPC_OPTIMISM_MAINNET --broadcast --verify --etherscan-api-key $OPTIMISTIC_ETHERSCAN_API_KEY --interactives 1 --sender $SENDER_OPTIMISM_MAINNET -vvv","deploy:optimism-sepolia":"source .env && forge script Deploy --chain-id 11155420 --rpc-url $RPC_OPTIMISM_SEPOLIA --broadcast --verify --etherscan-api-key $OPTIMISTIC_ETHERSCAN_API_KEY --interactives 1 --sender $SENDER_OPTIMISM_SEPOLIA -vvv"},"_id":"@bananapus/nana-address-registry@0.0.1","gitHead":"a982c3158d795ae85d6d050722f2d7b3f787aa3b","description":"Provides an accessible function linking pay/redeem hooks with their corresponding deployer addresses.","bugs":{"url":"https://github.com/Bananapus/nana-address-registry/issues"},"homepage":"https://github.com/Bananapus/nana-address-registry#readme","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-thgB1sN6EJtXcpJCl8P1j9l22dnGy43ALdFHpOZLea62vcwV5dzkjVZvAPoV36yDvnZ50AILEcfrioOGZiTfGw==","shasum":"4e787b5636b411e8b0b12c7120218eb2a7ec215b","tarball":"https://registry.npmjs.org/@bananapus/nana-address-registry/-/nana-address-registry-0.0.1.tgz","fileCount":9,"unpackedSize":20157,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFrreq7YoEUwq68cejkObsevYEOa2fah9Ov0jyu2naC1AiEA6yGlOdbE2gojCX5GHiJ6/jcYfOWnzcOTK+1qbVt3+dk="}]},"_npmUser":{"name":"me.jango","email":"me.jango@protonmail.com"},"directories":{},"maintainers":[{"name":"filipviz","email":"f@filip.world"},{"name":"simplemachine","email":"justinpulley92@gmail.com"},{"name":"me.jango","email":"me.jango@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nana-address-registry_0.0.1_1707916645351_0.5928619501814942"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-14T13:17:25.270Z","0.0.1":"2024-02-14T13:17:25.508Z","modified":"2024-02-14T13:17:25.816Z"},"maintainers":[{"name":"filipviz","email":"f@filip.world"},{"name":"simplemachine","email":"justinpulley92@gmail.com"},{"name":"me.jango","email":"me.jango@protonmail.com"}],"description":"Provides an accessible function linking pay/redeem hooks with their corresponding deployer addresses.","homepage":"https://github.com/Bananapus/nana-address-registry#readme","repository":{"type":"git","url":"git+https://github.com/Bananapus/nana-address-registry.git"},"bugs":{"url":"https://github.com/Bananapus/nana-address-registry/issues"},"license":"MIT","readme":"# Bananapus Address Registry\n\nProvides an accessible function linking pay/redeem hooks with their corresponding deployer addresses.\n\nThis registry uses `create1` and [`create2`](https://docs.soliditylang.org/en/v0.8.23/control-structures.html#salted-contract-creations-create2) to generate a deterministic address for a hook based on a deployer address and a nonce. That address is then used as a key to store the deployer's address. This allows clients to easily and trustlessly check a given hook's deployer, which can be used to help figure out whether a hook is \"safe\" or not, as determined by the client's developers.\n\nAlthough `JBAddressRegistry` is intended for registering deployers of Juicebox pay/redeem hooks, it does not enforce adherence to an interface, and can be used to track any `create1`/`create2` deployer. It is the deployer's responsibility to register their contracts.\n\n_If you're having trouble understanding this contract, take a look at the [core protocol contracts](https://github.com/Bananapus/nana-core) and the [documentation](https://docs.juicebox.money/) first. If you have questions, reach out on [Discord](https://discord.com/invite/ErQYmth4dS)._\n\n## Install\n\nFor `npm` projects (recommended):\n\n```bash\nnpm install @bananapus/address-registry\n```\n\nFor `forge` projects (not recommended):\n\n```bash\nforge install Bananapus/nana-address-registry\n```\n\nAdd `@bananapus/address-registry/=lib/nana-address-registry/` to `remappings.txt`.\n\n## Develop\n\n`nana-address-registry` uses the [Foundry](https://github.com/foundry-rs/foundry) development toolchain for builds, tests, and deployments. To get set up, install [Foundry](https://github.com/foundry-rs/foundry):\n\n```bash\ncurl -L https://foundry.paradigm.xyz | sh\n```\n\nYou can download and install dependencies with:\n\n```bash\nforge install\n```\n\nIf you run into trouble with `forge install`, try using `git submodule update --init --recursive` to ensure that nested submodules have been properly initialized.\n\nSome useful commands:\n\n| Command               | Description                                         |\n| --------------------- | --------------------------------------------------- |\n| `forge build`         | Compile the contracts and write artifacts to `out`. |\n| `forge fmt`           | Lint.                                               |\n| `forge test`          | Run the tests.                                      |\n| `forge build --sizes` | Get contract sizes.                                 |\n| `forge coverage`      | Generate a test coverage report.                    |\n| `foundryup`           | Update foundry. Run this periodically.              |\n| `forge clean`         | Remove the build artifacts and cache directories.   |\n\nTo learn more, visit the [Foundry Book](https://book.getfoundry.sh/) docs.\n\n## Scripts\n\nFor convenience, several utility commands are available in `package.json`.\n\n| Command                           | Description                            |\n| --------------------------------- | -------------------------------------- |\n| `npm test`                        | Run local tests.                       |\n| `npm run test:fork`               | Run fork tests (for use in CI).        |\n| `npm run coverage:lcov`           | Generate an LCOV test coverage report. |\n| `npm run deploy:ethereum-mainnet` | Deploy to Ethereum mainnet             |\n| `npm run deploy:ethereum-sepolia` | Deploy to Ethereum Sepolia testnet     |\n| `npm run deploy:optimism-mainnet` | Deploy to Optimism mainnet             |\n| `npm run deploy:optimism-testnet` | Deploy to Optimism testnet             |\n\n## Notes\n\n- After deploying a hook, any addresses can call `JBAddressRegistry.registerAddress(address deployer, uint256 nonce)` to add it to the registry. The registry will compute and store the corresponding hook address.\n- Alternatively, `JBAddressRegistry.registerAddress(address deployer, bytes32 salt, bytes calldata bytecode)` will compute and store the hook deployed from a contract using `create2`.\n\nThe registry doesn't enforce `IERC165` or the implementation of any hook interfaces, meaning it could be used for any contract deployed with `create`/`create2`.\n\nClients can retrieve the nonce for the contract and an EOA using `provider.getTransactionCount(address)` from `ethers.js` or `web3.eth.getTransactionCount` from `web3.js` just *before* the hook's deployment. If registering a hook later on, clients may need to manually calculate the nonce.\n\nThe `create2` salt is determined by a given deployer's logic. The deployment bytecode can be retrieved offchain (from the deployment transaction) or onchain (with `abi.encodePacked(type(deployedContract).creationCode, abi.encode(constructorArguments))`).\n\nThis registry is the second iteration and will fall back to the previous version as needed when calling `deployerOf`.\n\n## Risk\n\nMalicious hooks have a token minting access. Clients should provide comprehensive information to project owners and users on the potential for unintended or adversarial behaviour, especially for unknown hooks.\n","readmeFilename":"README.md"}