ERC721ConsecutiveMock.sol 1.9 KB

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