ERC721ConsecutiveMock.sol 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/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 ERC721ConsecutiveNoConstructorMintMock is ERC721Consecutive {
  82. constructor(string memory name, string memory symbol) ERC721(name, symbol) {
  83. _mint(msg.sender, 0);
  84. }
  85. }