{"_id":"@1-dao-protocol/juice-delegates-registry","name":"@1-dao-protocol/juice-delegates-registry","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.2":{"name":"@1-dao-protocol/juice-delegates-registry","bugs":{"url":"https://github.com/jbx-protocol/juice-delegates-registry/issues"},"repository":{"type":"git","url":"git+https://github.com/jbx-protocol/juice-delegates-registry.git"},"version":"1.0.2","license":"MIT","dependencies":{"@1-dao-protocol/juice-contracts-v3":"3.1.2","@openzeppelin/contracts":"4.8.2","@paulrberg/contracts":"3.7.0"},"gitHead":"d836dddcf1d83bfd5212a19996368fae61c2301d","description":"## Summary Provide an easy to access function linking Juicebox protocol pay and redemption delegate with their respective deployer address. This registry use create and create2 to, based on a deployer address and a nonce, generate a deterministic address ","homepage":"https://github.com/jbx-protocol/juice-delegates-registry#readme","_id":"@1-dao-protocol/juice-delegates-registry@1.0.2","_nodeVersion":"16.19.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-rJUv9iztv1wFsHXqSupUjLlW3gkDydUMWJLDwQYpP2XlPlTuBXm2Ncd7/KELDxt7VjpCLJhdxaE/Kiwm72dtFg==","shasum":"760ebf2727906c0bf45285e43c75cddeebb4adc5","tarball":"https://registry.npmjs.org/@1-dao-protocol/juice-delegates-registry/-/juice-delegates-registry-1.0.2.tgz","fileCount":5,"unpackedSize":18723,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQConNuB08hug1XgrNod8XOlhw91Jf74P8lOOlg3H5lIGQIhAKSIw+ABKJJEMpXFUo6VV29902VCy/HjtiKCPW1ylY9j"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIGpRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrv2w//ZkvBhsPfAn2jcXUOdNFR6VCxsrUXvGYCYw6ggP5/1GYLInYs\r\nsBZjZeMR7sTFo2W0CxBlwCh0LRpE07yjhMhcfE+gBdjfHbExTYAMaIlLlpcU\r\njjnxnyUdOE2BptY9GpIvAmXvoZ7a6lL8MbsLFDjQb73m6jozQImx2xWZDS5d\r\ng71DyXg5xZgaaeCMjTSPCFrR8cckmDVE18qwEa/MxmhN/EMUwN4S5foW0TEg\r\namH2yNgDPjaVVhwZkGQHfIq5DiO8Cl1EEMVnT5MVp+lS743bvgzoLIyhogVX\r\nPBnArCFwdje4R0m07v4fo/XlQdintOeL1fbYSqyk/lsX1/WsZadlaRImD49p\r\ncK9AacP0pw/UK0Nzn/E8MyTdJrmLAto+Q1oaumlqW6VS2tNSkDZw4MfEAAIW\r\nu+11ffWhPsGQly9XxQ+imc5BDAGgPKw6wWTTFMd4oJIHWSa3CxD1grNUB/A6\r\nZo4CYcWMMCETrf3KwDN65ZOIso0VIbYjDAxKbbJ0trT5QBQ1UDoL3emb9lc5\r\nc4LP2lKL98TLQgXVbFjt0jAiiUMJdACEr4v44kBJ2GbnXJflrm9Y8pbCWfGj\r\n5iO5TswIMf4EPfdwUzunVgSfyV9CivCq7KUOpSyH2amGJ6HeLxGhRCxfINiS\r\nNpfDeDI0WWW+PZ6dr9oo/zOa2ON6QDtA5c4=\r\n=O5I/\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"kr1p70n1c","email":"kr1p70n1c+npmjs.com@gmail.com"},"directories":{},"maintainers":[{"name":"kr1p70n1c","email":"kr1p70n1c+npmjs.com@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/juice-delegates-registry_1.0.2_1679845968819_0.2735492955647001"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-26T15:52:48.751Z","1.0.2":"2023-03-26T15:52:48.965Z","modified":"2023-03-26T15:52:49.130Z"},"maintainers":[{"name":"kr1p70n1c","email":"kr1p70n1c+npmjs.com@gmail.com"}],"description":"## Summary Provide an easy to access function linking Juicebox protocol pay and redemption delegate with their respective deployer address. This registry use create and create2 to, based on a deployer address and a nonce, generate a deterministic address ","homepage":"https://github.com/jbx-protocol/juice-delegates-registry#readme","repository":{"type":"git","url":"git+https://github.com/jbx-protocol/juice-delegates-registry.git"},"bugs":{"url":"https://github.com/jbx-protocol/juice-delegates-registry/issues"},"license":"MIT","readme":"# Juice Delegates Registry\n\n## Summary\nProvide an easy to access function linking Juicebox protocol pay and redemption delegate with their respective deployer address.\nThis registry use create and create2 to, based on a deployer address and a nonce, generate a deterministic address for a delegate.\nThis address is then used as a key to store the deployer address (after sanity check).\n\n## Design\n### Flow\nAfter deploying a delegate, any addresses can call `registry.addDelegate(address deployer, uint256 nonce)` to add it. The registry will compute the corresponding \ndelegate address, check if it is a valid delegate and add it. Alternatively, addDelegateCreate2(address _deployer, bytes32 _salt, bytes calldata _bytecode) can\nbe used to add delegate deployed from a contract, using create2.\n\nThe frontend might retrieve the correct nonce, for both contract and eoa, using  ethers `provider.getTransactionCount(address)` or web3js `web3.eth.getTransactionCount` just *before* the delegate deployment (if adding a delegate at a later time, manual nonce counting might be needed).\nCreate2 salt is based on the delegate deployer own internal logic while the deployment bytecode can be retrieved in the deployment transaction (off-chain) or via `abi.encodePacked(type(delegateContract).creationCode, abi.encode(constructorArguments))` (on-chain)\n\n### Contracts/interface\n- JBDelegatesRegistry: the registry\n- IJBDelegatesRegistry; the registry interface\n\n## Usage\nAnyone can deploy this registry using the provided forge script.\nTo run this repo, you'll need [Foundry](https://book.getfoundry.sh/) and [NodeJS](https://nodejs.dev/en/learn/how-to-install-nodejs/) installed.\n\nFirst install the dependencies with:\n\n* `yarn install && git submodule update --init --force --recursive`\n\nYou should then be able to run the tests using:\n\n* `forge test`\n \nDeploy a new registry using:\n\n* `forge script Deploy` (and the correct arguments, based on the chain and key you want to use - see the [Foundry docs](https://book.getfoundry.sh/)).\n\n## Use-case\nThis registry allows frontend to easily and trustlessly query the deployer behind a given delegate. This might then used to assume a delegate as \"safe\" or not, based on front-end opinion.\n\n## Risks & trade-off\nA nasty delegate has a mint privilege access. It is therefore a key responsability to front-end providing informations to project owners and users on unintended/potentially adversarial behaviour, especially for unknow delegates.\n","readmeFilename":"readme.md"}