NFT Token Resolver
This is the README from the juice-token-resolver
GitHub Repository.
Creates onchain SVG Metadata for all Juicebox projects on JBDirectory V3.
Deployed contracts
Mainnet
- StringSlicer.sol eth:0xaDE1ae7bCcc2Cb84De0431a70cceB5f1DE0E2c9b
- LibColor eth:0x53aD3C068B6bf487c1bFE8694C8a5b5546b43063
- DefaultUriResolver eth:0x9D63AFc505C6b2c9387ad837A1Acf23e1e4fa520
- TokenUriResolver eth:0x2c39bb41e2af6bec6c3bb102c07c15eda648a366
Goerli
- StringSlicer.sol gor:0x2cfab22421a948dc7dc27f2b95ade16f108b6639
- LibColor gor:0xb594f2a65dbe407e579bb1a6aef4fae641408812
- DefaultUriResolver gor:0x9d7a1a7296fd2debd5fd9f48c15830d0aac3c092
- TokenUriResolver gor:0x082d3969f2b7988b0362e8bd4f2af9bbd2fed36c
Getting started
This repo relies on Mainnet forking for its tests. This approach allows tests to surface real chain data, and avoids the need to redeploy the entire Juicebox protocol, Juicebox Project Handles, and ENS protocol, as well as instantiating projects, .eth addresses, and handles, before running its own test. The tradeoff is that you need access to an RPC to test the repo.
Installation
git clone git@github.com:jbx-protocol/juice-token-resolver.git
orgit clone https://github.com/jbx-protocol/juice-token-resolver.git
this repo.- Install Foundry, or update Foundry with
foundryup
. cd
into the directory and callforge install && yarn install
to install dependencies.- Rename
.env-example
to.env
and fill out the fields. You can generate a throwaway private key withcast wallet
. You can get a free RPC API key from Infura, Alchemy, and other providers listed on https://ethereumnodes.com/.
Testing
⚠️ Security note ⚠️ This repo's tests use forge's ffi
to save SVG images to disk and open them in your default SVG reader (usually the browser). This rendering approach means that malicious updates to this repo, or forks thereof, could allow Node to execute code on your system with filesystem access, and open files in your browser or other applications. Please be careful to check that no malicious changes have been introduced to the code before running tests. A dead giveaway would be unverified commits to the repo, or commits from an unexpected contributor. This code is provided as-is with no guarantee or warranty.
Run all tests
Run forge test -v --ffi
to run all test.
Test only the default SVG output
Run forge test -v --ffi --match-test testGetDefaultMetadataDirectoryV3Controller3_1
This test outputs the default SVG for a JBDirectoryV3 Controller3_1 project to src/onchain.svg
.
Deploying
Deploy all contracts to Goerli: forge script script/Goerli_Deploy.s.sol --rpc-url $GOERLI_RPC_URL --broadcast --verify
Deploy only the DefaultTokenUriResolver to Goerli: forge script script/Goerli_Deploy_DeafultResolverOnly.s --rpc-url $GOERLI_RPC_URL --broadcast --verify
Deploy all contracts to Mainnet: forge script script/Mainnet_Deploy.s.sol --rpc-url $MAINNET_RPC_URL --broadcast --verify
Deploy only the DefaultTokenUriResolver to Mainnet: forge script script/Mainnet_Deploy_DefaultResolverOnly.s.sol --rpc-url $MAINNET_RPC_URL --broadcast --verify