ERC721ConsecutiveMock.sol 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.19;
  3. import "../../token/ERC721/extensions/ERC721Consecutive.sol";
  4. import "../../token/ERC721/extensions/ERC721Pausable.sol";
  5. import "../../token/ERC721/extensions/ERC721Votes.sol";
  6. /**
  7. * @title ERC721ConsecutiveMock
  8. */
  9. contract ERC721ConsecutiveMock is ERC721Consecutive, ERC721Pausable, ERC721Votes {
  10. uint96 private immutable _offset;
  11. constructor(
  12. string memory name,
  13. string memory symbol,
  14. uint96 offset,
  15. address[] memory delegates,
  16. address[] memory receivers,
  17. uint96[] memory amounts
  18. ) ERC721(name, symbol) EIP712(name, "1") {
  19. _offset = offset;
  20. for (uint256 i = 0; i < delegates.length; ++i) {
  21. _delegate(delegates[i], delegates[i]);
  22. }
  23. for (uint256 i = 0; i < receivers.length; ++i) {
  24. _mintConsecutive(receivers[i], amounts[i]);
  25. }
  26. }
  27. function _firstConsecutiveId() internal view virtual override returns (uint96) {
  28. return _offset;
  29. }
  30. function _ownerOf(uint256 tokenId) internal view virtual override(ERC721, ERC721Consecutive) returns (address) {
  31. return super._ownerOf(tokenId);
  32. }
  33. function _mint(address to, uint256 tokenId) internal virtual override(ERC721, ERC721Consecutive) {
  34. super._mint(to, tokenId);
  35. }
  36. function _beforeTokenTransfer(
  37. address from,
  38. address to,
  39. uint256 firstTokenId,
  40. uint256 batchSize
  41. ) internal virtual override(ERC721, ERC721Pausable) {
  42. super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
  43. }
  44. function _afterTokenTransfer(
  45. address from,
  46. address to,
  47. uint256 firstTokenId,
  48. uint256 batchSize
  49. ) internal virtual override(ERC721, ERC721Votes, ERC721Consecutive) {
  50. super._afterTokenTransfer(from, to, firstTokenId, batchSize);
  51. }
  52. }
  53. contract ERC721ConsecutiveNoConstructorMintMock is ERC721Consecutive {
  54. constructor(string memory name, string memory symbol) ERC721(name, symbol) {
  55. _mint(msg.sender, 0);
  56. }
  57. }