Skip to content

Commit

Permalink
Merge pull request #20 from ProjectOpenSea/ryan/updates
Browse files Browse the repository at this point in the history
small updates
  • Loading branch information
ryanio authored Feb 9, 2024
2 parents 51a13aa + b096439 commit 970e2e4
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 157 deletions.
4 changes: 1 addition & 3 deletions script/DeployAndConfigure1155Receive.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ contract DeployAndConfigure1155Receive is Script, Test {
recipient: payable(BURN_ADDRESS)
});

CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0].offer = offer;
requirements[0].consideration = consideration;

Expand Down
8 changes: 3 additions & 5 deletions script/DeployAndRedeemTokens-CampaignOnReceiveToken.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ contract DeployAndRedeemTokens_CampaignOnReceiveToken is Script, Test {
recipient: payable(BURN_ADDRESS)
});

CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0].offer = offer;
requirements[0].consideration = consideration;

Expand All @@ -54,7 +52,7 @@ contract DeployAndRedeemTokens_CampaignOnReceiveToken is Script, Test {
});
Campaign memory campaign = Campaign({params: params, requirements: requirements});
uint256 campaignId =
receiveToken.createCampaign(campaign, "ipfs://QmbFxYgQMoBSUNFyW7WRWGaAWwJiRPM6HbK86aFkSJSq5N");
receiveToken.createCampaign(campaign, "ipfs://Qmd1svWLxdjRUCxDCv6i6MFZtcU6SY56mD6JM8Ds1ZrXPB");

// Mint token 1 to redeem for token 1.
redeemToken.mint(msg.sender, 1);
Expand All @@ -77,8 +75,8 @@ contract DeployAndRedeemTokens_CampaignOnReceiveToken is Script, Test {
tokenIds[0] = 1;

// Individual user approvals not needed when setting the burn address.
redeemToken.setApprovalForAll(address(receiveToken), true);
// redeemToken.setBurnAddress(address(receiveToken));
redeemToken.setApprovalForAll(address(receiveToken), true);

receiveToken.redeem(tokenIds, msg.sender, data);

Expand Down
16 changes: 5 additions & 11 deletions script/DeployAndRedeemTokens.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ contract DeployAndRedeemTokens is Script, Test {
function run() external {
vm.startBroadcast();

ERC721ShipyardRedeemableOwnerMintable redeemToken = new ERC721ShipyardRedeemableOwnerMintable(
"TestRedeemablesRedeemToken",
"TEST"
);
ERC721ShipyardRedeemableOwnerMintable redeemToken =
new ERC721ShipyardRedeemableOwnerMintable("TestRedeemablesRedeemToken", "TEST");
address[] memory redeemTokens = new address[](1);
redeemTokens[0] = address(redeemToken);
ERC721ShipyardRedeemableMintable receiveToken = new ERC721ShipyardRedeemableMintable(
"TestRedeemablesRecieveToken",
"TEST"
);
ERC721ShipyardRedeemableMintable receiveToken =
new ERC721ShipyardRedeemableMintable("TestRedeemablesRecieveToken", "TEST");
receiveToken.setRedeemablesContracts(redeemTokens);

// Configure the campaign.
Expand All @@ -46,9 +42,7 @@ contract DeployAndRedeemTokens is Script, Test {
recipient: payable(BURN_ADDRESS)
});

CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0].offer = offer;
requirements[0].consideration = consideration;

Expand Down
16 changes: 5 additions & 11 deletions script/DeployAndRedeemTrait.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@ contract DeployAndRedeemTrait is Script, Test {
vm.startBroadcast();

// deploy the receive token first
ERC721ShipyardRedeemableMintable receiveToken = new ERC721ShipyardRedeemableMintable(
"TestRedeemablesRecieveToken",
"TEST"
);
ERC721ShipyardRedeemableMintable receiveToken =
new ERC721ShipyardRedeemableMintable("TestRedeemablesRecieveToken", "TEST");

// add the receive token address to allowed trait setters array
address[] memory allowedTraitSetters = new address[](1);
allowedTraitSetters[0] = address(receiveToken);

// deploy the redeem token
ERC721ShipyardRedeemableTraitSetters redeemToken = new ERC721ShipyardRedeemableTraitSetters(
"DynamicTraitsRedeemToken",
"TEST"
);
ERC721ShipyardRedeemableTraitSetters redeemToken =
new ERC721ShipyardRedeemableTraitSetters("DynamicTraitsRedeemToken", "TEST");
// set the receive token as an allowed trait setter
redeemToken.setAllowedTraitSetters(allowedTraitSetters);

Expand Down Expand Up @@ -66,9 +62,7 @@ contract DeployAndRedeemTrait is Script, Test {
substandardValue: substandardValue
});

CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0].offer = offer;
requirements[0].consideration = consideration;
requirements[0].traitRedemptions = traitRedemptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ contract DeployERC721ReceiveTokenWithPredeployedSeaDropRedeemToken is Script, Te
recipient: payable(BURN_ADDRESS)
});

CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0].offer = offer;
requirements[0].consideration = consideration;

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IShipyardContractMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface IShipyardContractMetadata {
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);

/// @dev Emit an event when the URI for the collection-level metadata is updated.
event ContractURIUpdated(string uri);
event ContractURIUpdated();

/// @dev Emit an event when the provenance hash is updated.
event ProvenanceHashUpdated(bytes32 oldProvenanceHash, bytes32 newProvenanceHash);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ERC1155ShipyardContractMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ contract ERC1155ShipyardContractMetadata is
contractURI = newURI;

// Emit an event with the update.
emit ContractURIUpdated(newURI);
emit ContractURIUpdated();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ERC721ShipyardContractMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ contract ERC721ShipyardContractMetadata is
contractURI = newURI;

// Emit an event with the update.
emit ContractURIUpdated(newURI);
emit ContractURIUpdated();
}

/**
Expand Down
30 changes: 8 additions & 22 deletions test/ERC7498-MultiRedeem.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,26 @@ contract ERC7498_MultiRedeem is BaseRedeemablesTest {
address secondRedeemTokenAddress;
_mintToken(address(context.erc7498Token), tokenId);
if (_isERC721(address(context.erc7498Token))) {
ERC721ShipyardRedeemableOwnerMintable secondRedeemToken721 = new ERC721ShipyardRedeemableOwnerMintable(
"",
""
);
ERC721ShipyardRedeemableOwnerMintable secondRedeemToken721 =
new ERC721ShipyardRedeemableOwnerMintable("", "");
secondRedeemTokenAddress = address(secondRedeemToken721);
vm.label(secondRedeemTokenAddress, "secondRedeemToken721");
secondRedeemToken721.setApprovalForAll(address(context.erc7498Token), true);
} else {
ERC1155ShipyardRedeemableOwnerMintable secondRedeemToken1155 = new ERC1155ShipyardRedeemableOwnerMintable(
"",
""
);
ERC1155ShipyardRedeemableOwnerMintable secondRedeemToken1155 =
new ERC1155ShipyardRedeemableOwnerMintable("", "");
secondRedeemTokenAddress = address(secondRedeemToken1155);
vm.label(secondRedeemTokenAddress, "secondRedeemToken1155");
secondRedeemToken1155.setApprovalForAll(address(context.erc7498Token), true);
}
_mintToken(secondRedeemTokenAddress, tokenId);

ERC721ShipyardRedeemableMintable receiveToken = new ERC721ShipyardRedeemableMintable(
"",
""
);
ERC721ShipyardRedeemableMintable receiveToken = new ERC721ShipyardRedeemableMintable("", "");
receiveToken.setRedeemablesContracts(erc7498Tokens);
ConsiderationItem[] memory consideration = new ConsiderationItem[](2);
consideration[0] = _getCampaignConsiderationItem(address(context.erc7498Token));
consideration[1] = _getCampaignConsiderationItem(secondRedeemTokenAddress);
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
OfferItem[] memory offer = new OfferItem[](1);
offer[0] = defaultCampaignOffer[0].withToken(address(receiveToken));
requirements[0].offer = offer;
Expand Down Expand Up @@ -107,10 +98,7 @@ contract ERC7498_MultiRedeem is BaseRedeemablesTest {

function burnOneErc721OrErc1155RedeemMultiErc1155(RedeemablesContext memory context) public {
_mintToken(address(context.erc7498Token), tokenId);
ERC1155ShipyardRedeemableMintable receiveToken = new ERC1155ShipyardRedeemableMintable(
"",
""
);
ERC1155ShipyardRedeemableMintable receiveToken = new ERC1155ShipyardRedeemableMintable("", "");
ERC721(address(context.erc7498Token)).setApprovalForAll(address(receiveToken), true);
OfferItem[] memory offer = new OfferItem[](3);
offer[0] = OfferItem({
Expand All @@ -136,9 +124,7 @@ contract ERC7498_MultiRedeem is BaseRedeemablesTest {
});
ConsiderationItem[] memory consideration = new ConsiderationItem[](1);
consideration[0] = _getCampaignConsiderationItem(address(context.erc7498Token));
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0].offer = offer;
requirements[0].consideration = consideration;
CampaignParams memory params = CampaignParams({
Expand Down
29 changes: 7 additions & 22 deletions test/ERC7498-Revert.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ contract ERC7498_Revert is BaseRedeemablesTest {
uint256 invalidTokenId = tokenId + 1;
_mintToken(erc7498Tokens[0], invalidTokenId, dillon.addr);

CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0] = CampaignRequirements({
offer: defaultCampaignOffer,
consideration: defaultCampaignConsideration,
Expand Down Expand Up @@ -71,10 +69,7 @@ contract ERC7498_Revert is BaseRedeemablesTest {

function testRevertConsiderationLengthNotMet() public {
_mintToken(erc7498Tokens[0], tokenId);
ERC721ShipyardRedeemableOwnerMintable secondRedeemToken = new ERC721ShipyardRedeemableOwnerMintable(
"",
""
);
ERC721ShipyardRedeemableOwnerMintable secondRedeemToken = new ERC721ShipyardRedeemableOwnerMintable("", "");
ConsiderationItem[] memory consideration = new ConsiderationItem[](2);
consideration[0] = ConsiderationItem({
itemType: ItemType.ERC721_WITH_CRITERIA,
Expand All @@ -92,9 +87,7 @@ contract ERC7498_Revert is BaseRedeemablesTest {
endAmount: 1,
recipient: payable(BURN_ADDRESS)
});
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0].offer = defaultCampaignOffer;
requirements[0].consideration = consideration;
CampaignParams memory params = CampaignParams({
Expand Down Expand Up @@ -153,9 +146,7 @@ contract ERC7498_Revert is BaseRedeemablesTest {
endAmount: 0.1 ether,
recipient: payable(dillon.addr)
});
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0].offer = offer;
requirements[0].consideration = consideration;
CampaignParams memory params = CampaignParams({
Expand Down Expand Up @@ -215,9 +206,7 @@ contract ERC7498_Revert is BaseRedeemablesTest {
endAmount: 0.1 ether,
recipient: payable(dillon.addr)
});
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0].offer = offer;
requirements[0].consideration = consideration;
CampaignParams memory params = CampaignParams({
Expand Down Expand Up @@ -255,9 +244,7 @@ contract ERC7498_Revert is BaseRedeemablesTest {
uint256 considerationTokenId = 1;
_mintToken(erc7498Tokens[0], tokenId);
_mintToken(erc7498Tokens[0], considerationTokenId);
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
ConsiderationItem[] memory consideration = new ConsiderationItem[](1);
consideration[0] = defaultCampaignConsideration[0].withIdentifierOrCriteria(considerationTokenId);
requirements[0] = CampaignRequirements({
Expand Down Expand Up @@ -300,9 +287,7 @@ contract ERC7498_Revert is BaseRedeemablesTest {
uint256 considerationTokenId = 1;
_mintToken(address(erc1155s[0]), tokenId);
_mintToken(address(erc1155s[0]), considerationTokenId);
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
ConsiderationItem[] memory consideration = new ConsiderationItem[](1);
consideration[0] = defaultCampaignConsideration[0].withToken(address(erc1155s[0])).withItemType(
ItemType.ERC1155
Expand Down
30 changes: 8 additions & 22 deletions test/ERC7498-SimpleRedeem.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest {
_mintToken(address(context.erc7498Token), tokenId);
ConsiderationItem[] memory consideration = new ConsiderationItem[](1);
consideration[0] = _getCampaignConsiderationItem(address(context.erc7498Token));
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0] = CampaignRequirements({
offer: defaultCampaignOffer,
consideration: consideration,
Expand Down Expand Up @@ -118,9 +116,7 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest {
// Set consideration recipient to greg.
address greg = makeAddr("greg");
consideration[0].recipient = payable(greg);
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
requirements[0] = CampaignRequirements({
offer: defaultCampaignOffer,
consideration: consideration,
Expand Down Expand Up @@ -166,10 +162,8 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest {
}

function burnErc721OrErc1155RedeemErc721WithSecondRequirementsIndex(RedeemablesContext memory context) public {
ERC721ShipyardRedeemableOwnerMintable firstRequirementRedeemToken = new ERC721ShipyardRedeemableOwnerMintable(
"",
""
);
ERC721ShipyardRedeemableOwnerMintable firstRequirementRedeemToken =
new ERC721ShipyardRedeemableOwnerMintable("", "");
vm.label(address(firstRequirementRedeemToken), "firstRequirementRedeemToken");
firstRequirementRedeemToken.setApprovalForAll(address(context.erc7498Token), true);

Expand All @@ -187,9 +181,7 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest {
});
ConsiderationItem[] memory secondRequirementConsideration = new ConsiderationItem[](1);
secondRequirementConsideration[0] = _getCampaignConsiderationItem(address(context.erc7498Token));
CampaignRequirements[] memory requirements = new CampaignRequirements[](
2
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](2);
requirements[0] = CampaignRequirements({
offer: defaultCampaignOffer,
consideration: firstRequirementConsideration,
Expand Down Expand Up @@ -241,9 +233,7 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest {

function testBurnErc20RedeemErc721() public {
erc20s[0].mint(address(this), 0.5 ether);
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
ConsiderationItem[] memory consideration = new ConsiderationItem[](1);
consideration[0] = defaultCampaignConsideration[0].withToken(address(erc20s[0])).withItemType(ItemType.ERC20)
.withStartAmount(0.5 ether).withEndAmount(0.5 ether);
Expand Down Expand Up @@ -284,9 +274,7 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest {

function testSendErc20RedeemErc721() public {
erc20s[0].mint(address(this), 0.5 ether);
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
ConsiderationItem[] memory consideration = new ConsiderationItem[](1);
consideration[0] = defaultCampaignConsideration[0].withToken(address(erc20s[0])).withItemType(ItemType.ERC20)
.withStartAmount(0.5 ether).withEndAmount(0.5 ether);
Expand Down Expand Up @@ -329,9 +317,7 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest {

function testBurnErc721RedeemErc1155() public {
_mintToken(address(erc7498Tokens[0]), tokenId);
CampaignRequirements[] memory requirements = new CampaignRequirements[](
1
);
CampaignRequirements[] memory requirements = new CampaignRequirements[](1);
OfferItem[] memory offer = new OfferItem[](1);
offer[0] = defaultCampaignOffer[0].withItemType(ItemType.ERC1155).withToken(address(receiveToken1155));
requirements[0] = CampaignRequirements({
Expand Down
Loading

0 comments on commit 970e2e4

Please sign in to comment.