-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "./InitiaERC20.sol"; | ||
import "./ERC20Registry.sol"; | ||
|
||
contract ERC20Factory is ERC20Registry { | ||
event ERC20Created(address indexed erc20, address indexed owner); | ||
|
||
function createERC20( | ||
string memory name, | ||
string memory symbol, | ||
uint8 decimals | ||
) external returns (address) { | ||
InitiaERC20 erc20 = new InitiaERC20(name, symbol, decimals); | ||
|
||
// register the ERC20 contract with the ERC20 registry | ||
ERC20_REGISTRY_CONTRACT.register_erc20_from_factory(address(erc20)); | ||
|
||
// transfer ownership of the ERC20 contract to the sender | ||
erc20.transferOwnership(msg.sender); | ||
|
||
emit ERC20Created(address(erc20), msg.sender); | ||
return address(erc20); | ||
} | ||
} |