@@ -49,6 +49,26 @@ abstract contract CachableNFT is OwnableUpgradeable {
49
49
return $.cache.length ();
50
50
}
51
51
52
+ /// @notice Returns the cache mode.
53
+ /// @return The cache mode, true for cache mode, false for passthrough mode.
54
+ function getCacheMode () external view returns (bool ) {
55
+ return _getCacheableNFTStorage ().cacheMode;
56
+ }
57
+
58
+ /// @notice Returns the NFT at the given index in the cache.
59
+ /// @param index The index of the NFT in the cache.
60
+ /// @return tokenId The token ID of the NFT.
61
+ /// @return ipId The IP ID of the NFT.
62
+ function getCacheAtIndex (uint256 index ) external view returns (uint256 tokenId , address ipId ) {
63
+ return _getCacheableNFTStorage ().cache.at (index);
64
+ }
65
+
66
+ /// @notice Returns the number of NFTs in the cache.
67
+ /// @return The number of NFTs in the cache.
68
+ function getCacheLength () external view returns (uint256 ) {
69
+ return _getCacheableNFTStorage ().cache.length ();
70
+ }
71
+
52
72
/// @notice Transfers the first NFT from the cache to the recipient.
53
73
/// @param recipient The recipient of the NFT.
54
74
/// @return tokenId The token ID of the transferred NFT.
@@ -59,7 +79,7 @@ abstract contract CachableNFT is OwnableUpgradeable {
59
79
return (0 , address (0 ));
60
80
}
61
81
(tokenId, ipId) = $.cache.at (0 );
62
- $.cache.remove (0 );
82
+ $.cache.remove (tokenId );
63
83
64
84
_transferFrom (address (this ), recipient, tokenId);
65
85
}
0 commit comments