ERC20PresetFixedSupplyUpgradeable.sol 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.5.0-rc.0) (token/ERC20/presets/ERC20PresetFixedSupply.sol)
  3. pragma solidity ^0.8.0;
  4. import "../extensions/ERC20BurnableUpgradeable.sol";
  5. import "../../../proxy/utils/Initializable.sol";
  6. /**
  7. * @dev {ERC20} token, including:
  8. *
  9. * - Preminted initial supply
  10. * - Ability for holders to burn (destroy) their tokens
  11. * - No access control mechanism (for minting/pausing) and hence no governance
  12. *
  13. * This contract uses {ERC20Burnable} to include burn capabilities - head to
  14. * its documentation for details.
  15. *
  16. * _Available since v3.4._
  17. *
  18. * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
  19. */
  20. contract ERC20PresetFixedSupplyUpgradeable is Initializable, ERC20BurnableUpgradeable {
  21. function initialize(
  22. string memory name,
  23. string memory symbol,
  24. uint256 initialSupply,
  25. address owner
  26. ) public virtual initializer {
  27. __ERC20PresetFixedSupply_init(name, symbol, initialSupply, owner);
  28. }
  29. /**
  30. * @dev Mints `initialSupply` amount of token and transfers them to `owner`.
  31. *
  32. * See {ERC20-constructor}.
  33. */
  34. function __ERC20PresetFixedSupply_init(
  35. string memory name,
  36. string memory symbol,
  37. uint256 initialSupply,
  38. address owner
  39. ) internal onlyInitializing {
  40. __ERC20_init_unchained(name, symbol);
  41. __ERC20PresetFixedSupply_init_unchained(name, symbol, initialSupply, owner);
  42. }
  43. function __ERC20PresetFixedSupply_init_unchained(
  44. string memory,
  45. string memory,
  46. uint256 initialSupply,
  47. address owner
  48. ) internal onlyInitializing {
  49. _mint(owner, initialSupply);
  50. }
  51. /**
  52. * This empty reserved space is put in place to allow future versions to add new
  53. * variables without shifting down storage in the inheritance chain.
  54. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  55. */
  56. uint256[50] private __gap;
  57. }