Skip to content

Commit

Permalink
rebase off of main (#157)
Browse files Browse the repository at this point in the history
* [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 <8011362+PranavGarg01@users.noreply.github.com>
Co-authored-by: Joaquim Verges <joaquim.verges@gmail.com>
  • Loading branch information
3 people authored Sep 11, 2024
1 parent 21bf8d8 commit e77cb08
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/Core.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
if (interfaceId == 0xffffffff) {
return false;
}
if (interfaceId == 0x01ffc9a7) {
// ERC165 Interface ID for ERC165
return true;
}
if (supportedInterfaceRefCounter[interfaceId] > 0) {
return true;
}
Expand Down
12 changes: 6 additions & 6 deletions src/module/token/royalty/RoyaltyERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ contract RoyaltyERC1155 is
Module,
IInstallationCallback,
BeforeTransferCallbackERC1155,
BeforeBatchTransferCallbackERC1155
BeforeBatchTransferCallbackERC1155,
ICreatorToken
{

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

/// @notice Emitted when the transfer validator is updated.
event TransferValidatorUpdated(address oldValidator, address newValidator);

/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -126,8 +124,10 @@ contract RoyaltyERC1155 is
config.requiredInterfaces = new bytes4[](1);
config.requiredInterfaces[0] = 0xd9b67a26; // ERC1155

config.supportedInterfaces = new bytes4[](1);
config.supportedInterfaces = new bytes4[](3);
config.supportedInterfaces[0] = 0x2a55205a; // IERC2981.
config.supportedInterfaces[1] = 0xad0d7f6c; // ICreatorToken
config.supportedInterfaces[2] = 0xa07d229a; // ICreatorTokenLegacy

config.registerInstallationCallback = true;
}
Expand Down Expand Up @@ -245,7 +245,7 @@ contract RoyaltyERC1155 is

/// @notice Returns the transfer validator contract address for this token contract.
function getTransferValidator() public view returns (address validator) {
return _royaltyStorage().transferValidator;
validator = _royaltyStorage().transferValidator;
}

/**
Expand Down
17 changes: 11 additions & 6 deletions src/module/token/royalty/RoyaltyERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ library RoyaltyStorage {

}

contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackERC721 {
contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackERC721, ICreatorToken {

/*//////////////////////////////////////////////////////////////
CONSTANTS
//////////////////////////////////////////////////////////////*/

bytes32 private constant DEFAULT_ACCESS_CONTROL_ADMIN_ROLE = 0x00;

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

/// @notice Emitted when the transfer validator is updated.
event TransferValidatorUpdated(address oldValidator, address newValidator);

/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -119,8 +122,10 @@ contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackE
config.requiredInterfaces = new bytes4[](1);
config.requiredInterfaces[0] = 0x80ac58cd; // ERC721.

config.supportedInterfaces = new bytes4[](1);
config.supportedInterfaces = new bytes4[](3);
config.supportedInterfaces[0] = 0x2a55205a; // IERC2981.
config.supportedInterfaces[1] = 0xad0d7f6c; // ICreatorToken
config.supportedInterfaces[2] = 0xa07d229a; // ICreatorTokenLegacy

config.registerInstallationCallback = true;
}
Expand Down Expand Up @@ -223,7 +228,7 @@ contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackE

/// @notice Returns the transfer validator contract address for this token contract.
function getTransferValidator() public view returns (address validator) {
return _royaltyStorage().transferValidator;
validator = _royaltyStorage().transferValidator;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/module/token/transferable/CreatorTokenERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ contract CreatorTokenERC20 is Module, BeforeTransferCallbackERC20, ICreatorToken

/// @notice Returns the transfer validator contract address for this token contract.
function getTransferValidator() public view returns (address validator) {
return _creatorTokenStorage().transferValidator;
validator = _creatorTokenStorage().transferValidator;
}

/**
* @notice Returns the function selector for the transfer validator's validation function to be called
* @notice for transaction simulation.
*/
function getTransferValidationFunction() external pure returns (bytes4 functionSignature, bool isViewFunction) {
functionSignature = bytes4(keccak256("validateTransfer(address,address,address,uint256, uint256)"));
functionSignature = bytes4(keccak256("validateTransfer(address,address,address,uint256,uint256)"));
isViewFunction = true;
}

Expand Down

0 comments on commit e77cb08

Please sign in to comment.