GhostERC20Factory
Deploys new GhostERC20 tokens and registers them with the CommitRevealVault and AssetGuard.
Address: 0x925B548F059C0B8B6CF7168Efb84881252F88C8E
Interface
interface IGhostERC20Factory {
// Deploy a new GhostERC20 token
function deployToken(
string calldata name,
string calldata symbol,
uint8 decimals,
bytes32 salt
) external returns (address token);
// Predict deployment address (CREATE2)
function computeTokenAddress(
string calldata name,
string calldata symbol,
uint8 decimals,
bytes32 salt
) external view returns (address);
// View functions
function vault() external view returns (address);
function assetGuard() external view returns (address);
function isFactoryDeployed(address token) external view returns (bool);
function getTokenIdHash(address token) external view returns (bytes32);
// Events
event TokenDeployed(address indexed token, string name, string symbol, uint8 decimals);
}
Deploying a token
cast send 0x925B548F059C0B8B6CF7168Efb84881252F88C8E \
"deployToken(string,string,uint8,bytes32)(address)" \
"My Ghost Token" "gMTK" 18 \
0x0000000000000000000000000000000000000000000000000000000000000001 \
--rpc-url https://testnet.specterchain.com \
--chain-id 5445 \
--private-key $PRIVATE_KEY
What deployment does
- Deploys a new GhostERC20 contract using CREATE2 (deterministic address)
- Registers the token's
tokenIdHashwith the CommitRevealVault - Authorizes the token in AssetGuard
- Calls
enableGhost()on the token to activate vault permissions - Emits
TokenDeployedevent
Predicting the address
Since deployment uses CREATE2, you can predict the token address before deploying:
cast call 0x925B548F059C0B8B6CF7168Efb84881252F88C8E \
"computeTokenAddress(string,string,uint8,bytes32)(address)" \
"My Ghost Token" "gMTK" 18 \
0x0000000000000000000000000000000000000000000000000000000000000001 \
--rpc-url https://testnet.specterchain.com
Access control
Only authorized deployers can create new tokens. The factory owner manages the deployer list:
function authorizeDeployer(address deployer) external; // owner only
function revokeDeployer(address deployer) external; // owner only