DynamicTokenURI
is a Manifold extension that enables dynamic token URIs
for a Manifold creator contract. Specifically, when a token is transferred
between wallets, the URI changes. Foundry is
used to build, test, and deploy the contract.
$ forge install
$ forge build
$ forge test
$ forge fmt
$ forge create --rpc-url <rpc_url> \
--private-key <private_key> \
--etherscan-api-key <etherscan_api_key> \
-- verify \
DynamicTokenURI
Then call setExtensionConfig()
to configure the following parameters
for a creator contract:
baseURI
: base URI to be used for all tokens minted by the extensionmaxSupply
: the number of artworks and also the maximum number of tokens to be minted by the extensionmintCost
: the cost of minting. Can be zero.
Once the extension is deployed, it can be registered in the creator contract
by calling registerExtension()
in the creator contract.
By default it is assumed that the metadata directory follows a specific structure:
.
└──<baseURI>
├── 1.json
├── 2.json
├── ...
└── <maxSupply>.json
eg., the token URI for a token without any transfers will be ${baseURI}1.json
,
the token URI for a token with a single transfer will be ${baseURI}2.json
, etc.
In case the metadata files are not named after numbers indexed from 1 up to the
maximum supply of artworks, setTokenURIs()
can be called on the extension to
map the numbers to fully qualified token URIs,
eg., setTokenURIs(creatorContract,[1,2,..],["ar://bla420", "ar://bla69",...])
will force tokens without a transfer to point to "ar://bla420"
, tokens with a
single transfer to point to "ar://bla69"
, etc.
Learn more about Manifold extensions: