diff --git a/contracts/YourToken.sol b/contracts/YourToken.sol index a0b55ab..c84744d 100644 --- a/contracts/YourToken.sol +++ b/contracts/YourToken.sol @@ -3,76 +3,20 @@ pragma solidity 0.8.23; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; -import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; -import "@openzeppelin/contracts/access/AccessControl.sol"; /** * @title YOUR Token (YOUR) - * @dev ERC20 Token with more benefits, including minting, burning, - * access control, and pausable functionality. */ -contract YourToken is ERC20, ERC20Burnable, ERC20Pausable, AccessControl, ERC20Permit { - - // Roles for access control - bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); - bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); - +contract YourToken is ERC20, ERC20Burnable, ERC20Permit { /** * @dev Contract constructor. - * @param defaultAdmin The default admin for the contract. - * @param initialOwner The initial owner who receives the initial token supply. */ - constructor(address defaultAdmin, address initialOwner) + constructor() ERC20("YOUR AI", "YOURAI") ERC20Permit("YOUR AI") { - // Validate that initialOwner and defaultAdmin are not the zero address - require(initialOwner != address(0), "Initial owner cannot be the zero address"); - require(defaultAdmin != address(0), "Default admin cannot be the zero address"); - - // Assign roles and mint initial token supply to the initial owner - _grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin); - _grantRole(PAUSER_ROLE, defaultAdmin); - _grantRole(MINTER_ROLE, defaultAdmin); - _mint(initialOwner, 1000000000 * 10 ** decimals()); // Initial supply deposited to the address provided here - } - - /** - * @dev Pause token transfers. - * Only callable by an address with the PAUSER_ROLE. - */ - function pause() public onlyRole(PAUSER_ROLE) { - _pause(); - } - - /** - * @dev Unpause token transfers. - * Only callable by an address with the PAUSER_ROLE. - */ - function unpause() public onlyRole(PAUSER_ROLE) { - _unpause(); - } - - /** - * @dev Mint new tokens and assign them to the specified address. - * Only callable by an address with the MINTER_ROLE. - * @param to The address to which new tokens will be minted. - * @param amount The amount of tokens to mint. - */ - function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) { - _mint(to, amount); - } - - /** - * @dev Internal function to update token transfers. - * Overrides functions from ERC20 and ERC20Pausable. - */ - function _update(address from, address to, uint256 value) - internal - override(ERC20, ERC20Pausable) - { - super._update(from, to, value); + _mint(msg.sender, 1_000_000_000 * 10 ** decimals()); // Initial supply deposited to the address provided here } } \ No newline at end of file diff --git a/deploy/YourToken.js b/deploy/YourToken.js index abe2b16..ca98cb8 100644 --- a/deploy/YourToken.js +++ b/deploy/YourToken.js @@ -10,13 +10,7 @@ async function main() { console.log("Network name :", network.name); console.log("Network chain id :", network.chainId); - const adminAddress = "0x3Ec5faF545030cdE1f3D887F876061e0B0Ffa1a0"; - const tokenHoldingAddress = "0x3Ec5faF545030cdE1f3D887F876061e0B0Ffa1a0"; - - const contractDeployer1 = await ethers.deployContract("YourToken", [ - adminAddress, // Initial Admin - tokenHoldingAddress, // Initial Owner holding all tokens - ]); + const contractDeployer1 = await ethers.deployContract("YourToken"); if (contractDeployer1.waitForDeployment()) { console.log("ERC20 Token Deployed :", await contractDeployer1.getAddress());