@bannynet/core-v6 0.0.25 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bannynet/core-v6",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,10 @@ import {Base64} from "lib/base64/base64.sol";
17
17
 
18
18
  import {IBanny721TokenUriResolver} from "./interfaces/IBanny721TokenUriResolver.sol";
19
19
 
20
- /// @notice Banny asset manager. Stores and shows banny bodies in backgrounds with outfits on.
20
+ /// @notice Manages Banny NFT composition stores SVG assets (bodies, backgrounds, outfits), dresses banny bodies
21
+ /// with wearable outfits, and resolves fully on-chain SVG token URIs for the composed result. Each banny body can
22
+ /// have one background and multiple outfits attached; outfits can be locked for a duration. Asset SVGs are stored
23
+ /// on-chain and validated against pre-committed hashes.
21
24
  contract Banny721TokenUriResolver is
22
25
  Ownable,
23
26
  ERC2771Context,
@@ -148,12 +151,12 @@ contract Banny721TokenUriResolver is
148
151
  /// @custom:param upc The universal product code that the SVG contents represent.
149
152
  mapping(uint256 upc => string) internal _svgContentOf;
150
153
 
151
- /// @notice The ID of the banny body each background is being used by.
154
+ /// @notice The ID of the banny body each background is used by.
152
155
  /// @custom:param hook The hook address of the collection.
153
156
  /// @custom:param backgroundId The ID of the background.
154
157
  mapping(address hook => mapping(uint256 backgroundId => uint256)) internal _userOf;
155
158
 
156
- /// @notice The ID of the banny body each outfit is being worn by.
159
+ /// @notice The ID of the banny body each outfit is worn by.
157
160
  /// @custom:param hook The hook address of the collection.
158
161
  /// @custom:param outfitId The ID of the outfit.
159
162
  mapping(address hook => mapping(uint256 outfitId => uint256)) internal _wearerOf;
@@ -500,7 +503,7 @@ contract Banny721TokenUriResolver is
500
503
 
501
504
  /// @notice Checks to see which banny body is currently using a particular background.
502
505
  /// @param hook The hook address of the collection.
503
- /// @param backgroundId The ID of the background being used.
506
+ /// @param backgroundId The ID of the background to check.
504
507
  /// @return The ID of the banny body using the background.
505
508
  function userOf(address hook, uint256 backgroundId) public view override returns (uint256) {
506
509
  // Get a reference to the banny body using the background.
@@ -515,7 +518,7 @@ contract Banny721TokenUriResolver is
515
518
 
516
519
  /// @notice Checks to see which banny body is currently wearing a particular outfit.
517
520
  /// @param hook The hook address of the collection.
518
- /// @param outfitId The ID of the outfit being worn.
521
+ /// @param outfitId The ID of the outfit to check.
519
522
  /// @return The ID of the banny body wearing the outfit.
520
523
  function wearerOf(address hook, uint256 outfitId) public view override returns (uint256) {
521
524
  // Get a reference to the banny body wearing the outfit.
@@ -544,7 +547,7 @@ contract Banny721TokenUriResolver is
544
547
  //*********************************************************************//
545
548
 
546
549
  /// @notice The SVG contents for a banny body.
547
- /// @param upc The ID of the token whose product's SVG is being returned.
550
+ /// @param upc The ID of the token whose product's SVG to return.
548
551
  /// @return contents The SVG contents of the banny body.
549
552
  function _bannyBodySvgOf(uint256 upc) internal view returns (string memory) {
550
553
  (
@@ -577,7 +580,7 @@ contract Banny721TokenUriResolver is
577
580
  }
578
581
 
579
582
  /// @notice The name of each token's category.
580
- /// @param category The category of the token being named.
583
+ /// @param category The category of the token to name.
581
584
  /// @return name The token's category name.
582
585
  function _categoryNameOf(uint256 category) internal pure returns (string memory) {
583
586
  if (category == _BODY_CATEGORY) {
@@ -688,7 +691,7 @@ contract Banny721TokenUriResolver is
688
691
  }
689
692
 
690
693
  /// @notice The fills for a product.
691
- /// @param upc The ID of the token whose product's fills are being returned.
694
+ /// @param upc The ID of the token whose product's fills to return.
692
695
  /// @return fills The fills for the product.
693
696
  function _fillsFor(uint256 upc)
694
697
  internal
@@ -717,8 +720,8 @@ contract Banny721TokenUriResolver is
717
720
  }
718
721
 
719
722
  /// @notice The full name of each product, including category and inventory.
720
- /// @param tokenId The ID of the token being named.
721
- /// @param product The product of the token being named.
723
+ /// @param tokenId The ID of the token to name.
724
+ /// @param product The product of the token to name.
722
725
  /// @return name The full name.
723
726
  function _fullNameOf(uint256 tokenId, JB721Tier memory product) internal view returns (string memory name) {
724
727
  // Start with the item's name.
@@ -814,7 +817,7 @@ contract Banny721TokenUriResolver is
814
817
  /// @notice The SVG contents for a list of outfit IDs.
815
818
  /// @param hook The 721 contract that the product belongs to.
816
819
  /// @param outfitIds The IDs of the outfits that'll be associated with the specified banny.
817
- /// @param bodyUpc The UPC of the banny body being dressed (used for default eyes selection).
820
+ /// @param bodyUpc The UPC of the banny body to dress (used for default eyes selection).
818
821
  /// @return contents The SVG contents of the outfits.
819
822
  function _outfitContentsFor(
820
823
  address hook,
@@ -916,7 +919,7 @@ contract Banny721TokenUriResolver is
916
919
  }
917
920
 
918
921
  /// @notice The name of each token's product type.
919
- /// @param upc The ID of the token whose product type is being named.
922
+ /// @param upc The ID of the token whose product type to name.
920
923
  /// @return name The item's product name.
921
924
  function _productNameOf(uint256 upc) internal view returns (string memory) {
922
925
  // Get the token's name.
@@ -942,10 +945,10 @@ contract Banny721TokenUriResolver is
942
945
  return _storeOf(hook).tierOfTokenId({hook: hook, tokenId: tokenId, includeResolvedUri: false});
943
946
  }
944
947
 
945
- /// @notice Revert if an equipped asset is being reassigned away from a locked source body.
948
+ /// @notice Revert if an equipped asset is reassigned away from a locked source body.
946
949
  /// @param hook The hook storing the assets.
947
950
  /// @param bannyBodyId The body currently using the asset.
948
- /// @param exemptBodyId The destination body currently being decorated.
951
+ /// @param exemptBodyId The destination body currently decorated.
949
952
  function _revertIfBodyLocked(address hook, uint256 bannyBodyId, uint256 exemptBodyId) internal view {
950
953
  // Outfit locks are user-selected display locks; timestamp tolerance is acceptable here.
951
954
  // forge-lint: disable-next-line(block-timestamp)
@@ -1097,7 +1100,7 @@ contract Banny721TokenUriResolver is
1097
1100
  /// NFTs) or re-equip different items. Sellers should unequip valuable outfits before transferring a banny body.
1098
1101
  ///
1099
1102
  /// @param hook The hook storing the assets.
1100
- /// @param bannyBodyId The ID of the banny body being dressed.
1103
+ /// @param bannyBodyId The ID of the banny body to dress.
1101
1104
  /// @param backgroundId The ID of the background that'll be associated with the specified banny.
1102
1105
  /// @param outfitIds The IDs of the outfits that'll be associated with the specified banny. Only one outfit per
1103
1106
  /// outfit category allowed at a time and they must be passed in order.
@@ -1166,7 +1169,7 @@ contract Banny721TokenUriResolver is
1166
1169
  // transfers. Users and UIs should always use safeTransferFrom.
1167
1170
  /// @param operator The address that initiated the transaction.
1168
1171
  /// @param from The address that initiated the transfer.
1169
- /// @param tokenId The ID of the token being transferred.
1172
+ /// @param tokenId The ID of the token to transfer.
1170
1173
  /// @param data The data of the transfer.
1171
1174
  /// @return The ERC-721 receiver selector.
1172
1175
  function onERC721Received(
@@ -1236,7 +1239,7 @@ contract Banny721TokenUriResolver is
1236
1239
 
1237
1240
  /// @notice The owner of this contract can store SVG files for product IDs.
1238
1241
  /// @param upcs The universal product codes of the products having SVGs stored.
1239
- /// @param svgContents The svg contents being stored, not including the parent <svg></svg> element.
1242
+ /// @param svgContents The svg contents to store, not including the parent <svg></svg> element.
1240
1243
  function setSvgContentsOf(uint256[] memory upcs, string[] calldata svgContents) external override {
1241
1244
  if (upcs.length != svgContents.length) revert Banny721TokenUriResolver_ArrayLengthMismatch();
1242
1245
 
@@ -1270,7 +1273,7 @@ contract Banny721TokenUriResolver is
1270
1273
  /// @notice Allows the owner of this contract to upload the hash of an svg file for a universal product code.
1271
1274
  /// @dev This allows anyone to lazily upload the correct svg file.
1272
1275
  /// @param upcs The universal product codes of the products having SVG hashes stored.
1273
- /// @param svgHashes The svg hashes being stored, not including the parent <svg></svg> element.
1276
+ /// @param svgHashes The svg hashes to store, not including the parent <svg></svg> element.
1274
1277
  function setSvgHashesOf(uint256[] memory upcs, bytes32[] memory svgHashes) external override onlyOwner {
1275
1278
  if (upcs.length != svgHashes.length) revert Banny721TokenUriResolver_ArrayLengthMismatch();
1276
1279
 
@@ -1298,7 +1301,7 @@ contract Banny721TokenUriResolver is
1298
1301
 
1299
1302
  /// @notice Add a background to a banny body.
1300
1303
  /// @param hook The hook storing the assets.
1301
- /// @param bannyBodyId The ID of the banny body being dressed.
1304
+ /// @param bannyBodyId The ID of the banny body to dress.
1302
1305
  /// @param backgroundId The ID of the background that'll be associated with the specified banny.
1303
1306
  /// @param sender The cached msg sender.
1304
1307
  function _decorateBannyWithBackground(
@@ -1384,9 +1387,9 @@ contract Banny721TokenUriResolver is
1384
1387
  }
1385
1388
 
1386
1389
  /// @notice Add outfits to a banny body.
1387
- /// @dev The caller must own the banny body being dressed and all outfits being worn.
1390
+ /// @dev The caller must own the banny body to dress and all outfits to wear.
1388
1391
  /// @param hook The hook storing the assets.
1389
- /// @param bannyBodyId The ID of the banny body being dressed.
1392
+ /// @param bannyBodyId The ID of the banny body to dress.
1390
1393
  /// @param outfitIds The IDs of the outfits that'll be associated with the specified banny. Only one outfit per
1391
1394
  /// outfit category allowed at a time and they must be passed in order.
1392
1395
  /// @param sender The cached msg sender.
@@ -1573,7 +1576,7 @@ contract Banny721TokenUriResolver is
1573
1576
  /// @dev Entries in `previousOutfitIds` that are still non-zero represent outfits whose transfer back to the
1574
1577
  /// owner failed. These are appended to `outfitIds` so the attachment record is preserved and the owner can retry.
1575
1578
  /// @param hook The hook storing the assets.
1576
- /// @param bannyBodyId The ID of the banny body being dressed.
1579
+ /// @param bannyBodyId The ID of the banny body to dress.
1577
1580
  /// @param outfitIds The new outfit IDs to store.
1578
1581
  /// @param previousOutfitIds The previous outfit IDs array (zeroed entries were successfully transferred or
1579
1582
  /// handled).
@@ -1642,7 +1645,7 @@ contract Banny721TokenUriResolver is
1642
1645
  }
1643
1646
 
1644
1647
  /// @notice Transfer a token from one address to another.
1645
- /// @param hook The 721 contract of the token being transferred.
1648
+ /// @param hook The 721 contract of the token to transfer.
1646
1649
  /// @param from The address to transfer the token from.
1647
1650
  /// @param to The address to transfer the token to.
1648
1651
  /// @param assetId The ID of the token to transfer.
@@ -1652,7 +1655,7 @@ contract Banny721TokenUriResolver is
1652
1655
 
1653
1656
  /// @notice Try to transfer a token, returning whether the transfer succeeded.
1654
1657
  /// @dev Used when returning previously equipped items that may no longer exist.
1655
- /// @param hook The 721 contract of the token being transferred.
1658
+ /// @param hook The 721 contract of the token to transfer.
1656
1659
  /// @param from The address to transfer the token from.
1657
1660
  /// @param to The address to transfer the token to.
1658
1661
  /// @param assetId The ID of the token to transfer.
@@ -1,8 +1,9 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.0;
3
3
 
4
- /// @notice Manages Banny NFT assets -- bodies, backgrounds, and outfits -- and resolves on-chain SVG token URIs for
5
- /// dressed Banny compositions.
4
+ /// @notice Manages Banny NFT assets bodies, backgrounds, and outfits and resolves on-chain SVG token URIs for
5
+ /// dressed Banny compositions. Owners dress their banny bodies with outfits and backgrounds; the resolver composes
6
+ /// all attached assets into a single SVG returned as a base64-encoded data URI.
6
7
  interface IBanny721TokenUriResolver {
7
8
  /// @notice Emitted when a banny body is decorated with a background and outfits.
8
9
  /// @param hook The hook address of the collection.