Skip to content

Commit ea1b8c6

Browse files
ScreamingHawkacrylix
authored andcommitted
Salt is a hash of input params
1 parent bbbc213 commit ea1b8c6

15 files changed

+22
-58
lines changed

src/tokens/ERC1155/presets/minter/ERC1155TokenMinterFactory.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ contract ERC1155TokenMinterFactory is IERC1155TokenMinterFactory, SequenceProxyF
2727
* @param baseURI The base URI of the ERC-1155 Token Minter proxy
2828
* @param royaltyReceiver Address of who should be sent the royalty payment
2929
* @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500)
30-
* @param salt The deployment salt
3130
* @return proxyAddr The address of the ERC-1155 Token Minter Proxy
32-
* @dev The provided `salt` is hashed with the caller address for security.
3331
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-1155 Token Minter functions.
3432
*/
3533
function deploy(
@@ -38,12 +36,12 @@ contract ERC1155TokenMinterFactory is IERC1155TokenMinterFactory, SequenceProxyF
3836
string memory name,
3937
string memory baseURI,
4038
address royaltyReceiver,
41-
uint96 royaltyFeeNumerator,
42-
bytes32 salt
39+
uint96 royaltyFeeNumerator
4340
)
4441
external
4542
returns (address proxyAddr)
4643
{
44+
bytes32 salt = keccak256(abi.encodePacked(tokenOwner, name, baseURI, royaltyReceiver, royaltyFeeNumerator));
4745
proxyAddr = _createProxy(salt, proxyOwner, "");
4846
ERC1155TokenMinter(proxyAddr).initialize(tokenOwner, name, baseURI, royaltyReceiver, royaltyFeeNumerator);
4947
emit ERC1155TokenMinterDeployed(proxyAddr);

src/tokens/ERC1155/presets/minter/IERC1155TokenMinterFactory.sol

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ interface IERC1155TokenMinterFactoryFunctions {
1010
* @param baseURI The base URI of the ERC-1155 Token Minter proxy
1111
* @param royaltyReceiver Address of who should be sent the royalty payment
1212
* @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500)
13-
* @param salt The deployment salt
1413
* @return proxyAddr The address of the ERC-1155 Token Minter Proxy
15-
* @dev The provided `salt` is hashed with the caller address for security.
1614
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-1155 Token Minter functions.
1715
*/
1816
function deploy(
@@ -21,8 +19,7 @@ interface IERC1155TokenMinterFactoryFunctions {
2119
string memory name,
2220
string memory baseURI,
2321
address royaltyReceiver,
24-
uint96 royaltyFeeNumerator,
25-
bytes32 salt
22+
uint96 royaltyFeeNumerator
2623
)
2724
external
2825
returns (address proxyAddr);

src/tokens/ERC1155/presets/sale/ERC1155SaleFactory.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ contract ERC1155SaleFactory is IERC1155SaleFactory, SequenceProxyFactory {
2626
* @param baseURI The base URI of the ERC-1155 Sale token
2727
* @param royaltyReceiver Address of who should be sent the royalty payment
2828
* @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500)
29-
* @param salt The deployment salt
3029
* @return proxyAddr The address of the ERC-1155 Sale Proxy
3130
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-1155 Sale Minter functions.
3231
*/
@@ -36,12 +35,12 @@ contract ERC1155SaleFactory is IERC1155SaleFactory, SequenceProxyFactory {
3635
string memory name,
3736
string memory baseURI,
3837
address royaltyReceiver,
39-
uint96 royaltyFeeNumerator,
40-
bytes32 salt
38+
uint96 royaltyFeeNumerator
4139
)
4240
external
4341
returns (address proxyAddr)
4442
{
43+
bytes32 salt = keccak256(abi.encodePacked(tokenOwner, name, baseURI, royaltyReceiver, royaltyFeeNumerator));
4544
proxyAddr = _createProxy(salt, proxyOwner, "");
4645
ERC1155Sale(proxyAddr).initialize(tokenOwner, name, baseURI, royaltyReceiver, royaltyFeeNumerator);
4746
emit ERC1155SaleDeployed(proxyAddr);

src/tokens/ERC1155/presets/sale/IERC1155SaleFactory.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ interface IERC1155SaleFactoryFunctions {
1010
* @param baseURI The base URI of the ERC-1155 Sale token
1111
* @param royaltyReceiver Address of who should be sent the royalty payment
1212
* @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500)
13-
* @param salt The deployment salt
1413
* @return proxyAddr The address of the ERC-1155 Sale Proxy
1514
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-1155 Token Sale functions.
1615
*/
@@ -20,8 +19,7 @@ interface IERC1155SaleFactoryFunctions {
2019
string memory name,
2120
string memory baseURI,
2221
address royaltyReceiver,
23-
uint96 royaltyFeeNumerator,
24-
bytes32 salt
22+
uint96 royaltyFeeNumerator
2523
)
2624
external
2725
returns (address proxyAddr);

src/tokens/ERC20/presets/minter/ERC20TokenMinterFactory.sol

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,14 @@ contract ERC20TokenMinterFactory is IERC20TokenMinterFactory, SequenceProxyFacto
2626
* @param name The name of the ERC-20 Token Minter proxy
2727
* @param symbol The symbol of the ERC-20 Token Minter proxy
2828
* @param decimals The decimals of the ERC-20 Token Minter proxy
29-
* @param salt The deployment salt
3029
* @return proxyAddr The address of the ERC-20 Token Minter Proxy
31-
* @dev The provided `salt` is hashed with the caller address for security.
3230
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-20 Token Minter functions.
3331
*/
34-
function deploy(
35-
address proxyOwner,
36-
address tokenOwner,
37-
string memory name,
38-
string memory symbol,
39-
uint8 decimals,
40-
bytes32 salt
41-
)
32+
function deploy(address proxyOwner, address tokenOwner, string memory name, string memory symbol, uint8 decimals)
4233
external
4334
returns (address proxyAddr)
4435
{
36+
bytes32 salt = keccak256(abi.encodePacked(tokenOwner, name, symbol, decimals));
4537
proxyAddr = _createProxy(salt, proxyOwner, "");
4638
ERC20TokenMinter(proxyAddr).initialize(tokenOwner, name, symbol, decimals);
4739
emit ERC20TokenMinterDeployed(proxyAddr);

src/tokens/ERC20/presets/minter/IERC20TokenMinterFactory.sol

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,10 @@ interface IERC20TokenMinterFactoryFunctions {
99
* @param name The name of the ERC-20 Token Minter proxy
1010
* @param symbol The symbol of the ERC-20 Token Minter proxy
1111
* @param decimals The decimals of the ERC-20 Token Minter proxy
12-
* @param salt The deployment salt
1312
* @return proxyAddr The address of the ERC-20 Token Minter Proxy
14-
* @dev The provided `salt` is hashed with the caller address for security.
1513
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-20 Token Minter functions.
1614
*/
17-
function deploy(
18-
address proxyOwner,
19-
address tokenOwner,
20-
string memory name,
21-
string memory symbol,
22-
uint8 decimals,
23-
bytes32 salt
24-
)
15+
function deploy(address proxyOwner, address tokenOwner, string memory name, string memory symbol, uint8 decimals)
2516
external
2617
returns (address proxyAddr);
2718
}

src/tokens/ERC721/presets/minter/ERC721TokenMinterFactory.sol

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {SequenceProxyFactory} from "@0xsequence/contracts-library/proxies/Sequen
1010
* Deployer of ERC-721 Token Minter proxies.
1111
*/
1212
contract ERC721TokenMinterFactory is IERC721TokenMinterFactory, SequenceProxyFactory {
13-
1413
/**
1514
* Creates an ERC-721 Token Minter Factory.
1615
* @param factoryOwner The owner of the ERC-721 Token Minter Factory
@@ -29,9 +28,7 @@ contract ERC721TokenMinterFactory is IERC721TokenMinterFactory, SequenceProxyFac
2928
* @param baseURI The base URI of the ERC-721 Token Minter proxy
3029
* @param royaltyReceiver Address of who should be sent the royalty payment
3130
* @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500)
32-
* @param salt The deployment salt
3331
* @return proxyAddr The address of the ERC-721 Token Minter Proxy
34-
* @dev The provided `salt` is hashed with the caller address for security.
3532
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-721 Token Minter functions.
3633
*/
3734
function deploy(
@@ -41,12 +38,13 @@ contract ERC721TokenMinterFactory is IERC721TokenMinterFactory, SequenceProxyFac
4138
string memory symbol,
4239
string memory baseURI,
4340
address royaltyReceiver,
44-
uint96 royaltyFeeNumerator,
45-
bytes32 salt
41+
uint96 royaltyFeeNumerator
4642
)
4743
external
4844
returns (address proxyAddr)
4945
{
46+
bytes32 salt =
47+
keccak256(abi.encodePacked(tokenOwner, name, symbol, baseURI, royaltyReceiver, royaltyFeeNumerator));
5048
proxyAddr = _createProxy(salt, proxyOwner, "");
5149
ERC721TokenMinter(proxyAddr).initialize(tokenOwner, name, symbol, baseURI, royaltyReceiver, royaltyFeeNumerator);
5250
emit ERC721TokenMinterDeployed(proxyAddr);

src/tokens/ERC721/presets/minter/IERC721TokenMinterFactory.sol

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
pragma solidity ^0.8.17;
33

44
interface IERC721TokenMinterFactoryFunctions {
5-
65
/**
76
* Creates an ERC-721 Token Minter proxy.
87
* @param proxyOwner The owner of the ERC-721 Token Minter proxy
@@ -12,9 +11,7 @@ interface IERC721TokenMinterFactoryFunctions {
1211
* @param baseURI The base URI of the ERC-721 Token Minter proxy
1312
* @param royaltyReceiver Address of who should be sent the royalty payment
1413
* @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500)
15-
* @param salt The deployment salt
1614
* @return proxyAddr The address of the ERC-721 Token Minter Proxy
17-
* @dev The provided `salt` is hashed with the caller address for security.
1815
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-721 Token Minter functions.
1916
*/
2017
function deploy(
@@ -24,8 +21,7 @@ interface IERC721TokenMinterFactoryFunctions {
2421
string memory symbol,
2522
string memory baseURI,
2623
address royaltyReceiver,
27-
uint96 royaltyFeeNumerator,
28-
bytes32 salt
24+
uint96 royaltyFeeNumerator
2925
)
3026
external
3127
returns (address proxyAddr);

src/tokens/ERC721/presets/sale/ERC721SaleFactory.sol

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {SequenceProxyFactory} from "@0xsequence/contracts-library/proxies/Sequen
99
* Deployer of ERC-721 Sale proxies.
1010
*/
1111
contract ERC721SaleFactory is IERC721SaleFactory, SequenceProxyFactory {
12-
1312
/**
1413
* Creates an ERC-721 Sale Factory.
1514
* @param factoryOwner The owner of the ERC-721 Sale Factory
@@ -28,7 +27,6 @@ contract ERC721SaleFactory is IERC721SaleFactory, SequenceProxyFactory {
2827
* @param baseURI The base URI of the ERC-721 Sale token
2928
* @param royaltyReceiver Address of who should be sent the royalty payment
3029
* @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500)
31-
* @param salt The deployment salt
3230
* @return proxyAddr The address of the ERC-721 Sale Proxy
3331
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-721 Sale functions.
3432
*/
@@ -39,12 +37,13 @@ contract ERC721SaleFactory is IERC721SaleFactory, SequenceProxyFactory {
3937
string memory symbol,
4038
string memory baseURI,
4139
address royaltyReceiver,
42-
uint96 royaltyFeeNumerator,
43-
bytes32 salt
40+
uint96 royaltyFeeNumerator
4441
)
4542
external
4643
returns (address proxyAddr)
4744
{
45+
bytes32 salt =
46+
keccak256(abi.encodePacked(tokenOwner, name, symbol, baseURI, royaltyReceiver, royaltyFeeNumerator));
4847
proxyAddr = _createProxy(salt, proxyOwner, "");
4948
ERC721Sale(proxyAddr).initialize(tokenOwner, name, symbol, baseURI, royaltyReceiver, royaltyFeeNumerator);
5049
emit ERC721SaleDeployed(proxyAddr);

src/tokens/ERC721/presets/sale/IERC721SaleFactory.sol

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
pragma solidity ^0.8.17;
33

44
interface IERC721SaleFactoryFunctions {
5-
65
/**
76
* Creates an ERC-721 Sale for given token contract
87
* @param proxyOwner The owner of the ERC-721 Sale proxy
@@ -12,7 +11,6 @@ interface IERC721SaleFactoryFunctions {
1211
* @param baseURI The base URI of the ERC-721 Sale token
1312
* @param royaltyReceiver Address of who should be sent the royalty payment
1413
* @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500)
15-
* @param salt The deployment salt
1614
* @return proxyAddr The address of the ERC-721 Sale Proxy
1715
* @dev As `proxyOwner` owns the proxy, it will be unable to call the ERC-721 Sale functions.
1816
*/
@@ -23,15 +21,13 @@ interface IERC721SaleFactoryFunctions {
2321
string memory symbol,
2422
string memory baseURI,
2523
address royaltyReceiver,
26-
uint96 royaltyFeeNumerator,
27-
bytes32 salt
24+
uint96 royaltyFeeNumerator
2825
)
2926
external
3027
returns (address proxyAddr);
3128
}
3229

3330
interface IERC721SaleFactorySignals {
34-
3531
/**
3632
* Event emitted when a new ERC-721 Sale proxy contract is deployed.
3733
* @param proxyAddr The address of the deployed proxy.

0 commit comments

Comments
 (0)