From 2f96f4a6897c99ffc8371745c1805f15f3607146 Mon Sep 17 00:00:00 2001 From: Stanley Date: Tue, 19 Nov 2024 12:27:09 -0500 Subject: [PATCH 1/4] updated transferable to use onInstall to set transferEnabled to true update mintable to allow owner to be able to mint without mintable role implemented crosschainEncodeBytesOnInstall for crosschain modular contracts --- src/module/token/minting/ClaimableERC1155.sol | 5 +++++ src/module/token/minting/ClaimableERC20.sol | 5 +++++ src/module/token/minting/ClaimableERC721.sol | 5 +++++ src/module/token/minting/MintableERC1155.sol | 10 +++++++++- src/module/token/minting/MintableERC20.sol | 10 +++++++++- src/module/token/minting/MintableERC721.sol | 10 +++++++++- src/module/token/royalty/RoyaltyERC1155.sol | 9 +++++++++ src/module/token/royalty/RoyaltyERC721.sol | 9 +++++++++ .../token/transferable/TransferableERC1155.sol | 10 ++++++++++ .../token/transferable/TransferableERC20.sol | 10 ++++++++++ .../token/transferable/TransferableERC721.sol | 10 ++++++++++ test/module/minting/MintableERC1155.t.sol | 14 +++++++++++++- test/module/minting/MintableERC20.t.sol | 12 ++++++++++++ test/module/minting/MintableERC721.t.sol | 14 +++++++++++++- 14 files changed, 128 insertions(+), 5 deletions(-) diff --git a/src/module/token/minting/ClaimableERC1155.sol b/src/module/token/minting/ClaimableERC1155.sol index 82fb3861..96bfaf96 100644 --- a/src/module/token/minting/ClaimableERC1155.sol +++ b/src/module/token/minting/ClaimableERC1155.sol @@ -237,6 +237,11 @@ contract ClaimableERC1155 is /// @dev Called by a Core into an Module during the uninstallation of the Module. function onUninstall(bytes calldata data) external {} + /// @dev Returns bytes encoded for installing modules on cross-chain + function crosschainBytesOnInstall() external view returns (bytes memory) { + return abi.encode(_claimableStorage().saleConfig.primarySaleRecipient); + } + /*////////////////////////////////////////////////////////////// Encode install / uninstall data //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/ClaimableERC20.sol b/src/module/token/minting/ClaimableERC20.sol index 0f72d90f..957a9772 100644 --- a/src/module/token/minting/ClaimableERC20.sol +++ b/src/module/token/minting/ClaimableERC20.sol @@ -246,6 +246,11 @@ contract ClaimableERC20 is /// @dev Called by a Core into an Module during the uninstallation of the Module. function onUninstall(bytes calldata data) external {} + /// @dev Returns bytes encoded for installing modules on cross-chain + function crosschainBytesOnInstall() external view returns (bytes memory) { + return abi.encode(_claimableStorage().saleConfig.primarySaleRecipient); + } + /*////////////////////////////////////////////////////////////// Encode install / uninstall data //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/ClaimableERC721.sol b/src/module/token/minting/ClaimableERC721.sol index 3cf8d204..828c9e6a 100644 --- a/src/module/token/minting/ClaimableERC721.sol +++ b/src/module/token/minting/ClaimableERC721.sol @@ -230,6 +230,11 @@ contract ClaimableERC721 is /// @dev Called by a Core into an Module during the uninstallation of the Module. function onUninstall(bytes calldata data) external {} + /// @dev Returns bytes encoded for installing modules on cross-chain + function crosschainBytesOnInstall() external view returns (bytes memory) { + return abi.encode(_claimableStorage().saleConfig.primarySaleRecipient); + } + /*////////////////////////////////////////////////////////////// Encode install / uninstall data //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/MintableERC1155.sol b/src/module/token/minting/MintableERC1155.sol index e6c5ad95..4d1a5365 100644 --- a/src/module/token/minting/MintableERC1155.sol +++ b/src/module/token/minting/MintableERC1155.sol @@ -145,7 +145,10 @@ contract MintableERC1155 is override returns (bytes memory) { - if (!OwnableRoles(address(this)).hasAllRoles(msg.sender, Role._MINTER_ROLE)) { + if ( + OwnableRoles(address(this)).owner() != msg.sender + && !OwnableRoles(address(this)).hasAllRoles(msg.sender, Role._MINTER_ROLE) + ) { revert MintableRequestUnauthorized(); } } @@ -190,6 +193,11 @@ contract MintableERC1155 is return ""; } + /// @dev Returns bytes encoded for installing modules on cross-chain + function crosschainBytesOnInstall() external view returns (bytes memory) { + return abi.encode(_mintableStorage().saleConfig.primarySaleRecipient); + } + /*////////////////////////////////////////////////////////////// Encode mint params //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/MintableERC20.sol b/src/module/token/minting/MintableERC20.sol index 235cee01..5cdb819b 100644 --- a/src/module/token/minting/MintableERC20.sol +++ b/src/module/token/minting/MintableERC20.sol @@ -148,7 +148,10 @@ contract MintableERC20 is override returns (bytes memory) { - if (!OwnableRoles(address(this)).hasAllRoles(msg.sender, Role._MINTER_ROLE)) { + if ( + OwnableRoles(address(this)).owner() != msg.sender + && !OwnableRoles(address(this)).hasAllRoles(msg.sender, Role._MINTER_ROLE) + ) { revert MintableRequestUnauthorized(); } } @@ -196,6 +199,11 @@ contract MintableERC20 is return ""; } + /// @dev Returns bytes encoded for installing modules on cross-chain + function crosschainBytesOnInstall() external view returns (bytes memory) { + return abi.encode(_mintableStorage().saleConfig.primarySaleRecipient); + } + /*////////////////////////////////////////////////////////////// Encode mint params //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/MintableERC721.sol b/src/module/token/minting/MintableERC721.sol index 136394b9..dbe7c349 100644 --- a/src/module/token/minting/MintableERC721.sol +++ b/src/module/token/minting/MintableERC721.sol @@ -150,7 +150,10 @@ contract MintableERC721 is override returns (bytes memory) { - if (!OwnableRoles(address(this)).hasAllRoles(msg.sender, Role._MINTER_ROLE)) { + if ( + OwnableRoles(address(this)).owner() != msg.sender + && !OwnableRoles(address(this)).hasAllRoles(msg.sender, Role._MINTER_ROLE) + ) { revert MintableRequestUnauthorized(); } } @@ -182,6 +185,11 @@ contract MintableERC721 is /// @dev Called by a Core into an Module during the uninstallation of the Module. function onUninstall(bytes calldata data) external {} + /// @dev Returns bytes encoded for installing modules on cross-chain + function crosschainBytesOnInstall() external view returns (bytes memory) { + return abi.encode(_mintableStorage().saleConfig.primarySaleRecipient); + } + /*////////////////////////////////////////////////////////////// Encode install / uninstall data //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/royalty/RoyaltyERC1155.sol b/src/module/token/royalty/RoyaltyERC1155.sol index 456bd86a..d41a6740 100644 --- a/src/module/token/royalty/RoyaltyERC1155.sol +++ b/src/module/token/royalty/RoyaltyERC1155.sol @@ -150,6 +150,15 @@ contract RoyaltyERC1155 is return ""; } + /// @dev Returns bytes encoded for installing modules on cross-chain + function crosschainBytesOnInstall() external view returns (bytes memory) { + return abi.encode( + _royaltyStorage().defaultRoyaltyInfo.recipient, + _royaltyStorage().defaultRoyaltyInfo.bps, + _royaltyStorage().transferValidator + ); + } + /*////////////////////////////////////////////////////////////// CALLBACK FUNCTIONS //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/royalty/RoyaltyERC721.sol b/src/module/token/royalty/RoyaltyERC721.sol index ca9b8379..e9207f58 100644 --- a/src/module/token/royalty/RoyaltyERC721.sol +++ b/src/module/token/royalty/RoyaltyERC721.sol @@ -142,6 +142,15 @@ contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackE return ""; } + /// @dev Returns bytes encoded for installing modules on cross-chain + function crosschainBytesOnInstall() external view returns (bytes memory) { + return abi.encode( + _royaltyStorage().defaultRoyaltyInfo.recipient, + _royaltyStorage().defaultRoyaltyInfo.bps, + _royaltyStorage().transferValidator + ); + } + /*////////////////////////////////////////////////////////////// CALLBACK FUNCTIONS //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/transferable/TransferableERC1155.sol b/src/module/token/transferable/TransferableERC1155.sol index 20423902..9985ee9f 100644 --- a/src/module/token/transferable/TransferableERC1155.sol +++ b/src/module/token/transferable/TransferableERC1155.sol @@ -60,8 +60,18 @@ contract TransferableERC1155 is Module, BeforeTransferCallbackERC1155, BeforeBat config.requiredInterfaces = new bytes4[](1); config.requiredInterfaces[0] = 0xd9b67a26; // ERC1155 + + config.registerInstallationCallback = true; + } + + /// @dev Called by a Core into an Module during the installation of the Module. + function onInstall(bytes calldata data) external { + _transferableStorage().transferEnabled = true; } + /// @dev Called by a Core into an Module during the uninstallation of the Module. + function onUninstall(bytes calldata data) external {} + /*////////////////////////////////////////////////////////////// CALLBACK FUNCTIONS //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/transferable/TransferableERC20.sol b/src/module/token/transferable/TransferableERC20.sol index 9dd747b0..e689e133 100644 --- a/src/module/token/transferable/TransferableERC20.sol +++ b/src/module/token/transferable/TransferableERC20.sol @@ -54,8 +54,18 @@ contract TransferableERC20 is Module, BeforeTransferCallbackERC20 { FallbackFunction({selector: this.setTransferable.selector, permissionBits: Role._MANAGER_ROLE}); config.fallbackFunctions[3] = FallbackFunction({selector: this.setTransferableFor.selector, permissionBits: Role._MANAGER_ROLE}); + + config.registerInstallationCallback = true; + } + + /// @dev Called by a Core into an Module during the installation of the Module. + function onInstall(bytes calldata data) external { + _transferableStorage().transferEnabled = true; } + /// @dev Called by a Core into an Module during the uninstallation of the Module. + function onUninstall(bytes calldata data) external {} + /*////////////////////////////////////////////////////////////// CALLBACK FUNCTIONS //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/transferable/TransferableERC721.sol b/src/module/token/transferable/TransferableERC721.sol index d43aad29..47ead416 100644 --- a/src/module/token/transferable/TransferableERC721.sol +++ b/src/module/token/transferable/TransferableERC721.sol @@ -57,8 +57,18 @@ contract TransferableERC721 is Module, BeforeTransferCallbackERC721 { config.requiredInterfaces = new bytes4[](1); config.requiredInterfaces[0] = 0x80ac58cd; // ERC721. + + config.registerInstallationCallback = true; + } + + /// @dev Called by a Core into an Module during the installation of the Module. + function onInstall(bytes calldata data) external { + _transferableStorage().transferEnabled = true; } + /// @dev Called by a Core into an Module during the uninstallation of the Module. + function onUninstall(bytes calldata data) external {} + /*////////////////////////////////////////////////////////////// CALLBACK FUNCTIONS //////////////////////////////////////////////////////////////*/ diff --git a/test/module/minting/MintableERC1155.t.sol b/test/module/minting/MintableERC1155.t.sol index 522daf03..8d2de48a 100644 --- a/test/module/minting/MintableERC1155.t.sol +++ b/test/module/minting/MintableERC1155.t.sol @@ -188,7 +188,7 @@ contract MintableERC1155Test is Test { ); // Check minted balance - assertEq(core.balanceOf(address(0x123), tokenId), amount); + assertEq(core.balanceOf(tokenRecipient, tokenId), amount); uint256 salePrice = (amount * mintRequest.pricePerUnit); (uint256 primarySaleAmount, uint256 platformFeeAmount) = @@ -198,6 +198,18 @@ contract MintableERC1155Test is Test { assertEq(feeRecipient.balance, platformFeeAmount, "feeRecipient balance"); } + function test_simple_mint() public { + vm.prank(owner); + core.mint(owner, tokenId, amount, "", ""); + + assertEq(core.balanceOf(owner, tokenId), amount); + + vm.prank(permissionedActor); + core.mint(permissionedActor, tokenId, amount, "", ""); + + assertEq(core.balanceOf(permissionedActor, tokenId), amount); + } + function test_mint_revert_unableToDecodeArgs() public { vm.deal(tokenRecipient, 100 ether); diff --git a/test/module/minting/MintableERC20.t.sol b/test/module/minting/MintableERC20.t.sol index 4a2fc009..bc69726c 100644 --- a/test/module/minting/MintableERC20.t.sol +++ b/test/module/minting/MintableERC20.t.sol @@ -186,6 +186,18 @@ contract MintableERC20Test is Test { assertEq(feeRecipient.balance, platformFeeAmount, "feeRecipient balance"); } + function test_simple_mint() public { + vm.prank(owner); + core.mint(owner, amount, ""); + + assertEq(core.balanceOf(owner), amount); + + vm.prank(permissionedActor); + core.mint(permissionedActor, amount, ""); + + assertEq(core.balanceOf(permissionedActor), amount); + } + function test_mint_revert_unableToDecodeArgs() public { vm.deal(tokenRecipient, 100 ether); diff --git a/test/module/minting/MintableERC721.t.sol b/test/module/minting/MintableERC721.t.sol index 5fd4c52c..f0fc1fb0 100644 --- a/test/module/minting/MintableERC721.t.sol +++ b/test/module/minting/MintableERC721.t.sol @@ -186,7 +186,7 @@ contract MintableERC721Test is Test { ); // Check minted balance - assertEq(core.balanceOf(address(0x123)), amount); + assertEq(core.balanceOf(tokenRecipient), amount); uint256 salePrice = (amount * mintRequest.pricePerUnit); (uint256 primarySaleAmount, uint256 platformFeeAmount) = @@ -196,6 +196,18 @@ contract MintableERC721Test is Test { assertEq(feeRecipient.balance, platformFeeAmount, "feeRecipient balance"); } + function test_simple_mint() public { + vm.prank(owner); + core.mint(owner, amount, "", ""); + + assertEq(core.balanceOf(owner), amount); + + vm.prank(permissionedActor); + core.mint(permissionedActor, amount, "", ""); + + assertEq(core.balanceOf(permissionedActor), amount); + } + function test_mint_revert_unableToDecodeArgs() public { vm.deal(tokenRecipient, 100 ether); From ea988cdd84163b220a278254ac4d1842871adec7 Mon Sep 17 00:00:00 2001 From: Stanley Date: Fri, 29 Nov 2024 18:33:46 -0500 Subject: [PATCH 2/4] updated init function to now emit initializer function params --- src/core/token/ERC1155Base.sol | 12 ++++++++++++ src/core/token/ERC20Base.sol | 12 ++++++++++++ src/core/token/ERC721Base.sol | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/core/token/ERC1155Base.sol b/src/core/token/ERC1155Base.sol index fcc4d19c..aaeaf7c5 100644 --- a/src/core/token/ERC1155Base.sol +++ b/src/core/token/ERC1155Base.sol @@ -53,6 +53,16 @@ contract ERC1155Base is ERC1155, Core, Multicallable, EIP712 { /// @notice Emitted when the contract URI is updated. event ContractURIUpdated(); + /// @notice Emitted when the contract URI is updated. + event ContractInitialized( + string _name, + string _symbol, + string _contractURI, + address _owner, + address[] _modules, + bytes[] _moduleInstallData + ); + /*////////////////////////////////////////////////////////////// ERRORS //////////////////////////////////////////////////////////////*/ @@ -82,6 +92,8 @@ contract ERC1155Base is ERC1155, Core, Multicallable, EIP712 { for (uint256 i = 0; i < _modules.length; i++) { _installModule(_modules[i], _moduleInstallData[i]); } + + emit ContractInitialized(_name, _symbol, _contractURI, _owner, _modules, _moduleInstallData); } /*////////////////////////////////////////////////////////////// diff --git a/src/core/token/ERC20Base.sol b/src/core/token/ERC20Base.sol index 952c027f..d2af99dc 100644 --- a/src/core/token/ERC20Base.sol +++ b/src/core/token/ERC20Base.sol @@ -48,6 +48,16 @@ contract ERC20Base is ERC20, Multicallable, Core, EIP712 { /// @notice Emitted when the contract URI is updated. event ContractURIUpdated(); + /// @notice Emitted when the contract is initialized. + event ContractInitialized( + string _name, + string _symbol, + string _contractURI, + address _owner, + address[] _modules, + bytes[] _moduleInstallData + ); + /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ @@ -71,6 +81,8 @@ contract ERC20Base is ERC20, Multicallable, Core, EIP712 { for (uint256 i = 0; i < _modules.length; i++) { _installModule(_modules[i], _moduleInstallData[i]); } + + emit ContractInitialized(_name, _symbol, _contractURI, _owner, _modules, _moduleInstallData); } /*////////////////////////////////////////////////////////////// diff --git a/src/core/token/ERC721Base.sol b/src/core/token/ERC721Base.sol index 42a5827b..166dbb06 100644 --- a/src/core/token/ERC721Base.sol +++ b/src/core/token/ERC721Base.sol @@ -48,6 +48,16 @@ contract ERC721Base is ERC721AQueryableUpgradeable, Core, Multicallable, EIP712 /// @notice Emitted when the contract URI is updated. event ContractURIUpdated(); + /// @notice Emitted when the contract URI is updated. + event ContractInitialized( + string _name, + string _symbol, + string _contractURI, + address _owner, + address[] _modules, + bytes[] _moduleInstallData + ); + /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ @@ -70,6 +80,8 @@ contract ERC721Base is ERC721AQueryableUpgradeable, Core, Multicallable, EIP712 for (uint256 i = 0; i < _modules.length; i++) { _installModule(_modules[i], _moduleInstallData[i]); } + + emit ContractInitialized(_name, _symbol, _contractURI, _owner, _modules, _moduleInstallData); } /*////////////////////////////////////////////////////////////// From 797b0e927e2d3e7bbecd8ee17e9e4c0d8192b11e Mon Sep 17 00:00:00 2001 From: Stanley Date: Fri, 6 Dec 2024 17:51:15 -0500 Subject: [PATCH 3/4] removed crosschain install function --- src/module/token/minting/ClaimableERC1155.sol | 5 ----- src/module/token/minting/ClaimableERC20.sol | 5 ----- src/module/token/minting/ClaimableERC721.sol | 5 ----- src/module/token/minting/MintableERC1155.sol | 5 ----- src/module/token/minting/MintableERC20.sol | 5 ----- src/module/token/minting/MintableERC721.sol | 5 ----- src/module/token/royalty/RoyaltyERC1155.sol | 9 --------- src/module/token/royalty/RoyaltyERC721.sol | 9 --------- src/module/token/transferable/TransferableERC1155.sol | 8 ++++++++ src/module/token/transferable/TransferableERC20.sol | 8 ++++++++ src/module/token/transferable/TransferableERC721.sol | 8 ++++++++ 11 files changed, 24 insertions(+), 48 deletions(-) diff --git a/src/module/token/minting/ClaimableERC1155.sol b/src/module/token/minting/ClaimableERC1155.sol index 96bfaf96..82fb3861 100644 --- a/src/module/token/minting/ClaimableERC1155.sol +++ b/src/module/token/minting/ClaimableERC1155.sol @@ -237,11 +237,6 @@ contract ClaimableERC1155 is /// @dev Called by a Core into an Module during the uninstallation of the Module. function onUninstall(bytes calldata data) external {} - /// @dev Returns bytes encoded for installing modules on cross-chain - function crosschainBytesOnInstall() external view returns (bytes memory) { - return abi.encode(_claimableStorage().saleConfig.primarySaleRecipient); - } - /*////////////////////////////////////////////////////////////// Encode install / uninstall data //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/ClaimableERC20.sol b/src/module/token/minting/ClaimableERC20.sol index 957a9772..0f72d90f 100644 --- a/src/module/token/minting/ClaimableERC20.sol +++ b/src/module/token/minting/ClaimableERC20.sol @@ -246,11 +246,6 @@ contract ClaimableERC20 is /// @dev Called by a Core into an Module during the uninstallation of the Module. function onUninstall(bytes calldata data) external {} - /// @dev Returns bytes encoded for installing modules on cross-chain - function crosschainBytesOnInstall() external view returns (bytes memory) { - return abi.encode(_claimableStorage().saleConfig.primarySaleRecipient); - } - /*////////////////////////////////////////////////////////////// Encode install / uninstall data //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/ClaimableERC721.sol b/src/module/token/minting/ClaimableERC721.sol index 828c9e6a..3cf8d204 100644 --- a/src/module/token/minting/ClaimableERC721.sol +++ b/src/module/token/minting/ClaimableERC721.sol @@ -230,11 +230,6 @@ contract ClaimableERC721 is /// @dev Called by a Core into an Module during the uninstallation of the Module. function onUninstall(bytes calldata data) external {} - /// @dev Returns bytes encoded for installing modules on cross-chain - function crosschainBytesOnInstall() external view returns (bytes memory) { - return abi.encode(_claimableStorage().saleConfig.primarySaleRecipient); - } - /*////////////////////////////////////////////////////////////// Encode install / uninstall data //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/MintableERC1155.sol b/src/module/token/minting/MintableERC1155.sol index 4d1a5365..793a7894 100644 --- a/src/module/token/minting/MintableERC1155.sol +++ b/src/module/token/minting/MintableERC1155.sol @@ -193,11 +193,6 @@ contract MintableERC1155 is return ""; } - /// @dev Returns bytes encoded for installing modules on cross-chain - function crosschainBytesOnInstall() external view returns (bytes memory) { - return abi.encode(_mintableStorage().saleConfig.primarySaleRecipient); - } - /*////////////////////////////////////////////////////////////// Encode mint params //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/MintableERC20.sol b/src/module/token/minting/MintableERC20.sol index 5cdb819b..d00bd703 100644 --- a/src/module/token/minting/MintableERC20.sol +++ b/src/module/token/minting/MintableERC20.sol @@ -199,11 +199,6 @@ contract MintableERC20 is return ""; } - /// @dev Returns bytes encoded for installing modules on cross-chain - function crosschainBytesOnInstall() external view returns (bytes memory) { - return abi.encode(_mintableStorage().saleConfig.primarySaleRecipient); - } - /*////////////////////////////////////////////////////////////// Encode mint params //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/minting/MintableERC721.sol b/src/module/token/minting/MintableERC721.sol index dbe7c349..9c1be9e1 100644 --- a/src/module/token/minting/MintableERC721.sol +++ b/src/module/token/minting/MintableERC721.sol @@ -185,11 +185,6 @@ contract MintableERC721 is /// @dev Called by a Core into an Module during the uninstallation of the Module. function onUninstall(bytes calldata data) external {} - /// @dev Returns bytes encoded for installing modules on cross-chain - function crosschainBytesOnInstall() external view returns (bytes memory) { - return abi.encode(_mintableStorage().saleConfig.primarySaleRecipient); - } - /*////////////////////////////////////////////////////////////// Encode install / uninstall data //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/royalty/RoyaltyERC1155.sol b/src/module/token/royalty/RoyaltyERC1155.sol index d41a6740..456bd86a 100644 --- a/src/module/token/royalty/RoyaltyERC1155.sol +++ b/src/module/token/royalty/RoyaltyERC1155.sol @@ -150,15 +150,6 @@ contract RoyaltyERC1155 is return ""; } - /// @dev Returns bytes encoded for installing modules on cross-chain - function crosschainBytesOnInstall() external view returns (bytes memory) { - return abi.encode( - _royaltyStorage().defaultRoyaltyInfo.recipient, - _royaltyStorage().defaultRoyaltyInfo.bps, - _royaltyStorage().transferValidator - ); - } - /*////////////////////////////////////////////////////////////// CALLBACK FUNCTIONS //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/royalty/RoyaltyERC721.sol b/src/module/token/royalty/RoyaltyERC721.sol index e9207f58..ca9b8379 100644 --- a/src/module/token/royalty/RoyaltyERC721.sol +++ b/src/module/token/royalty/RoyaltyERC721.sol @@ -142,15 +142,6 @@ contract RoyaltyERC721 is Module, IInstallationCallback, BeforeTransferCallbackE return ""; } - /// @dev Returns bytes encoded for installing modules on cross-chain - function crosschainBytesOnInstall() external view returns (bytes memory) { - return abi.encode( - _royaltyStorage().defaultRoyaltyInfo.recipient, - _royaltyStorage().defaultRoyaltyInfo.bps, - _royaltyStorage().transferValidator - ); - } - /*////////////////////////////////////////////////////////////// CALLBACK FUNCTIONS //////////////////////////////////////////////////////////////*/ diff --git a/src/module/token/transferable/TransferableERC1155.sol b/src/module/token/transferable/TransferableERC1155.sol index 9985ee9f..20b04adf 100644 --- a/src/module/token/transferable/TransferableERC1155.sol +++ b/src/module/token/transferable/TransferableERC1155.sol @@ -38,6 +38,13 @@ contract TransferableERC1155 is Module, BeforeTransferCallbackERC1155, BeforeBat /// @notice Emitted on attempt to transfer a token when transfers are disabled. error TransferDisabled(); + /*////////////////////////////////////////////////////////////// + EVENTS + //////////////////////////////////////////////////////////////*/ + + /// @notice Emitted on attempt to transfer a token when transfers are disabled. + event TransferEnableFor(address indexed target, bool enabled); + /*////////////////////////////////////////////////////////////// MODULE CONFIG //////////////////////////////////////////////////////////////*/ @@ -130,6 +137,7 @@ contract TransferableERC1155 is Module, BeforeTransferCallbackERC1155, BeforeBat /// @notice Set transferability for an operator for a token. function setTransferableFor(address target, bool enableTransfer) external { _transferableStorage().transferEnabledFor[target] = enableTransfer; + emit TransferEnableFor(target, enableTransfer); } /*////////////////////////////////////////////////////////////// diff --git a/src/module/token/transferable/TransferableERC20.sol b/src/module/token/transferable/TransferableERC20.sol index e689e133..163a68f0 100644 --- a/src/module/token/transferable/TransferableERC20.sol +++ b/src/module/token/transferable/TransferableERC20.sol @@ -36,6 +36,13 @@ contract TransferableERC20 is Module, BeforeTransferCallbackERC20 { /// @notice Emitted on attempt to transfer a token when transfers are disabled. error TransferDisabled(); + /*////////////////////////////////////////////////////////////// + EVENTS + //////////////////////////////////////////////////////////////*/ + + /// @notice Emitted on attempt to transfer a token when transfers are disabled. + event TransferEnableFor(address indexed target, bool enabled); + /*////////////////////////////////////////////////////////////// MODULE CONFIG //////////////////////////////////////////////////////////////*/ @@ -103,6 +110,7 @@ contract TransferableERC20 is Module, BeforeTransferCallbackERC20 { /// @notice Set transferability for an address for a token. function setTransferableFor(address target, bool enableTransfer) external { _transferableStorage().transferEnabledFor[target] = enableTransfer; + emit TransferEnableFor(target, enableTransfer); } /*////////////////////////////////////////////////////////////// diff --git a/src/module/token/transferable/TransferableERC721.sol b/src/module/token/transferable/TransferableERC721.sol index 47ead416..e1b1b6d0 100644 --- a/src/module/token/transferable/TransferableERC721.sol +++ b/src/module/token/transferable/TransferableERC721.sol @@ -36,6 +36,13 @@ contract TransferableERC721 is Module, BeforeTransferCallbackERC721 { /// @notice Emitted on attempt to transfer a token when transfers are disabled. error TransferDisabled(); + /*////////////////////////////////////////////////////////////// + EVENTS + //////////////////////////////////////////////////////////////*/ + + /// @notice Emitted on attempt to transfer a token when transfers are disabled. + event TransferEnableFor(address indexed target, bool enabled); + /*////////////////////////////////////////////////////////////// MODULE CONFIG //////////////////////////////////////////////////////////////*/ @@ -106,6 +113,7 @@ contract TransferableERC721 is Module, BeforeTransferCallbackERC721 { /// @notice Set transferability for an address for a token. function setTransferableFor(address target, bool enableTransfer) external { _transferableStorage().transferEnabledFor[target] = enableTransfer; + emit TransferEnableFor(target, enableTransfer); } /*////////////////////////////////////////////////////////////// From 92cb2e683f49480f321a55b05eb53ade15e99bb2 Mon Sep 17 00:00:00 2001 From: Stanley Date: Fri, 6 Dec 2024 17:53:21 -0500 Subject: [PATCH 4/4] removed contract initialized event --- src/core/token/ERC1155Base.sol | 12 ------------ src/core/token/ERC20Base.sol | 12 ------------ src/core/token/ERC721Base.sol | 12 ------------ 3 files changed, 36 deletions(-) diff --git a/src/core/token/ERC1155Base.sol b/src/core/token/ERC1155Base.sol index aaeaf7c5..fcc4d19c 100644 --- a/src/core/token/ERC1155Base.sol +++ b/src/core/token/ERC1155Base.sol @@ -53,16 +53,6 @@ contract ERC1155Base is ERC1155, Core, Multicallable, EIP712 { /// @notice Emitted when the contract URI is updated. event ContractURIUpdated(); - /// @notice Emitted when the contract URI is updated. - event ContractInitialized( - string _name, - string _symbol, - string _contractURI, - address _owner, - address[] _modules, - bytes[] _moduleInstallData - ); - /*////////////////////////////////////////////////////////////// ERRORS //////////////////////////////////////////////////////////////*/ @@ -92,8 +82,6 @@ contract ERC1155Base is ERC1155, Core, Multicallable, EIP712 { for (uint256 i = 0; i < _modules.length; i++) { _installModule(_modules[i], _moduleInstallData[i]); } - - emit ContractInitialized(_name, _symbol, _contractURI, _owner, _modules, _moduleInstallData); } /*////////////////////////////////////////////////////////////// diff --git a/src/core/token/ERC20Base.sol b/src/core/token/ERC20Base.sol index d2af99dc..952c027f 100644 --- a/src/core/token/ERC20Base.sol +++ b/src/core/token/ERC20Base.sol @@ -48,16 +48,6 @@ contract ERC20Base is ERC20, Multicallable, Core, EIP712 { /// @notice Emitted when the contract URI is updated. event ContractURIUpdated(); - /// @notice Emitted when the contract is initialized. - event ContractInitialized( - string _name, - string _symbol, - string _contractURI, - address _owner, - address[] _modules, - bytes[] _moduleInstallData - ); - /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ @@ -81,8 +71,6 @@ contract ERC20Base is ERC20, Multicallable, Core, EIP712 { for (uint256 i = 0; i < _modules.length; i++) { _installModule(_modules[i], _moduleInstallData[i]); } - - emit ContractInitialized(_name, _symbol, _contractURI, _owner, _modules, _moduleInstallData); } /*////////////////////////////////////////////////////////////// diff --git a/src/core/token/ERC721Base.sol b/src/core/token/ERC721Base.sol index 166dbb06..42a5827b 100644 --- a/src/core/token/ERC721Base.sol +++ b/src/core/token/ERC721Base.sol @@ -48,16 +48,6 @@ contract ERC721Base is ERC721AQueryableUpgradeable, Core, Multicallable, EIP712 /// @notice Emitted when the contract URI is updated. event ContractURIUpdated(); - /// @notice Emitted when the contract URI is updated. - event ContractInitialized( - string _name, - string _symbol, - string _contractURI, - address _owner, - address[] _modules, - bytes[] _moduleInstallData - ); - /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ @@ -80,8 +70,6 @@ contract ERC721Base is ERC721AQueryableUpgradeable, Core, Multicallable, EIP712 for (uint256 i = 0; i < _modules.length; i++) { _installModule(_modules[i], _moduleInstallData[i]); } - - emit ContractInitialized(_name, _symbol, _contractURI, _owner, _modules, _moduleInstallData); } /*//////////////////////////////////////////////////////////////