-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #326 from ourzora/ignore_supply_royalty_schedule
refactor: ignore nonzero supply royalty schedule
- Loading branch information
Showing
3 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/protocol-deployments/test/ZoraCreator1155SupplyRoyaltyDeprecation.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.17; | ||
|
||
import "forge-std/Test.sol"; | ||
|
||
import { | ||
ForkDeploymentConfig, | ||
Deployment, | ||
ChainConfig | ||
} from "@zoralabs/zora-1155-contracts/src/deployment/DeploymentConfig.sol"; | ||
import {ZoraDeployerUtils} from "@zoralabs/zora-1155-contracts/src/deployment/ZoraDeployerUtils.sol"; | ||
|
||
import {Zora1155Factory} from "@zoralabs/zora-1155-contracts/src/proxies/Zora1155Factory.sol"; | ||
import {ZoraCreator1155FactoryImpl} from "@zoralabs/zora-1155-contracts/src/factory/ZoraCreator1155FactoryImpl.sol"; | ||
import {ZoraCreator1155Impl} from "@zoralabs/zora-1155-contracts/src/nft/ZoraCreator1155Impl.sol"; | ||
import {ICreatorRoyaltiesControl} from "@zoralabs/zora-1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol"; | ||
import {IMinter1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IMinter1155.sol"; | ||
|
||
contract ZoraCreator1155SupplyRoyaltyDeprecationTest is Test, ForkDeploymentConfig { | ||
address internal creator; | ||
string[] internal chains; | ||
|
||
function setUp() public { | ||
creator = makeAddr("creator"); | ||
|
||
chains = new string[](1); | ||
chains[0] = "zora_goerli"; | ||
} | ||
|
||
function testFork_SupplyRoyaltyDeprecation() public { | ||
for (uint256 i; i < chains.length; ++i) { | ||
string memory chain = chains[i]; | ||
|
||
vm.createSelectFork(vm.rpcUrl(chain)); | ||
|
||
Deployment memory deployment = getDeployment(); | ||
ChainConfig memory chainConfig = getChainConfig(); | ||
|
||
ZoraCreator1155FactoryImpl factory = ZoraCreator1155FactoryImpl(deployment.factoryProxy); | ||
|
||
uint32 invalidRoyaltyMintSchedule = 10; | ||
|
||
ICreatorRoyaltiesControl.RoyaltyConfiguration memory royaltyConfig = ICreatorRoyaltiesControl | ||
.RoyaltyConfiguration({ | ||
royaltyBPS: 0, | ||
royaltyRecipient: address(0), | ||
royaltyMintSchedule: invalidRoyaltyMintSchedule | ||
}); | ||
|
||
vm.expectRevert(abi.encodeWithSignature("InvalidMintSchedule()")); | ||
factory.createContract("mock uri", "mock name", royaltyConfig, payable(creator), new bytes[](0)); | ||
|
||
(address newFactoryImpl,,) = ZoraDeployerUtils.deployNew1155AndFactoryImpl({ | ||
upgradeGateAddress: deployment.upgradeGate, | ||
mintFeeRecipient: chainConfig.mintFeeRecipient, | ||
protocolRewards: chainConfig.protocolRewards, | ||
merkleMinter: IMinter1155(deployment.merkleMintSaleStrategy), | ||
redeemMinterFactory: IMinter1155(deployment.redeemMinterFactory), | ||
fixedPriceMinter: IMinter1155(deployment.fixedPriceSaleStrategy) | ||
}); | ||
|
||
ZoraCreator1155FactoryImpl newFactory = | ||
ZoraCreator1155FactoryImpl(address(new Zora1155Factory(newFactoryImpl, ""))); | ||
|
||
address tokenContractAddress = | ||
newFactory.createContract("mock uri", "mock name", royaltyConfig, payable(creator), new bytes[](0)); | ||
|
||
ZoraCreator1155Impl tokenContract = ZoraCreator1155Impl(tokenContractAddress); | ||
|
||
// Ensure the specified royalty mint schedule is ignored + set to zero | ||
assertEq(tokenContract.getRoyalties(0).royaltyMintSchedule, 0); | ||
} | ||
} | ||
} |