Skip to content

Commit 0ec838a

Browse files
authored
Sparks contracts (ourzora#501)
* rename mints to sparks * Sparks - when doing a transfer, if there is a `data` passed, then emit an event that includes that data (ourzora#505) This would allow us to include mint comments in that `data` field, and know that the comment was made by the executor of the transaction, or the signer of the permit message * Deployed Sparks contracts (ourzora#506) <!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> ## Does this change the ABI/API? - [ ] This changes the ABI/API <!-- If so, please describe how and what potential impact this may have --> ## What tests did you add/modify to account for these changes <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, tests ran to see how --> <!--- your change affects other areas of the code, etc. --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New module / feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I added a changeset to account for this change ## Reviewer Checklist: - [ ] My review includes a symposis of the changes and potential issues - [ ] The code style is enforced - [ ] There are no risky / concerning changes / additions to the PR * Sparks subgraph (ourzora#507) Copy of the mints subgraph, less mint comment * fix foundry config for file access * rename sparks unwrapper to eth unwrapper * added changeset * fix sparks impl address * fixed sparks proxy addresses * added a changeset * fix unwrapper * added changeset * fix subgraph deploys * dont lint wagmi generated * fix sparks rename * update version upgrades * use dynamic mint fee in test * deployed lowerSupply interface check * version bump subgraph so it matches whats deployed * clean up constructor * clean up changesets
1 parent 898c84a commit 0ec838a

File tree

170 files changed

+4275
-3872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+4275
-3872
lines changed

.changeset/cold-pillows-join.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@zoralabs/sparks-contracts": minor
3+
---
4+
5+
Renamed Mints contracts to Sparks contracts. Removed all collect/collectPremint functions from the sparks manager contract

.changeset/giant-wombats-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@zoralabs/protocol-deployments": minor
3+
---
4+
5+
Publishing Sparks contracts abis and addresses.

.changeset/heavy-geese-warn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@zoralabs/zora-1155-contracts": minor
3+
---
4+
5+
1155 contracts have a hardcoded mint fee of 0.000111 ether, and no longer have a fee that is determined by the MintsManager contract

.github/workflows/contracts.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
name: Protocol Rewards
1717
uses: ./.github/workflows/protocol-rewards.yml
1818

19-
contracts-mints:
20-
name: Mints
21-
uses: ./.github/workflows/mints.yml
19+
contracts-sparks:
20+
name: Sparks
21+
uses: ./.github/workflows/sparks.yml
2222
secrets: inherit
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
name: "Mints"
1+
name: "Sparks"
22
on:
33
workflow_call:
44

55
jobs:
66
build:
77
uses: ./.github/workflows/build.yml
88
with:
9-
package_folder: packages/mints
9+
package_folder: packages/sparks
1010

1111
test:
1212
needs: build
1313
uses: ./.github/workflows/test.yml
1414
with:
15-
package_folder: packages/mints
16-
name: Mints
15+
package_folder: packages/sparks
16+
name: Sparks
1717

1818
contract_sizes:
1919
needs: build
2020
uses: ./.github/workflows/contract_sizes.yml
2121
with:
22-
package_folder: packages/mints
23-
name: Mints
22+
package_folder: packages/sparks
23+
name: Sparks
2424

2525
coverage:
2626
uses: ./.github/workflows/coverage.yml
2727
with:
28-
package: "mints"
28+
package: "sparks"
2929
files_to_ignore: '"*Ownable*" "*Mock*" "*BatchDataHelper*" "*test*"'

packages/1155-contracts/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"dev": "FOUNDRY_PROFILE=dev forge test --watch -vvv",
2121
"test": "forge test -vv",
2222
"test-gas": "forge test --gas-report",
23-
"prettier:check": "prettier --check 'src/**/*.sol' 'test/**/*.sol' 'package/**/*.ts' 'wagmi.config.ts'",
24-
"prettier:write": "prettier --write 'src/**/*.sol' 'test/**/*.sol' 'package/**/*.ts' 'script/**/*.ts' 'wagmi.config.ts'",
23+
"prettier:check": "prettier --check 'src/**/*.sol' 'test/**/*.sol' 'package/index.ts' 'wagmi.config.ts'",
24+
"prettier:write": "prettier --write 'src/**/*.sol' 'test/**/*.sol' 'package/index.ts' 'wagmi.config.ts'",
2525
"copy-abis": "yarn tsx script/bundle-abis.ts",
2626
"lint": "yarn run prettier:check",
2727
"coverage": "forge coverage --report lcov",
@@ -40,7 +40,6 @@
4040
"@openzeppelin/contracts": "4.9.2",
4141
"@types/node": "^20.1.2",
4242
"@wagmi/cli": "^1.0.1",
43-
"@zoralabs/mints-contracts": "*",
4443
"@zoralabs/openzeppelin-contracts-upgradeable": "4.8.4",
4544
"@zoralabs/protocol-rewards": "*",
4645
"@zoralabs/shared-contracts": "*",

packages/1155-contracts/src/interfaces/IZoraCreator1155.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {IVersionedContract} from "@zoralabs/shared-contracts/interfaces/IVersion
1212
import {ICreatorRoyaltiesControl} from "../interfaces/ICreatorRoyaltiesControl.sol";
1313
import {IZoraCreator1155DelegatedCreation} from "./IZoraCreator1155DelegatedCreation.sol";
1414
import {IMintWithRewardsRecipients} from "./IMintWithRewardsRecipients.sol";
15-
import {IMintWithMints} from "@zoralabs/mints-contracts/src/IMintWithMints.sol";
1615
import {IReduceSupply} from "./IReduceSupply.sol";
1716

1817
/*
@@ -47,7 +46,6 @@ interface IZoraCreator1155 is
4746
IERC1155MetadataURIUpgradeable,
4847
IZoraCreator1155DelegatedCreation,
4948
IMintWithRewardsRecipients,
50-
IMintWithMints,
5149
IReduceSupply
5250
{
5351
function PERMISSION_BIT_ADMIN() external returns (uint256);

packages/1155-contracts/src/nft/ZoraCreator1155Impl.sol

Lines changed: 5 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,8 @@ import {IZoraCreator1155DelegatedCreation, ISupportsAABasedDelegatedTokenCreatio
3737
import {IMintWithRewardsRecipients} from "../interfaces/IMintWithRewardsRecipients.sol";
3838
import {ZoraCreator1155Attribution, DecodedCreatorAttribution, PremintTokenSetup, PremintConfigV2, DelegatedTokenCreation, DelegatedTokenSetup} from "../delegation/ZoraCreator1155Attribution.sol";
3939
import {ContractCreationConfig, PremintConfig} from "@zoralabs/shared-contracts/entities/Premint.sol";
40-
import {IZoraMintsMinterManager} from "@zoralabs/mints-contracts/src/interfaces/IZoraMintsMinterManager.sol";
41-
import {IZoraMints1155} from "@zoralabs/mints-contracts/src/interfaces/IZoraMints1155.sol";
4240
import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
4341
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
44-
import {IMintWithMints} from "@zoralabs/mints-contracts/src/IMintWithMints.sol";
45-
import {Redemption} from "@zoralabs/mints-contracts/src/ZoraMintsTypes.sol";
4642
import {IReduceSupply} from "../interfaces/IReduceSupply.sol";
4743

4844
/// Imagine. Mint. Enjoy.
@@ -80,20 +76,14 @@ contract ZoraCreator1155Impl is
8076
uint256 public constant PERMISSION_BIT_FUNDS_MANAGER = 2 ** 5;
8177
/// @notice Factory contract
8278
IUpgradeGate internal immutable upgradeGate;
83-
/// @notice The mint token contract
84-
IZoraMintsMinterManager internal immutable mintsManager;
79+
80+
uint256 constant MINT_FEE = 0.000111 ether;
8581

8682
bytes4 constant ON_ERC1155_RECEIVED_HASH = IERC1155Receiver.onERC1155Received.selector;
8783
bytes4 constant ON_ERC1155_BATCH_RECEIVED_HASH = IERC1155Receiver.onERC1155BatchReceived.selector;
8884

89-
constructor(
90-
address _mintFeeRecipient,
91-
address _upgradeGate,
92-
address _protocolRewards,
93-
address _mints
94-
) RewardSplits(_protocolRewards, _mintFeeRecipient) initializer {
85+
constructor(address _mintFeeRecipient, address _upgradeGate, address _protocolRewards) RewardSplits(_protocolRewards, _mintFeeRecipient) initializer {
9586
upgradeGate = IUpgradeGate(_upgradeGate);
96-
mintsManager = IZoraMintsMinterManager(_mints);
9787
}
9888

9989
/// @notice Initializes the contract
@@ -229,14 +219,6 @@ contract ZoraCreator1155Impl is
229219
}
230220
}
231221

232-
modifier onlyMints() {
233-
if (msg.sender != address(mintsManager.zoraMints1155())) {
234-
revert OnlyTransfersFromZoraMints();
235-
}
236-
237-
_;
238-
}
239-
240222
/// @notice Modifier checking if the user is an admin or has a role
241223
/// @dev This reverts if the msg.sender is not an admin for the given token id or contract
242224
/// @param tokenId tokenId to check
@@ -533,7 +515,7 @@ contract ZoraCreator1155Impl is
533515
// Require admin from the minter to mint
534516
_requireAdminOrRole(address(minter), tokenId, PERMISSION_BIT_MINTER);
535517

536-
uint256 totalReward = mintsManager.getEthPrice() * quantity;
518+
uint256 totalReward = MINT_FEE * quantity;
537519

538520
_mintAndHandleRewards(minter, rewardsRecipients, msg.value, totalReward, tokenId, quantity, minterArguments);
539521
}
@@ -548,50 +530,8 @@ contract ZoraCreator1155Impl is
548530
}
549531
}
550532

551-
/// @notice Mint tokens and payout rewards given a minter contract, minter arguments, and rewards arguments,
552-
/// while MINTs are redeemed to pay for the mint fee, instead of paying with ETH directly.
553-
/// The MINTs must have been approved to be transferred to this contract from the msg.sender before calling this function.
554-
/// Value sent is used for paid mints, if this is a paid mint
555-
/// @param mintTokenIds The MINT token IDs that are to be redeemed
556-
/// @param quantities The quantities of each MINT token id to redeem
557-
/// @param minter The minter contract to use
558-
/// @param tokenId The token ID to mint
559-
/// @param rewardsRecipients The addresses of rewards arguments - rewardsRecipients[0] = mintReferral, rewardsRecipients[1] = platformReferral
560-
/// @param minterArguments The arguments to pass to the minter
561-
/// @param quantityMinted The total quantity of tokens minted
562-
function mintWithMints(
563-
uint256[] calldata mintTokenIds,
564-
uint256[] calldata quantities,
565-
IMinter1155 minter,
566-
uint256 tokenId,
567-
address[] memory rewardsRecipients,
568-
bytes calldata minterArguments
569-
) external payable returns (uint256 quantityMinted) {
570-
// Require admin from the minter to mint
571-
_requireAdminOrRole(address(minter), tokenId, PERMISSION_BIT_MINTER);
572-
573-
quantityMinted = _getTotalMintsQuantity(mintTokenIds, quantities);
574-
IZoraMints1155 mints = mintsManager.zoraMints1155();
575-
mints.safeBatchTransferFrom(msg.sender, address(this), mintTokenIds, quantities, "");
576-
Redemption[] memory redemptions = mints.redeemBatch(mintTokenIds, quantities, address(this));
577-
578-
uint256 totalEthReward = _getEthRedemptionTotal(redemptions);
579-
580-
_mintAndHandleRewards(minter, rewardsRecipients, msg.value + totalEthReward, totalEthReward, tokenId, quantityMinted, minterArguments);
581-
}
582-
583-
function _getEthRedemptionTotal(Redemption[] memory redemptions) private pure returns (uint256 totalEth) {
584-
for (uint256 i = 0; i < redemptions.length; i++) {
585-
if (redemptions[i].tokenAddress != address(0)) {
586-
revert NonEthRedemption();
587-
}
588-
589-
totalEth += redemptions[i].valueRedeemed;
590-
}
591-
}
592-
593533
function mintFee() external view returns (uint256) {
594-
return mintsManager.getEthPrice();
534+
return MINT_FEE;
595535
}
596536

597537
/// @notice Get the creator reward recipient address for a specific token.
@@ -712,7 +652,6 @@ contract ZoraCreator1155Impl is
712652
interfaceId == type(IHasSupportedPremintSignatureVersions).interfaceId ||
713653
interfaceId == type(ISupportsAABasedDelegatedTokenCreation).interfaceId ||
714654
interfaceId == type(IMintWithRewardsRecipients).interfaceId ||
715-
interfaceId == type(IMintWithMints).interfaceId ||
716655
interfaceId == type(IReduceSupply).interfaceId;
717656
}
718657

@@ -933,13 +872,4 @@ contract ZoraCreator1155Impl is
933872
// grant the token creator as admin of the newly created token
934873
_addPermission(newTokenId, creator, PERMISSION_BIT_ADMIN);
935874
}
936-
937-
// /// Allows receiving ERC1155 tokens
938-
function onERC1155Received(address, address, uint256, uint256, bytes calldata) external view onlyMints returns (bytes4) {
939-
return ON_ERC1155_RECEIVED_HASH;
940-
}
941-
942-
function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) external view onlyMints returns (bytes4) {
943-
return ON_ERC1155_BATCH_RECEIVED_HASH;
944-
}
945875
}

packages/1155-contracts/test/factory/ZoraCreator1155Factory.t.sol

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,17 @@ import {Zora1155} from "../../src/proxies/Zora1155.sol";
1515
import {UpgradeGate} from "../../src/upgrades/UpgradeGate.sol";
1616
import {MockContractMetadata} from "../mock/MockContractMetadata.sol";
1717
import {ProxyShim} from "../../src/utils/ProxyShim.sol";
18-
import {ZoraMintsFixtures} from "../fixtures/ZoraMintsFixtures.sol";
19-
import {IZoraMintsMinterManager} from "@zoralabs/mints-contracts/src/interfaces/IZoraMintsMinterManager.sol";
20-
import {IZoraMints1155} from "@zoralabs/mints-contracts/src/interfaces/IZoraMints1155.sol";
2118

2219
contract ZoraCreator1155FactoryTest is Test {
2320
using stdJson for string;
2421
address internal zora;
25-
uint256 internal mintFeeAmount;
26-
uint256 initialTokenId = 777;
27-
uint256 initialTokenPrice = 0.000777 ether;
2822

2923
ZoraCreator1155FactoryImpl internal factoryImpl;
3024
ZoraCreator1155FactoryImpl internal factory;
3125
UpgradeGate internal upgradeGate;
3226

3327
function setUp() external {
3428
zora = makeAddr("zora");
35-
mintFeeAmount = 0.000777 ether;
3629

3730
upgradeGate = new UpgradeGate();
3831
upgradeGate.initialize(zora);
@@ -41,8 +34,7 @@ contract ZoraCreator1155FactoryTest is Test {
4134
Zora1155Factory factoryProxy = new Zora1155Factory(factoryShimAddress, "");
4235

4336
ProtocolRewards protocolRewards = new ProtocolRewards();
44-
IZoraMintsMinterManager mints = ZoraMintsFixtures.createMockMints(initialTokenId, initialTokenPrice);
45-
ZoraCreator1155Impl zoraCreator1155Impl = new ZoraCreator1155Impl(zora, address(upgradeGate), address(protocolRewards), address(mints));
37+
ZoraCreator1155Impl zoraCreator1155Impl = new ZoraCreator1155Impl(zora, address(upgradeGate), address(protocolRewards));
4638

4739
factoryImpl = new ZoraCreator1155FactoryImpl(zoraCreator1155Impl, IMinter1155(address(1)), IMinter1155(address(2)), IMinter1155(address(3)));
4840
factory = ZoraCreator1155FactoryImpl(address(factoryProxy));
@@ -227,12 +219,7 @@ contract ZoraCreator1155FactoryTest is Test {
227219
// * create a new version of the erc1155 implementation
228220
// * create a new factory that points to that new erc1155 implementation,
229221
// * upgrade the proxy to point to the new factory
230-
IZoraCreator1155 newZoraCreator = new ZoraCreator1155Impl(
231-
zora,
232-
address(factory),
233-
address(new ProtocolRewards()),
234-
address(ZoraMintsFixtures.createMockMints(initialTokenId, initialTokenPrice))
235-
);
222+
IZoraCreator1155 newZoraCreator = new ZoraCreator1155Impl(zora, address(factory), address(new ProtocolRewards()));
236223

237224
ZoraCreator1155FactoryImpl newFactoryImpl = new ZoraCreator1155FactoryImpl(
238225
newZoraCreator,
@@ -281,12 +268,7 @@ contract ZoraCreator1155FactoryTest is Test {
281268
ZoraCreator1155Impl creatorProxy = ZoraCreator1155Impl(payable(createdAddress));
282269

283270
// 2. upgrade the created contract by creating a new contract and upgrading the existing one to point to it.
284-
IZoraCreator1155 newZoraCreator = new ZoraCreator1155Impl(
285-
zora,
286-
address(0),
287-
address(new ProtocolRewards()),
288-
address(ZoraMintsFixtures.createMockMints(initialTokenId, initialTokenPrice))
289-
);
271+
IZoraCreator1155 newZoraCreator = new ZoraCreator1155Impl(zora, address(0), address(new ProtocolRewards()));
290272

291273
address[] memory baseImpls = new address[](1);
292274
baseImpls[0] = address(factory.zora1155Impl());

packages/1155-contracts/test/fixtures/Zora1155FactoryFixtures.sol

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ import {IUpgradeGate} from "../../src/interfaces/IUpgradeGate.sol";
1414
import {UpgradeGate} from "../../src/upgrades/UpgradeGate.sol";
1515

1616
library Zora1155FactoryFixtures {
17-
function setupZora1155Impl(
18-
address zora,
19-
IUpgradeGate upgradeGate,
20-
address mints
21-
) internal returns (ProtocolRewards rewards, ZoraCreator1155Impl zora1155Impl) {
17+
function setupZora1155Impl(address zora, IUpgradeGate upgradeGate) internal returns (ProtocolRewards rewards, ZoraCreator1155Impl zora1155Impl) {
2218
rewards = new ProtocolRewards();
23-
zora1155Impl = new ZoraCreator1155Impl(zora, address(upgradeGate), address(rewards), mints);
19+
zora1155Impl = new ZoraCreator1155Impl(zora, address(upgradeGate), address(rewards));
2420
}
2521

2622
function upgradeFactoryProxyToUse1155(
@@ -45,17 +41,15 @@ library Zora1155FactoryFixtures {
4541
function setupNew1155AndFactory(
4642
address zora,
4743
IUpgradeGate upgradeGate,
48-
IMinter1155 fixedPriceMinter,
49-
address mints
44+
IMinter1155 fixedPriceMinter
5045
) internal returns (ProtocolRewards rewards, ZoraCreator1155Impl zoraCreator1155Impl, ZoraCreator1155FactoryImpl factoryImpl) {
51-
(rewards, zoraCreator1155Impl) = setupZora1155Impl(zora, upgradeGate, mints);
46+
(rewards, zoraCreator1155Impl) = setupZora1155Impl(zora, upgradeGate);
5247
factoryImpl = new ZoraCreator1155FactoryImpl(zoraCreator1155Impl, IMinter1155(address(1)), fixedPriceMinter, IMinter1155(address(3)));
5348
}
5449

5550
function setup1155AndFactoryProxy(
5651
address zora,
57-
address deployer,
58-
address mints
52+
address deployer
5953
)
6054
internal
6155
returns (
@@ -69,7 +63,7 @@ library Zora1155FactoryFixtures {
6963
factoryProxy = setupFactoryProxy(deployer);
7064
fixedPriceMinter = new ZoraCreatorFixedPriceSaleStrategy();
7165
upgradeGate = new UpgradeGate();
72-
(rewards, zoraCreator1155Impl) = setupZora1155Impl(zora, upgradeGate, mints);
66+
(rewards, zoraCreator1155Impl) = setupZora1155Impl(zora, upgradeGate);
7367
upgradeFactoryProxyToUse1155(factoryProxy, zoraCreator1155Impl, fixedPriceMinter, deployer);
7468
}
7569
}

0 commit comments

Comments
 (0)