polkamarkets-js 3.4.0 → 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 (297) hide show
  1. package/abis/PredictionMarketV3Querier.json +1 -1
  2. package/contracts/PredictionMarketV3Querier.sol +4 -2
  3. package/package.json +1 -1
  4. package/src/models/PredictionMarketV3Contract.js +51 -17
  5. package/abis/AddAdminToLand.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/MintTokens.json +0 -1
  14. package/abis/PublishMerkleRoot.json +0 -1
  15. package/abis/ResolveMarket.json +0 -1
  16. package/abis/TradeMarket.json +0 -1
  17. package/abis/USDT.json +0 -1
  18. package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
  19. package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
  20. package/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
  21. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
  22. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
  23. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
  24. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
  25. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
  26. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
  27. package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
  28. package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
  29. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
  30. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
  31. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
  32. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
  33. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
  34. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
  35. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
  36. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
  37. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
  38. package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
  39. package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
  40. package/lib/openzeppelin-contracts/docs/README.md +0 -16
  41. package/lib/openzeppelin-contracts/docs/antora.yml +0 -7
  42. package/lib/openzeppelin-contracts/docs/config.js +0 -21
  43. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  44. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  45. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
  46. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  47. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  48. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  49. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  50. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  51. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  52. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  53. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  54. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  55. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
  56. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
  57. package/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
  58. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
  59. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  60. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
  61. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  62. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  63. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  64. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  65. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
  66. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  67. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  68. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
  69. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  70. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
  71. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
  72. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
  73. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
  74. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
  75. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  76. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
  77. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
  78. package/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
  79. package/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
  80. package/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
  81. package/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
  82. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC20WithAutoMinerRewardUpgradeable.sol +0 -28
  83. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC4626FeesUpgradeable.sol +0 -115
  84. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/MyNFTUpgradeable.sol +0 -14
  85. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintBaseUpgradeable.sol +0 -31
  86. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintMissingUpgradeable.sol +0 -30
  87. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRoleUpgradeable.sol +0 -29
  88. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlModifiedUpgradeable.sol +0 -20
  89. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessManagedERC20MintBaseUpgradeable.sol +0 -22
  90. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/MyContractOwnableUpgradeable.sol +0 -22
  91. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyAccountERC7702Upgradeable.sol +0 -26
  92. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyFactoryAccountUpgradeable.sol +0 -42
  93. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyGovernorUpgradeable.sol +0 -92
  94. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenTimestampBasedUpgradeable.sol +0 -39
  95. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenUpgradeable.sol +0 -28
  96. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenWrappedUpgradeable.sol +0 -39
  97. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/GameItemsUpgradeable.sol +0 -27
  98. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/MyERC115HolderContractUpgradeable.sol +0 -13
  99. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC20/GLDTokenUpgradeable.sol +0 -17
  100. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC6909/ERC6909GameItemsUpgradeable.sol +0 -31
  101. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC721/GameItemUpgradeable.sol +0 -24
  102. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/Base64NFTUpgradeable.sol +0 -32
  103. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/MulticallUpgradeable.sol +0 -21
  104. package/lib/openzeppelin-contracts-upgradeable/docs/README.md +0 -16
  105. package/lib/openzeppelin-contracts-upgradeable/docs/antora.yml +0 -7
  106. package/lib/openzeppelin-contracts-upgradeable/docs/config.js +0 -21
  107. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  108. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  109. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager.svg +0 -99
  110. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  111. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  112. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  113. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  114. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  115. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  116. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  117. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  118. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  119. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-exec.png +0 -0
  120. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-vote.png +0 -0
  121. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/nav.adoc +0 -29
  122. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/access-control.adoc +0 -288
  123. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  124. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/accounts.adoc +0 -354
  125. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  126. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  127. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  128. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  129. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20.adoc +0 -67
  130. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  131. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  132. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc721.adoc +0 -58
  133. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  134. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/faq.adoc +0 -13
  135. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/governance.adoc +0 -239
  136. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/index.adoc +0 -70
  137. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/multisig.adoc +0 -306
  138. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/tokens.adoc +0 -31
  139. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  140. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/utilities.adoc +0 -591
  141. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/wizard.adoc +0 -15
  142. package/lib/openzeppelin-contracts-upgradeable/docs/templates/contract.hbs +0 -141
  143. package/lib/openzeppelin-contracts-upgradeable/docs/templates/helpers.js +0 -46
  144. package/lib/openzeppelin-contracts-upgradeable/docs/templates/page.hbs +0 -4
  145. package/lib/openzeppelin-contracts-upgradeable/docs/templates/properties.js +0 -88
  146. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
  147. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
  148. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
  149. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
  150. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
  151. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
  152. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
  153. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
  154. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
  155. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
  156. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
  157. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
  158. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
  159. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
  160. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
  161. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
  162. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
  163. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
  164. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
  165. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
  166. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
  167. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
  168. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/README.md +0 -16
  169. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/antora.yml +0 -7
  170. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/config.js +0 -21
  171. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  172. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  173. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
  174. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  175. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  176. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  177. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  178. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  179. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  180. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  181. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  182. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  183. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
  184. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
  185. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
  186. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
  187. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  188. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
  189. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  190. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  191. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  192. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  193. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
  194. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  195. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  196. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
  197. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  198. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
  199. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
  200. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
  201. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
  202. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
  203. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  204. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
  205. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
  206. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
  207. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
  208. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
  209. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
  210. package/lib/openzeppelin-contracts-upgradeable.git/docs/antora.yml +0 -6
  211. package/lib/openzeppelin-contracts-upgradeable.git/docs/config.js +0 -21
  212. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-exec.png +0 -0
  213. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-vote.png +0 -0
  214. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/nav.adoc +0 -23
  215. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
  216. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
  217. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
  218. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
  219. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
  220. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
  221. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
  222. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
  223. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
  224. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
  225. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/governance.adoc +0 -321
  226. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/index.adoc +0 -63
  227. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
  228. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
  229. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
  230. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
  231. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
  232. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/contract.hbs +0 -85
  233. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/helpers.js +0 -46
  234. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/page.hbs +0 -4
  235. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/properties.js +0 -49
  236. package/lib/openzeppelin-contracts.git/docs/antora.yml +0 -6
  237. package/lib/openzeppelin-contracts.git/docs/config.js +0 -21
  238. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-exec.png +0 -0
  239. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-vote.png +0 -0
  240. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/nav.adoc +0 -23
  241. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
  242. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
  243. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
  244. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
  245. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
  246. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
  247. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
  248. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
  249. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
  250. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
  251. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/governance.adoc +0 -321
  252. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/index.adoc +0 -63
  253. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
  254. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
  255. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
  256. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
  257. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
  258. package/lib/openzeppelin-contracts.git/docs/templates/contract.hbs +0 -85
  259. package/lib/openzeppelin-contracts.git/docs/templates/helpers.js +0 -46
  260. package/lib/openzeppelin-contracts.git/docs/templates/page.hbs +0 -4
  261. package/lib/openzeppelin-contracts.git/docs/templates/properties.js +0 -49
  262. package/lib/reality-eth-monorepo/packages/docs/Audit_Reality_v3_202108.pdf +0 -0
  263. package/lib/reality-eth-monorepo/packages/docs/Makefile +0 -20
  264. package/lib/reality-eth-monorepo/packages/docs/arbitrators.rst +0 -85
  265. package/lib/reality-eth-monorepo/packages/docs/audit.rst +0 -12
  266. package/lib/reality-eth-monorepo/packages/docs/audit_v2.rst +0 -249
  267. package/lib/reality-eth-monorepo/packages/docs/audit_v2_ERC20.rst +0 -1075
  268. package/lib/reality-eth-monorepo/packages/docs/audit_v3.rst +0 -70
  269. package/lib/reality-eth-monorepo/packages/docs/conf.py +0 -155
  270. package/lib/reality-eth-monorepo/packages/docs/contract_explanation.rst +0 -82
  271. package/lib/reality-eth-monorepo/packages/docs/contracts.rst +0 -277
  272. package/lib/reality-eth-monorepo/packages/docs/dapp.rst +0 -126
  273. package/lib/reality-eth-monorepo/packages/docs/dapp_links.rst +0 -67
  274. package/lib/reality-eth-monorepo/packages/docs/fees.rst +0 -89
  275. package/lib/reality-eth-monorepo/packages/docs/index.rst +0 -26
  276. package/lib/reality-eth-monorepo/packages/docs/javascript.rst +0 -142
  277. package/lib/reality-eth-monorepo/packages/docs/make.bat +0 -36
  278. package/lib/reality-eth-monorepo/packages/docs/question_box.png +0 -0
  279. package/lib/reality-eth-monorepo/packages/docs/requirements.txt +0 -24
  280. package/lib/reality-eth-monorepo/packages/docs/whitepaper.rst +0 -165
  281. package/script/UpdateMarket.s.sol +0 -56
  282. package/scripts/AddAdminToLand.s.sol +0 -29
  283. package/scripts/ClaimMerkleRoot.s.sol +0 -34
  284. package/scripts/CreateLand.s.sol +0 -28
  285. package/scripts/CreateMarkets.s.sol +0 -71
  286. package/scripts/DeployContracts.s.sol +0 -94
  287. package/scripts/DeployMerkleRewardsDistributor.s.sol +0 -27
  288. package/scripts/DeployToken.s.sol +0 -17
  289. package/scripts/DeployUSDT.s.sol +0 -24
  290. package/scripts/MintTokens.s.sol +0 -21
  291. package/scripts/PublishMerkleRoot.s.sol +0 -50
  292. package/scripts/ResolveMarket.s.sol +0 -23
  293. package/scripts/TradeMarket.s.sol +0 -28
  294. package/scripts/UpdateMarket.s.sol +0 -55
  295. package/test/UpdateTest.t.sol +0 -55
  296. package/test/WhaleTest.t.sol +0 -188
  297. package/tooling/docs/jsdoc.json +0 -6
@@ -1,21 +0,0 @@
1
- const path = require('path');
2
- const fs = require('fs');
3
-
4
- /** @type import('solidity-docgen/dist/config').UserConfig */
5
- module.exports = {
6
- outputDir: 'docs/modules/api/pages',
7
- templates: 'docs/templates',
8
- exclude: ['mocks'],
9
- pageExtension: '.adoc',
10
- pages: (_, file, config) => {
11
- // For each contract file, find the closest README.adoc and return its location as the output page path.
12
- const sourcesDir = path.resolve(config.root, config.sourcesDir);
13
- let dir = path.resolve(config.root, file.absolutePath);
14
- while (dir.startsWith(sourcesDir)) {
15
- dir = path.dirname(dir);
16
- if (fs.existsSync(path.join(dir, 'README.adoc'))) {
17
- return path.relative(sourcesDir, dir) + config.pageExtension;
18
- }
19
- }
20
- },
21
- };
@@ -1,23 +0,0 @@
1
- * xref:index.adoc[Overview]
2
- * xref:wizard.adoc[Wizard]
3
- * xref:extending-contracts.adoc[Extending Contracts]
4
- * xref:upgradeable.adoc[Using with Upgrades]
5
-
6
- * xref:releases-stability.adoc[Releases & Stability]
7
-
8
- * xref:access-control.adoc[Access Control]
9
-
10
- * xref:tokens.adoc[Tokens]
11
- ** xref:erc20.adoc[ERC20]
12
- *** xref:erc20-supply.adoc[Creating Supply]
13
- ** xref:erc721.adoc[ERC721]
14
- ** xref:erc777.adoc[ERC777]
15
- ** xref:erc1155.adoc[ERC1155]
16
-
17
- * xref:governance.adoc[Governance]
18
-
19
- * xref:crosschain.adoc[Crosschain]
20
-
21
- * xref:utilities.adoc[Utilities]
22
-
23
- * xref:subgraphs::index.adoc[Subgraphs]
@@ -1,217 +0,0 @@
1
- = Access Control
2
-
3
- Access control—that is, "who is allowed to do this thing"—is incredibly important in the world of smart contracts. The access control of your contract may govern who can mint tokens, vote on proposals, freeze transfers, and many other things. It is therefore *critical* to understand how you implement it, lest someone else https://blog.openzeppelin.com/on-the-parity-wallet-multisig-hack-405a8c12e8f7[steals your whole system].
4
-
5
- [[ownership-and-ownable]]
6
- == Ownership and `Ownable`
7
-
8
- The most common and basic form of access control is the concept of _ownership_: there's an account that is the `owner` of a contract and can do administrative tasks on it. This approach is perfectly reasonable for contracts that have a single administrative user.
9
-
10
- OpenZeppelin Contracts provides xref:api:access.adoc#Ownable[`Ownable`] for implementing ownership in your contracts.
11
-
12
- [source,solidity]
13
- ----
14
- // contracts/MyContract.sol
15
- // SPDX-License-Identifier: MIT
16
- pragma solidity ^0.8.0;
17
-
18
- import "@openzeppelin/contracts/access/Ownable.sol";
19
-
20
- contract MyContract is Ownable {
21
- function normalThing() public {
22
- // anyone can call this normalThing()
23
- }
24
-
25
- function specialThing() public onlyOwner {
26
- // only the owner can call specialThing()!
27
- }
28
- }
29
- ----
30
-
31
- By default, the xref:api:access.adoc#Ownable-owner--[`owner`] of an `Ownable` contract is the account that deployed it, which is usually exactly what you want.
32
-
33
- Ownable also lets you:
34
-
35
- * xref:api:access.adoc#Ownable-transferOwnership-address-[`transferOwnership`] from the owner account to a new one, and
36
- * xref:api:access.adoc#Ownable-renounceOwnership--[`renounceOwnership`] for the owner to relinquish this administrative privilege, a common pattern after an initial stage with centralized administration is over.
37
-
38
- WARNING: Removing the owner altogether will mean that administrative tasks that are protected by `onlyOwner` will no longer be callable!
39
-
40
- Note that *a contract can also be the owner of another one*! This opens the door to using, for example, a https://gnosis-safe.io[Gnosis Safe], an https://aragon.org[Aragon DAO], or a totally custom contract that _you_ create.
41
-
42
- In this way you can use _composability_ to add additional layers of access control complexity to your contracts. Instead of having a single regular Ethereum account (Externally Owned Account, or EOA) as the owner, you could use a 2-of-3 multisig run by your project leads, for example. Prominent projects in the space, such as https://makerdao.com[MakerDAO], use systems similar to this one.
43
-
44
- [[role-based-access-control]]
45
- == Role-Based Access Control
46
-
47
- While the simplicity of _ownership_ can be useful for simple systems or quick prototyping, different levels of authorization are often needed. You may want for an account to have permission to ban users from a system, but not create new tokens. https://en.wikipedia.org/wiki/Role-based_access_control[_Role-Based Access Control (RBAC)_] offers flexibility in this regard.
48
-
49
- In essence, we will be defining multiple _roles_, each allowed to perform different sets of actions. An account may have, for example, 'moderator', 'minter' or 'admin' roles, which you will then check for instead of simply using `onlyOwner`. This check can be enforced through the `onlyRole` modifier. Separately, you will be able to define rules for how accounts can be granted a role, have it revoked, and more.
50
-
51
- Most software uses access control systems that are role-based: some users are regular users, some may be supervisors or managers, and a few will often have administrative privileges.
52
-
53
- [[using-access-control]]
54
- === Using `AccessControl`
55
-
56
- OpenZeppelin Contracts provides xref:api:access.adoc#AccessControl[`AccessControl`] for implementing role-based access control. Its usage is straightforward: for each role that you want to define,
57
- you will create a new _role identifier_ that is used to grant, revoke, and check if an account has that role.
58
-
59
- Here's a simple example of using `AccessControl` in an xref:tokens.adoc#ERC20[`ERC20` token] to define a 'minter' role, which allows accounts that have it create new tokens:
60
-
61
- [source,solidity]
62
- ----
63
- // contracts/MyToken.sol
64
- // SPDX-License-Identifier: MIT
65
- pragma solidity ^0.8.0;
66
-
67
- import "@openzeppelin/contracts/access/AccessControl.sol";
68
- import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
69
-
70
- contract MyToken is ERC20, AccessControl {
71
- // Create a new role identifier for the minter role
72
- bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
73
-
74
- constructor(address minter) ERC20("MyToken", "TKN") {
75
- // Grant the minter role to a specified account
76
- _grantRole(MINTER_ROLE, minter);
77
- }
78
-
79
- function mint(address to, uint256 amount) public {
80
- // Check that the calling account has the minter role
81
- require(hasRole(MINTER_ROLE, msg.sender), "Caller is not a minter");
82
- _mint(to, amount);
83
- }
84
- }
85
- ----
86
-
87
- NOTE: Make sure you fully understand how xref:api:access.adoc#AccessControl[`AccessControl`] works before using it on your system, or copy-pasting the examples from this guide.
88
-
89
- While clear and explicit, this isn't anything we wouldn't have been able to achieve with `Ownable`. Indeed, where `AccessControl` shines is in scenarios where granular permissions are required, which can be implemented by defining _multiple_ roles.
90
-
91
- Let's augment our ERC20 token example by also defining a 'burner' role, which lets accounts destroy tokens, and by using the `onlyRole` modifier:
92
-
93
- [source,solidity]
94
- ----
95
- // contracts/MyToken.sol
96
- // SPDX-License-Identifier: MIT
97
- pragma solidity ^0.8.0;
98
-
99
- import "@openzeppelin/contracts/access/AccessControl.sol";
100
- import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
101
-
102
- contract MyToken is ERC20, AccessControl {
103
- bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
104
- bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
105
-
106
- constructor(address minter, address burner) ERC20("MyToken", "TKN") {
107
- _grantRole(MINTER_ROLE, minter);
108
- _grantRole(BURNER_ROLE, burner);
109
- }
110
-
111
- function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
112
- _mint(to, amount);
113
- }
114
-
115
- function burn(address from, uint256 amount) public onlyRole(BURNER_ROLE) {
116
- _burn(from, amount);
117
- }
118
- }
119
- ----
120
-
121
- So clean! By splitting concerns this way, more granular levels of permission may be implemented than were possible with the simpler _ownership_ approach to access control. Limiting what each component of a system is able to do is known as the https://en.wikipedia.org/wiki/Principle_of_least_privilege[principle of least privilege], and is a good security practice. Note that each account may still have more than one role, if so desired.
122
-
123
- [[granting-and-revoking]]
124
- === Granting and Revoking Roles
125
-
126
- The ERC20 token example above uses `_grantRole`, an `internal` function that is useful when programmatically assigning roles (such as during construction). But what if we later want to grant the 'minter' role to additional accounts?
127
-
128
- By default, **accounts with a role cannot grant it or revoke it from other accounts**: all having a role does is making the `hasRole` check pass. To grant and revoke roles dynamically, you will need help from the _role's admin_.
129
-
130
- Every role has an associated admin role, which grants permission to call the `grantRole` and `revokeRole` functions. A role can be granted or revoked by using these if the calling account has the corresponding admin role. Multiple roles may have the same admin role to make management easier. A role's admin can even be the same role itself, which would cause accounts with that role to be able to also grant and revoke it.
131
-
132
- This mechanism can be used to create complex permissioning structures resembling organizational charts, but it also provides an easy way to manage simpler applications. `AccessControl` includes a special role, called `DEFAULT_ADMIN_ROLE`, which acts as the **default admin role for all roles**. An account with this role will be able to manage any other role, unless `_setRoleAdmin` is used to select a new admin role.
133
-
134
- Let's take a look at the ERC20 token example, this time taking advantage of the default admin role:
135
-
136
- [source,solidity]
137
- ----
138
- // contracts/MyToken.sol
139
- // SPDX-License-Identifier: MIT
140
- pragma solidity ^0.8.0;
141
-
142
- import "@openzeppelin/contracts/access/AccessControl.sol";
143
- import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
144
-
145
- contract MyToken is ERC20, AccessControl {
146
- bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
147
- bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
148
-
149
- constructor() ERC20("MyToken", "TKN") {
150
- // Grant the contract deployer the default admin role: it will be able
151
- // to grant and revoke any roles
152
- _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
153
- }
154
-
155
- function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
156
- _mint(to, amount);
157
- }
158
-
159
- function burn(address from, uint256 amount) public onlyRole(BURNER_ROLE) {
160
- _burn(from, amount);
161
- }
162
- }
163
- ----
164
-
165
- Note that, unlike the previous examples, no accounts are granted the 'minter' or 'burner' roles. However, because those roles' admin role is the default admin role, and _that_ role was granted to `msg.sender`, that same account can call `grantRole` to give minting or burning permission, and `revokeRole` to remove it.
166
-
167
- Dynamic role allocation is often a desirable property, for example in systems where trust in a participant may vary over time. It can also be used to support use cases such as https://en.wikipedia.org/wiki/Know_your_customer[KYC], where the list of role-bearers may not be known up-front, or may be prohibitively expensive to include in a single transaction.
168
-
169
- [[querying-privileged-accounts]]
170
- === Querying Privileged Accounts
171
-
172
- Because accounts might <<granting-and-revoking, grant and revoke roles>> dynamically, it is not always possible to determine which accounts hold a particular role. This is important as it allows to prove certain properties about a system, such as that an administrative account is a multisig or a DAO, or that a certain role has been removed from all users, effectively disabling any associated functionality.
173
-
174
- Under the hood, `AccessControl` uses `EnumerableSet`, a more powerful variant of Solidity's `mapping` type, which allows for key enumeration. `getRoleMemberCount` can be used to retrieve the number of accounts that have a particular role, and `getRoleMember` can then be called to get the address of each of these accounts.
175
-
176
- ```javascript
177
- const minterCount = await myToken.getRoleMemberCount(MINTER_ROLE);
178
-
179
- const members = [];
180
- for (let i = 0; i < minterCount; ++i) {
181
- members.push(await myToken.getRoleMember(MINTER_ROLE, i));
182
- }
183
- ```
184
-
185
- == Delayed operation
186
-
187
- Access control is essential to prevent unauthorized access to critical functions. These functions may be used to mint tokens, freeze transfers or perform an upgrade that completely changes the smart contract logic. While xref:api:access.adoc#Ownable[`Ownable`] and xref:api:access.adoc#AccessControl[`AccessControl`] can prevent unauthorized access, they do not address the issue of a misbehaving administrator attacking their own system to the prejudice of their users.
188
-
189
- This is the issue the xref:api:governance.adoc#TimelockController[`TimelockController`] is addressing.
190
-
191
- The xref:api:governance.adoc#TimelockController[`TimelockController`] is a proxy that is governed by proposers and executors. When set as the owner/admin/controller of a smart contract, it ensures that whichever maintenance operation is ordered by the proposers is subject to a delay. This delay protects the users of the smart contract by giving them time to review the maintenance operation and exit the system if they consider it is in their best interest to do so.
192
-
193
- === Using `TimelockController`
194
-
195
- By default, the address that deployed the xref:api:governance.adoc#TimelockController[`TimelockController`] gets administration privileges over the timelock. This role grants the right to assign proposers, executors, and other administrators.
196
-
197
- The first step in configuring the xref:api:governance.adoc#TimelockController[`TimelockController`] is to assign at least one proposer and one executor. These can be assigned during construction or later by anyone with the administrator role. These roles are not exclusive, meaning an account can have both roles.
198
-
199
- Roles are managed using the xref:api:access.adoc#AccessControl[`AccessControl`] interface and the `bytes32` values for each role are accessible through the `ADMIN_ROLE`, `PROPOSER_ROLE` and `EXECUTOR_ROLE` constants.
200
-
201
- There is an additional feature built on top of `AccessControl`: giving the executor role to `address(0)` opens access to anyone to execute a proposal once the timelock has expired. This feature, while useful, should be used with caution.
202
-
203
- At this point, with both a proposer and an executor assigned, the timelock can perform operations.
204
-
205
- An optional next step is for the deployer to renounce its administrative privileges and leave the timelock self-administered. If the deployer decides to do so, all further maintenance, including assigning new proposers/schedulers or changing the timelock duration will have to follow the timelock workflow. This links the governance of the timelock to the governance of contracts attached to the timelock, and enforce a delay on timelock maintenance operations.
206
-
207
- WARNING: If the deployer renounces administrative rights in favour of timelock itself, assigning new proposers or executors will require a timelocked operation. This means that if the accounts in charge of any of these two roles become unavailable, then the entire contract (and any contract it controls) becomes locked indefinitely.
208
-
209
- With both the proposer and executor roles assigned and the timelock in charge of its own administration, you can now transfer the ownership/control of any contract to the timelock.
210
-
211
- TIP: A recommended configuration is to grant both roles to a secure governance contract such as a DAO or a multisig, and to additionally grant the executor role to a few EOAs held by people in charge of helping with the maintenance operations. These wallets cannot take over control of the timelock but they can help smoothen the workflow.
212
-
213
- === Minimum delay
214
-
215
- Operations executed by the xref:api:governance.adoc#TimelockController[`TimelockController`] are not subject to a fixed delay but rather a minimum delay. Some major updates might call for a longer delay. For example, if a delay of just a few days might be sufficient for users to audit a minting operation, it makes sense to use a delay of a few weeks, or even a few months, when scheduling a smart contract upgrade.
216
-
217
- The minimum delay (accessible through the xref:api:governance.adoc#TimelockController-getMinDelay--[`getMinDelay`] method) can be updated by calling the xref:api:governance.adoc#TimelockController-updateDelay-uint256-[`updateDelay`] function. Bear in mind that access to this function is only accessible by the timelock itself, meaning this maintenance operation has to go through the timelock itself.
@@ -1,210 +0,0 @@
1
- = Adding cross-chain support to contracts
2
-
3
- If your contract is targeting to be used in the context of multichain operations, you may need specific tools to identify and process these cross-chain operations.
4
-
5
- OpenZeppelin provides the xref:api:crosschain.adoc#CrossChainEnabled[`CrossChainEnabled`] abstract contract, that includes dedicated internal functions.
6
-
7
- In this guide, we will go through an example use case: _how to build an upgradeable & mintable ERC20 token controlled by a governor present on a foreign chain_.
8
-
9
- == Starting point, our ERC20 contract
10
-
11
- Let's start with a small ERC20 contract, that we bootstrapped using the https://wizard.openzeppelin.com/[OpenZeppelin Contracts Wizard], and extended with an owner that has the ability to mint. Note that for demonstration purposes we have not used the built-in `Ownable` contract.
12
-
13
- [source,solidity]
14
- ----
15
- // SPDX-License-Identifier: MIT
16
- pragma solidity ^0.8.4;
17
-
18
- import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
19
- import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
20
- import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
21
-
22
- contract MyToken is Initializable, ERC20Upgradeable, UUPSUpgradeable {
23
- address public owner;
24
-
25
- modifier onlyOwner() {
26
- require(owner == _msgSender(), "Not authorized");
27
- _;
28
- }
29
-
30
- /// @custom:oz-upgrades-unsafe-allow constructor
31
- constructor() initializer {}
32
-
33
- function initialize(address initialOwner) initializer public {
34
- __ERC20_init("MyToken", "MTK");
35
- __UUPSUpgradeable_init();
36
-
37
- owner = initialOwner;
38
- }
39
-
40
- function mint(address to, uint256 amount) public onlyOwner {
41
- _mint(to, amount);
42
- }
43
-
44
- function _authorizeUpgrade(address newImplementation) internal override onlyOwner {
45
- }
46
- }
47
- ----
48
-
49
- This token is mintable and upgradeable by the owner of the contract.
50
-
51
- == Preparing our contract for cross-chain operations.
52
-
53
- Let's now imagine that this contract is going to live on one chain, but we want the minting and the upgrading to be performed by a xref:governance.adoc[`governor`] contract on another chain.
54
-
55
- For example, we could have our token on xDai, with our governor on mainnet, or we could have our token on mainnet, with our governor on optimism
56
-
57
- In order to do that, we will start by adding xref:api:crosschain.adoc#CrossChainEnabled[`CrossChainEnabled`] to our contract. You will notice that the contract is now abstract. This is because `CrossChainEnabled` is an abstract contract: it is not tied to any particular chain and it deals with cross-chain interactions in an abstract way. This is what enables us to easily reuse the code for different chains. We will specialize it later by inheriting from a chain-specific implementation of the abstraction.
58
-
59
- ```diff
60
- import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
61
- +import "@openzeppelin/contracts-upgradeable/crosschain/CrossChainEnabled.sol";
62
-
63
- -contract MyToken is Initializable, ERC20Upgradeable, UUPSUpgradeable {
64
- +abstract contract MyTokenCrossChain is Initializable, ERC20Upgradeable, UUPSUpgradeable, CrossChainEnabled {
65
- ```
66
-
67
- Once that is done, we can use the `onlyCrossChainSender` modifier, provided by `CrossChainEnabled` in order to protect the minting and upgrading operations.
68
-
69
- ```diff
70
- - function mint(address to, uint256 amount) public onlyOwner {
71
- + function mint(address to, uint256 amount) public onlyCrossChainSender(owner) {
72
-
73
- - function _authorizeUpgrade(address newImplementation) internal override onlyOwner {
74
- + function _authorizeUpgrade(address newImplementation) internal override onlyCrossChainSender(owner) {
75
- ```
76
-
77
- This change will effectively restrict the mint and upgrade operations to the `owner` on the remote chain.
78
-
79
- == Specializing for a specific chain
80
-
81
- Once the abstract cross-chain version of our token is ready we can easily specialize it for the chain we want, or more precisely for the bridge system that we want to rely on.
82
-
83
- This is done using one of the many `CrossChainEnabled` implementations.
84
-
85
- For example, if our token is on xDai, and our governor on mainnet, we can use the https://docs.tokenbridge.net/amb-bridge/about-amb-bridge[AMB] bridge available on xDai at https://blockscout.com/xdai/mainnet/address/0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59[0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59]
86
-
87
- [source,solidity]
88
- ----
89
- [...]
90
-
91
- import "@openzeppelin/contracts-upgradeable/crosschain/amb/CrossChainEnabledAMB.sol";
92
-
93
- contract MyTokenXDAI is
94
- MyTokenCrossChain,
95
- CrossChainEnabledAMB(0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59)
96
- {}
97
- ----
98
-
99
- If the token is on Ethereum mainnet, and our governor on Optimism, we use the Optimism https://community.optimism.io/docs/protocol/protocol-2.0/#l1crossdomainmessenger[CrossDomainMessenger] available on mainnet at https://etherscan.io/address/0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1[0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1].
100
-
101
- [source,solidity]
102
- ----
103
- [...]
104
-
105
- import "@openzeppelin/contracts-upgradeable/crosschain/optimismCrossChainEnabledOptimism.sol";
106
-
107
- contract MyTokenOptimism is
108
- MyTokenCrossChain,
109
- CrossChainEnabledOptimism(0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1)
110
- {}
111
- ----
112
-
113
- == Mixing cross domain addresses is dangerous
114
-
115
- When designing a contract with cross-chain support, it is essential to understand possible fallbacks and the security assumption that are being made.
116
-
117
- In this guide, we are particularly focusing on restricting access to a specific caller. This is usually done (as shown above) using `msg.sender` or `_msgSender()`. However, when going cross-chain, it is not just that simple. Even without considering possible bridge issues, it is important to keep in mind that the same address can correspond to very different entities when considering a multi-chain space. EOA wallets can only execute operations if the wallet's private-key signs the transaction. To our knowledge this is the case in all EVM chains, so a cross-chain message coming from such a wallet is arguably equivalent to a non-cross-chain message by the same wallet. The situation is however very different for smart contracts.
118
-
119
- Due to the way smart contract addresses are computed, and the fact that smart contracts on different chains live independent lives, you could have two very different contracts live at the same address on different chains. You could imagine two multisig wallets with different signers using the same address on different chains. You could also see a very basic smart wallet live on one chain at the same address as a full-fledged governor on another chain. Therefore, you should be careful that whenever you give permissions to a specific address, you control with chain this address can act from.
120
-
121
- == Going further with access control
122
-
123
- In the previous example, we have both an `onlyOwner()` modifier and the `onlyCrossChainSender(owner)` mechanism. We didn't use the xref:access-control.adoc#ownership-and-ownable[`Ownable`] pattern because the ownership transfer mechanism in includes is not designed to work with the owner being a cross-chain entity. Unlike xref:access-control.adoc#ownership-and-ownable[`Ownable`], xref:access-control.adoc#role-based-access-control[`AccessControl`] is more effective at capturing the nuances and can effectively be used to build cross-chain-aware contracts.
124
-
125
- Using xref:api:access.adoc#AccessControlCrossChain[`AccessControlCrossChain`] includes both the xref:api:access.adoc#AccessControl[`AccessControl`] core and the xref:api:crosschain.adoc#CrossChainEnabled[`CrossChainEnabled`] abstraction. It also includes some binding to make role management compatible with cross-chain operations.
126
-
127
- In the case of the `mint` function, the caller must have the `MINTER_ROLE` when the call originates from the same chain. If the caller is on a remote chain, then the caller should not have the `MINTER_ROLE`, but the "aliased" version (`MINTER_ROLE ^ CROSSCHAIN_ALIAS`). This mitigates the danger described in the previous section by strictly separating local accounts from remote accounts from a different chain. See the xref:api:access.adoc#AccessControlCrossChain[`AccessControlCrossChain`] documentation for more details.
128
-
129
-
130
- ```diff
131
- import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
132
- import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
133
- +import "@openzeppelin/contracts-upgradeable/access/AccessControlCrossChainUpgradeable.sol";
134
-
135
- -abstract contract MyTokenCrossChain is Initializable, ERC20Upgradeable, UUPSUpgradeable, CrossChainEnabled {
136
- +abstract contract MyTokenCrossChain is Initializable, ERC20Upgradeable, UUPSUpgradeable, AccessControlCrossChainUpgradeable {
137
-
138
- - address public owner;
139
- - modifier onlyOwner() {
140
- - require(owner == _msgSender(), "Not authorized");
141
- - _;
142
- - }
143
-
144
- + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
145
- + bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
146
-
147
- function initialize(address initialOwner) initializer public {
148
- __ERC20_init("MyToken", "MTK");
149
- __UUPSUpgradeable_init();
150
- + __AccessControl_init();
151
- + _grantRole(_crossChainRoleAlias(DEFAULT_ADMIN_ROLE), initialOwner); // initialOwner is on a remote chain
152
- - owner = initialOwner;
153
- }
154
-
155
- - function mint(address to, uint256 amount) public onlyCrossChainSender(owner) {
156
- + function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
157
-
158
- - function _authorizeUpgrade(address newImplementation) internal override onlyCrossChainSender(owner) {
159
- + function _authorizeUpgrade(address newImplementation) internal override onlyRole(UPGRADER_ROLE) {
160
- ```
161
-
162
- This results in the following, final, code:
163
-
164
- [source,solidity]
165
- ----
166
- // SPDX-License-Identifier: MIT
167
- pragma solidity ^0.8.4;
168
-
169
- import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
170
- import "@openzeppelin/contracts-upgradeable/access/AccessControlCrossChainUpgradeable.sol";
171
- import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
172
- import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
173
-
174
- abstract contract MyTokenCrossChain is Initializable, ERC20Upgradeable, AccessControlCrossChainUpgradeable, UUPSUpgradeable {
175
- bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
176
- bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
177
-
178
- /// @custom:oz-upgrades-unsafe-allow constructor
179
- constructor() initializer {}
180
-
181
- function initialize(address initialOwner) initializer public {
182
- __ERC20_init("MyToken", "MTK");
183
- __AccessControl_init();
184
- __UUPSUpgradeable_init();
185
-
186
- _grantRole(_crossChainRoleAlias(DEFAULT_ADMIN_ROLE), initialOwner); // initialOwner is on a remote chain
187
- }
188
-
189
- function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
190
- _mint(to, amount);
191
- }
192
-
193
- function _authorizeUpgrade(address newImplementation) internal onlyRole(UPGRADER_ROLE) override {
194
- }
195
- }
196
-
197
- import "@openzeppelin/contracts-upgradeable/crosschain/amb/CrossChainEnabledAMB.sol";
198
-
199
- contract MyTokenXDAI is
200
- MyTokenCrossChain,
201
- CrossChainEnabledAMB(0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59)
202
- {}
203
-
204
- import "@openzeppelin/contracts-upgradeable/crosschain/optimismCrossChainEnabledOptimism.sol";
205
-
206
- contract MyTokenOptimism is
207
- MyTokenCrossChain,
208
- CrossChainEnabledOptimism(0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1)
209
- {}
210
- ----
@@ -1,11 +0,0 @@
1
- = Crowdsales
2
-
3
- All crowdsale-related contracts were removed from the OpenZeppelin Contracts library on the https://forum.openzeppelin.com/t/openzeppelin-contracts-v3-0-beta-release/2256[v3.0.0 release] due to both a decline in their usage and the complexity associated with migrating them to Solidity v0.6.
4
-
5
- They are however still available on the v2.5 release of OpenZeppelin Contracts, which you can install by running:
6
-
7
- ```console
8
- $ npm install @openzeppelin/contracts@v2.5
9
- ```
10
-
11
- Refer to the https://docs.openzeppelin.com/contracts/2.x/crowdsales[v2.x documentation] when working with them.
@@ -1,19 +0,0 @@
1
- = Drafts
2
-
3
- All draft contracts were either moved into a different directory or removed from the OpenZeppelin Contracts library on the https://forum.openzeppelin.com/t/openzeppelin-contracts-v3-0-beta-release/2256[v3.0.0 release].
4
-
5
- * `ERC20Migrator`: removed.
6
- * xref:api:token/ERC20.adoc#ERC20Snapshot[`ERC20Snapshot`]: moved to `token/ERC20`.
7
- * `ERC20Detailed` and `ERC1046`: removed.
8
- * `TokenVesting`: removed. Pending a replacement that is being discussed in https://github.com/OpenZeppelin/openzeppelin-contracts/issues/1214[`#1214`].
9
- * xref:api:utils.adoc#Counters[`Counters`]: moved to xref:api:utils.adoc[`utils`].
10
- * xref:api:utils.adoc#Strings[`Strings`]: moved to xref:api:utils.adoc[`utils`].
11
- * xref:api:utils.adoc#SignedSafeMath[`SignedSafeMath`]: moved to xref:api:utils.adoc[`utils`].
12
-
13
- Removed contracts are still available on the v2.5 release of OpenZeppelin Contracts, which you can install by running:
14
-
15
- ```console
16
- $ npm install @openzeppelin/contracts@v2.5
17
- ```
18
-
19
- Refer to the xref:2.x@contracts:api:drafts.adoc[v2.x documentation] when working with them.