ERC721ConsecutiveMock.sol 2.1 KB

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