From f28973cfeb885fd843a635ad90c31961b7bbc664 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Wed, 7 Aug 2024 13:44:58 +0700 Subject: [PATCH] Create erc20_factory.sol --- .../smart-contracts/ethereum/erc20_factory.sol | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/DAPIO/smart-contracts/ethereum/erc20_factory.sol diff --git a/projects/DAPIO/smart-contracts/ethereum/erc20_factory.sol b/projects/DAPIO/smart-contracts/ethereum/erc20_factory.sol new file mode 100644 index 000000000..78d052e26 --- /dev/null +++ b/projects/DAPIO/smart-contracts/ethereum/erc20_factory.sol @@ -0,0 +1,16 @@ +pragma solidity ^0.8.0; + +import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol"; + +contract ERC20Factory { + mapping (address => ERC20) public tokens; + + function createToken(string memory _name, string memory _symbol, uint256 _totalSupply) public { + ERC20 token = new ERC20(_name, _symbol, _totalSupply); + tokens[msg.sender] = token; + } + + function getToken(address _owner) public view returns (ERC20) { + return tokens[_owner]; + } +}