Skip to content

Commit e77cb08

Browse files
GWSzetoPranavGarg01joaquim-verges
authored
rebase off of main (#157)
* [L-4] Wrong function selector returned for the transfer validation function (#150) * [L-4] Wrong function selector returned for the transfer validation function * [Q-3] Move interface identifier for ERC165 to Core * [Q-5] Royalty modules should inherit ICreatorToken interface * [Q-6] Nitpicks * removes duplicate supportsInterface (#156) * renamed to nextTokenIdToMint in BatchMetadata (#141) * fix: expectRevert on low-level call (#136) * update batchMetadata logic to make each batchUris independent (#144) * update batchMetadata logic to make each batchUris independent * format * Module Core Refactor (#145) * separated out metadata functionality from mintable module * built in signature mint into the core erc721 contract * implemented in Mintable * Implemented updateMetadata * simplified parameters and structs * all tests pass * updated ERC721 initializable to match ERC721Core * addressed the PR issues * updated 1155 versions to now match 721 implementations * completed all the tests * Implemented parity in the ERC1155Initializable contract * unified naming from quantity and value to amount * slapped on a keccak256 * move OwnableRoles check on the signature * removed double events being emitted * tests pass * updated ERC20 core * implemented Claimable and Mintable on the ERC20 side * tests pass * updated based on PR feedback * Fix getSupportedCallbackFunctions ub ERC721CoreInitializable (#149) * implmented delayed functionality into batchMetadata (#148) * implmented delayed functionality into batchMetadata * created tests for BatchMetadata * updated ERC1155 tests and updated from batchStartId to batchRange * Implement tokenIdERC1155 module to handle tokenId management (#147) * initial commit * created tests for tokenIdERC1155 * updated to be optional * updated naming and tests * Transfer validator has roles (#143) * created hasRole function in the roylaty module * created tests * Optimzed callback execution (#135) * gas benchmark * optimize execute callback function * fix typo * optimize execute callback view function * optimize callback mode loop * Implement Max per wallet (#151) * implemented maxMintPerWallet * tests pass * maxMintPerWalletExceeded tests pass * introduced base contracts for core and initilizable to inherit * rename commit * rename commit * renamed from core to coreInitializable for the ERC1155 (#152) * updated to now use 1e18 divided (#153) * Remove double initializer in ERC721CoreInitializable (#154) --------- Co-authored-by: Pranav Garg <[email protected]> Co-authored-by: Joaquim Verges <[email protected]>
1 parent 21bf8d8 commit e77cb08

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

src/Core.sol

+4
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
150150
if (interfaceId == 0xffffffff) {
151151
return false;
152152
}
153+
if (interfaceId == 0x01ffc9a7) {
154+
// ERC165 Interface ID for ERC165
155+
return true;
156+
}
153157
if (supportedInterfaceRefCounter[interfaceId] > 0) {
154158
return true;
155159
}

src/module/token/royalty/RoyaltyERC1155.sol

+6-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ contract RoyaltyERC1155 is
4545
Module,
4646
IInstallationCallback,
4747
BeforeTransferCallbackERC1155,
48-
BeforeBatchTransferCallbackERC1155
48+
BeforeBatchTransferCallbackERC1155,
49+
ICreatorToken
4950
{
5051

5152
/*//////////////////////////////////////////////////////////////
@@ -78,9 +79,6 @@ contract RoyaltyERC1155 is
7879
/// @notice Emitted when the royalty info for a specific NFT is updated.
7980
event TokenRoyaltyUpdated(uint256 indexed tokenId, address indexed recipient, uint16 bps);
8081

81-
/// @notice Emitted when the transfer validator is updated.
82-
event TransferValidatorUpdated(address oldValidator, address newValidator);
83-
8482
/*//////////////////////////////////////////////////////////////
8583
ERRORS
8684
//////////////////////////////////////////////////////////////*/
@@ -126,8 +124,10 @@ contract RoyaltyERC1155 is
126124
config.requiredInterfaces = new bytes4[](1);
127125
config.requiredInterfaces[0] = 0xd9b67a26; // ERC1155
128126

129-
config.supportedInterfaces = new bytes4[](1);
127+
config.supportedInterfaces = new bytes4[](3);
130128
config.supportedInterfaces[0] = 0x2a55205a; // IERC2981.
129+
config.supportedInterfaces[1] = 0xad0d7f6c; // ICreatorToken
130+
config.supportedInterfaces[2] = 0xa07d229a; // ICreatorTokenLegacy
131131

132132
config.registerInstallationCallback = true;
133133
}
@@ -245,7 +245,7 @@ contract RoyaltyERC1155 is
245245

246246
/// @notice Returns the transfer validator contract address for this token contract.
247247
function getTransferValidator() public view returns (address validator) {
248-
return _royaltyStorage().transferValidator;
248+
validator = _royaltyStorage().transferValidator;
249249
}
250250

251251
/**

src/module/token/royalty/RoyaltyERC721.sol

+11-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ library RoyaltyStorage {
4040

4141
}
4242

43-
contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackERC721 {
43+
contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackERC721, ICreatorToken {
44+
45+
/*//////////////////////////////////////////////////////////////
46+
CONSTANTS
47+
//////////////////////////////////////////////////////////////*/
48+
49+
bytes32 private constant DEFAULT_ACCESS_CONTROL_ADMIN_ROLE = 0x00;
4450

4551
/*//////////////////////////////////////////////////////////////
4652
CONSTANTS
@@ -72,9 +78,6 @@ contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackE
7278
/// @notice Emitted when the royalty info for a specific NFT is updated.
7379
event TokenRoyaltyUpdated(uint256 indexed tokenId, address indexed recipient, uint16 bps);
7480

75-
/// @notice Emitted when the transfer validator is updated.
76-
event TransferValidatorUpdated(address oldValidator, address newValidator);
77-
7881
/*//////////////////////////////////////////////////////////////
7982
ERRORS
8083
//////////////////////////////////////////////////////////////*/
@@ -119,8 +122,10 @@ contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackE
119122
config.requiredInterfaces = new bytes4[](1);
120123
config.requiredInterfaces[0] = 0x80ac58cd; // ERC721.
121124

122-
config.supportedInterfaces = new bytes4[](1);
125+
config.supportedInterfaces = new bytes4[](3);
123126
config.supportedInterfaces[0] = 0x2a55205a; // IERC2981.
127+
config.supportedInterfaces[1] = 0xad0d7f6c; // ICreatorToken
128+
config.supportedInterfaces[2] = 0xa07d229a; // ICreatorTokenLegacy
124129

125130
config.registerInstallationCallback = true;
126131
}
@@ -223,7 +228,7 @@ contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackE
223228

224229
/// @notice Returns the transfer validator contract address for this token contract.
225230
function getTransferValidator() public view returns (address validator) {
226-
return _royaltyStorage().transferValidator;
231+
validator = _royaltyStorage().transferValidator;
227232
}
228233

229234
/**

src/module/token/transferable/CreatorTokenERC20.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ contract CreatorTokenERC20 is Module, BeforeTransferCallbackERC20, ICreatorToken
8383

8484
/// @notice Returns the transfer validator contract address for this token contract.
8585
function getTransferValidator() public view returns (address validator) {
86-
return _creatorTokenStorage().transferValidator;
86+
validator = _creatorTokenStorage().transferValidator;
8787
}
8888

8989
/**
9090
* @notice Returns the function selector for the transfer validator's validation function to be called
9191
* @notice for transaction simulation.
9292
*/
9393
function getTransferValidationFunction() external pure returns (bytes4 functionSignature, bool isViewFunction) {
94-
functionSignature = bytes4(keccak256("validateTransfer(address,address,address,uint256, uint256)"));
94+
functionSignature = bytes4(keccak256("validateTransfer(address,address,address,uint256,uint256)"));
9595
isViewFunction = true;
9696
}
9797

0 commit comments

Comments
 (0)