polkamarkets-js 3.4.1 → 3.4.2

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 (319) hide show
  1. package/package.json +1 -1
  2. package/src/models/PredictionMarketV3Contract.js +49 -16
  3. package/abis/AccessControlUpgradeable.json +0 -1
  4. package/abis/AddAdminToLand.json +0 -1
  5. package/abis/AddressUpgradeable.json +0 -1
  6. package/abis/ClaimMerkleRoot.json +0 -1
  7. package/abis/CreateLand.json +0 -1
  8. package/abis/CreateMarkets.json +0 -1
  9. package/abis/DeployContracts.json +0 -1
  10. package/abis/DeployMerkleRewardsDistributor.json +0 -1
  11. package/abis/DeployToken.json +0 -1
  12. package/abis/DeployUSDT.json +0 -1
  13. package/abis/ECDSA.json +0 -1
  14. package/abis/ERC165Upgradeable.json +0 -1
  15. package/abis/ERC1967UpgradeUpgradeable.json +0 -1
  16. package/abis/Hashes.json +0 -1
  17. package/abis/IBeaconUpgradeable.json +0 -1
  18. package/abis/IERC1822ProxiableUpgradeable.json +0 -1
  19. package/abis/IERC20PermitUpgradeable.json +0 -1
  20. package/abis/IERC20Upgradeable.json +0 -1
  21. package/abis/Manager.json +0 -1
  22. package/abis/MerkleProof.json +0 -1
  23. package/abis/MerkleRewardsDistributor.json +0 -1
  24. package/abis/MerkleRewardsDistributorTest.json +0 -1
  25. package/abis/MessageHashUtils.json +0 -1
  26. package/abis/MintTokens.json +0 -1
  27. package/abis/Nonces.json +0 -1
  28. package/abis/Panic.json +0 -1
  29. package/abis/PublishMerkleRoot.json +0 -1
  30. package/abis/ResolveMarket.json +0 -1
  31. package/abis/RewardsDistributor.json +0 -1
  32. package/abis/RewardsDistributorTest.json +0 -1
  33. package/abis/SafeCast.json +0 -1
  34. package/abis/SafeERC20Upgradeable.json +0 -1
  35. package/abis/SignedMath.json +0 -1
  36. package/abis/StorageSlotUpgradeable.json +0 -1
  37. package/abis/TradeMarket.json +0 -1
  38. package/abis/USDT.json +0 -1
  39. package/abis/UpdateMarket.json +0 -1
  40. package/abis/UpdateTest.json +0 -1
  41. package/abis/WhaleTest.json +0 -1
  42. package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
  43. package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
  44. package/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
  45. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
  46. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
  47. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
  48. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
  49. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
  50. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
  51. package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
  52. package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
  53. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
  54. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
  55. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
  56. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
  57. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
  58. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
  59. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
  60. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
  61. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
  62. package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
  63. package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
  64. package/lib/openzeppelin-contracts/docs/README.md +0 -16
  65. package/lib/openzeppelin-contracts/docs/antora.yml +0 -7
  66. package/lib/openzeppelin-contracts/docs/config.js +0 -21
  67. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  68. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  69. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
  70. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  71. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  72. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  73. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  74. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  75. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  76. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  77. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  78. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  79. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
  80. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
  81. package/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
  82. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
  83. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  84. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
  85. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  86. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  87. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  88. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  89. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
  90. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  91. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  92. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
  93. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  94. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
  95. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
  96. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
  97. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
  98. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
  99. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  100. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
  101. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
  102. package/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
  103. package/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
  104. package/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
  105. package/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
  106. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC20WithAutoMinerRewardUpgradeable.sol +0 -28
  107. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC4626FeesUpgradeable.sol +0 -115
  108. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/MyNFTUpgradeable.sol +0 -14
  109. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintBaseUpgradeable.sol +0 -31
  110. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintMissingUpgradeable.sol +0 -30
  111. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRoleUpgradeable.sol +0 -29
  112. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlModifiedUpgradeable.sol +0 -20
  113. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessManagedERC20MintBaseUpgradeable.sol +0 -22
  114. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/MyContractOwnableUpgradeable.sol +0 -22
  115. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyAccountERC7702Upgradeable.sol +0 -26
  116. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyFactoryAccountUpgradeable.sol +0 -42
  117. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyGovernorUpgradeable.sol +0 -92
  118. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenTimestampBasedUpgradeable.sol +0 -39
  119. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenUpgradeable.sol +0 -28
  120. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenWrappedUpgradeable.sol +0 -39
  121. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/GameItemsUpgradeable.sol +0 -27
  122. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/MyERC115HolderContractUpgradeable.sol +0 -13
  123. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC20/GLDTokenUpgradeable.sol +0 -17
  124. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC6909/ERC6909GameItemsUpgradeable.sol +0 -31
  125. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC721/GameItemUpgradeable.sol +0 -24
  126. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/Base64NFTUpgradeable.sol +0 -32
  127. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/MulticallUpgradeable.sol +0 -21
  128. package/lib/openzeppelin-contracts-upgradeable/docs/README.md +0 -16
  129. package/lib/openzeppelin-contracts-upgradeable/docs/antora.yml +0 -7
  130. package/lib/openzeppelin-contracts-upgradeable/docs/config.js +0 -21
  131. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  132. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  133. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager.svg +0 -99
  134. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  135. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  136. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  137. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  138. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  139. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  140. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  141. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  142. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  143. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-exec.png +0 -0
  144. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-vote.png +0 -0
  145. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/nav.adoc +0 -29
  146. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/access-control.adoc +0 -288
  147. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  148. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/accounts.adoc +0 -354
  149. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  150. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  151. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  152. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  153. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20.adoc +0 -67
  154. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  155. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  156. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc721.adoc +0 -58
  157. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  158. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/faq.adoc +0 -13
  159. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/governance.adoc +0 -239
  160. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/index.adoc +0 -70
  161. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/multisig.adoc +0 -306
  162. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/tokens.adoc +0 -31
  163. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  164. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/utilities.adoc +0 -591
  165. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/wizard.adoc +0 -15
  166. package/lib/openzeppelin-contracts-upgradeable/docs/templates/contract.hbs +0 -141
  167. package/lib/openzeppelin-contracts-upgradeable/docs/templates/helpers.js +0 -46
  168. package/lib/openzeppelin-contracts-upgradeable/docs/templates/page.hbs +0 -4
  169. package/lib/openzeppelin-contracts-upgradeable/docs/templates/properties.js +0 -88
  170. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
  171. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
  172. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
  173. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
  174. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
  175. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
  176. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
  177. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
  178. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
  179. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
  180. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
  181. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
  182. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
  183. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
  184. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
  185. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
  186. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
  187. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
  188. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
  189. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
  190. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
  191. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
  192. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/README.md +0 -16
  193. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/antora.yml +0 -7
  194. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/config.js +0 -21
  195. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  196. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  197. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
  198. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  199. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  200. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  201. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  202. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  203. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  204. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  205. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  206. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  207. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
  208. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
  209. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
  210. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
  211. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  212. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
  213. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  214. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  215. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  216. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  217. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
  218. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  219. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  220. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
  221. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  222. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
  223. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
  224. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
  225. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
  226. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
  227. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  228. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
  229. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
  230. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
  231. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
  232. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
  233. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
  234. package/lib/openzeppelin-contracts-upgradeable.git/docs/antora.yml +0 -6
  235. package/lib/openzeppelin-contracts-upgradeable.git/docs/config.js +0 -21
  236. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-exec.png +0 -0
  237. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-vote.png +0 -0
  238. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/nav.adoc +0 -23
  239. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
  240. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
  241. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
  242. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
  243. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
  244. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
  245. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
  246. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
  247. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
  248. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
  249. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/governance.adoc +0 -321
  250. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/index.adoc +0 -63
  251. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
  252. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
  253. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
  254. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
  255. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
  256. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/contract.hbs +0 -85
  257. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/helpers.js +0 -46
  258. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/page.hbs +0 -4
  259. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/properties.js +0 -49
  260. package/lib/openzeppelin-contracts.git/docs/antora.yml +0 -6
  261. package/lib/openzeppelin-contracts.git/docs/config.js +0 -21
  262. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-exec.png +0 -0
  263. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-vote.png +0 -0
  264. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/nav.adoc +0 -23
  265. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
  266. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
  267. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
  268. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
  269. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
  270. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
  271. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
  272. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
  273. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
  274. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
  275. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/governance.adoc +0 -321
  276. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/index.adoc +0 -63
  277. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
  278. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
  279. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
  280. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
  281. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
  282. package/lib/openzeppelin-contracts.git/docs/templates/contract.hbs +0 -85
  283. package/lib/openzeppelin-contracts.git/docs/templates/helpers.js +0 -46
  284. package/lib/openzeppelin-contracts.git/docs/templates/page.hbs +0 -4
  285. package/lib/openzeppelin-contracts.git/docs/templates/properties.js +0 -49
  286. package/lib/reality-eth-monorepo/packages/docs/Audit_Reality_v3_202108.pdf +0 -0
  287. package/lib/reality-eth-monorepo/packages/docs/Makefile +0 -20
  288. package/lib/reality-eth-monorepo/packages/docs/arbitrators.rst +0 -85
  289. package/lib/reality-eth-monorepo/packages/docs/audit.rst +0 -12
  290. package/lib/reality-eth-monorepo/packages/docs/audit_v2.rst +0 -249
  291. package/lib/reality-eth-monorepo/packages/docs/audit_v2_ERC20.rst +0 -1075
  292. package/lib/reality-eth-monorepo/packages/docs/audit_v3.rst +0 -70
  293. package/lib/reality-eth-monorepo/packages/docs/conf.py +0 -155
  294. package/lib/reality-eth-monorepo/packages/docs/contract_explanation.rst +0 -82
  295. package/lib/reality-eth-monorepo/packages/docs/contracts.rst +0 -277
  296. package/lib/reality-eth-monorepo/packages/docs/dapp.rst +0 -126
  297. package/lib/reality-eth-monorepo/packages/docs/dapp_links.rst +0 -67
  298. package/lib/reality-eth-monorepo/packages/docs/fees.rst +0 -89
  299. package/lib/reality-eth-monorepo/packages/docs/index.rst +0 -26
  300. package/lib/reality-eth-monorepo/packages/docs/javascript.rst +0 -142
  301. package/lib/reality-eth-monorepo/packages/docs/make.bat +0 -36
  302. package/lib/reality-eth-monorepo/packages/docs/question_box.png +0 -0
  303. package/lib/reality-eth-monorepo/packages/docs/requirements.txt +0 -24
  304. package/lib/reality-eth-monorepo/packages/docs/whitepaper.rst +0 -165
  305. package/script/AddAdminToLand.s.sol +0 -29
  306. package/script/ClaimMerkleRoot.s.sol +0 -34
  307. package/script/CreateLand.s.sol +0 -28
  308. package/script/CreateMarkets.s.sol +0 -71
  309. package/script/DeployContracts.s.sol +0 -94
  310. package/script/DeployMerkleRewardsDistributor.s.sol +0 -27
  311. package/script/DeployToken.s.sol +0 -17
  312. package/script/DeployUSDT.s.sol +0 -24
  313. package/script/MintTokens.s.sol +0 -21
  314. package/script/PublishMerkleRoot.s.sol +0 -50
  315. package/script/ResolveMarket.s.sol +0 -23
  316. package/script/TradeMarket.s.sol +0 -28
  317. package/test/UpdateTest.t.sol +0 -55
  318. package/test/WhaleTest.t.sol +0 -188
  319. package/tooling/docs/jsdoc.json +0 -6
@@ -1,90 +0,0 @@
1
- = ERC721
2
-
3
- We've discussed how you can make a _fungible_ token using xref:erc20.adoc[ERC20], but what if not all tokens are alike? This comes up in situations like *real estate*, *voting rights*, or *collectibles*, where some items are valued more than others, due to their usefulness, rarity, etc. ERC721 is a standard for representing ownership of xref:tokens.adoc#different-kinds-of-tokens[_non-fungible_ tokens], that is, where each token is unique.
4
-
5
- ERC721 is a more complex standard than ERC20, with multiple optional extensions, and is split across a number of contracts. The OpenZeppelin Contracts provide flexibility regarding how these are combined, along with custom useful extensions. Check out the xref:api:token/ERC721.adoc[API Reference] to learn more about these.
6
-
7
- == Constructing an ERC721 Token Contract
8
-
9
- We'll use ERC721 to track items in our game, which will each have their own unique attributes. Whenever one is to be awarded to a player, it will be minted and sent to them. Players are free to keep their token or trade it with other people as they see fit, as they would any other asset on the blockchain! Please note any account can call `awardItem` to mint items. To restrict what accounts can mint items we can add xref:access-control.adoc[Access Control].
10
-
11
- Here's what a contract for tokenized items might look like:
12
-
13
- [source,solidity]
14
- ----
15
- // contracts/GameItem.sol
16
- // SPDX-License-Identifier: MIT
17
- pragma solidity ^0.8.0;
18
-
19
- import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
20
- import "@openzeppelin/contracts/utils/Counters.sol";
21
-
22
- contract GameItem is ERC721URIStorage {
23
- using Counters for Counters.Counter;
24
- Counters.Counter private _tokenIds;
25
-
26
- constructor() ERC721("GameItem", "ITM") {}
27
-
28
- function awardItem(address player, string memory tokenURI)
29
- public
30
- returns (uint256)
31
- {
32
- uint256 newItemId = _tokenIds.current();
33
- _mint(player, newItemId);
34
- _setTokenURI(newItemId, tokenURI);
35
-
36
- _tokenIds.increment();
37
- return newItemId;
38
- }
39
- }
40
- ----
41
-
42
- The xref:api:token/ERC721.adoc#ERC721URIStorage[`ERC721URIStorage`] contract is an implementation of ERC721 that includes the metadata standard extensions (xref:api:token/ERC721.adoc#IERC721Metadata[`IERC721Metadata`]) as well as a mechanism for per-token metadata. That's where the xref:api:token/ERC721.adoc#ERC721-_setTokenURI-uint256-string-[`_setTokenURI`] method comes from: we use it to store an item's metadata.
43
-
44
- Also note that, unlike ERC20, ERC721 lacks a `decimals` field, since each token is distinct and cannot be partitioned.
45
-
46
- New items can be created:
47
-
48
- [source,javascript]
49
- ----
50
- > gameItem.awardItem(playerAddress, "https://game.example/item-id-8u5h2m.json")
51
- Transaction successful. Transaction hash: 0x...
52
- Events emitted:
53
- - Transfer(0x0000000000000000000000000000000000000000, playerAddress, 7)
54
- ----
55
-
56
- And the owner and metadata of each item queried:
57
-
58
- [source,javascript]
59
- ----
60
- > gameItem.ownerOf(7)
61
- playerAddress
62
- > gameItem.tokenURI(7)
63
- "https://game.example/item-id-8u5h2m.json"
64
- ----
65
-
66
- This `tokenURI` should resolve to a JSON document that might look something like:
67
-
68
- [source,json]
69
- ----
70
- {
71
- "name": "Thor's hammer",
72
- "description": "Mjölnir, the legendary hammer of the Norse god of thunder.",
73
- "image": "https://game.example/item-id-8u5h2m.png",
74
- "strength": 20
75
- }
76
- ----
77
-
78
- For more information about the `tokenURI` metadata JSON Schema, check out the https://eips.ethereum.org/EIPS/eip-721[ERC721 specification].
79
-
80
- NOTE: You'll notice that the item's information is included in the metadata, but that information isn't on-chain! So a game developer could change the underlying metadata, changing the rules of the game!
81
-
82
- TIP: If you'd like to put all item information on-chain, you can extend ERC721 to do so (though it will be rather costly) by providing a xref:utilities.adoc#base64[`Base64`] Data URI with the JSON schema encoded. You could also leverage IPFS to store the tokenURI information, but these techniques are out of the scope of this overview guide.
83
-
84
- [[Presets]]
85
- == Preset ERC721 contract
86
- A preset ERC721 is available, https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.7/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol[`ERC721PresetMinterPauserAutoId`]. It is preconfigured with token minting (creation) with token ID and URI auto generation, the ability to stop all token transfers (pause), and it allows holders to burn (destroy) their tokens. The contract uses xref:access-control.adoc[Access Control] to control access to the minting and pausing functionality. The account that deploys the contract will be granted the minter and pauser roles, as well as the default admin role.
87
-
88
- This contract is ready to deploy without having to write any Solidity code. It can be used as-is for quick prototyping and testing but is also suitable for production environments.
89
-
90
- NOTE: Contract presets are now deprecated in favor of https://wizard.openzeppelin.com[Contracts Wizard] as a more powerful alternative.
@@ -1,73 +0,0 @@
1
- = ERC777
2
-
3
- Like xref:erc20.adoc[ERC20], ERC777 is a standard for xref:tokens.adoc#different-kinds-of-tokens[_fungible_ tokens], and is focused around allowing more complex interactions when trading tokens. More generally, it brings tokens and Ether closer together by providing the equivalent of a `msg.value` field, but for tokens.
4
-
5
- The standard also brings multiple quality-of-life improvements, such as getting rid of the confusion around `decimals`, minting and burning with proper events, among others, but its killer feature is *receive hooks*. A hook is simply a function in a contract that is called when tokens are sent to it, meaning *accounts and contracts can react to receiving tokens*.
6
-
7
- This enables a lot of interesting use cases, including atomic purchases using tokens (no need to do `approve` and `transferFrom` in two separate transactions), rejecting reception of tokens (by reverting on the hook call), redirecting the received tokens to other addresses (similarly to how xref:api:payment#PaymentSplitter[`PaymentSplitter`] does it), among many others.
8
-
9
- Furthermore, since contracts are required to implement these hooks in order to receive tokens, _no tokens can get stuck in a contract that is unaware of the ERC777 protocol_, as has happened countless times when using ERC20s.
10
-
11
- == What If I Already Use ERC20?
12
-
13
- The standard has you covered! The ERC777 standard is *backwards compatible with ERC20*, meaning you can interact with these tokens as if they were ERC20, using the standard functions, while still getting all of the niceties, including send hooks. See the https://eips.ethereum.org/EIPS/eip-777#backward-compatibility[EIP's Backwards Compatibility section] to learn more.
14
-
15
- == Constructing an ERC777 Token Contract
16
-
17
- We will replicate the `GLD` example of the xref:erc20.adoc#constructing-an-erc20-token-contract[ERC20 guide], this time using ERC777. As always, check out the xref:api:token/ERC777.adoc[`API reference`] to learn more about the details of each function.
18
-
19
- [source,solidity]
20
- ----
21
- // contracts/GLDToken.sol
22
- // SPDX-License-Identifier: MIT
23
- pragma solidity ^0.8.0;
24
-
25
- import "@openzeppelin/contracts/token/ERC777/ERC777.sol";
26
-
27
- contract GLDToken is ERC777 {
28
- constructor(uint256 initialSupply, address[] memory defaultOperators)
29
- ERC777("Gold", "GLD", defaultOperators)
30
- {
31
- _mint(msg.sender, initialSupply, "", "");
32
- }
33
- }
34
- ----
35
-
36
- In this case, we'll be extending from the xref:api:token/ERC777.adoc#ERC777[`ERC777`] contract, which provides an implementation with compatibility support for ERC20. The API is quite similar to that of xref:api:token/ERC777.adoc#ERC777[`ERC777`], and we'll once again make use of xref:api:token/ERC777.adoc#ERC777-_mint-address-address-uint256-bytes-bytes-[`_mint`] to assign the `initialSupply` to the deployer account. Unlike xref:api:token/ERC20.adoc#ERC20-_mint-address-uint256-[ERC20's `_mint`], this one includes some extra parameters, but you can safely ignore those for now.
37
-
38
- You'll notice both xref:api:token/ERC777.adoc#IERC777-name--[`name`] and xref:api:token/ERC777.adoc#IERC777-symbol--[`symbol`] are assigned, but not xref:api:token/ERC777.adoc#ERC777-decimals--[`decimals`]. The ERC777 specification makes it mandatory to include support for these functions (unlike ERC20, where it is optional and we had to include xref:api:token/ERC20.adoc#ERC20Detailed[`ERC20Detailed`]), but also mandates that `decimals` always returns a fixed value of `18`, so there's no need to set it ourselves. For a review of ``decimals``'s role and importance, refer back to our xref:erc20.adoc#a-note-on-decimals[ERC20 guide].
39
-
40
- Finally, we'll need to set the xref:api:token/ERC777.adoc#IERC777-defaultOperators--[`defaultOperators`]: special accounts (usually other smart contracts) that will be able to transfer tokens on behalf of their holders. If you're not planning on using operators in your token, you can simply pass an empty array. _Stay tuned for an upcoming in-depth guide on ERC777 operators!_
41
-
42
- That's it for a basic token contract! We can now deploy it, and use the same xref:api:token/ERC777.adoc#IERC777-balanceOf-address-[`balanceOf`] method to query the deployer's balance:
43
-
44
- [source,javascript]
45
- ----
46
- > GLDToken.balanceOf(deployerAddress)
47
- 1000
48
- ----
49
-
50
- To move tokens from one account to another, we can use both xref:api:token/ERC777.adoc#ERC777-transfer-address-uint256-[``ERC20``'s `transfer`] method, or the new xref:api:token/ERC777.adoc#ERC777-send-address-uint256-bytes-[``ERC777``'s `send`], which fulfills a very similar role, but adds an optional `data` field:
51
-
52
- [source,javascript]
53
- ----
54
- > GLDToken.transfer(otherAddress, 300)
55
- > GLDToken.send(otherAddress, 300, "")
56
- > GLDToken.balanceOf(otherAddress)
57
- 600
58
- > GLDToken.balanceOf(deployerAddress)
59
- 400
60
- ----
61
-
62
- == Sending Tokens to Contracts
63
-
64
- A key difference when using xref:api:token/ERC777.adoc#ERC777-send-address-uint256-bytes-[`send`] is that token transfers to other contracts may revert with the following message:
65
-
66
- [source,text]
67
- ----
68
- ERC777: token recipient contract has no implementer for ERC777TokensRecipient
69
- ----
70
-
71
- This is a good thing! It means that the recipient contract has not registered itself as aware of the ERC777 protocol, so transfers to it are disabled to *prevent tokens from being locked forever*. As an example, https://etherscan.io/token/0xa74476443119A942dE498590Fe1f2454d7D4aC0d?a=0xa74476443119A942dE498590Fe1f2454d7D4aC0d[the Golem contract currently holds over 350k `GNT` tokens], worth multiple tens of thousands of dollars, and lacks methods to get them out of there. This has happened to virtually every ERC20-backed project, usually due to user error.
72
-
73
- _An upcoming guide will cover how a contract can register itself as a recipient, send and receive hooks, and other advanced features of ERC777!_
@@ -1,129 +0,0 @@
1
- = Extending Contracts
2
-
3
- Most of the OpenZeppelin Contracts are expected to be used via https://solidity.readthedocs.io/en/latest/contracts.html#inheritance[inheritance]: you will _inherit_ from them when writing your own contracts.
4
-
5
- This is the commonly found `is` syntax, like in `contract MyToken is ERC20`.
6
-
7
- [NOTE]
8
- ====
9
- Unlike ``contract``s, Solidity ``library``s are not inherited from and instead rely on the https://solidity.readthedocs.io/en/latest/contracts.html#using-for[`using for`] syntax.
10
-
11
- OpenZeppelin Contracts has some ``library``s: most are in the xref:api:utils.adoc[Utils] directory.
12
- ====
13
-
14
- == Overriding
15
-
16
- Inheritance is often used to add the parent contract's functionality to your own contract, but that's not all it can do. You can also _change_ how some parts of the parent behave using _overrides_.
17
-
18
- For example, imagine you want to change xref:api:access.adoc#AccessControl[`AccessControl`] so that xref:api:access.adoc#AccessControl-revokeRole-bytes32-address-[`revokeRole`] can no longer be called. This can be achieved using overrides:
19
-
20
- ```solidity
21
- // contracts/ModifiedAccessControl.sol
22
- // SPDX-License-Identifier: MIT
23
- pragma solidity ^0.8.0;
24
-
25
- import "@openzeppelin/contracts/access/AccessControl.sol";
26
-
27
- contract ModifiedAccessControl is AccessControl {
28
- // Override the revokeRole function
29
- function revokeRole(bytes32, address) public override {
30
- revert("ModifiedAccessControl: cannot revoke roles");
31
- }
32
- }
33
- ```
34
-
35
- The old `revokeRole` is then replaced by our override, and any calls to it will immediately revert. We cannot _remove_ the function from the contract, but reverting on all calls is good enough.
36
-
37
- === Calling `super`
38
-
39
- Sometimes you want to _extend_ a parent's behavior, instead of outright changing it to something else. This is where `super` comes in.
40
-
41
- The `super` keyword will let you call functions defined in a parent contract, even if they are overridden. This mechanism can be used to add additional checks to a function, emit events, or otherwise add functionality as you see fit.
42
-
43
- TIP: For more information on how overrides work, head over to the https://solidity.readthedocs.io/en/latest/contracts.html#index-17[official Solidity documentation].
44
-
45
- Here is a modified version of xref:api:access.adoc#AccessControl[`AccessControl`] where xref:api:access.adoc#AccessControl-revokeRole-bytes32-address-[`revokeRole`] cannot be used to revoke the `DEFAULT_ADMIN_ROLE`:
46
-
47
-
48
- ```solidity
49
- // contracts/ModifiedAccessControl.sol
50
- // SPDX-License-Identifier: MIT
51
- pragma solidity ^0.8.0;
52
-
53
- import "@openzeppelin/contracts/access/AccessControl.sol";
54
-
55
- contract ModifiedAccessControl is AccessControl {
56
- function revokeRole(bytes32 role, address account) public override {
57
- require(
58
- role != DEFAULT_ADMIN_ROLE,
59
- "ModifiedAccessControl: cannot revoke default admin role"
60
- );
61
-
62
- super.revokeRole(role, account);
63
- }
64
- }
65
- ```
66
-
67
- The `super.revokeRole` statement at the end will invoke ``AccessControl``'s original version of `revokeRole`, the same code that would've run if there were no overrides in place.
68
-
69
- [[using-hooks]]
70
- == Using Hooks
71
-
72
- Sometimes, in order to extend a parent contract you will need to override multiple related functions, which leads to code duplication and increased likelihood of bugs.
73
-
74
- For example, consider implementing safe xref:api:token/ERC20.adoc#ERC20[`ERC20`] transfers in the style of xref:api:token/ERC721.adoc#IERC721Receiver[`IERC721Receiver`]. You may think overriding xref:api:token/ERC20.adoc#ERC20-transfer-address-uint256-[`transfer`] and xref:api:token/ERC20.adoc#ERC20-transferFrom-address-address-uint256-[`transferFrom`] would be enough, but what about xref:api:token/ERC20.adoc#ERC20-_transfer-address-address-uint256-[`_transfer`] and xref:api:token/ERC20.adoc#ERC20-_mint-address-uint256-[`_mint`]? To prevent you from having to deal with these details, we introduced **hooks**.
75
-
76
- Hooks are simply functions that are called before or after some action takes place. They provide a centralized point to _hook into_ and extend the original behavior.
77
-
78
- Here's how you would implement the `IERC721Receiver` pattern in `ERC20`, using the xref:api:token/ERC20.adoc#ERC20-_beforeTokenTransfer-address-address-uint256-[`_beforeTokenTransfer`] hook:
79
-
80
- ```solidity
81
- pragma solidity ^0.8.0;
82
-
83
- import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
84
-
85
- contract ERC20WithSafeTransfer is ERC20 {
86
- function _beforeTokenTransfer(address from, address to, uint256 amount)
87
- internal virtual override
88
- {
89
- super._beforeTokenTransfer(from, to, amount);
90
-
91
- require(_validRecipient(to), "ERC20WithSafeTransfer: invalid recipient");
92
- }
93
-
94
- function _validRecipient(address to) private view returns (bool) {
95
- ...
96
- }
97
-
98
- ...
99
- }
100
- ```
101
-
102
- Using hooks this way leads to cleaner and safer code, without having to rely on a deep understanding of the parent's internals.
103
-
104
- === Rules of Hooks
105
-
106
- There's a few guidelines you should follow when writing code that uses hooks in order to prevent issues. They are very simple, but do make sure you follow them:
107
-
108
- 1. Whenever you override a parent's hook, re-apply the `virtual` attribute to the hook. That will allow child contracts to add more functionality to the hook.
109
- 2. **Always** call the parent's hook in your override using `super`. This will make sure all hooks in the inheritance tree are called: contracts like xref:api:token/ERC20.adoc#ERC20Pausable[`ERC20Pausable`] rely on this behavior.
110
-
111
- ```solidity
112
- contract MyToken is ERC20 {
113
- function _beforeTokenTransfer(address from, address to, uint256 amount)
114
- internal virtual override // Add virtual here!
115
- {
116
- super._beforeTokenTransfer(from, to, amount); // Call parent hook
117
- ...
118
- }
119
- }
120
- ```
121
- That's it! Enjoy simpler code using hooks!
122
-
123
- == Security
124
-
125
- The maintainers of OpenZeppelin Contracts are mainly concerned with the correctness and security of the code as published in the library, and the combinations of base contracts with the official extensions from the library.
126
-
127
- Custom overrides, and those of hooks in particular, may break some important assumptions and introduce vulnerabilities in otherwise secure code. While we try to ensure the contracts remain secure in the face of a wide range of potential customizations, this is done in a best-effort manner. While we try to document all important assumptions, this should not be relied upon. Custom overrides should be carefully reviewed and checked against the source code of the contract they are customizing so as to fully understand their impact and guarantee their security.
128
-
129
- The way functions interact internally should not be assumed to stay stable across releases of the library. For example, a function that is used in one context in a particular release may not be used in the same context in the next release. Contracts that override functions should revalidate their assumptions when updating the version of OpenZeppelin Contracts they are built on.
@@ -1,321 +0,0 @@
1
- = How to set up on-chain governance
2
-
3
- In this guide we will learn how OpenZeppelin’s Governor contract works, how to set it up, and how to use it to create proposals, vote for them, and execute them, using tools provided by Ethers.js and Tally.
4
-
5
- NOTE: Find detailed contract documentation at xref:api:governance.adoc[Governance API].
6
-
7
- == Introduction
8
-
9
- Decentralized protocols are in constant evolution from the moment they are publicly released. Often, the initial team retains control of this evolution in the first stages, but eventually delegates it to a community of stakeholders. The process by which this community makes decisions is called on-chain governance, and it has become a central component of decentralized protocols, fueling varied decisions such as parameter tweaking, smart contract upgrades, integrations with other protocols, treasury management, grants, etc.
10
-
11
- This governance protocol is generally implemented in a special-purpose contract called “Governor”. The GovernorAlpha and GovernorBravo contracts designed by Compound have been very successful and popular so far, with the downside that projects with different requirements have had to fork the code to customize it for their needs, which can pose a high risk of introducing security issues. For OpenZeppelin Contracts, we set out to build a modular system of Governor contracts so that forking is not needed, and different requirements can be accommodated by writing small modules using Solidity inheritance. You will find the most common requirements out of the box in OpenZeppelin Contracts, but writing additional ones is simple, and we will be adding new features as requested by the community in future releases. Additionally, the design of OpenZeppelin Governor requires minimal use of storage and results in more gas efficient operation.
12
-
13
- == Compatibility
14
-
15
- OpenZeppelin’s Governor system was designed with a concern for compatibility with existing systems that were based on Compound’s GovernorAlpha and GovernorBravo. Because of this, you will find that many modules are presented in two variants, one of which is built for compatibility with those systems.
16
-
17
- === ERC20Votes & ERC20VotesComp
18
-
19
- The ERC20 extension to keep track of votes and vote delegation is one such case. The shorter one is the more generic version because it can support token supplies greater than 2^96, while the “Comp” variant is limited in that regard, but exactly fits the interface of the COMP token that is used by GovernorAlpha and Bravo. Both contract variants share the same events, so they are fully compatible when looking at events only.
20
-
21
- === Governor & GovernorCompatibilityBravo
22
-
23
- An OpenZeppelin Governor contract is by default not interface-compatible with GovernorAlpha or Bravo, since some of the functions are different or missing, although it shares all of the same events. However, it’s possible to opt in to full compatibility by inheriting from the GovernorCompatibilityBravo module. The contract will be cheaper to deploy and use without this module.
24
-
25
- === GovernorTimelockControl & GovernorTimelockCompound
26
-
27
- When using a timelock with your Governor contract, you can use either OpenZeppelin’s TimelockController or Compound’s Timelock. Based on the choice of timelock, you should choose the corresponding Governor module: GovernorTimelockControl or GovernorTimelockCompound respectively. This allows you to migrate an existing GovernorAlpha instance to an OpenZeppelin-based Governor without changing the timelock in use.
28
-
29
- === Tally
30
-
31
- https://www.tally.xyz[Tally] is a full-fledged application for user owned on-chain governance. It comprises a voting dashboard, proposal creation wizard, real time research and analysis, and educational content.
32
-
33
- For all of these options, the Governor will be compatible with Tally: users will be able to create proposals, visualize voting power and advocates, navigate proposals, and cast votes. For proposal creation in particular, projects can also use Defender Admin as an alternative interface.
34
-
35
- In the rest of this guide, we will focus on a fresh deploy of the vanilla OpenZeppelin Governor features without concern for compatibility with GovernorAlpha or Bravo.
36
-
37
- == Setup
38
-
39
- === Token
40
-
41
- The voting power of each account in our governance setup will be determined by an ERC20 token. The token has to implement the ERC20Votes extension. This extension will keep track of historical balances so that voting power is retrieved from past snapshots rather than current balance, which is an important protection that prevents double voting.
42
-
43
- ```solidity
44
- // SPDX-License-Identifier: MIT
45
- pragma solidity ^0.8.2;
46
-
47
- import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
48
- import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
49
- import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
50
-
51
- contract MyToken is ERC20, ERC20Permit, ERC20Votes {
52
- constructor() ERC20("MyToken", "MTK") ERC20Permit("MyToken") {}
53
-
54
- // The functions below are overrides required by Solidity.
55
-
56
- function _afterTokenTransfer(address from, address to, uint256 amount)
57
- internal
58
- override(ERC20, ERC20Votes)
59
- {
60
- super._afterTokenTransfer(from, to, amount);
61
- }
62
-
63
- function _mint(address to, uint256 amount)
64
- internal
65
- override(ERC20, ERC20Votes)
66
- {
67
- super._mint(to, amount);
68
- }
69
-
70
- function _burn(address account, uint256 amount)
71
- internal
72
- override(ERC20, ERC20Votes)
73
- {
74
- super._burn(account, amount);
75
- }
76
- }
77
- ```
78
-
79
- If your project already has a live token that does not include ERC20Votes and is not upgradeable, you can wrap it in a governance token by using ERC20Wrapper. This will allow token holders to participate in governance by wrapping their tokens 1-to-1.
80
-
81
- ```solidity
82
- // SPDX-License-Identifier: MIT
83
- pragma solidity ^0.8.2;
84
-
85
- import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
86
- import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
87
- import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
88
- import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Wrapper.sol";
89
-
90
- contract MyToken is ERC20, ERC20Permit, ERC20Votes, ERC20Wrapper {
91
- constructor(IERC20 wrappedToken)
92
- ERC20("MyToken", "MTK")
93
- ERC20Permit("MyToken")
94
- ERC20Wrapper(wrappedToken)
95
- {}
96
-
97
- // The functions below are overrides required by Solidity.
98
-
99
- function _afterTokenTransfer(address from, address to, uint256 amount)
100
- internal
101
- override(ERC20, ERC20Votes)
102
- {
103
- super._afterTokenTransfer(from, to, amount);
104
- }
105
-
106
- function _mint(address to, uint256 amount)
107
- internal
108
- override(ERC20, ERC20Votes)
109
- {
110
- super._mint(to, amount);
111
- }
112
-
113
- function _burn(address account, uint256 amount)
114
- internal
115
- override(ERC20, ERC20Votes)
116
- {
117
- super._burn(account, amount);
118
- }
119
- }
120
- ```
121
-
122
- NOTE: Voting power could be determined in different ways: multiple ERC20 tokens, ERC721 tokens, sybil resistant identities, etc. All of these options are potentially supported by writing a custom Votes module for your Governor. The only other source of voting power available in OpenZeppelin Contracts currently is xref:api:token/ERC721.adoc#ERC721Votes[`ERC721Votes`].
123
-
124
- === Governor
125
-
126
- Initially, we will build a Governor without a timelock. The core logic is given by the Governor contract, but we still need to choose: 1) how voting power is determined, 2) how many votes are needed for quorum, 3) what options people have when casting a vote and how those votes are counted, and 4) what type of token should be used to vote. Each of these aspects is customizable by writing your own module, or more easily choosing one from OpenZeppelin Contracts.
127
-
128
- For 1) we will use the GovernorVotes module, which hooks to an IVotes instance to determine the voting power of an account based on the token balance they hold when a proposal becomes active. This module requires as a constructor parameter the address of the token.
129
-
130
- For 2) we will use GovernorVotesQuorumFraction which works together with ERC20Votes to define quorum as a percentage of the total supply at the block a proposal’s voting power is retrieved. This requires a constructor parameter to set the percentage. Most Governors nowadays use 4%, so we will initialize the module with parameter 4 (this indicates the percentage, resulting in 4%).
131
-
132
- For 3) we will use GovernorCountingSimple, a module that offers 3 options to voters: For, Against, and Abstain, and where only For and Abstain votes are counted towards quorum.
133
-
134
- Besides these modules, Governor itself has some parameters we must set.
135
-
136
- votingDelay: How long after a proposal is created should voting power be fixed. A large voting delay gives users time to unstake tokens if necessary.
137
-
138
- votingPeriod: How long does a proposal remain open to votes.
139
-
140
- These parameters are specified in number of blocks. Assuming block time of around 13.14 seconds, we will set votingDelay = 1 day = 6570 blocks, and votingPeriod = 1 week = 45992 blocks.
141
-
142
- We can optionally set a proposal threshold as well. This restricts proposal creation to accounts who have enough voting power.
143
-
144
- ```solidity
145
- // SPDX-License-Identifier: MIT
146
- pragma solidity ^0.8.2;
147
-
148
- import "@openzeppelin/contracts/governance/Governor.sol";
149
- import "@openzeppelin/contracts/governance/compatibility/GovernorCompatibilityBravo.sol";
150
- import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";
151
- import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";
152
- import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";
153
-
154
- contract MyGovernor is Governor, GovernorCompatibilityBravo, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {
155
- constructor(IVotes _token, TimelockController _timelock)
156
- Governor("MyGovernor")
157
- GovernorVotes(_token)
158
- GovernorVotesQuorumFraction(4)
159
- GovernorTimelockControl(_timelock)
160
- {}
161
-
162
- function votingDelay() public pure override returns (uint256) {
163
- return 6575; // 1 day
164
- }
165
-
166
- function votingPeriod() public pure override returns (uint256) {
167
- return 46027; // 1 week
168
- }
169
-
170
- function proposalThreshold() public pure override returns (uint256) {
171
- return 0;
172
- }
173
-
174
- // The functions below are overrides required by Solidity.
175
-
176
- function state(uint256 proposalId)
177
- public
178
- view
179
- override(Governor, IGovernor, GovernorTimelockControl)
180
- returns (ProposalState)
181
- {
182
- return super.state(proposalId);
183
- }
184
-
185
- function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)
186
- public
187
- override(Governor, GovernorCompatibilityBravo, IGovernor)
188
- returns (uint256)
189
- {
190
- return super.propose(targets, values, calldatas, description);
191
- }
192
-
193
- function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
194
- internal
195
- override(Governor, GovernorTimelockControl)
196
- {
197
- super._execute(proposalId, targets, values, calldatas, descriptionHash);
198
- }
199
-
200
- function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
201
- internal
202
- override(Governor, GovernorTimelockControl)
203
- returns (uint256)
204
- {
205
- return super._cancel(targets, values, calldatas, descriptionHash);
206
- }
207
-
208
- function _executor()
209
- internal
210
- view
211
- override(Governor, GovernorTimelockControl)
212
- returns (address)
213
- {
214
- return super._executor();
215
- }
216
-
217
- function supportsInterface(bytes4 interfaceId)
218
- public
219
- view
220
- override(Governor, IERC165, GovernorTimelockControl)
221
- returns (bool)
222
- {
223
- return super.supportsInterface(interfaceId);
224
- }
225
- }
226
-
227
- ```
228
-
229
- === Timelock
230
-
231
- It is good practice to add a timelock to governance decisions. This allows users to exit the system if they disagree with a decision before it is executed. We will use OpenZeppelin’s TimelockController in combination with the GovernorTimelockControl module.
232
-
233
- IMPORTANT: When using a timelock, it is the timelock that will execute proposals and thus the timelock that should hold any funds, ownership, and access control roles. Before version 4.5 there was no way to recover funds in the Governor contract when using a timelock! Before version 4.3, when using the Compound Timelock, ETH in the timelock was not easily accessible.
234
-
235
- TimelockController uses an AccessControl setup that we need to understand in order to set up roles.
236
-
237
- - The Proposer role is in charge of queueing operations: this is the role the Governor instance should be granted, and it should likely be the only proposer in the system.
238
- - The Executor role is in charge of executing already available operations: we can assign this role to the special zero address to allow anyone to execute (if operations can be particularly time sensitive, the Governor should be made Executor instead).
239
- - Lastly, there is the Admin role, which can grant and revoke the two previous roles: this is a very sensitive role that will be granted automatically to the timelock itself, and optionally to a second account, which can be used for ease of setup but should promptly renounce the role.
240
-
241
- == Proposal Lifecycle
242
-
243
- Let’s walk through how to create and execute a proposal on our newly deployed Governor.
244
-
245
- A proposal is a sequence of actions that the Governor contract will perform if it passes. Each action consists of a target address, calldata encoding a function call, and an amount of ETH to include. Additionally, a proposal includes a human-readable description.
246
-
247
- === Create a Proposal
248
-
249
- Let’s say we want to create a proposal to give a team a grant, in the form of ERC20 tokens from the governance treasury. This proposal will consist of a single action where the target is the ERC20 token, calldata is the encoded function call `transfer(<team wallet>, <grant amount>)`, and with 0 ETH attached.
250
-
251
- Generally a proposal will be created with the help of an interface such as Tally or Defender. Here we will show how to create the proposal using Ethers.js.
252
-
253
- First we get all the parameters necessary for the proposal action.
254
-
255
- ```javascript
256
- const tokenAddress = ...;
257
- const token = await ethers.getContractAt(‘ERC20’, tokenAddress);
258
-
259
- const teamAddress = ...;
260
- const grantAmount = ...;
261
- const transferCalldata = token.interface.encodeFunctionData(‘transfer’, [teamAddress, grantAmount]);
262
- ```
263
-
264
- Now we are ready to call the propose function of the governor. Note that we don’t pass in one array of actions, but instead three arrays corresponding to the list of targets, the list of values, and the list of calldatas. In this case it’s a single action, so it’s simple:
265
-
266
- ```javascript
267
- await governor.propose(
268
- [tokenAddress],
269
- [0],
270
- [transferCalldata],
271
- “Proposal #1: Give grant to team”,
272
- );
273
- ```
274
-
275
- This will create a new proposal, with a proposal id that is obtained by hashing together the proposal data, and which will also be found in an event in the logs of the transaction.
276
-
277
- === Cast a Vote
278
-
279
- Once a proposal is active, delegates can cast their vote. Note that it is delegates who carry voting power: if a token holder wants to participate, they can set a trusted representative as their delegate, or they can become a delegate themselves by self-delegating their voting power.
280
-
281
- Votes are cast by interacting with the Governor contract through the `castVote` family of functions. Voters would generally invoke this from a governance UI such as Tally.
282
-
283
- image::tally-vote.png[Voting in Tally]
284
-
285
- === Execute the Proposal
286
-
287
- Once the voting period is over, if quorum was reached (enough voting power participated) and the majority voted in favor, the proposal is considered successful and can proceed to be executed. Once a proposal passes, it can be queued and executed from the same place you voted.
288
-
289
- image::tally-exec.png[Administration Panel in Tally]
290
-
291
- We will see now how to do this manually using Ethers.js.
292
-
293
- If a timelock was set up, the first step to execution is queueing. You will notice that both the queue and execute functions require passing in the entire proposal parameters, as opposed to just the proposal id. This is necessary because this data is not stored on chain, as a measure to save gas. Note that these parameters can always be found in the events emitted by the contract. The only parameter that is not sent in its entirety is the description, since this is only needed in its hashed form to compute the proposal id.
294
-
295
- To queue, we call the queue function:
296
-
297
- ```javascript
298
- const descriptionHash = ethers.utils.id(“Proposal #1: Give grant to team”);
299
-
300
- await governor.queue(
301
- [tokenAddress],
302
- [0],
303
- [transferCalldata],
304
- descriptionHash,
305
- );
306
- ```
307
-
308
- This will cause the governor to interact with the timelock contract and queue the actions for execution after the required delay.
309
-
310
- After enough time has passed (according to the timelock parameters), the proposal can be executed. If there was no timelock to begin with, this step can be ran immediately after the proposal succeeds.
311
-
312
- ```javascript
313
- await governor.execute(
314
- [tokenAddress],
315
- [0],
316
- [transferCalldata],
317
- descriptionHash,
318
- );
319
- ```
320
-
321
- Executing the proposal will transfer the ERC20 tokens to the chosen recipient. To wrap up: we set up a system where a treasury is controlled by the collective decision of the token holders of a project, and all actions are executed via proposals enforced by on-chain votes.