ERC721ConsecutiveMock.sol 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 firstTokenId,
  54. uint256 batchSize
  55. ) internal virtual override(ERC721, ERC721Pausable) {
  56. super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
  57. }
  58. function _afterTokenTransfer(
  59. address from,
  60. address to,
  61. uint256 firstTokenId,
  62. uint256 batchSize
  63. ) internal virtual override(ERC721, ERC721Votes, ERC721Consecutive) {
  64. super._afterTokenTransfer(from, to, firstTokenId, batchSize);
  65. }
  66. }
  67. contract ERC721ConsecutiveNoConstructorMintMock is ERC721Consecutive {
  68. constructor(string memory name, string memory symbol) ERC721(name, symbol) {
  69. _mint(msg.sender, 0);
  70. }
  71. }