polkamarkets-js 3.4.1 → 3.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/package.json +1 -1
  2. package/script/AddAdminToLand.s.sol +1 -1
  3. package/script/ClaimMerkleRoot.s.sol +29 -29
  4. package/script/CreateLand.s.sol +1 -1
  5. package/script/DeployMerkleRewardsDistributor.s.sol +21 -21
  6. package/script/MintTokens.s.sol +1 -1
  7. package/script/PublishMerkleRoot.s.sol +50 -50
  8. package/script/UpdateMarket.s.sol +55 -0
  9. package/script/copy-abis.js +57 -0
  10. package/src/Application.js +12 -1
  11. package/src/models/IContract.js +87 -1
  12. package/src/models/PolkamarketsSmartAccount.js +23 -0
  13. package/src/models/PredictionMarketV3Contract.js +49 -16
  14. package/abis/AccessControlUpgradeable.json +0 -1
  15. package/abis/AddAdminToLand.json +0 -1
  16. package/abis/AddressUpgradeable.json +0 -1
  17. package/abis/ClaimMerkleRoot.json +0 -1
  18. package/abis/CreateLand.json +0 -1
  19. package/abis/CreateMarkets.json +0 -1
  20. package/abis/DeployContracts.json +0 -1
  21. package/abis/DeployMerkleRewardsDistributor.json +0 -1
  22. package/abis/DeployToken.json +0 -1
  23. package/abis/DeployUSDT.json +0 -1
  24. package/abis/ECDSA.json +0 -1
  25. package/abis/ERC165Upgradeable.json +0 -1
  26. package/abis/ERC1967UpgradeUpgradeable.json +0 -1
  27. package/abis/Hashes.json +0 -1
  28. package/abis/IBeaconUpgradeable.json +0 -1
  29. package/abis/IERC1822ProxiableUpgradeable.json +0 -1
  30. package/abis/IERC20PermitUpgradeable.json +0 -1
  31. package/abis/IERC20Upgradeable.json +0 -1
  32. package/abis/Manager.json +0 -1
  33. package/abis/MerkleProof.json +0 -1
  34. package/abis/MerkleRewardsDistributor.json +0 -1
  35. package/abis/MerkleRewardsDistributorTest.json +0 -1
  36. package/abis/MessageHashUtils.json +0 -1
  37. package/abis/MintTokens.json +0 -1
  38. package/abis/Nonces.json +0 -1
  39. package/abis/Panic.json +0 -1
  40. package/abis/PublishMerkleRoot.json +0 -1
  41. package/abis/ResolveMarket.json +0 -1
  42. package/abis/RewardsDistributor.json +0 -1
  43. package/abis/RewardsDistributorTest.json +0 -1
  44. package/abis/SafeCast.json +0 -1
  45. package/abis/SafeERC20Upgradeable.json +0 -1
  46. package/abis/SignedMath.json +0 -1
  47. package/abis/StorageSlotUpgradeable.json +0 -1
  48. package/abis/TradeMarket.json +0 -1
  49. package/abis/USDT.json +0 -1
  50. package/abis/UpdateMarket.json +0 -1
  51. package/abis/UpdateTest.json +0 -1
  52. package/abis/WhaleTest.json +0 -1
  53. package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
  54. package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
  55. package/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
  56. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
  57. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
  58. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
  59. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
  60. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
  61. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
  62. package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
  63. package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
  64. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
  65. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
  66. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
  67. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
  68. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
  69. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
  70. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
  71. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
  72. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
  73. package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
  74. package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
  75. package/lib/openzeppelin-contracts/docs/README.md +0 -16
  76. package/lib/openzeppelin-contracts/docs/antora.yml +0 -7
  77. package/lib/openzeppelin-contracts/docs/config.js +0 -21
  78. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  79. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  80. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
  81. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  82. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  83. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  84. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  85. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  86. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  87. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  88. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  89. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  90. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
  91. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
  92. package/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
  93. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
  94. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  95. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
  96. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  97. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  98. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  99. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  100. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
  101. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  102. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  103. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
  104. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  105. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
  106. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
  107. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
  108. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
  109. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
  110. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  111. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
  112. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
  113. package/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
  114. package/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
  115. package/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
  116. package/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
  117. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC20WithAutoMinerRewardUpgradeable.sol +0 -28
  118. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC4626FeesUpgradeable.sol +0 -115
  119. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/MyNFTUpgradeable.sol +0 -14
  120. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintBaseUpgradeable.sol +0 -31
  121. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintMissingUpgradeable.sol +0 -30
  122. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRoleUpgradeable.sol +0 -29
  123. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlModifiedUpgradeable.sol +0 -20
  124. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessManagedERC20MintBaseUpgradeable.sol +0 -22
  125. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/MyContractOwnableUpgradeable.sol +0 -22
  126. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyAccountERC7702Upgradeable.sol +0 -26
  127. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyFactoryAccountUpgradeable.sol +0 -42
  128. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyGovernorUpgradeable.sol +0 -92
  129. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenTimestampBasedUpgradeable.sol +0 -39
  130. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenUpgradeable.sol +0 -28
  131. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenWrappedUpgradeable.sol +0 -39
  132. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/GameItemsUpgradeable.sol +0 -27
  133. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/MyERC115HolderContractUpgradeable.sol +0 -13
  134. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC20/GLDTokenUpgradeable.sol +0 -17
  135. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC6909/ERC6909GameItemsUpgradeable.sol +0 -31
  136. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC721/GameItemUpgradeable.sol +0 -24
  137. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/Base64NFTUpgradeable.sol +0 -32
  138. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/MulticallUpgradeable.sol +0 -21
  139. package/lib/openzeppelin-contracts-upgradeable/docs/README.md +0 -16
  140. package/lib/openzeppelin-contracts-upgradeable/docs/antora.yml +0 -7
  141. package/lib/openzeppelin-contracts-upgradeable/docs/config.js +0 -21
  142. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  143. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  144. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager.svg +0 -99
  145. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  146. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  147. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  148. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  149. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  150. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  151. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  152. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  153. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  154. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-exec.png +0 -0
  155. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-vote.png +0 -0
  156. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/nav.adoc +0 -29
  157. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/access-control.adoc +0 -288
  158. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  159. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/accounts.adoc +0 -354
  160. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  161. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  162. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  163. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  164. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20.adoc +0 -67
  165. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  166. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  167. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc721.adoc +0 -58
  168. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  169. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/faq.adoc +0 -13
  170. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/governance.adoc +0 -239
  171. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/index.adoc +0 -70
  172. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/multisig.adoc +0 -306
  173. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/tokens.adoc +0 -31
  174. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  175. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/utilities.adoc +0 -591
  176. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/wizard.adoc +0 -15
  177. package/lib/openzeppelin-contracts-upgradeable/docs/templates/contract.hbs +0 -141
  178. package/lib/openzeppelin-contracts-upgradeable/docs/templates/helpers.js +0 -46
  179. package/lib/openzeppelin-contracts-upgradeable/docs/templates/page.hbs +0 -4
  180. package/lib/openzeppelin-contracts-upgradeable/docs/templates/properties.js +0 -88
  181. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
  182. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
  183. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
  184. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
  185. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
  186. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
  187. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
  188. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
  189. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
  190. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
  191. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
  192. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
  193. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
  194. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
  195. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
  196. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
  197. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
  198. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
  199. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
  200. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
  201. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
  202. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
  203. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/README.md +0 -16
  204. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/antora.yml +0 -7
  205. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/config.js +0 -21
  206. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  207. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  208. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
  209. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  210. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  211. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  212. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  213. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  214. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  215. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  216. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  217. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  218. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
  219. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
  220. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
  221. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
  222. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  223. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
  224. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  225. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  226. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  227. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  228. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
  229. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  230. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  231. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
  232. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  233. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
  234. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
  235. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
  236. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
  237. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
  238. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  239. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
  240. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
  241. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
  242. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
  243. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
  244. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
  245. package/lib/openzeppelin-contracts-upgradeable.git/docs/antora.yml +0 -6
  246. package/lib/openzeppelin-contracts-upgradeable.git/docs/config.js +0 -21
  247. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-exec.png +0 -0
  248. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-vote.png +0 -0
  249. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/nav.adoc +0 -23
  250. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
  251. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
  252. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
  253. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
  254. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
  255. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
  256. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
  257. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
  258. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
  259. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
  260. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/governance.adoc +0 -321
  261. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/index.adoc +0 -63
  262. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
  263. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
  264. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
  265. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
  266. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
  267. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/contract.hbs +0 -85
  268. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/helpers.js +0 -46
  269. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/page.hbs +0 -4
  270. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/properties.js +0 -49
  271. package/lib/openzeppelin-contracts.git/docs/antora.yml +0 -6
  272. package/lib/openzeppelin-contracts.git/docs/config.js +0 -21
  273. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-exec.png +0 -0
  274. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-vote.png +0 -0
  275. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/nav.adoc +0 -23
  276. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
  277. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
  278. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
  279. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
  280. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
  281. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
  282. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
  283. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
  284. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
  285. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
  286. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/governance.adoc +0 -321
  287. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/index.adoc +0 -63
  288. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
  289. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
  290. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
  291. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
  292. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
  293. package/lib/openzeppelin-contracts.git/docs/templates/contract.hbs +0 -85
  294. package/lib/openzeppelin-contracts.git/docs/templates/helpers.js +0 -46
  295. package/lib/openzeppelin-contracts.git/docs/templates/page.hbs +0 -4
  296. package/lib/openzeppelin-contracts.git/docs/templates/properties.js +0 -49
  297. package/lib/reality-eth-monorepo/packages/docs/Audit_Reality_v3_202108.pdf +0 -0
  298. package/lib/reality-eth-monorepo/packages/docs/Makefile +0 -20
  299. package/lib/reality-eth-monorepo/packages/docs/arbitrators.rst +0 -85
  300. package/lib/reality-eth-monorepo/packages/docs/audit.rst +0 -12
  301. package/lib/reality-eth-monorepo/packages/docs/audit_v2.rst +0 -249
  302. package/lib/reality-eth-monorepo/packages/docs/audit_v2_ERC20.rst +0 -1075
  303. package/lib/reality-eth-monorepo/packages/docs/audit_v3.rst +0 -70
  304. package/lib/reality-eth-monorepo/packages/docs/conf.py +0 -155
  305. package/lib/reality-eth-monorepo/packages/docs/contract_explanation.rst +0 -82
  306. package/lib/reality-eth-monorepo/packages/docs/contracts.rst +0 -277
  307. package/lib/reality-eth-monorepo/packages/docs/dapp.rst +0 -126
  308. package/lib/reality-eth-monorepo/packages/docs/dapp_links.rst +0 -67
  309. package/lib/reality-eth-monorepo/packages/docs/fees.rst +0 -89
  310. package/lib/reality-eth-monorepo/packages/docs/index.rst +0 -26
  311. package/lib/reality-eth-monorepo/packages/docs/javascript.rst +0 -142
  312. package/lib/reality-eth-monorepo/packages/docs/make.bat +0 -36
  313. package/lib/reality-eth-monorepo/packages/docs/question_box.png +0 -0
  314. package/lib/reality-eth-monorepo/packages/docs/requirements.txt +0 -24
  315. package/lib/reality-eth-monorepo/packages/docs/whitepaper.rst +0 -165
  316. package/test/UpdateTest.t.sol +0 -55
  317. package/test/WhaleTest.t.sol +0 -188
  318. package/tooling/docs/jsdoc.json +0 -6
@@ -1,63 +0,0 @@
1
- = Contracts
2
-
3
- *A library for secure smart contract development.* Build on a solid foundation of community-vetted code.
4
-
5
- * Implementations of standards like xref:erc20.adoc[ERC20] and xref:erc721.adoc[ERC721].
6
- * Flexible xref:access-control.adoc[role-based permissioning] scheme.
7
- * Reusable xref:utilities.adoc[Solidity components] to build custom contracts and complex decentralized systems.
8
-
9
- == Overview
10
-
11
- [[install]]
12
- === Installation
13
-
14
- ```console
15
- $ npm install @openzeppelin/contracts
16
- ```
17
-
18
- OpenZeppelin Contracts features a xref:releases-stability.adoc#api-stability[stable API], which means your contracts won't break unexpectedly when upgrading to a newer minor version.
19
-
20
- [[usage]]
21
- === Usage
22
-
23
- Once installed, you can use the contracts in the library by importing them:
24
-
25
- [source,solidity]
26
- ----
27
- // contracts/MyNFT.sol
28
- // SPDX-License-Identifier: MIT
29
- pragma solidity ^0.8.0;
30
-
31
- import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
32
-
33
- contract MyNFT is ERC721 {
34
- constructor() ERC721("MyNFT", "MNFT") {
35
- }
36
- }
37
- ----
38
-
39
- TIP: If you're new to smart contract development, head to xref:learn::developing-smart-contracts.adoc[Developing Smart Contracts] to learn about creating a new project and compiling your contracts.
40
-
41
- To keep your system secure, you should **always** use the installed code as-is, and neither copy-paste it from online sources, nor modify it yourself. The library is designed so that only the contracts and functions you use are deployed, so you don't need to worry about it needlessly increasing gas costs.
42
-
43
- [[security]]
44
- == Security
45
-
46
- Please report any security issues you find via our https://www.immunefi.com/bounty/openzeppelin[bug bounty program on Immunefi] or directly to security@openzeppelin.org.
47
-
48
- [[next-steps]]
49
- == Learn More
50
-
51
- The guides in the sidebar will teach about different concepts, and how to use the related contracts that OpenZeppelin Contracts provides:
52
-
53
- * xref:access-control.adoc[Access Control]: decide who can perform each of the actions on your system.
54
- * xref:tokens.adoc[Tokens]: create tradable assets or collectibles, like the well known xref:erc20.adoc[ERC20] and xref:erc721.adoc[ERC721] standards.
55
- * xref:utilities.adoc[Utilities]: generic useful tools, including non-overflowing math, signature verification, and trustless paying systems.
56
-
57
- The xref:api:token/ERC20.adoc[full API] is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts' development in the https://forum.openzeppelin.com[community forum].
58
-
59
- Finally, you may want to take a look at the https://blog.openzeppelin.com/guides/[guides on our blog], which cover several common use cases and good practices. The following articles provide great background reading, though please note, some of the referenced tools have changed as the tooling in the ecosystem continues to rapidly evolve.
60
-
61
- * https://blog.openzeppelin.com/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05[The Hitchhiker’s Guide to Smart Contracts in Ethereum] will help you get an overview of the various tools available for smart contract development, and help you set up your environment.
62
- * https://blog.openzeppelin.com/a-gentle-introduction-to-ethereum-programming-part-1-783cc7796094[A Gentle Introduction to Ethereum Programming, Part 1] provides very useful information on an introductory level, including many basic concepts from the Ethereum platform.
63
- * For a more in-depth dive, you may read the guide https://blog.openzeppelin.com/designing-the-architecture-for-your-ethereum-application-9cec086f8317[Designing the architecture for your Ethereum application], which discusses how to better structure your application and its relationship to the real world.
@@ -1,85 +0,0 @@
1
- = New Releases and API Stability
2
-
3
- Developing smart contracts is hard, and a conservative approach towards dependencies is sometimes favored. However, it is also very important to stay on top of new releases: these may include bug fixes, or deprecate old patterns in favor of newer and better practices.
4
-
5
- Here we describe when you should expect new releases to come out, and how this affects you as a user of OpenZeppelin Contracts.
6
-
7
- [[release-schedule]]
8
- == Release Schedule
9
-
10
- OpenZeppelin Contracts follows a <<versioning-scheme, semantic versioning scheme>>.
11
-
12
- We aim for a new minor release every 1 or 2 months.
13
-
14
- [[minor-releases]]
15
- === Release Candidates
16
-
17
- Before every release, we publish a feature-frozen release candidate. The purpose of the release candidate is to have a period where the community can review the new code before the actual release. If important problems are discovered, several more release candidates may be required. After a week of no more changes to the release candidate, the new version is published.
18
-
19
- [[major-releases]]
20
- === Major Releases
21
-
22
- After several months or a year a new major release may come out. These are not scheduled, but will be based on the need to release breaking changes such as a redesign of a core feature of the library (e.g. https://github.com/OpenZeppelin/openzeppelin-contracts/pulls/2112[access control] in 3.0). Since we value stability, we aim for these to happen infrequently (expect no less than six months between majors). However, we may be forced to release one when there are big changes to the Solidity language.
23
-
24
- [[api-stability]]
25
- == API Stability
26
-
27
- On the https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v2.0.0[OpenZeppelin Contracts 2.0 release], we committed ourselves to keeping a stable API. We aim to more precisely define what we understand by _stable_ and _API_ here, so users of the library can understand these guarantees and be confident their project won't break unexpectedly.
28
-
29
- In a nutshell, the API being stable means _if your project is working today, it will continue to do so after a minor upgrade_. New contracts and features will be added in minor releases, but only in a backwards compatible way.
30
-
31
- [[versioning-scheme]]
32
- === Versioning Scheme
33
-
34
- We follow https://semver.org/[SemVer], which means API breakage may occur between major releases (which <<release-schedule, don't happen very often>>).
35
-
36
- [[solidity-functions]]
37
- === Solidity Functions
38
-
39
- While the internal implementation of functions may change, their semantics and signature will remain the same. The domain of their arguments will not be less restrictive (e.g. if transferring a value of 0 is disallowed, it will remain disallowed), nor will general state restrictions be lifted (e.g. `whenPaused` modifiers).
40
-
41
- If new functions are added to a contract, it will be in a backwards-compatible way: their usage won't be mandatory, and they won't extend functionality in ways that may foreseeable break an application (e.g. https://github.com/OpenZeppelin/openzeppelin-contracts/issues/1512[an `internal` method may be added to make it easier to retrieve information that was already available]).
42
-
43
- [[internal]]
44
- ==== `internal`
45
-
46
- This extends not only to `external` and `public` functions, but also `internal` ones: many contracts are meant to be used by inheriting them (e.g. `Pausable`, `PullPayment`, `AccessControl`), and are therefore used by calling these functions. Similarly, since all OpenZeppelin Contracts state variables are `private`, they can only be accessed this way (e.g. to create new `ERC20` tokens, instead of manually modifying `totalSupply` and `balances`, `_mint` should be called).
47
-
48
- `private` functions have no guarantees on their behavior, usage, or existence.
49
-
50
- Finally, sometimes language limitations will force us to e.g. make `internal` a function that should be `private` in order to implement features the way we want to. These cases will be well documented, and the normal stability guarantees won't apply.
51
-
52
- [[libraries]]
53
- === Libraries
54
-
55
- Some of our Solidity libraries use ``struct``s to handle internal data that should not be accessed directly (e.g. `Counter`). There's an https://github.com/ethereum/solidity/issues/4637[open issue] in the Solidity repository requesting a language feature to prevent said access, but it looks like it won't be implemented any time soon. Because of this, we will use leading underscores and mark said `struct` s to make it clear to the user that its contents and layout are _not_ part of the API.
56
-
57
- [[events]]
58
- === Events
59
-
60
- No events will be removed, and their arguments won't be changed in any way. New events may be added in later versions, and existing events may be emitted under new, reasonable circumstances (e.g. https://github.com/OpenZeppelin/openzeppelin-contracts/issues/707[from 2.1 on, `ERC20` also emits `Approval` on `transferFrom` calls]).
61
-
62
- [[drafts]]
63
- === Drafts
64
-
65
- Some contracts implement EIPs that are still in Draft status, recognizable by a file name beginning with `draft-`, such as `utils/cryptography/draft-EIP712.sol`. Due to their nature as drafts, the details of these contracts may change and we cannot guarantee their stability. Minor releases of OpenZeppelin Contracts may contain breaking changes for the contracts labelled as Drafts, which will be duly announced in the https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CHANGELOG.md[changelog]. The EIPs included are used by projects in production and this may make them less likely to change significantly.
66
-
67
- [[gas-costs]]
68
- === Gas Costs
69
-
70
- While attempts will generally be made to lower the gas costs of working with OpenZeppelin Contracts, there are no guarantees regarding this. In particular, users should not assume gas costs will not increase when upgrading library versions.
71
-
72
- [[bugfixes]]
73
- === Bug Fixes
74
-
75
- The API stability guarantees may need to be broken in order to fix a bug, and we will do so. This decision won't be made lightly however, and all options will be explored to make the change as non-disruptive as possible. When sufficient, contracts or functions which may result in unsafe behavior will be deprecated instead of removed (e.g. https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1543[#1543] and https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1550[#1550]).
76
-
77
- [[solidity-compiler-version]]
78
- === Solidity Compiler Version
79
-
80
- Starting on version 0.5.0, the Solidity team switched to a faster release cycle, with minor releases every few weeks (v0.5.0 was released on November 2018, and v0.5.5 on March 2019), and major, breaking-change releases every couple of months (with v0.6.0 released on December 2019 and v0.7.0 on July 2020). Including the compiler version in OpenZeppelin Contract's stability guarantees would therefore force the library to either stick to old compilers, or release frequent major updates simply to keep up with newer Solidity releases.
81
-
82
- Because of this, *the minimum required Solidity compiler version is not part of the stability guarantees*, and users may be required to upgrade their compiler when using newer versions of Contracts. Bug fixes will still be backported to past major releases so that all versions currently in use receive these updates.
83
-
84
- You can read more about the rationale behind this, the other options we considered and why we went down this path https://github.com/OpenZeppelin/openzeppelin-contracts/issues/1498#issuecomment-449191611[here].
85
-
@@ -1,32 +0,0 @@
1
- = Tokens
2
-
3
- Ah, the "token": blockchain's most powerful and most misunderstood tool.
4
-
5
- A token is a _representation of something in the blockchain_. This something can be money, time, services, shares in a company, a virtual pet, anything. By representing things as tokens, we can allow smart contracts to interact with them, exchange them, create or destroy them.
6
-
7
- [[but_first_coffee_a_primer_on_token_contracts]]
8
- == But First, [strikethrough]#Coffee# a Primer on Token Contracts
9
-
10
- Much of the confusion surrounding tokens comes from two concepts getting mixed up: _token contracts_ and the actual _tokens_.
11
-
12
- A _token contract_ is simply an Ethereum smart contract. "Sending tokens" actually means "calling a method on a smart contract that someone wrote and deployed". At the end of the day, a token contract is not much more than a mapping of addresses to balances, plus some methods to add and subtract from those balances.
13
-
14
- It is these balances that represent the _tokens_ themselves. Someone "has tokens" when their balance in the token contract is non-zero. That's it! These balances could be considered money, experience points in a game, deeds of ownership, or voting rights, and each of these tokens would be stored in different token contracts.
15
-
16
- [[different-kinds-of-tokens]]
17
- == Different Kinds of Tokens
18
-
19
- Note that there's a big difference between having two voting rights and two deeds of ownership: each vote is equal to all others, but houses usually are not! This is called https://en.wikipedia.org/wiki/Fungibility[fungibility]. _Fungible goods_ are equivalent and interchangeable, like Ether, fiat currencies, and voting rights. _Non-fungible_ goods are unique and distinct, like deeds of ownership, or collectibles.
20
-
21
- In a nutshell, when dealing with non-fungibles (like your house) you care about _which ones_ you have, while in fungible assets (like your bank account statement) what matters is _how much_ you have.
22
-
23
- == Standards
24
-
25
- Even though the concept of a token is simple, they have a variety of complexities in the implementation. Because everything in Ethereum is just a smart contract, and there are no rules about what smart contracts have to do, the community has developed a variety of *standards* (called EIPs or ERCs) for documenting how a contract can interoperate with other contracts.
26
-
27
- You've probably heard of the ERC20 or ERC721 token standards, and that's why you're here. Head to our specialized guides to learn more about these:
28
-
29
- * xref:erc20.adoc[ERC20]: the most widespread token standard for fungible assets, albeit somewhat limited by its simplicity.
30
- * xref:erc721.adoc[ERC721]: the de-facto solution for non-fungible tokens, often used for collectibles and games.
31
- * xref:erc777.adoc[ERC777]: a richer standard for fungible tokens, enabling new use cases and building on past learnings. Backwards compatible with ERC20.
32
- * xref:erc1155.adoc[ERC1155]: a novel standard for multi-tokens, allowing for a single contract to represent multiple fungible and non-fungible tokens, along with batched operations for increased gas efficiency.
@@ -1,73 +0,0 @@
1
- = Using with Upgrades
2
-
3
- If your contract is going to be deployed with upgradeability, such as using the xref:upgrades-plugins::index.adoc[OpenZeppelin Upgrades Plugins], you will need to use the Upgradeable variant of OpenZeppelin Contracts.
4
-
5
- This variant is available as a separate package called `@openzeppelin/contracts-upgradeable`, which is hosted in the repository https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable[OpenZeppelin/openzeppelin-contracts-upgradeable].
6
-
7
- It follows all of the rules for xref:upgrades-plugins::writing-upgradeable.adoc[Writing Upgradeable Contracts]: constructors are replaced by initializer functions, state variables are initialized in initializer functions, and we additionally check for storage incompatibilities across minor versions.
8
-
9
- TIP: OpenZeppelin provides a full suite of tools for deploying and securing upgradeable smart contracts. xref:openzeppelin::upgrades.adoc[Check out the full list of resources].
10
-
11
- == Overview
12
-
13
- === Installation
14
-
15
- ```console
16
- $ npm install @openzeppelin/contracts-upgradeable
17
- ```
18
-
19
- === Usage
20
-
21
- The package replicates the structure of the main OpenZeppelin Contracts package, but every file and contract has the suffix `Upgradeable`.
22
-
23
- ```diff
24
- -import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
25
- +import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
26
-
27
- -contract MyCollectible is ERC721 {
28
- +contract MyCollectible is ERC721Upgradeable {
29
- ```
30
-
31
- Constructors are replaced by internal initializer functions following the naming convention `+__{ContractName}_init+`. Since these are internal, you must always define your own public initializer function and call the parent initializer of the contract you extend.
32
-
33
- ```diff
34
- - constructor() ERC721("MyCollectible", "MCO") public {
35
- + function initialize() initializer public {
36
- + __ERC721_init("MyCollectible", "MCO");
37
- }
38
- ```
39
-
40
- CAUTION: Use with multiple inheritance requires special attention. See the section below titled <<multiple-inheritance>>.
41
-
42
- Once this contract is set up and compiled, you can deploy it using the xref:upgrades-plugins::index.adoc[Upgrades Plugins]. The following snippet shows an example deployment script using Hardhat.
43
-
44
- ```js
45
- // scripts/deploy-my-collectible.js
46
- const { ethers, upgrades } = require("hardhat");
47
-
48
- async function main() {
49
- const MyCollectible = await ethers.getContractFactory("MyCollectible");
50
-
51
- const mc = await upgrades.deployProxy(MyCollectible);
52
-
53
- await mc.deployed();
54
- console.log("MyCollectible deployed to:", mc.address);
55
- }
56
-
57
- main();
58
- ```
59
-
60
- == Further Notes
61
-
62
- [[multiple-inheritance]]
63
- === Multiple Inheritance
64
-
65
- Initializer functions are not linearized by the compiler like constructors. Because of this, each `+__{ContractName}_init+` function embeds the linearized calls to all parent initializers. As a consequence, calling two of these `init` functions can potentially initialize the same contract twice.
66
-
67
- The function `+__{ContractName}_init_unchained+` found in every contract is the initializer function minus the calls to parent initializers, and can be used to avoid the double initialization problem, but doing this manually is not recommended. We hope to be able to implement safety checks for this in future versions of the Upgrades Plugins.
68
-
69
- === Storage Gaps
70
-
71
- You may notice that every contract includes a state variable named `+__gap+`. This is empty reserved space in storage that is put in place in Upgradeable contracts. It allows us to freely add new state variables in the future without compromising the storage compatibility with existing deployments.
72
-
73
- It isn't safe to simply add a state variable because it "shifts down" all of the state variables below in the inheritance chain. This makes the storage layouts incompatible, as explained in xref:upgrades-plugins::writing-upgradeable.adoc#modifying-your-contracts[Writing Upgradeable Contracts]. The size of the `+__gap+` array is calculated so that the amount of storage used by a contract always adds up to the same number (in this case 50 storage slots).
@@ -1,190 +0,0 @@
1
- = Utilities
2
-
3
- The OpenZeppelin Contracts provide a ton of useful utilities that you can use in your project. Here are some of the more popular ones.
4
-
5
- [[cryptography]]
6
- == Cryptography
7
-
8
- === Checking Signatures On-Chain
9
-
10
- xref:api:utils.adoc#ECDSA[`ECDSA`] provides functions for recovering and managing Ethereum account ECDSA signatures. These are often generated via https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#sign[`web3.eth.sign`], and are a 65 byte array (of type `bytes` in Solidity) arranged the following way: `[[v (1)], [r (32)], [s (32)]]`.
11
-
12
- The data signer can be recovered with xref:api:utils.adoc#ECDSA-recover-bytes32-bytes-[`ECDSA.recover`], and its address compared to verify the signature. Most wallets will hash the data to sign and add the prefix '\x19Ethereum Signed Message:\n', so when attempting to recover the signer of an Ethereum signed message hash, you'll want to use xref:api:utils.adoc#ECDSA-toEthSignedMessageHash-bytes32-[`toEthSignedMessageHash`].
13
-
14
- [source,solidity]
15
- ----
16
- using ECDSA for bytes32;
17
-
18
- function _verify(bytes32 data, bytes memory signature, address account) internal pure returns (bool) {
19
- return data
20
- .toEthSignedMessageHash()
21
- .recover(signature) == account;
22
- }
23
- ----
24
-
25
- WARNING: Getting signature verification right is not trivial: make sure you fully read and understand xref:api:utils.adoc#ECDSA[`ECDSA`]'s documentation.
26
-
27
- === Verifying Merkle Proofs
28
-
29
- xref:api:utils.adoc#MerkleProof[`MerkleProof`] provides:
30
-
31
- * xref:api:utils.adoc#MerkleProof-verify-bytes32---bytes32-bytes32-[`verify`] - can prove that some value is part of a https://en.wikipedia.org/wiki/Merkle_tree[Merkle tree].
32
-
33
- * xref:api:utils.adoc#MerkleProof-multiProofVerify-bytes32-bytes32---bytes32---bool---[`multiProofVerify`] - can prove multiple values are part of a Merkle tree.
34
-
35
- [[introspection]]
36
- == Introspection
37
-
38
- In Solidity, it's frequently helpful to know whether or not a contract supports an interface you'd like to use. ERC165 is a standard that helps do runtime interface detection. Contracts provide helpers both for implementing ERC165 in your contracts and querying other contracts:
39
-
40
- * xref:api:utils.adoc#IERC165[`IERC165`] — this is the ERC165 interface that defines xref:api:utils.adoc#IERC165-supportsInterface-bytes4-[`supportsInterface`]. When implementing ERC165, you'll conform to this interface.
41
- * xref:api:utils.adoc#ERC165[`ERC165`] — inherit this contract if you'd like to support interface detection using a lookup table in contract storage. You can register interfaces using xref:api:utils.adoc#ERC165-_registerInterface-bytes4-[`_registerInterface(bytes4)`]: check out example usage as part of the ERC721 implementation.
42
- * xref:api:utils.adoc#ERC165Checker[`ERC165Checker`] — ERC165Checker simplifies the process of checking whether or not a contract supports an interface you care about.
43
- * include with `using ERC165Checker for address;`
44
- * xref:api:utils.adoc#ERC165Checker-_supportsInterface-address-bytes4-[`myAddress._supportsInterface(bytes4)`]
45
- * xref:api:utils.adoc#ERC165Checker-_supportsAllInterfaces-address-bytes4---[`myAddress._supportsAllInterfaces(bytes4[\])`]
46
-
47
- [source,solidity]
48
- ----
49
- contract MyContract {
50
- using ERC165Checker for address;
51
-
52
- bytes4 private InterfaceId_ERC721 = 0x80ac58cd;
53
-
54
- /**
55
- * @dev transfer an ERC721 token from this contract to someone else
56
- */
57
- function transferERC721(
58
- address token,
59
- address to,
60
- uint256 tokenId
61
- )
62
- public
63
- {
64
- require(token.supportsInterface(InterfaceId_ERC721), "IS_NOT_721_TOKEN");
65
- IERC721(token).transferFrom(address(this), to, tokenId);
66
- }
67
- }
68
- ----
69
-
70
- [[math]]
71
- == Math
72
-
73
- The most popular math related library OpenZeppelin Contracts provides is xref:api:utils.adoc#SafeMath[`SafeMath`], which provides mathematical functions that protect your contract from overflows and underflows.
74
-
75
- Include the contract with `using SafeMath for uint256;` and then call the functions:
76
-
77
- * `myNumber.add(otherNumber)`
78
- * `myNumber.sub(otherNumber)`
79
- * `myNumber.div(otherNumber)`
80
- * `myNumber.mul(otherNumber)`
81
- * `myNumber.mod(otherNumber)`
82
-
83
- Easy!
84
-
85
- [[payment]]
86
- == Payment
87
-
88
- Want to split some payments between multiple people? Maybe you have an app that sends 30% of art purchases to the original creator and 70% of the profits to the current owner; you can build that with xref:api:finance.adoc#PaymentSplitter[`PaymentSplitter`]!
89
-
90
- In Solidity, there are some security concerns with blindly sending money to accounts, since it allows them to execute arbitrary code. You can read up on these security concerns in the https://consensys.github.io/smart-contract-best-practices/[Ethereum Smart Contract Best Practices] website. One of the ways to fix reentrancy and stalling problems is, instead of immediately sending Ether to accounts that need it, you can use xref:api:security.adoc#PullPayment[`PullPayment`], which offers an xref:api:security.adoc#PullPayment-_asyncTransfer-address-uint256-[`_asyncTransfer`] function for sending money to something and requesting that they xref:api:security.adoc#PullPayment-withdrawPayments-address-payable-[`withdrawPayments()`] it later.
91
-
92
- If you want to Escrow some funds, check out xref:api:utils.adoc#Escrow[`Escrow`] and xref:api:utils.adoc#ConditionalEscrow[`ConditionalEscrow`] for governing the release of some escrowed Ether.
93
-
94
- [[collections]]
95
- == Collections
96
-
97
- If you need support for more powerful collections than Solidity's native arrays and mappings, take a look at xref:api:utils.adoc#EnumerableSet[`EnumerableSet`] and xref:api:utils.adoc#EnumerableMap[`EnumerableMap`]. They are similar to mappings in that they store and remove elements in constant time and don't allow for repeated entries, but they also support _enumeration_, which means you can easily query all stored entries both on and off-chain.
98
-
99
- [[misc]]
100
- == Misc
101
-
102
- Want to check if an address is a contract? Use xref:api:utils.adoc#Address[`Address`] and xref:api:utils.adoc#Address-isContract-address-[`Address.isContract()`].
103
-
104
- Want to keep track of some numbers that increment by 1 every time you want another one? Check out xref:api:utils.adoc#Counters[`Counters`]. This is useful for lots of things, like creating incremental identifiers, as shown on the xref:erc721.adoc[ERC721 guide].
105
-
106
- === Base64
107
-
108
- xref:api:utils.adoc#Base64[`Base64`] util allows you to transform `bytes32` data into its Base64 `string` representation.
109
-
110
- This is specially useful to build URL-safe tokenURIs for both xref:api:token/ERC721.adoc#IERC721Metadata-tokenURI-uint256-[`ERC721`] or xref:api:token/ERC1155.adoc#IERC1155MetadataURI-uri-uint256-[`ERC1155`]. This library provides a clever way to serve URL-safe https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs/[Data URI] compliant strings to serve on-chain data structures.
111
-
112
- Consider this is an example to send JSON Metadata through a Base64 Data URI using an ERC721:
113
-
114
- [source, solidity]
115
- ----
116
- // contracts/My721Token.sol
117
- // SPDX-License-Identifier: MIT
118
-
119
- import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
120
- import "@openzeppelin/contracts/utils/Strings.sol";
121
- import "@openzeppelin/contracts/utils/Base64.sol";
122
-
123
- contract My721Token is ERC721 {
124
- using Strings for uint256;
125
-
126
- constructor() ERC721("My721Token", "MTK") {}
127
-
128
- ...
129
-
130
- function tokenURI(uint256 tokenId)
131
- public
132
- pure
133
- override
134
- returns (string memory)
135
- {
136
- bytes memory dataURI = abi.encodePacked(
137
- '{',
138
- '"name": "My721Token #', tokenId.toString(), '"',
139
- // Replace with extra ERC721 Metadata properties
140
- '}'
141
- );
142
-
143
- return string(
144
- abi.encodePacked(
145
- "data:application/json;base64,",
146
- Base64.encode(dataURI)
147
- )
148
- );
149
- }
150
- }
151
- ----
152
-
153
- === Multicall
154
-
155
- The `Multicall` abstract contract comes with a `multicall` function that bundles together multiple calls in a single external call. With it, external accounts may perform atomic operations comprising several function calls. This is not only useful for EOAs to make multiple calls in a single transaction, it's also a way to revert a previous call if a later one fails.
156
-
157
- Consider this dummy contract:
158
-
159
- [source,solidity]
160
- ----
161
- // contracts/Box.sol
162
- // SPDX-License-Identifier: MIT
163
- pragma solidity ^0.8.0;
164
-
165
- import "@openzeppelin/contracts/utils/Multicall.sol";
166
-
167
- contract Box is Multicall {
168
- function foo() public {
169
- ...
170
- }
171
-
172
- function bar() public {
173
- ...
174
- }
175
- }
176
- ----
177
-
178
- This is how to call the `multicall` function using Truffle, allowing `foo` and `bar` to be called in a single transaction:
179
- [source,javascript]
180
- ----
181
- // scripts/foobar.js
182
-
183
- const Box = artifacts.require('Box');
184
- const instance = await Box.new();
185
-
186
- await instance.multicall([
187
- instance.contract.methods.foo().encodeABI(),
188
- instance.contract.methods.bar().encodeABI()
189
- ]);
190
- ----
@@ -1,15 +0,0 @@
1
- = Contracts Wizard
2
- :page-notoc:
3
-
4
- Not sure where to start? Use the interactive generator below to bootstrap your
5
- contract and learn about the components offered in OpenZeppelin Contracts.
6
-
7
- TIP: Place the resulting contract in your `contracts` directory in order to compile it with a tool like Hardhat or Truffle. Consider reading our guide on xref:learn::developing-smart-contracts.adoc[Developing Smart Contracts] for more guidance!
8
-
9
- ++++
10
- <script async src="https://wizard.openzeppelin.com/build/embed.js"></script>
11
-
12
- <oz-wizard style="display: block; min-height: 40rem;"></oz-wizard>
13
- ++++
14
-
15
-
@@ -1,85 +0,0 @@
1
- {{#each items}}
2
- :{{name}}: pass:normal[xref:#{{anchor}}[`++{{name}}++`]]
3
- {{/each}}
4
-
5
- [.contract]
6
- [[{{anchor}}]]
7
- === `++{{name}}++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v{{oz-version}}/{{__item_context.file.absolutePath}}[{github-icon},role=heading-link]
8
-
9
- [.hljs-theme-light.nopadding]
10
- ```solidity
11
- import "@openzeppelin/{{__item_context.file.absolutePath}}";
12
- ```
13
-
14
- {{{natspec.dev}}}
15
-
16
- {{#if modifiers}}
17
- [.contract-index]
18
- .Modifiers
19
- --
20
- {{#each modifiers}}
21
- * {xref-{{anchor~}} }[`++{{name}}({{names params}})++`]
22
- {{/each}}
23
- --
24
- {{/if}}
25
-
26
- {{#if has-functions}}
27
- [.contract-index]
28
- .Functions
29
- --
30
- {{#each inherited-functions}}
31
- {{#unless @first}}
32
- [.contract-subindex-inherited]
33
- .{{contract.name}}
34
- {{/unless}}
35
- {{#each functions}}
36
- * {xref-{{anchor~}} }[`++{{name}}({{names params}})++`]
37
- {{/each}}
38
-
39
- {{/each}}
40
- --
41
- {{/if}}
42
-
43
- {{#if has-events}}
44
- [.contract-index]
45
- .Events
46
- --
47
- {{#each inheritance}}
48
- {{#unless @first}}
49
- [.contract-subindex-inherited]
50
- .{{name}}
51
- {{/unless}}
52
- {{#each events}}
53
- * {xref-{{anchor~}} }[`++{{name}}({{names params}})++`]
54
- {{/each}}
55
-
56
- {{/each}}
57
- --
58
- {{/if}}
59
-
60
- {{#each modifiers}}
61
- [.contract-item]
62
- [[{{anchor}}]]
63
- ==== `[.contract-item-name]#++{{name}}++#++({{typed-params params}})++` [.item-kind]#modifier#
64
-
65
- {{{natspec.dev}}}
66
-
67
- {{/each}}
68
-
69
- {{#each functions}}
70
- [.contract-item]
71
- [[{{anchor}}]]
72
- ==== `[.contract-item-name]#++{{name}}++#++({{typed-params params}}){{#if returns}} → {{typed-params returns}}{{/if}}++` [.item-kind]#{{visibility}}#
73
-
74
- {{{natspec.dev}}}
75
-
76
- {{/each}}
77
-
78
- {{#each events}}
79
- [.contract-item]
80
- [[{{anchor}}]]
81
- ==== `[.contract-item-name]#++{{name}}++#++({{typed-params params}})++` [.item-kind]#event#
82
-
83
- {{{natspec.dev}}}
84
-
85
- {{/each}}
@@ -1,46 +0,0 @@
1
- const { version } = require('../../package.json');
2
-
3
- module.exports['oz-version'] = () => version;
4
-
5
- module.exports['readme-path'] = (opts) => {
6
- return 'contracts/' + opts.data.root.id.replace(/\.adoc$/, '') + '/README.adoc';
7
- };
8
-
9
- module.exports.names = (params) => params.map(p => p.name).join(', ');
10
-
11
- module.exports['typed-params'] = (params) => {
12
- return params?.map(p => `${p.type}${p.indexed ? ' indexed' : ''}${p.name ? ' ' + p.name : ''}`).join(', ');
13
- };
14
-
15
- const slug = module.exports.slug = (str) => {
16
- if (str === undefined) {
17
- throw new Error('Missing argument');
18
- }
19
- return str.replace(/\W/g, '-');
20
- };
21
-
22
- const linksCache = new WeakMap();
23
-
24
- function getAllLinks (items) {
25
- if (linksCache.has(items)) {
26
- return linksCache.get(items);
27
- }
28
- const res = {};
29
- linksCache.set(items, res);
30
- for (const item of items) {
31
- res[`xref-${item.anchor}`] = `xref:${item.__item_context.page}#${item.anchor}`;
32
- res[slug(item.fullName)] = `pass:normal[xref:${item.__item_context.page}#${item.anchor}[\`${item.fullName}\`]]`;
33
- }
34
- return res;
35
- }
36
-
37
- module.exports['with-prelude'] = (opts) => {
38
- const links = getAllLinks(opts.data.site.items);
39
- const contents = opts.fn();
40
- const neededLinks = contents
41
- .match(/\{[-._a-z0-9]+\}/ig)
42
- .map(m => m.replace(/^\{(.+)\}$/, '$1'))
43
- .filter(k => k in links);
44
- const prelude = neededLinks.map(k => `:${k}: ${links[k]}`).join('\n');
45
- return prelude + '\n' + contents;
46
- };
@@ -1,4 +0,0 @@
1
- :github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
2
- {{#with-prelude}}
3
- {{readme (readme-path)}}
4
- {{/with-prelude}}
@@ -1,49 +0,0 @@
1
- const { isNodeType } = require('solidity-ast/utils');
2
- const { slug } = require('./helpers');
3
-
4
- module.exports.anchor = function anchor ({ item, contract }) {
5
- let res = '';
6
- if (contract) {
7
- res += contract.name + '-';
8
- }
9
- res += item.name;
10
- if ('parameters' in item) {
11
- const signature = item.parameters.parameters.map(v => v.typeName.typeDescriptions.typeString).join(',');
12
- res += slug('(' + signature + ')');
13
- }
14
- if (isNodeType('VariableDeclaration', item)) {
15
- res += '-' + slug(item.typeName.typeDescriptions.typeString);
16
- }
17
- return res;
18
- };
19
-
20
- module.exports.inheritance = function ({ item, build }) {
21
- if (!isNodeType('ContractDefinition', item)) {
22
- throw new Error('used inherited-items on non-contract');
23
- }
24
-
25
- return item.linearizedBaseContracts
26
- .map(id => build.deref('ContractDefinition', id))
27
- .filter((c, i) => c.name !== 'Context' || i === 0);
28
- };
29
-
30
- module.exports['has-functions'] = function ({ item }) {
31
- return item.inheritance.some(c => c.functions.length > 0);
32
- };
33
-
34
- module.exports['has-events'] = function ({ item }) {
35
- return item.inheritance.some(c => c.events.length > 0);
36
- };
37
-
38
- module.exports['inherited-functions'] = function ({ item }) {
39
- const { inheritance } = item;
40
- const baseFunctions = new Set(
41
- inheritance.flatMap(c => c.functions.flatMap(f => f.baseFunctions ?? [])),
42
- );
43
- return inheritance.map((contract, i) => ({
44
- contract,
45
- functions: contract.functions.filter(f =>
46
- !baseFunctions.has(f.id) && (f.name !== 'constructor' || i === 0),
47
- ),
48
- }));
49
- };
@@ -1,6 +0,0 @@
1
- name: contracts
2
- title: Contracts
3
- version: 4.x
4
- nav:
5
- - modules/ROOT/nav.adoc
6
- - modules/api/nav.adoc