@@ -9,7 +9,7 @@ import "./interfaces/IERC721Template.sol";
9
9
import "./interfaces/IFactory.sol " ;
10
10
import "@openzeppelin/contracts/access/Ownable.sol " ;
11
11
import "./interfaces/IERC20Template.sol " ;
12
-
12
+ import " hardhat/console.sol " ;
13
13
/**
14
14
* @title DTFactory contract
15
15
* @author Ocean Protocol Team
@@ -276,29 +276,35 @@ contract ERC721Factory is Deployer, Ownable {
276
276
* @dev Deploys new DataToken proxy contract.
277
277
* This function is not called directly from here. It's called from the NFT contract.
278
278
An NFT contract can deploy multiple ERC20 tokens.
279
-
280
- * @param name token name
281
- * @param symbol token symbol
282
- * @param cap the maximum total supply
283
279
* @param _templateIndex ERC20Template index
284
- * @param minter account who can mint datatokens (can have multiple minters)
285
-
280
+ * @param strings refers to an array of strings
281
+ * [0] = name
282
+ * [1] = symbol
283
+ * @param addresses refers to an array of addresses
284
+ * [0] = minter account who can mint datatokens (can have multiple minters)
285
+ * [1] = feeManager initial feeManager for this DT
286
+ * [2] = publishing Market Address
287
+ * [3] = publishing Market Fee Token
288
+ * @param uints refers to an array of uints
289
+ * [0] = cap_ the total ERC20 cap
290
+ * [1] = publishing Market Fee Amount
291
+ * @param bytess refers to an array of bytes
292
+ * Currently not used, usefull for future templates
286
293
* @return token address of a new proxy DataToken contract
287
294
*/
288
295
function createToken (
289
- string memory name ,
290
- string memory symbol ,
291
- uint256 cap ,
292
296
uint256 _templateIndex ,
293
- address minter ,
294
- address feeManager
297
+ string [] memory strings ,
298
+ address [] memory addresses ,
299
+ uint256 [] memory uints ,
300
+ bytes [] calldata bytess
295
301
) public returns (address token ) {
296
302
require (
297
303
erc721List[msg .sender ] == msg .sender ,
298
304
"ERC721Factory: ONLY ERC721 INSTANCE FROM ERC721FACTORY "
299
305
);
300
306
301
- require (cap != 0 , "ERC20Factory: zero cap is not allowed " );
307
+ require (uints[ 0 ] != 0 , "ERC20Factory: zero cap is not allowed " );
302
308
require (
303
309
_templateIndex <= templateCount && _templateIndex != 0 ,
304
310
"ERC20Factory: Template index doesnt exist "
@@ -311,7 +317,7 @@ contract ERC721Factory is Deployer, Ownable {
311
317
);
312
318
313
319
token = deploy (tokenTemplate.templateAddress);
314
-
320
+
315
321
erc20List[token] = true ;
316
322
317
323
require (
@@ -320,24 +326,25 @@ contract ERC721Factory is Deployer, Ownable {
320
326
);
321
327
322
328
IERC20Template tokenInstance = IERC20Template (token);
323
-
324
-
325
-
329
+ address [] memory factoryAddresses = new address [](3 );
330
+ factoryAddresses[0 ] = msg .sender ;
331
+
332
+ factoryAddresses[1 ] = communityFeeCollector;
333
+
334
+ factoryAddresses[2 ] = router;
335
+
326
336
require (
327
337
tokenInstance.initialize (
328
- name,
329
- symbol,
330
- msg .sender ,
331
- cap,
332
- communityFeeCollector,
333
- minter,
334
- router,
335
- feeManager
338
+ strings,
339
+ addresses,
340
+ factoryAddresses,
341
+ uints,
342
+ bytess
336
343
),
337
344
"ERC20Factory: Unable to initialize token instance "
338
345
);
339
- emit TokenCreated (token, tokenTemplate.templateAddress, name );
340
- emit TokenRegistered (token, name, symbol, cap , msg .sender );
346
+ emit TokenCreated (token, tokenTemplate.templateAddress, strings[ 0 ] );
347
+ emit TokenRegistered (token, strings[ 0 ], strings[ 1 ], uints[ 0 ] , msg .sender );
341
348
342
349
currentTokenCount += 1 ;
343
350
}
0 commit comments