ERC777PresetFixedSupplyUpgradeable.sol 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.1 (token/ERC777/presets/ERC777PresetFixedSupply.sol)
  3. pragma solidity ^0.8.0;
  4. import "../ERC777Upgradeable.sol";
  5. import "../../../proxy/utils/Initializable.sol";
  6. /**
  7. * @dev {ERC777} token, including:
  8. *
  9. * - Preminted initial supply
  10. * - No access control mechanism (for minting/pausing) and hence no governance
  11. *
  12. * _Available since v3.4._
  13. */
  14. contract ERC777PresetFixedSupplyUpgradeable is Initializable, ERC777Upgradeable {
  15. function initialize(
  16. string memory name,
  17. string memory symbol,
  18. address[] memory defaultOperators,
  19. uint256 initialSupply,
  20. address owner
  21. ) public virtual initializer {
  22. __ERC777PresetFixedSupply_init(name, symbol, defaultOperators, initialSupply, owner);
  23. }
  24. /**
  25. * @dev Mints `initialSupply` amount of token and transfers them to `owner`.
  26. *
  27. * See {ERC777-constructor}.
  28. */
  29. function __ERC777PresetFixedSupply_init(
  30. string memory name,
  31. string memory symbol,
  32. address[] memory defaultOperators,
  33. uint256 initialSupply,
  34. address owner
  35. ) internal onlyInitializing {
  36. __ERC777_init_unchained(name, symbol, defaultOperators);
  37. __ERC777PresetFixedSupply_init_unchained(name, symbol, defaultOperators, initialSupply, owner);
  38. }
  39. function __ERC777PresetFixedSupply_init_unchained(
  40. string memory,
  41. string memory,
  42. address[] memory,
  43. uint256 initialSupply,
  44. address owner
  45. ) internal onlyInitializing {
  46. _mint(owner, initialSupply, "", "");
  47. }
  48. /**
  49. * This empty reserved space is put in place to allow future versions to add new
  50. * variables without shifting down storage in the inheritance chain.
  51. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  52. */
  53. uint256[50] private __gap;
  54. }