{"_id":"@1-dao-protocol/juice-721-delegate","name":"@1-dao-protocol/juice-721-delegate","dist-tags":{"latest":"6.0.3"},"versions":{"6.0.3":{"name":"@1-dao-protocol/juice-721-delegate","bugs":{"url":"https://github.com/jbx-protocol/juice-721-delegate/issues"},"repository":{"type":"git","url":"git+https://github.com/jbx-protocol/juice-721-delegate.git"},"version":"6.0.3","license":"MIT","dependencies":{"@1-dao-protocol/juice-delegates-registry":"1.0.2","@jbx-protocol/juice-contracts-v3":"^2.0.4","@jbx-protocol/juice-delegates-registry":"^1.0.0","@jbx-protocol/juice-ownable":"git+https://github.com/jbx-protocol/juice-ownable.git","@openzeppelin/contracts":"^4.6.0","@paulrberg/contracts":"^3.7.0","prb-math":"^2.4.3"},"devDependencies":{"prettier":"^2.4.0","prettier-plugin-solidity":"^1.0.0-beta.19","solhint":"^3.3.6","solhint-plugin-prettier":"^0.0.5"},"scripts":{"pretty":"prettier --write \"./**/*.{js,jsx,json,sol}\"","deploy-goerli":"source .env && forge script DeployGoerli --rpc-url $GOERLI_RPC_PROVIDER_URL --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY --ledger --sender $SENDER_ADDRESS --optimize --optimizer-runs 200 -vvv","deploy-mainnet":"source .env && forge script DeployMainnet --rpc-url $MAINNET_RPC_PROVIDER_URL --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY --ledger --sender $SENDER_ADDRESS --optimize --optimizer-runs 200 -vvv"},"gitHead":"fc0bf08850ad04f445ec8810a23ecc01aaacf536","description":"## Motivation","homepage":"https://github.com/jbx-protocol/juice-721-delegate#readme","_id":"@1-dao-protocol/juice-721-delegate@6.0.3","_nodeVersion":"16.19.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-TQJS3kSbMpLj2eWdc+QDdquL5b8Ir36Mc5lgrx/zEkPgEQ3/WqLaGTZO+oDuIMYNXm1u51DoT4dDOuQ5xLrJMg==","shasum":"f3fb368eedb641577ed075dabbc86c8c20ce61b3","tarball":"https://registry.npmjs.org/@1-dao-protocol/juice-721-delegate/-/juice-721-delegate-6.0.3.tgz","fileCount":276,"unpackedSize":131506368,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnK1BuM67wmr1Qfai58RhYEA2lK+sjuQbvYF4/6mzHAgIgBRILObX7kyxLtAEzGefGVM3c+DwdAaqqEM8VhYmKi/M="}]},"_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-721-delegate_6.0.3_1684999585253_0.5270926550527044"},"_hasShrinkwrap":false}},"time":{"created":"2023-05-25T07:26:25.195Z","6.0.3":"2023-05-25T07:26:25.668Z","modified":"2023-05-25T07:26:26.090Z"},"maintainers":[{"name":"kr1p70n1c","email":"kr1p70n1c+npmjs.com@gmail.com"}],"description":"## Motivation","homepage":"https://github.com/jbx-protocol/juice-721-delegate#readme","repository":{"type":"git","url":"git+https://github.com/jbx-protocol/juice-721-delegate.git"},"bugs":{"url":"https://github.com/jbx-protocol/juice-721-delegate/issues"},"license":"MIT","readme":"# Juicebox 721 Distribution Mechanism\n\n## Motivation\n\nIf added to an existing project via a funding cycle, NFTs can provide utility or incentive for contributors to participate in funding of a project.\n\n## Mechanic\n\nWithin one collection, NFTs can be minted within any number of pre-programmed tiers.\n\nEach tier has the following optional properties:\n\n- a contribution floor amount.\n- a max quantity.\n- a number of voting units to associate with each unit within the tier.\n- a reserved rate, allowing a proprtion of units within the tier to be minted to a pre-programmed beneficiary.\n- URI, overridable by a URI resolver that can return dynamic values for each unit with the tier.\n- a lock date, before which the tier must remain accessible.\n- the ability for the contract's owner to mint tokens from the tier on demand.\n- if the tokens within the tier can have transfers paused on a per-funding-cycle basis, or if they must always remain transferable.\n\nNew tiers can be added, so long as they respect the contract's `flags` that specify if new tiers can influence voting units, reserved quantities, or be manually minted.\n\nTiers can also be removed, so long as they are not locked.\n\nAn incoming payment can specify any number of tiers to mint as part of the payment, so long as the sum of the tier's prices are contained within the paid amount. If specific tiers aren't specified, the best available tier will be minted based on the specified floor amount, unless a flag is specifically sent along with the payment telling the contract to not mint.\n\nIf a tier's contribution floor is specified in a currency different to the incoming payment, a `JBPrices` contract will by used for trying to normalize the values.\n\nIf a payment received does not meet a minting threshold or is in excess of the minted tiers, the balance is stored as a credit which will be added to future payments and applied to mints at that time. A flag can also be passed to avoid accepting payments that aren't applied to mints in full.\n\nThe contract's owner can mint on demand from tier's that have been pre-programmed to allow manual token minting.\n\nThe NFTs from each tier can also be used for redemptions against the underlying Juicebox treasury. The rate of redemptions corresponds to the price floor of the tier being redeemed, compared to the total price floors of all minted NFTs. Fungible project tokens cannot be being redeemed at the same time. In order to activate NFT redemptions, turn on the `shouldUseDataSourceForRedeem` metadata flag of your next funding cycle.\n\nThe NFTs can serve as utilities for on-chain governance if specified during the collection's deployment. Voting delegation can be made on a per-tier basis, or on a global basis.\n\n## Architecture\n\nAn understanding of how the Juicebox protocol's pay and redeem functionality works is an important prereq to understanding how this repo's contracts work and attach themselves to Juicebox's regular operating behavior. This contract specifically makes use of the DataSource+Delegate pattern. See https://info.juicebox.money/dev/.\n\nIn order to use a 721 delegate, a Juicebox project should be launched from `JBTiered721DelegateProjectDeployer` instead of a `JBController`. This Deployer will deploy a `JBTiered721Delegate` (through it's reference to a `JBTiered721DelegateDeployer`) and attach it to the first funding cycle of the newly launched project as a DataSource and Delegate. Funding cycle reconfigurations can also be done using the `JBTiered721DelegateProjectDeployer`, though it will need to have Operator permissions from the project's owner.\n\nThe abstract `JB721Delegate` implementation of the ERC721 Juicebox DataSource+Delegate extension can be used for any distribution mechanic. This repo includes one implementation – the `JBTiered721Delegate` – as well as two extensions that offer on-chain governance capabilities to the distributed tokens. \n\nAll `JBTiered721Delegate`'s use a generic `JBTiered721DelegateStore` to store it's data.\n\n## Deploy\n\nThe deployer copies the data of a pre-existing cononical version of the 721 contracts, which can be either GlobalGovernance, TierGovernance, or no governance. This was done to keep the deployer contract size small enough to be deployable, without the extra cost of the delegatecalls associated with a proxy pattern. \n\n\n# Install\n\nQuick all-in-one command:\n\n```bash\nrm -Rf juice-721-delegate || true && git clone -n https://github.com/jbx-protocol/juice-721-delegate && cd juice-721-delegate && git pull origin f9893b1497098241dd3a664956d8016ff0d0efd0 && git checkout FETCH_HEAD && foundryup && git submodule update --init --recursive --force && yarn install && forge test --gas-report\n```\n\nTo get set up:\n\n1. Install [Foundry](https://github.com/gakonst/foundry).\n\n```bash\ncurl -L https://foundry.paradigm.xyz | sh\n```\n\n2. Install external lib(s)\n\n```bash\ngit submodule update --init --recursive --force && yarn install\n```\n\nthen run\n\n```bash\nforge update\n```\n\n3. Run tests:\n\n```bash\nforge test\n```\n\n4. Update Foundry periodically:\n\n```bash\nfoundryup\n```\n\n#### Setup\n\nConfigure the .env variables, and add a mnemonic.txt file with the mnemonic of the deployer wallet. The sender address in the .env must correspond to the mnemonic account.\n\n## Goerli\n\n```bash\nyarn deploy-goerli\n```\n\n## Mainnet\n\n```bash\nyarn deploy-mainnet\n```\n\nThe deployments are stored in ./broadcast\n\nSee the [Foundry Book for available options](https://book.getfoundry.sh/reference/forge/forge-create.html).\n","readmeFilename":"README.md"}