ERC721ConsecutiveMock.sol 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../token/ERC721/extensions/ERC721Burnable.sol";
  4. import "../token/ERC721/extensions/ERC721Consecutive.sol";
  5. import "../token/ERC721/extensions/ERC721Enumerable.sol";
  6. import "../token/ERC721/extensions/ERC721Pausable.sol";
  7. import "../token/ERC721/extensions/draft-ERC721Votes.sol";
  8. /**
  9. * @title ERC721ConsecutiveMock
  10. */
  11. contract ERC721ConsecutiveMock is ERC721Burnable, ERC721Consecutive, ERC721Pausable, ERC721Votes {
  12. constructor(
  13. string memory name,
  14. string memory symbol,
  15. address[] memory delegates,
  16. address[] memory receivers,
  17. uint96[] memory amounts
  18. ) ERC721(name, symbol) EIP712(name, "1") {
  19. for (uint256 i = 0; i < delegates.length; ++i) {
  20. _delegate(delegates[i], delegates[i]);
  21. }
  22. for (uint256 i = 0; i < receivers.length; ++i) {
  23. _mintConsecutive(receivers[i], amounts[i]);
  24. }
  25. }
  26. function pause() external {
  27. _pause();
  28. }
  29. function unpause() external {
  30. _unpause();
  31. }
  32. function exists(uint256 tokenId) public view returns (bool) {
  33. return _exists(tokenId);
  34. }
  35. function mint(address to, uint256 tokenId) public {
  36. _mint(to, tokenId);
  37. }
  38. function mintConsecutive(address to, uint96 amount) public {
  39. _mintConsecutive(to, amount);
  40. }
  41. function safeMint(address to, uint256 tokenId) public {
  42. _safeMint(to, tokenId);
  43. }
  44. function _ownerOf(uint256 tokenId) internal view virtual override(ERC721, ERC721Consecutive) returns (address) {
  45. return super._ownerOf(tokenId);
  46. }
  47. function _mint(address to, uint256 tokenId) internal virtual override(ERC721, ERC721Consecutive) {
  48. super._mint(to, tokenId);
  49. }
  50. function _beforeTokenTransfer(
  51. address from,
  52. address to,
  53. uint256 tokenId
  54. ) internal virtual override(ERC721, ERC721Pausable) {
  55. super._beforeTokenTransfer(from, to, tokenId);
  56. }
  57. function _afterTokenTransfer(
  58. address from,
  59. address to,
  60. uint256 tokenId
  61. ) internal virtual override(ERC721, ERC721Votes, ERC721Consecutive) {
  62. super._afterTokenTransfer(from, to, tokenId);
  63. }
  64. function _beforeConsecutiveTokenTransfer(
  65. address from,
  66. address to,
  67. uint256 first,
  68. uint96 size
  69. ) internal virtual override(ERC721, ERC721Pausable) {
  70. super._beforeConsecutiveTokenTransfer(from, to, first, size);
  71. }
  72. function _afterConsecutiveTokenTransfer(
  73. address from,
  74. address to,
  75. uint256 first,
  76. uint96 size
  77. ) internal virtual override(ERC721, ERC721Votes) {
  78. super._afterConsecutiveTokenTransfer(from, to, first, size);
  79. }
  80. }
  81. contract ERC721ConsecutiveEnumerableMock is ERC721Consecutive, ERC721Enumerable {
  82. constructor(
  83. string memory name,
  84. string memory symbol,
  85. address[] memory receivers,
  86. uint96[] memory amounts
  87. ) ERC721(name, symbol) {
  88. for (uint256 i = 0; i < receivers.length; ++i) {
  89. _mintConsecutive(receivers[i], amounts[i]);
  90. }
  91. }
  92. function supportsInterface(bytes4 interfaceId)
  93. public
  94. view
  95. virtual
  96. override(ERC721, ERC721Enumerable)
  97. returns (bool)
  98. {
  99. return super.supportsInterface(interfaceId);
  100. }
  101. function _ownerOf(uint256 tokenId) internal view virtual override(ERC721, ERC721Consecutive) returns (address) {
  102. return super._ownerOf(tokenId);
  103. }
  104. function _mint(address to, uint256 tokenId) internal virtual override(ERC721, ERC721Consecutive) {
  105. super._mint(to, tokenId);
  106. }
  107. function _beforeTokenTransfer(
  108. address from,
  109. address to,
  110. uint256 tokenId
  111. ) internal virtual override(ERC721, ERC721Enumerable) {
  112. super._beforeTokenTransfer(from, to, tokenId);
  113. }
  114. function _afterTokenTransfer(
  115. address from,
  116. address to,
  117. uint256 tokenId
  118. ) internal virtual override(ERC721, ERC721Consecutive) {
  119. super._afterTokenTransfer(from, to, tokenId);
  120. }
  121. function _beforeConsecutiveTokenTransfer(
  122. address from,
  123. address to,
  124. uint256 first,
  125. uint96 size
  126. ) internal virtual override(ERC721, ERC721Enumerable) {
  127. super._beforeConsecutiveTokenTransfer(from, to, first, size);
  128. }
  129. }
  130. contract ERC721ConsecutiveNoConstructorMintMock is ERC721Consecutive {
  131. constructor(string memory name, string memory symbol) ERC721(name, symbol) {
  132. _mint(msg.sender, 0);
  133. }
  134. }