From d3dd40ede99899349711b8f36683379441bd22e8 Mon Sep 17 00:00:00 2001 From: Dan Oved Date: Mon, 14 Aug 2023 15:34:50 -0700 Subject: [PATCH] remove unused function --- src/royalties/CreatorRoyaltiesControl.sol | 13 ------------- test/royalties/CreatorRoyaltiesControl.t.sol | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/royalties/CreatorRoyaltiesControl.sol b/src/royalties/CreatorRoyaltiesControl.sol index d5cb109c6..f41029551 100644 --- a/src/royalties/CreatorRoyaltiesControl.sol +++ b/src/royalties/CreatorRoyaltiesControl.sol @@ -32,19 +32,6 @@ abstract contract CreatorRoyaltiesControl is CreatorRoyaltiesStorageV1, SharedBa receiver = config.royaltyRecipient; } - /// @notice Returns the supply royalty information for a given token. - /// @param tokenId The token ID to get the royalty information for. - /// @param mintAmount The amount of tokens being minted. - /// @param totalSupply The total supply of the token, - function supplyRoyaltyInfo(uint256 tokenId, uint256 totalSupply, uint256 mintAmount) public view returns (address receiver, uint256 royaltyAmount) { - RoyaltyConfiguration memory config = getRoyalties(tokenId); - if (config.royaltyMintSchedule == 0) { - return (config.royaltyRecipient, 0); - } - uint256 totalRoyaltyMints = (mintAmount + (totalSupply % config.royaltyMintSchedule)) / (config.royaltyMintSchedule - 1); - return (config.royaltyRecipient, totalRoyaltyMints); - } - function _updateRoyalties(uint256 tokenId, RoyaltyConfiguration memory configuration) internal { // Don't allow 100% supply royalties if (configuration.royaltyMintSchedule == 1) { diff --git a/test/royalties/CreatorRoyaltiesControl.t.sol b/test/royalties/CreatorRoyaltiesControl.t.sol index 6d0fc7b34..962ed986d 100644 --- a/test/royalties/CreatorRoyaltiesControl.t.sol +++ b/test/royalties/CreatorRoyaltiesControl.t.sol @@ -32,6 +32,19 @@ contract CreatorRoyaltiesControlTest is Test { response = new bytes[](0); } + /// @notice Returns the supply royalty information for a given token. + /// @param tokenId The token ID to get the royalty information for. + /// @param mintAmount The amount of tokens being minted. + /// @param totalSupply The total supply of the token, + function supplyRoyaltyInfo(uint256 tokenId, uint256 totalSupply, uint256 mintAmount) public view returns (address receiver, uint256 royaltyAmount) { + ICreatorRoyaltiesControl.RoyaltyConfiguration memory config = target.getRoyalties(tokenId); + if (config.royaltyMintSchedule == 0) { + return (config.royaltyRecipient, 0); + } + uint256 totalRoyaltyMints = (mintAmount + (totalSupply % config.royaltyMintSchedule)) / (config.royaltyMintSchedule - 1); + return (config.royaltyRecipient, totalRoyaltyMints); + } + function test_GetsRoyaltiesInfoGlobalDefault() external { address royaltyPayout = address(0x999); @@ -44,7 +57,7 @@ contract CreatorRoyaltiesControlTest is Test { uint256 tokenId = target.setupNewToken("test", 100); (address royaltyRecipient, uint256 amount) = target.royaltyInfo(tokenId, 1 ether); - (, uint256 supplyAmount) = target.supplyRoyaltyInfo(tokenId, 0, 100); + (, uint256 supplyAmount) = supplyRoyaltyInfo(tokenId, 0, 100); assertEq(amount, 0.001 ether); assertEq(royaltyRecipient, royaltyPayout); assertEq(supplyAmount, 11); @@ -66,13 +79,13 @@ contract CreatorRoyaltiesControlTest is Test { vm.stopPrank(); (address royaltyRecipient, uint256 amount) = target.royaltyInfo(tokenIdFirst, 1 ether); - (, uint256 supplyAmount) = target.supplyRoyaltyInfo(tokenIdFirst, 0, 100); + (, uint256 supplyAmount) = supplyRoyaltyInfo(tokenIdFirst, 0, 100); assertEq(amount, 0.001 ether); assertEq(supplyAmount, 1); assertEq(royaltyRecipient, royaltyPayout); (address royaltyRecipientSecond, uint256 amountSecond) = target.royaltyInfo(tokenIdSecond, 1 ether); - (, uint256 supplyAmountSecond) = target.supplyRoyaltyInfo(tokenIdSecond, 0, 100); + (, uint256 supplyAmountSecond) = supplyRoyaltyInfo(tokenIdSecond, 0, 100); assertEq(amountSecond, 0.01 ether); assertEq(supplyAmountSecond, 11); assertEq(royaltyRecipientSecond, address(0x992));