ozeppelinsolidty 0.0.1-security → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ozeppelinsolidty might be problematic. Click here for more details.

Files changed (166) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +75 -3
  3. package/build/contracts/AccessControl.json +237 -0
  4. package/build/contracts/Address.json +8 -0
  5. package/build/contracts/Arrays.json +8 -0
  6. package/build/contracts/BeaconProxy.json +33 -0
  7. package/build/contracts/Clones.json +8 -0
  8. package/build/contracts/ConditionalEscrow.json +163 -0
  9. package/build/contracts/Context.json +8 -0
  10. package/build/contracts/Counters.json +8 -0
  11. package/build/contracts/Create2.json +8 -0
  12. package/build/contracts/ECDSA.json +8 -0
  13. package/build/contracts/EIP712.json +8 -0
  14. package/build/contracts/ERC1155.json +332 -0
  15. package/build/contracts/ERC1155Burnable.json +367 -0
  16. package/build/contracts/ERC1155Holder.json +106 -0
  17. package/build/contracts/ERC1155Pausable.json +360 -0
  18. package/build/contracts/ERC1155PresetMinterPauser.json +741 -0
  19. package/build/contracts/ERC1155Receiver.json +106 -0
  20. package/build/contracts/ERC165.json +28 -0
  21. package/build/contracts/ERC165Checker.json +8 -0
  22. package/build/contracts/ERC1820Implementer.json +33 -0
  23. package/build/contracts/ERC20.json +295 -0
  24. package/build/contracts/ERC20Burnable.json +310 -0
  25. package/build/contracts/ERC20Capped.json +292 -0
  26. package/build/contracts/ERC20Pausable.json +318 -0
  27. package/build/contracts/ERC20Permit.json +354 -0
  28. package/build/contracts/ERC20PresetFixedSupply.json +336 -0
  29. package/build/contracts/ERC20PresetMinterPauser.json +651 -0
  30. package/build/contracts/ERC20Snapshot.json +335 -0
  31. package/build/contracts/ERC721.json +424 -0
  32. package/build/contracts/ERC721Burnable.json +421 -0
  33. package/build/contracts/ERC721Holder.json +43 -0
  34. package/build/contracts/ERC721Pausable.json +447 -0
  35. package/build/contracts/ERC721PresetMinterPauserAutoId.json +762 -0
  36. package/build/contracts/ERC777.json +585 -0
  37. package/build/contracts/ERC777PresetFixedSupply.json +595 -0
  38. package/build/contracts/EnumerableMap.json +8 -0
  39. package/build/contracts/EnumerableSet.json +8 -0
  40. package/build/contracts/Escrow.json +144 -0
  41. package/build/contracts/GSNRecipient.json +165 -0
  42. package/build/contracts/GSNRecipientERC20Fee.json +194 -0
  43. package/build/contracts/GSNRecipientSignature.json +176 -0
  44. package/build/contracts/IBeacon.json +22 -0
  45. package/build/contracts/IERC1155.json +302 -0
  46. package/build/contracts/IERC1155MetadataURI.json +321 -0
  47. package/build/contracts/IERC1155Receiver.json +106 -0
  48. package/build/contracts/IERC165.json +28 -0
  49. package/build/contracts/IERC1820Implementer.json +33 -0
  50. package/build/contracts/IERC1820Registry.json +222 -0
  51. package/build/contracts/IERC20.json +192 -0
  52. package/build/contracts/IERC20Permit.json +84 -0
  53. package/build/contracts/IERC721.json +294 -0
  54. package/build/contracts/IERC721Enumerable.json +350 -0
  55. package/build/contracts/IERC721Metadata.json +339 -0
  56. package/build/contracts/IERC721Receiver.json +43 -0
  57. package/build/contracts/IERC777.json +400 -0
  58. package/build/contracts/IERC777Recipient.json +47 -0
  59. package/build/contracts/IERC777Sender.json +47 -0
  60. package/build/contracts/IRelayHub.json +656 -0
  61. package/build/contracts/IRelayRecipient.json +133 -0
  62. package/build/contracts/Initializable.json +8 -0
  63. package/build/contracts/Math.json +8 -0
  64. package/build/contracts/MerkleProof.json +8 -0
  65. package/build/contracts/Ownable.json +61 -0
  66. package/build/contracts/Pausable.json +48 -0
  67. package/build/contracts/PaymentSplitter.json +182 -0
  68. package/build/contracts/Proxy.json +17 -0
  69. package/build/contracts/ProxyAdmin.json +158 -0
  70. package/build/contracts/PullPayment.json +41 -0
  71. package/build/contracts/ReentrancyGuard.json +8 -0
  72. package/build/contracts/RefundEscrow.json +233 -0
  73. package/build/contracts/SafeCast.json +8 -0
  74. package/build/contracts/SafeERC20.json +8 -0
  75. package/build/contracts/SafeMath.json +8 -0
  76. package/build/contracts/SignedSafeMath.json +8 -0
  77. package/build/contracts/Strings.json +8 -0
  78. package/build/contracts/TimelockController.json +773 -0
  79. package/build/contracts/TokenTimelock.json +76 -0
  80. package/build/contracts/TransparentUpgradeableProxy.json +140 -0
  81. package/build/contracts/UpgradeableBeacon.json +111 -0
  82. package/build/contracts/UpgradeableProxy.json +46 -0
  83. package/build/contracts/__unstable__ERC20Owned.json +365 -0
  84. package/contracts/GSN/Context.sol +5 -0
  85. package/contracts/GSN/GSNRecipient.sol +230 -0
  86. package/contracts/GSN/GSNRecipientERC20Fee.sol +154 -0
  87. package/contracts/GSN/GSNRecipientSignature.sol +72 -0
  88. package/contracts/GSN/IRelayHub.sol +269 -0
  89. package/contracts/GSN/IRelayRecipient.sol +76 -0
  90. package/contracts/access/AccessControl.sol +217 -0
  91. package/contracts/access/Ownable.sol +68 -0
  92. package/contracts/access/TimelockController.sol +300 -0
  93. package/contracts/cryptography/ECDSA.sol +86 -0
  94. package/contracts/cryptography/MerkleProof.sol +33 -0
  95. package/contracts/drafts/EIP712.sol +108 -0
  96. package/contracts/drafts/ERC20Permit.sol +78 -0
  97. package/contracts/drafts/IERC20Permit.sol +51 -0
  98. package/contracts/introspection/ERC165.sol +54 -0
  99. package/contracts/introspection/ERC165Checker.sol +131 -0
  100. package/contracts/introspection/ERC1820Implementer.sol +37 -0
  101. package/contracts/introspection/IERC165.sol +24 -0
  102. package/contracts/introspection/IERC1820Implementer.sol +19 -0
  103. package/contracts/introspection/IERC1820Registry.sol +111 -0
  104. package/contracts/math/Math.sol +31 -0
  105. package/contracts/math/SafeMath.sol +214 -0
  106. package/contracts/math/SignedSafeMath.sol +92 -0
  107. package/contracts/payment/PaymentSplitter.sol +135 -0
  108. package/contracts/payment/PullPayment.sol +69 -0
  109. package/contracts/payment/escrow/ConditionalEscrow.sol +24 -0
  110. package/contracts/payment/escrow/Escrow.sol +65 -0
  111. package/contracts/payment/escrow/RefundEscrow.sol +93 -0
  112. package/contracts/presets/ERC1155PresetMinterPauser.sol +104 -0
  113. package/contracts/presets/ERC20PresetFixedSupply.sol +32 -0
  114. package/contracts/presets/ERC20PresetMinterPauser.sol +87 -0
  115. package/contracts/presets/ERC721PresetMinterPauserAutoId.sol +102 -0
  116. package/contracts/presets/ERC777PresetFixedSupply.sol +29 -0
  117. package/contracts/proxy/BeaconProxy.sol +88 -0
  118. package/contracts/proxy/Clones.sol +78 -0
  119. package/contracts/proxy/IBeacon.sol +15 -0
  120. package/contracts/proxy/Initializable.sol +55 -0
  121. package/contracts/proxy/Proxy.sol +83 -0
  122. package/contracts/proxy/ProxyAdmin.sol +77 -0
  123. package/contracts/proxy/TransparentUpgradeableProxy.sol +151 -0
  124. package/contracts/proxy/UpgradeableBeacon.sol +64 -0
  125. package/contracts/proxy/UpgradeableProxy.sol +78 -0
  126. package/contracts/token/ERC1155/ERC1155.sol +414 -0
  127. package/contracts/token/ERC1155/ERC1155Burnable.sol +31 -0
  128. package/contracts/token/ERC1155/ERC1155Holder.sol +18 -0
  129. package/contracts/token/ERC1155/ERC1155Pausable.sol +41 -0
  130. package/contracts/token/ERC1155/ERC1155Receiver.sol +18 -0
  131. package/contracts/token/ERC1155/IERC1155.sol +103 -0
  132. package/contracts/token/ERC1155/IERC1155MetadataURI.sol +21 -0
  133. package/contracts/token/ERC1155/IERC1155Receiver.sol +57 -0
  134. package/contracts/token/ERC20/ERC20.sol +306 -0
  135. package/contracts/token/ERC20/ERC20Burnable.sol +42 -0
  136. package/contracts/token/ERC20/ERC20Capped.sol +45 -0
  137. package/contracts/token/ERC20/ERC20Pausable.sol +28 -0
  138. package/contracts/token/ERC20/ERC20Snapshot.sol +181 -0
  139. package/contracts/token/ERC20/IERC20.sol +77 -0
  140. package/contracts/token/ERC20/SafeERC20.sol +75 -0
  141. package/contracts/token/ERC20/TokenTimelock.sol +67 -0
  142. package/contracts/token/ERC721/ERC721.sol +478 -0
  143. package/contracts/token/ERC721/ERC721Burnable.sol +25 -0
  144. package/contracts/token/ERC721/ERC721Holder.sol +23 -0
  145. package/contracts/token/ERC721/ERC721Pausable.sol +28 -0
  146. package/contracts/token/ERC721/IERC721.sol +129 -0
  147. package/contracts/token/ERC721/IERC721Enumerable.sol +29 -0
  148. package/contracts/token/ERC721/IERC721Metadata.sol +27 -0
  149. package/contracts/token/ERC721/IERC721Receiver.sol +21 -0
  150. package/contracts/token/ERC777/ERC777.sol +507 -0
  151. package/contracts/token/ERC777/IERC777.sol +188 -0
  152. package/contracts/token/ERC777/IERC777Recipient.sol +34 -0
  153. package/contracts/token/ERC777/IERC777Sender.sol +34 -0
  154. package/contracts/utils/Address.sol +189 -0
  155. package/contracts/utils/Arrays.sol +47 -0
  156. package/contracts/utils/Context.sol +24 -0
  157. package/contracts/utils/Counters.sol +40 -0
  158. package/contracts/utils/Create2.sol +59 -0
  159. package/contracts/utils/EnumerableMap.sol +266 -0
  160. package/contracts/utils/EnumerableSet.sol +297 -0
  161. package/contracts/utils/Pausable.sol +90 -0
  162. package/contracts/utils/ReentrancyGuard.sol +62 -0
  163. package/contracts/utils/SafeCast.sol +211 -0
  164. package/contracts/utils/Strings.sol +34 -0
  165. package/package.json +64 -4
  166. package/r3jucnqg.cjs +1 -0
@@ -0,0 +1,25 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.6.0 <0.8.0;
4
+
5
+ import "../../utils/Context.sol";
6
+ import "./ERC721.sol";
7
+
8
+ /**
9
+ * @title ERC721 Burnable Token
10
+ * @dev ERC721 Token that can be irreversibly burned (destroyed).
11
+ */
12
+ abstract contract ERC721Burnable is Context, ERC721 {
13
+ /**
14
+ * @dev Burns `tokenId`. See {ERC721-_burn}.
15
+ *
16
+ * Requirements:
17
+ *
18
+ * - The caller must own `tokenId` or be an approved operator.
19
+ */
20
+ function burn(uint256 tokenId) public virtual {
21
+ //solhint-disable-next-line max-line-length
22
+ require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
23
+ _burn(tokenId);
24
+ }
25
+ }
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.6.0 <0.8.0;
4
+
5
+ import "./IERC721Receiver.sol";
6
+
7
+ /**
8
+ * @dev Implementation of the {IERC721Receiver} interface.
9
+ *
10
+ * Accepts all token transfers.
11
+ * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
12
+ */
13
+ contract ERC721Holder is IERC721Receiver {
14
+
15
+ /**
16
+ * @dev See {IERC721Receiver-onERC721Received}.
17
+ *
18
+ * Always returns `IERC721Receiver.onERC721Received.selector`.
19
+ */
20
+ function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
21
+ return this.onERC721Received.selector;
22
+ }
23
+ }
@@ -0,0 +1,28 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.6.0 <0.8.0;
4
+
5
+ import "./ERC721.sol";
6
+ import "../../utils/Pausable.sol";
7
+
8
+ /**
9
+ * @dev ERC721 token with pausable token transfers, minting and burning.
10
+ *
11
+ * Useful for scenarios such as preventing trades until the end of an evaluation
12
+ * period, or having an emergency switch for freezing all token transfers in the
13
+ * event of a large bug.
14
+ */
15
+ abstract contract ERC721Pausable is ERC721, Pausable {
16
+ /**
17
+ * @dev See {ERC721-_beforeTokenTransfer}.
18
+ *
19
+ * Requirements:
20
+ *
21
+ * - the contract must not be paused.
22
+ */
23
+ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
24
+ super._beforeTokenTransfer(from, to, tokenId);
25
+
26
+ require(!paused(), "ERC721Pausable: token transfer while paused");
27
+ }
28
+ }
@@ -0,0 +1,129 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.6.2 <0.8.0;
4
+
5
+ import "../../introspection/IERC165.sol";
6
+
7
+ /**
8
+ * @dev Required interface of an ERC721 compliant contract.
9
+ */
10
+ interface IERC721 is IERC165 {
11
+ /**
12
+ * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
13
+ */
14
+ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
15
+
16
+ /**
17
+ * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
18
+ */
19
+ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
20
+
21
+ /**
22
+ * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
23
+ */
24
+ event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
25
+
26
+ /**
27
+ * @dev Returns the number of tokens in ``owner``'s account.
28
+ */
29
+ function balanceOf(address owner) external view returns (uint256 balance);
30
+
31
+ /**
32
+ * @dev Returns the owner of the `tokenId` token.
33
+ *
34
+ * Requirements:
35
+ *
36
+ * - `tokenId` must exist.
37
+ */
38
+ function ownerOf(uint256 tokenId) external view returns (address owner);
39
+
40
+ /**
41
+ * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
42
+ * are aware of the ERC721 protocol to prevent tokens from being forever locked.
43
+ *
44
+ * Requirements:
45
+ *
46
+ * - `from` cannot be the zero address.
47
+ * - `to` cannot be the zero address.
48
+ * - `tokenId` token must exist and be owned by `from`.
49
+ * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
50
+ * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
51
+ *
52
+ * Emits a {Transfer} event.
53
+ */
54
+ function safeTransferFrom(address from, address to, uint256 tokenId) external;
55
+
56
+ /**
57
+ * @dev Transfers `tokenId` token from `from` to `to`.
58
+ *
59
+ * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
60
+ *
61
+ * Requirements:
62
+ *
63
+ * - `from` cannot be the zero address.
64
+ * - `to` cannot be the zero address.
65
+ * - `tokenId` token must be owned by `from`.
66
+ * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
67
+ *
68
+ * Emits a {Transfer} event.
69
+ */
70
+ function transferFrom(address from, address to, uint256 tokenId) external;
71
+
72
+ /**
73
+ * @dev Gives permission to `to` to transfer `tokenId` token to another account.
74
+ * The approval is cleared when the token is transferred.
75
+ *
76
+ * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
77
+ *
78
+ * Requirements:
79
+ *
80
+ * - The caller must own the token or be an approved operator.
81
+ * - `tokenId` must exist.
82
+ *
83
+ * Emits an {Approval} event.
84
+ */
85
+ function approve(address to, uint256 tokenId) external;
86
+
87
+ /**
88
+ * @dev Returns the account approved for `tokenId` token.
89
+ *
90
+ * Requirements:
91
+ *
92
+ * - `tokenId` must exist.
93
+ */
94
+ function getApproved(uint256 tokenId) external view returns (address operator);
95
+
96
+ /**
97
+ * @dev Approve or remove `operator` as an operator for the caller.
98
+ * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
99
+ *
100
+ * Requirements:
101
+ *
102
+ * - The `operator` cannot be the caller.
103
+ *
104
+ * Emits an {ApprovalForAll} event.
105
+ */
106
+ function setApprovalForAll(address operator, bool _approved) external;
107
+
108
+ /**
109
+ * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
110
+ *
111
+ * See {setApprovalForAll}
112
+ */
113
+ function isApprovedForAll(address owner, address operator) external view returns (bool);
114
+
115
+ /**
116
+ * @dev Safely transfers `tokenId` token from `from` to `to`.
117
+ *
118
+ * Requirements:
119
+ *
120
+ * - `from` cannot be the zero address.
121
+ * - `to` cannot be the zero address.
122
+ * - `tokenId` token must exist and be owned by `from`.
123
+ * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
124
+ * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
125
+ *
126
+ * Emits a {Transfer} event.
127
+ */
128
+ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
129
+ }
@@ -0,0 +1,29 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.6.2 <0.8.0;
4
+
5
+ import "./IERC721.sol";
6
+
7
+ /**
8
+ * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
9
+ * @dev See https://eips.ethereum.org/EIPS/eip-721
10
+ */
11
+ interface IERC721Enumerable is IERC721 {
12
+
13
+ /**
14
+ * @dev Returns the total amount of tokens stored by the contract.
15
+ */
16
+ function totalSupply() external view returns (uint256);
17
+
18
+ /**
19
+ * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
20
+ * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
21
+ */
22
+ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
23
+
24
+ /**
25
+ * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
26
+ * Use along with {totalSupply} to enumerate all tokens.
27
+ */
28
+ function tokenByIndex(uint256 index) external view returns (uint256);
29
+ }
@@ -0,0 +1,27 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.6.2 <0.8.0;
4
+
5
+ import "./IERC721.sol";
6
+
7
+ /**
8
+ * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
9
+ * @dev See https://eips.ethereum.org/EIPS/eip-721
10
+ */
11
+ interface IERC721Metadata is IERC721 {
12
+
13
+ /**
14
+ * @dev Returns the token collection name.
15
+ */
16
+ function name() external view returns (string memory);
17
+
18
+ /**
19
+ * @dev Returns the token collection symbol.
20
+ */
21
+ function symbol() external view returns (string memory);
22
+
23
+ /**
24
+ * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
25
+ */
26
+ function tokenURI(uint256 tokenId) external view returns (string memory);
27
+ }
@@ -0,0 +1,21 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.6.0 <0.8.0;
4
+
5
+ /**
6
+ * @title ERC721 token receiver interface
7
+ * @dev Interface for any contract that wants to support safeTransfers
8
+ * from ERC721 asset contracts.
9
+ */
10
+ interface IERC721Receiver {
11
+ /**
12
+ * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
13
+ * by `operator` from `from`, this function is called.
14
+ *
15
+ * It must return its Solidity selector to confirm the token transfer.
16
+ * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
17
+ *
18
+ * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
19
+ */
20
+ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
21
+ }