Skip to content

Commit

Permalink
feat: add erc20factory contract
Browse files Browse the repository at this point in the history
  • Loading branch information
tansawit committed Jul 20, 2024
1 parent 63d8e1a commit 5631e71
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/ERC20Factory.sol
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);
}
}

0 comments on commit 5631e71

Please sign in to comment.