diff --git a/src/tokens/ERC1155/presets/minter/ERC1155TokenMinterFactory.sol b/src/tokens/ERC1155/presets/minter/ERC1155TokenMinterFactory.sol index ff0b13e..b74cd02 100644 --- a/src/tokens/ERC1155/presets/minter/ERC1155TokenMinterFactory.sol +++ b/src/tokens/ERC1155/presets/minter/ERC1155TokenMinterFactory.sol @@ -27,9 +27,7 @@ contract ERC1155TokenMinterFactory is IERC1155TokenMinterFactory, SequenceProxyF * @param baseURI The base URI of the ERC-1155 Token Minter proxy * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) - * @param salt The deployment salt * @return proxyAddr The address of the ERC-1155 Token Minter Proxy - * @dev The provided `salt` is hashed with the caller address for security. * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-1155 Token Minter functions. */ function deploy( @@ -38,12 +36,12 @@ contract ERC1155TokenMinterFactory is IERC1155TokenMinterFactory, SequenceProxyF string memory name, string memory baseURI, address royaltyReceiver, - uint96 royaltyFeeNumerator, - bytes32 salt + uint96 royaltyFeeNumerator ) external returns (address proxyAddr) { + bytes32 salt = keccak256(abi.encodePacked(tokenOwner, name, baseURI, royaltyReceiver, royaltyFeeNumerator)); proxyAddr = _createProxy(salt, proxyOwner, ""); ERC1155TokenMinter(proxyAddr).initialize(tokenOwner, name, baseURI, royaltyReceiver, royaltyFeeNumerator); emit ERC1155TokenMinterDeployed(proxyAddr); diff --git a/src/tokens/ERC1155/presets/minter/IERC1155TokenMinterFactory.sol b/src/tokens/ERC1155/presets/minter/IERC1155TokenMinterFactory.sol index 4ba1e3d..b4da515 100644 --- a/src/tokens/ERC1155/presets/minter/IERC1155TokenMinterFactory.sol +++ b/src/tokens/ERC1155/presets/minter/IERC1155TokenMinterFactory.sol @@ -10,9 +10,7 @@ interface IERC1155TokenMinterFactoryFunctions { * @param baseURI The base URI of the ERC-1155 Token Minter proxy * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) - * @param salt The deployment salt * @return proxyAddr The address of the ERC-1155 Token Minter Proxy - * @dev The provided `salt` is hashed with the caller address for security. * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-1155 Token Minter functions. */ function deploy( @@ -21,8 +19,7 @@ interface IERC1155TokenMinterFactoryFunctions { string memory name, string memory baseURI, address royaltyReceiver, - uint96 royaltyFeeNumerator, - bytes32 salt + uint96 royaltyFeeNumerator ) external returns (address proxyAddr); diff --git a/src/tokens/ERC1155/presets/sale/ERC1155SaleFactory.sol b/src/tokens/ERC1155/presets/sale/ERC1155SaleFactory.sol index f8a99a5..74f0263 100644 --- a/src/tokens/ERC1155/presets/sale/ERC1155SaleFactory.sol +++ b/src/tokens/ERC1155/presets/sale/ERC1155SaleFactory.sol @@ -26,7 +26,6 @@ contract ERC1155SaleFactory is IERC1155SaleFactory, SequenceProxyFactory { * @param baseURI The base URI of the ERC-1155 Sale token * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) - * @param salt The deployment salt * @return proxyAddr The address of the ERC-1155 Sale Proxy * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-1155 Sale Minter functions. */ @@ -36,12 +35,12 @@ contract ERC1155SaleFactory is IERC1155SaleFactory, SequenceProxyFactory { string memory name, string memory baseURI, address royaltyReceiver, - uint96 royaltyFeeNumerator, - bytes32 salt + uint96 royaltyFeeNumerator ) external returns (address proxyAddr) { + bytes32 salt = keccak256(abi.encodePacked(tokenOwner, name, baseURI, royaltyReceiver, royaltyFeeNumerator)); proxyAddr = _createProxy(salt, proxyOwner, ""); ERC1155Sale(proxyAddr).initialize(tokenOwner, name, baseURI, royaltyReceiver, royaltyFeeNumerator); emit ERC1155SaleDeployed(proxyAddr); diff --git a/src/tokens/ERC1155/presets/sale/IERC1155SaleFactory.sol b/src/tokens/ERC1155/presets/sale/IERC1155SaleFactory.sol index b7e8d93..3ebb10e 100644 --- a/src/tokens/ERC1155/presets/sale/IERC1155SaleFactory.sol +++ b/src/tokens/ERC1155/presets/sale/IERC1155SaleFactory.sol @@ -10,7 +10,6 @@ interface IERC1155SaleFactoryFunctions { * @param baseURI The base URI of the ERC-1155 Sale token * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) - * @param salt The deployment salt * @return proxyAddr The address of the ERC-1155 Sale Proxy * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-1155 Token Sale functions. */ @@ -20,8 +19,7 @@ interface IERC1155SaleFactoryFunctions { string memory name, string memory baseURI, address royaltyReceiver, - uint96 royaltyFeeNumerator, - bytes32 salt + uint96 royaltyFeeNumerator ) external returns (address proxyAddr); diff --git a/src/tokens/ERC20/presets/minter/ERC20TokenMinterFactory.sol b/src/tokens/ERC20/presets/minter/ERC20TokenMinterFactory.sol index be95da7..fe0fdd0 100644 --- a/src/tokens/ERC20/presets/minter/ERC20TokenMinterFactory.sol +++ b/src/tokens/ERC20/presets/minter/ERC20TokenMinterFactory.sol @@ -26,22 +26,14 @@ contract ERC20TokenMinterFactory is IERC20TokenMinterFactory, SequenceProxyFacto * @param name The name of the ERC-20 Token Minter proxy * @param symbol The symbol of the ERC-20 Token Minter proxy * @param decimals The decimals of the ERC-20 Token Minter proxy - * @param salt The deployment salt * @return proxyAddr The address of the ERC-20 Token Minter Proxy - * @dev The provided `salt` is hashed with the caller address for security. * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-20 Token Minter functions. */ - function deploy( - address proxyOwner, - address tokenOwner, - string memory name, - string memory symbol, - uint8 decimals, - bytes32 salt - ) + function deploy(address proxyOwner, address tokenOwner, string memory name, string memory symbol, uint8 decimals) external returns (address proxyAddr) { + bytes32 salt = keccak256(abi.encodePacked(tokenOwner, name, symbol, decimals)); proxyAddr = _createProxy(salt, proxyOwner, ""); ERC20TokenMinter(proxyAddr).initialize(tokenOwner, name, symbol, decimals); emit ERC20TokenMinterDeployed(proxyAddr); diff --git a/src/tokens/ERC20/presets/minter/IERC20TokenMinterFactory.sol b/src/tokens/ERC20/presets/minter/IERC20TokenMinterFactory.sol index 4ce9483..64af83e 100644 --- a/src/tokens/ERC20/presets/minter/IERC20TokenMinterFactory.sol +++ b/src/tokens/ERC20/presets/minter/IERC20TokenMinterFactory.sol @@ -9,19 +9,10 @@ interface IERC20TokenMinterFactoryFunctions { * @param name The name of the ERC-20 Token Minter proxy * @param symbol The symbol of the ERC-20 Token Minter proxy * @param decimals The decimals of the ERC-20 Token Minter proxy - * @param salt The deployment salt * @return proxyAddr The address of the ERC-20 Token Minter Proxy - * @dev The provided `salt` is hashed with the caller address for security. * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-20 Token Minter functions. */ - function deploy( - address proxyOwner, - address tokenOwner, - string memory name, - string memory symbol, - uint8 decimals, - bytes32 salt - ) + function deploy(address proxyOwner, address tokenOwner, string memory name, string memory symbol, uint8 decimals) external returns (address proxyAddr); } diff --git a/src/tokens/ERC721/presets/minter/ERC721TokenMinterFactory.sol b/src/tokens/ERC721/presets/minter/ERC721TokenMinterFactory.sol index 029bc58..ef03cde 100644 --- a/src/tokens/ERC721/presets/minter/ERC721TokenMinterFactory.sol +++ b/src/tokens/ERC721/presets/minter/ERC721TokenMinterFactory.sol @@ -10,7 +10,6 @@ import {SequenceProxyFactory} from "@0xsequence/contracts-library/proxies/Sequen * Deployer of ERC-721 Token Minter proxies. */ contract ERC721TokenMinterFactory is IERC721TokenMinterFactory, SequenceProxyFactory { - /** * Creates an ERC-721 Token Minter Factory. * @param factoryOwner The owner of the ERC-721 Token Minter Factory @@ -29,9 +28,7 @@ contract ERC721TokenMinterFactory is IERC721TokenMinterFactory, SequenceProxyFac * @param baseURI The base URI of the ERC-721 Token Minter proxy * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) - * @param salt The deployment salt * @return proxyAddr The address of the ERC-721 Token Minter Proxy - * @dev The provided `salt` is hashed with the caller address for security. * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-721 Token Minter functions. */ function deploy( @@ -41,12 +38,13 @@ contract ERC721TokenMinterFactory is IERC721TokenMinterFactory, SequenceProxyFac string memory symbol, string memory baseURI, address royaltyReceiver, - uint96 royaltyFeeNumerator, - bytes32 salt + uint96 royaltyFeeNumerator ) external returns (address proxyAddr) { + bytes32 salt = + keccak256(abi.encodePacked(tokenOwner, name, symbol, baseURI, royaltyReceiver, royaltyFeeNumerator)); proxyAddr = _createProxy(salt, proxyOwner, ""); ERC721TokenMinter(proxyAddr).initialize(tokenOwner, name, symbol, baseURI, royaltyReceiver, royaltyFeeNumerator); emit ERC721TokenMinterDeployed(proxyAddr); diff --git a/src/tokens/ERC721/presets/minter/IERC721TokenMinterFactory.sol b/src/tokens/ERC721/presets/minter/IERC721TokenMinterFactory.sol index 41c782b..486f05a 100644 --- a/src/tokens/ERC721/presets/minter/IERC721TokenMinterFactory.sol +++ b/src/tokens/ERC721/presets/minter/IERC721TokenMinterFactory.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.17; interface IERC721TokenMinterFactoryFunctions { - /** * Creates an ERC-721 Token Minter proxy. * @param proxyOwner The owner of the ERC-721 Token Minter proxy @@ -12,9 +11,7 @@ interface IERC721TokenMinterFactoryFunctions { * @param baseURI The base URI of the ERC-721 Token Minter proxy * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) - * @param salt The deployment salt * @return proxyAddr The address of the ERC-721 Token Minter Proxy - * @dev The provided `salt` is hashed with the caller address for security. * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-721 Token Minter functions. */ function deploy( @@ -24,8 +21,7 @@ interface IERC721TokenMinterFactoryFunctions { string memory symbol, string memory baseURI, address royaltyReceiver, - uint96 royaltyFeeNumerator, - bytes32 salt + uint96 royaltyFeeNumerator ) external returns (address proxyAddr); diff --git a/src/tokens/ERC721/presets/sale/ERC721SaleFactory.sol b/src/tokens/ERC721/presets/sale/ERC721SaleFactory.sol index 989274d..39c1aa5 100644 --- a/src/tokens/ERC721/presets/sale/ERC721SaleFactory.sol +++ b/src/tokens/ERC721/presets/sale/ERC721SaleFactory.sol @@ -9,7 +9,6 @@ import {SequenceProxyFactory} from "@0xsequence/contracts-library/proxies/Sequen * Deployer of ERC-721 Sale proxies. */ contract ERC721SaleFactory is IERC721SaleFactory, SequenceProxyFactory { - /** * Creates an ERC-721 Sale Factory. * @param factoryOwner The owner of the ERC-721 Sale Factory @@ -28,7 +27,6 @@ contract ERC721SaleFactory is IERC721SaleFactory, SequenceProxyFactory { * @param baseURI The base URI of the ERC-721 Sale token * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) - * @param salt The deployment salt * @return proxyAddr The address of the ERC-721 Sale Proxy * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-721 Sale functions. */ @@ -39,12 +37,13 @@ contract ERC721SaleFactory is IERC721SaleFactory, SequenceProxyFactory { string memory symbol, string memory baseURI, address royaltyReceiver, - uint96 royaltyFeeNumerator, - bytes32 salt + uint96 royaltyFeeNumerator ) external returns (address proxyAddr) { + bytes32 salt = + keccak256(abi.encodePacked(tokenOwner, name, symbol, baseURI, royaltyReceiver, royaltyFeeNumerator)); proxyAddr = _createProxy(salt, proxyOwner, ""); ERC721Sale(proxyAddr).initialize(tokenOwner, name, symbol, baseURI, royaltyReceiver, royaltyFeeNumerator); emit ERC721SaleDeployed(proxyAddr); diff --git a/src/tokens/ERC721/presets/sale/IERC721SaleFactory.sol b/src/tokens/ERC721/presets/sale/IERC721SaleFactory.sol index aa8a687..ac2933e 100644 --- a/src/tokens/ERC721/presets/sale/IERC721SaleFactory.sol +++ b/src/tokens/ERC721/presets/sale/IERC721SaleFactory.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.17; interface IERC721SaleFactoryFunctions { - /** * Creates an ERC-721 Sale for given token contract * @param proxyOwner The owner of the ERC-721 Sale proxy @@ -12,7 +11,6 @@ interface IERC721SaleFactoryFunctions { * @param baseURI The base URI of the ERC-721 Sale token * @param royaltyReceiver Address of who should be sent the royalty payment * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500) - * @param salt The deployment salt * @return proxyAddr The address of the ERC-721 Sale Proxy * @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-721 Sale functions. */ @@ -23,15 +21,13 @@ interface IERC721SaleFactoryFunctions { string memory symbol, string memory baseURI, address royaltyReceiver, - uint96 royaltyFeeNumerator, - bytes32 salt + uint96 royaltyFeeNumerator ) external returns (address proxyAddr); } interface IERC721SaleFactorySignals { - /** * Event emitted when a new ERC-721 Sale proxy contract is deployed. * @param proxyAddr The address of the deployed proxy. diff --git a/test/tokens/ERC1155/presets/ERC1155Sale.t.sol b/test/tokens/ERC1155/presets/ERC1155Sale.t.sol index 3016e90..38342c3 100644 --- a/test/tokens/ERC1155/presets/ERC1155Sale.t.sol +++ b/test/tokens/ERC1155/presets/ERC1155Sale.t.sol @@ -46,7 +46,7 @@ contract ERC1155SaleTest is Test, Merkle, IERC1155SaleSignals, IERC1155SupplySig function setUpFromFactory() public { ERC1155SaleFactory factory = new ERC1155SaleFactory(address(this)); - token = ERC1155Sale(factory.deploy(proxyOwner, address(this), "test", "ipfs://", address(this), 0, "")); + token = ERC1155Sale(factory.deploy(proxyOwner, address(this), "test", "ipfs://", address(this), 0)); } function testSupportsInterface() public { diff --git a/test/tokens/ERC1155/presets/ERC1155TokenMinter.t.sol b/test/tokens/ERC1155/presets/ERC1155TokenMinter.t.sol index f096ba5..c2d72d8 100644 --- a/test/tokens/ERC1155/presets/ERC1155TokenMinter.t.sol +++ b/test/tokens/ERC1155/presets/ERC1155TokenMinter.t.sol @@ -35,7 +35,7 @@ contract ERC1155TokenMinterTest is Test, IERC1155TokenMinterSignals { vm.deal(owner, 100 ether); ERC1155TokenMinterFactory factory = new ERC1155TokenMinterFactory(address(this)); - token = ERC1155TokenMinter(factory.deploy(proxyOwner, owner, "name", "baseURI", address(this), 0, 0x0)); + token = ERC1155TokenMinter(factory.deploy(proxyOwner, owner, "name", "baseURI", address(this), 0)); } function testReinitializeFails() public { diff --git a/test/tokens/ERC20/ERC20TokenMinter.t.sol b/test/tokens/ERC20/ERC20TokenMinter.t.sol index 792caf2..60344db 100644 --- a/test/tokens/ERC20/ERC20TokenMinter.t.sol +++ b/test/tokens/ERC20/ERC20TokenMinter.t.sol @@ -32,7 +32,7 @@ contract ERC20TokenMinterTest is Test, IERC20TokenMinterSignals { vm.deal(owner, 100 ether); ERC20TokenMinterFactory factory = new ERC20TokenMinterFactory(address(this)); - token = ERC20TokenMinter(factory.deploy(proxyOwner, owner, "name", "symbol", DECIMALS, 0x0)); + token = ERC20TokenMinter(factory.deploy(proxyOwner, owner, "name", "symbol", DECIMALS)); } function testReinitializeFails() public { diff --git a/test/tokens/ERC721/presets/ERC721Sale.t.sol b/test/tokens/ERC721/presets/ERC721Sale.t.sol index 815651f..a86dc2b 100644 --- a/test/tokens/ERC721/presets/ERC721Sale.t.sol +++ b/test/tokens/ERC721/presets/ERC721Sale.t.sol @@ -42,7 +42,7 @@ contract ERC721SaleTest is Test, Merkle, IERC721SaleSignals, IMerkleProofSingleU function setUpFromFactory() public { ERC721SaleFactory factory = new ERC721SaleFactory(address(this)); - token = ERC721Sale(factory.deploy(proxyOwner, address(this), "test", "test", "ipfs://", address(this), 0, "")); + token = ERC721Sale(factory.deploy(proxyOwner, address(this), "test", "test", "ipfs://", address(this), 0)); } function testSupportsInterface() public { diff --git a/test/tokens/ERC721/presets/ERC721TokenMinter.t.sol b/test/tokens/ERC721/presets/ERC721TokenMinter.t.sol index 9ccf231..783ec2c 100644 --- a/test/tokens/ERC721/presets/ERC721TokenMinter.t.sol +++ b/test/tokens/ERC721/presets/ERC721TokenMinter.t.sol @@ -30,7 +30,7 @@ contract ERC721TokenMinterTest is Test, IERC721TokenMinterSignals { vm.deal(owner, 100 ether); ERC721TokenMinterFactory factory = new ERC721TokenMinterFactory(address(this)); - token = ERC721TokenMinter(factory.deploy(proxyOwner, owner, "name", "symbol", "baseURI", address(this), 0, 0x0)); + token = ERC721TokenMinter(factory.deploy(proxyOwner, owner, "name", "symbol", "baseURI", address(this), 0)); } function testReinitializeFails() public {