Skip to content

Commit

Permalink
Add SoundEditionV2_1 and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized committed Nov 6, 2023
1 parent e8a50f4 commit 0b19c45
Show file tree
Hide file tree
Showing 3 changed files with 573 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/core/SoundEditionV2_1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ contract SoundEditionV2_1 is ISoundEditionV2_1, ERC721AQueryableUpgradeable, ERC
unchecked {
uint256 l = stop - start;
uint256 n = tierMinted(tier);
if (LibOps.or(start >= stop, stop > n)) revert InvalidQueryRange();
if (LibOps.or(start > stop, stop > n)) revert InvalidQueryRange();
tokenIds = new uint256[](l);
LibMap.Uint32Map storage m = _tierTokenIds[tier];
for (uint256 i; i != l; ++i) {
Expand Down
32 changes: 32 additions & 0 deletions tests/TestConfigV2_1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import "./TestPlus.sol";
import { SoundCreatorV1 } from "@core/SoundCreatorV1.sol";
import { ISoundEditionV2_1, SoundEditionV2_1 } from "@core/SoundEditionV2_1.sol";

contract TestConfigV2_1 is TestPlus {
uint256 internal _salt;

SoundCreatorV1 soundCreator;

function setUp() public virtual {
soundCreator = new SoundCreatorV1(address(new SoundEditionV2_1()));
}

function createSoundEdition(ISoundEditionV2_1.EditionInitialization memory init) public returns (SoundEditionV2_1) {
bytes memory initData = abi.encodeWithSelector(SoundEditionV2_1.initialize.selector, init);

address[] memory contracts;
bytes[] memory data;

soundCreator.createSoundAndMints(bytes32(++_salt), initData, contracts, data);
(address addr, ) = soundCreator.soundEditionAddress(address(this), bytes32(_salt));
return SoundEditionV2_1(addr);
}

function genericEditionInitialization() public view returns (ISoundEditionV2_1.EditionInitialization memory init) {
init.fundingRecipient = address(this);
init.tierCreations = new ISoundEditionV2_1.TierCreation[](1);
}
}
Loading

0 comments on commit 0b19c45

Please sign in to comment.