Appearance
Solidity API
TradeTokenFactory
_Factory contract for deploying TradeToken contract using CREATE2.
This implementation provides a way to deterministically deploy TradeToken contract using the CREATE2 opcode.
The factory can deploy different types of TradeToken contract based on the TradeTokenType enum defined in the TradeToken contract._
TradeTokenCreated
solidity
event TradeTokenCreated(address _address, bytes32 _salt)
Emitted when a new TradeToken contract is created.
Parameters
Name | Type | Description |
---|---|---|
_address | address | The address of the newly deployed TradeToken contract |
_salt | bytes32 | The salt value used in CREATE2 deployment |
TradeTokenCreate2Failed
solidity
error TradeTokenCreate2Failed()
Error thrown when the CREATE2 deployment fails
deployTradeTokenFromFactory
solidity
function deployTradeTokenFromFactory(string _tokenName, string _tokenSymbol, uint256 _initialSupply, bytes32 _salt, enum TradeToken.TradeTokenType _tradeTokenType) public returns (address)
_Deploys a new TradeToken contract using CREATE2.
This function creates a new TradeToken contract with the specified parameters. The address of the deployed contract is deterministic and depends on the salt value.
Requirements:
- The deployment must not fail
- The salt value must not have been used before_
Parameters
Name | Type | Description |
---|---|---|
_tokenName | string | The name of the token |
_tokenSymbol | string | The symbol of the token |
_initialSupply | uint256 | The initial supply of tokens to mint |
_salt | bytes32 | A unique value used to determine the contract address |
_tradeTokenType | enum TradeToken.TradeTokenType | The type of TradeToken to deploy |
Return Values
Name | Type | Description |
---|---|---|
[0] | address | deployedAddress The address of the newly deployed TradeToken contract |