Skip to content

Commit

Permalink
forge fmt, add Redeemed boolean trait to test script
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio committed Oct 25, 2023
1 parent 0ba0308 commit f3df598
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 7 additions & 1 deletion script/EmitDynamicTraitsTestEvents.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@ contract EmitDynamicTraitTestEvents is Script {
bytes32 birthdayValue4 = bytes32(uint256(765417860));
bytes32[] birthdayValues = Solarray.bytes32s(birthdayValue1, birthdayValue2, birthdayValue3, birthdayValue4);

bytes32 redeemedKey = keccak256("redeemed");
bytes32 redeemedValue1 = bytes32(0);
bytes32 redeemedValue2 = bytes32(uint256(1));
bytes32[] redeemedValues = Solarray.bytes32s(redeemedValue1, redeemedValue2);

function run() public {
vm.startBroadcast();

token = new ERC721DynamicTraitsMultiUpdate();

// Emit TraitUpdated
Expand Down Expand Up @@ -87,6 +92,7 @@ contract EmitDynamicTraitTestEvents is Script {

// Emit TraitUpdatedListUniformValue
token.setTraitsList(tokenIds, pointsKey, pointsValue1);
token.setTraitsList(tokenIds, redeemedKey, redeemedValue1);

// Emit TraitMetadataURIUpdated
// file: dynamic-traits-test-metadata.json
Expand Down
10 changes: 10 additions & 0 deletions script/dynamic-traits-test-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@
"0x0": null
}
}
},
"redeemed": {
"displayName": "Redeemed",
"dataType": {
"type": "boolean",
"valueMappings": {
"0x0": "No",
"0x0000000000000000000000000000000000000000000000000000000000000001": "Yes"
}
}
}
}
}
4 changes: 2 additions & 2 deletions src/dynamic-traits/interfaces/IERC7496.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.19;

interface IERC7496 {
/* Events */
event TraitUpdated(bytes32 indexed traitKey, uint256 tokenId, bytes32 trait);
event TraitUpdated(bytes32 indexed traitKey, uint256 tokenId, bytes32 traitValue);
event TraitUpdatedRange(bytes32 indexed traitKey, uint256 fromTokenId, uint256 toTokenId);
event TraitUpdatedRangeUniformValue(
bytes32 indexed traitKey, uint256 fromTokenId, uint256 toTokenId, bytes32 traitValue
Expand All @@ -21,7 +21,7 @@ interface IERC7496 {
function getTraitMetadataURI() external view returns (string memory uri);

/* Setters */
function setTrait(uint256 tokenId, bytes32 traitKey, bytes32 value) external;
function setTrait(uint256 tokenId, bytes32 traitKey, bytes32 traitValue) external;

/* Errors */
error TraitValueUnchanged();
Expand Down

0 comments on commit f3df598

Please sign in to comment.