polkamarkets-js 3.4.1 → 3.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/package.json +1 -1
  2. package/script/AddAdminToLand.s.sol +1 -1
  3. package/script/ClaimMerkleRoot.s.sol +29 -29
  4. package/script/CreateLand.s.sol +1 -1
  5. package/script/DeployMerkleRewardsDistributor.s.sol +21 -21
  6. package/script/MintTokens.s.sol +1 -1
  7. package/script/PublishMerkleRoot.s.sol +50 -50
  8. package/script/UpdateMarket.s.sol +55 -0
  9. package/script/copy-abis.js +57 -0
  10. package/src/Application.js +12 -1
  11. package/src/models/IContract.js +87 -1
  12. package/src/models/PolkamarketsSmartAccount.js +23 -0
  13. package/src/models/PredictionMarketV3Contract.js +49 -16
  14. package/abis/AccessControlUpgradeable.json +0 -1
  15. package/abis/AddAdminToLand.json +0 -1
  16. package/abis/AddressUpgradeable.json +0 -1
  17. package/abis/ClaimMerkleRoot.json +0 -1
  18. package/abis/CreateLand.json +0 -1
  19. package/abis/CreateMarkets.json +0 -1
  20. package/abis/DeployContracts.json +0 -1
  21. package/abis/DeployMerkleRewardsDistributor.json +0 -1
  22. package/abis/DeployToken.json +0 -1
  23. package/abis/DeployUSDT.json +0 -1
  24. package/abis/ECDSA.json +0 -1
  25. package/abis/ERC165Upgradeable.json +0 -1
  26. package/abis/ERC1967UpgradeUpgradeable.json +0 -1
  27. package/abis/Hashes.json +0 -1
  28. package/abis/IBeaconUpgradeable.json +0 -1
  29. package/abis/IERC1822ProxiableUpgradeable.json +0 -1
  30. package/abis/IERC20PermitUpgradeable.json +0 -1
  31. package/abis/IERC20Upgradeable.json +0 -1
  32. package/abis/Manager.json +0 -1
  33. package/abis/MerkleProof.json +0 -1
  34. package/abis/MerkleRewardsDistributor.json +0 -1
  35. package/abis/MerkleRewardsDistributorTest.json +0 -1
  36. package/abis/MessageHashUtils.json +0 -1
  37. package/abis/MintTokens.json +0 -1
  38. package/abis/Nonces.json +0 -1
  39. package/abis/Panic.json +0 -1
  40. package/abis/PublishMerkleRoot.json +0 -1
  41. package/abis/ResolveMarket.json +0 -1
  42. package/abis/RewardsDistributor.json +0 -1
  43. package/abis/RewardsDistributorTest.json +0 -1
  44. package/abis/SafeCast.json +0 -1
  45. package/abis/SafeERC20Upgradeable.json +0 -1
  46. package/abis/SignedMath.json +0 -1
  47. package/abis/StorageSlotUpgradeable.json +0 -1
  48. package/abis/TradeMarket.json +0 -1
  49. package/abis/USDT.json +0 -1
  50. package/abis/UpdateMarket.json +0 -1
  51. package/abis/UpdateTest.json +0 -1
  52. package/abis/WhaleTest.json +0 -1
  53. package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
  54. package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
  55. package/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
  56. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
  57. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
  58. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
  59. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
  60. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
  61. package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
  62. package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
  63. package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
  64. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
  65. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
  66. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
  67. package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
  68. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
  69. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
  70. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
  71. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
  72. package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
  73. package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
  74. package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
  75. package/lib/openzeppelin-contracts/docs/README.md +0 -16
  76. package/lib/openzeppelin-contracts/docs/antora.yml +0 -7
  77. package/lib/openzeppelin-contracts/docs/config.js +0 -21
  78. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  79. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  80. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
  81. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  82. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  83. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  84. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  85. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  86. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  87. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  88. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  89. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  90. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
  91. package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
  92. package/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
  93. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
  94. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  95. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
  96. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  97. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  98. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  99. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  100. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
  101. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  102. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  103. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
  104. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  105. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
  106. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
  107. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
  108. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
  109. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
  110. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  111. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
  112. package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
  113. package/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
  114. package/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
  115. package/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
  116. package/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
  117. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC20WithAutoMinerRewardUpgradeable.sol +0 -28
  118. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/ERC4626FeesUpgradeable.sol +0 -115
  119. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/MyNFTUpgradeable.sol +0 -14
  120. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintBaseUpgradeable.sol +0 -31
  121. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintMissingUpgradeable.sol +0 -30
  122. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRoleUpgradeable.sol +0 -29
  123. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessControlModifiedUpgradeable.sol +0 -20
  124. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/AccessManagedERC20MintBaseUpgradeable.sol +0 -22
  125. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/access-control/MyContractOwnableUpgradeable.sol +0 -22
  126. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyAccountERC7702Upgradeable.sol +0 -26
  127. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/account/MyFactoryAccountUpgradeable.sol +0 -42
  128. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyGovernorUpgradeable.sol +0 -92
  129. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenTimestampBasedUpgradeable.sol +0 -39
  130. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenUpgradeable.sol +0 -28
  131. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/governance/MyTokenWrappedUpgradeable.sol +0 -39
  132. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/GameItemsUpgradeable.sol +0 -27
  133. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC1155/MyERC115HolderContractUpgradeable.sol +0 -13
  134. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC20/GLDTokenUpgradeable.sol +0 -17
  135. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC6909/ERC6909GameItemsUpgradeable.sol +0 -31
  136. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/token/ERC721/GameItemUpgradeable.sol +0 -24
  137. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/Base64NFTUpgradeable.sol +0 -32
  138. package/lib/openzeppelin-contracts-upgradeable/contracts/mocks/docs/utilities/MulticallUpgradeable.sol +0 -21
  139. package/lib/openzeppelin-contracts-upgradeable/docs/README.md +0 -16
  140. package/lib/openzeppelin-contracts-upgradeable/docs/antora.yml +0 -7
  141. package/lib/openzeppelin-contracts-upgradeable/docs/config.js +0 -21
  142. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  143. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  144. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/access-manager.svg +0 -99
  145. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  146. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  147. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  148. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  149. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  150. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  151. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  152. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  153. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  154. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-exec.png +0 -0
  155. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/images/tally-vote.png +0 -0
  156. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/nav.adoc +0 -29
  157. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/access-control.adoc +0 -288
  158. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  159. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/accounts.adoc +0 -354
  160. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  161. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  162. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  163. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  164. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc20.adoc +0 -67
  165. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  166. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  167. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/erc721.adoc +0 -58
  168. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  169. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/faq.adoc +0 -13
  170. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/governance.adoc +0 -239
  171. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/index.adoc +0 -70
  172. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/multisig.adoc +0 -306
  173. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/tokens.adoc +0 -31
  174. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  175. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/utilities.adoc +0 -591
  176. package/lib/openzeppelin-contracts-upgradeable/docs/modules/ROOT/pages/wizard.adoc +0 -15
  177. package/lib/openzeppelin-contracts-upgradeable/docs/templates/contract.hbs +0 -141
  178. package/lib/openzeppelin-contracts-upgradeable/docs/templates/helpers.js +0 -46
  179. package/lib/openzeppelin-contracts-upgradeable/docs/templates/page.hbs +0 -4
  180. package/lib/openzeppelin-contracts-upgradeable/docs/templates/properties.js +0 -88
  181. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +0 -22
  182. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -109
  183. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +0 -9
  184. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +0 -25
  185. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +0 -24
  186. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +0 -23
  187. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +0 -14
  188. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +0 -16
  189. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +0 -17
  190. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountERC7702.sol +0 -20
  191. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +0 -37
  192. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -80
  193. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -21
  194. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -32
  195. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -28
  196. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +0 -21
  197. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +0 -7
  198. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +0 -11
  199. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +0 -26
  200. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +0 -19
  201. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +0 -27
  202. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +0 -15
  203. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/README.md +0 -16
  204. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/antora.yml +0 -7
  205. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/config.js +0 -21
  206. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +0 -97
  207. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +0 -47
  208. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +0 -99
  209. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  210. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  211. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  212. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  213. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  214. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  215. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  216. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  217. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  218. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
  219. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
  220. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -29
  221. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -288
  222. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +0 -100
  223. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +0 -354
  224. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +0 -50
  225. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +0 -143
  226. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -118
  227. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -71
  228. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -67
  229. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  230. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +0 -47
  231. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -58
  232. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -51
  233. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +0 -13
  234. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -239
  235. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -70
  236. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +0 -306
  237. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -31
  238. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -77
  239. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -591
  240. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +0 -15
  241. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -141
  242. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
  243. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
  244. package/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/docs/templates/properties.js +0 -88
  245. package/lib/openzeppelin-contracts-upgradeable.git/docs/antora.yml +0 -6
  246. package/lib/openzeppelin-contracts-upgradeable.git/docs/config.js +0 -21
  247. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-exec.png +0 -0
  248. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/images/tally-vote.png +0 -0
  249. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/nav.adoc +0 -23
  250. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
  251. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
  252. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
  253. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
  254. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
  255. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
  256. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
  257. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
  258. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
  259. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
  260. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/governance.adoc +0 -321
  261. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/index.adoc +0 -63
  262. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
  263. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
  264. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
  265. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
  266. package/lib/openzeppelin-contracts-upgradeable.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
  267. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/contract.hbs +0 -85
  268. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/helpers.js +0 -46
  269. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/page.hbs +0 -4
  270. package/lib/openzeppelin-contracts-upgradeable.git/docs/templates/properties.js +0 -49
  271. package/lib/openzeppelin-contracts.git/docs/antora.yml +0 -6
  272. package/lib/openzeppelin-contracts.git/docs/config.js +0 -21
  273. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-exec.png +0 -0
  274. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/images/tally-vote.png +0 -0
  275. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/nav.adoc +0 -23
  276. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/access-control.adoc +0 -217
  277. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crosschain.adoc +0 -210
  278. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
  279. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/drafts.adoc +0 -19
  280. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc1155.adoc +0 -153
  281. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
  282. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc20.adoc +0 -85
  283. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc721.adoc +0 -90
  284. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/erc777.adoc +0 -73
  285. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/extending-contracts.adoc +0 -129
  286. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/governance.adoc +0 -321
  287. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/index.adoc +0 -63
  288. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
  289. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/tokens.adoc +0 -32
  290. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
  291. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/utilities.adoc +0 -190
  292. package/lib/openzeppelin-contracts.git/docs/modules/ROOT/pages/wizard.adoc +0 -15
  293. package/lib/openzeppelin-contracts.git/docs/templates/contract.hbs +0 -85
  294. package/lib/openzeppelin-contracts.git/docs/templates/helpers.js +0 -46
  295. package/lib/openzeppelin-contracts.git/docs/templates/page.hbs +0 -4
  296. package/lib/openzeppelin-contracts.git/docs/templates/properties.js +0 -49
  297. package/lib/reality-eth-monorepo/packages/docs/Audit_Reality_v3_202108.pdf +0 -0
  298. package/lib/reality-eth-monorepo/packages/docs/Makefile +0 -20
  299. package/lib/reality-eth-monorepo/packages/docs/arbitrators.rst +0 -85
  300. package/lib/reality-eth-monorepo/packages/docs/audit.rst +0 -12
  301. package/lib/reality-eth-monorepo/packages/docs/audit_v2.rst +0 -249
  302. package/lib/reality-eth-monorepo/packages/docs/audit_v2_ERC20.rst +0 -1075
  303. package/lib/reality-eth-monorepo/packages/docs/audit_v3.rst +0 -70
  304. package/lib/reality-eth-monorepo/packages/docs/conf.py +0 -155
  305. package/lib/reality-eth-monorepo/packages/docs/contract_explanation.rst +0 -82
  306. package/lib/reality-eth-monorepo/packages/docs/contracts.rst +0 -277
  307. package/lib/reality-eth-monorepo/packages/docs/dapp.rst +0 -126
  308. package/lib/reality-eth-monorepo/packages/docs/dapp_links.rst +0 -67
  309. package/lib/reality-eth-monorepo/packages/docs/fees.rst +0 -89
  310. package/lib/reality-eth-monorepo/packages/docs/index.rst +0 -26
  311. package/lib/reality-eth-monorepo/packages/docs/javascript.rst +0 -142
  312. package/lib/reality-eth-monorepo/packages/docs/make.bat +0 -36
  313. package/lib/reality-eth-monorepo/packages/docs/question_box.png +0 -0
  314. package/lib/reality-eth-monorepo/packages/docs/requirements.txt +0 -24
  315. package/lib/reality-eth-monorepo/packages/docs/whitepaper.rst +0 -165
  316. package/test/UpdateTest.t.sol +0 -55
  317. package/test/WhaleTest.t.sol +0 -188
  318. package/tooling/docs/jsdoc.json +0 -6
@@ -1,1075 +0,0 @@
1
- Audit, v2.0 ERC20 version
2
- =========================
3
-
4
- Realit.io Modifications
5
- ----------------------0
6
- for WeTrust.io
7
- Roland Kofler Blockchain Consulting
8
- June 2019
9
-
10
-
11
- DISCLAIMER: The auditor shall not be held liable to and shall not accept any liability, obligation or responsibility whatsoever for any loss or damage arising from the use of the software. Especially but not only not for undiscovered errors, bugs and vulnerabilities.
12
- Abstract
13
- The Realit.io smart contracts are examined for security vulnerabilities after allowing ERC20 Tokens as a means of payment. Potential vulnerabilities were found in the Code under Audit (sometimes referred as CuA in the text):
14
- 1. While benevolence of the token contracts are assumed, we can improve the resilience of the code by checking the successful execution of a transfer: MEDIUM: do not suppose tokens are ER20 compliant. TRST is implemented correctly. It might be contentions to mark this as MEDIUM, but the attitude in this audit is to err on the false positive side.
15
- 2. There is a documentation error in a `require` string. MEDIUM: correct `require` string
16
-
17
-
18
- Ad 1.: Realitio has decided not to change the check for transfer and therefore not to be compliant (at this level) with “BadTokens”, tokens that do not report correctly whether the transfer() function has been called directly. Realitio believes it can write a wrapper for such tokens if necessary. This is plausible.
19
- Ad 2.: Has been implemented https://github.com/realitio/realitio-contracts/commit/0e6ba5998d83700c8a485e3dead65bc3cdcc965e
20
- Additionally also a superfluous comment has been fixed, see Observation 5: constructor comment not consistent:
21
- https://github.com/realitio/realitio-contracts/commit/b91efd77fc7644e7026d84063462b83eb33574af
22
- Thanks to Ronan Sandford and Shaun Shutte for reviewing the document.
23
-
24
-
25
-
26
-
27
- Abstract
28
- -------
29
-
30
- Scope of the audit
31
- The benevolence of Token is mandatory
32
- Also check previous changes to the Contracts under Audit
33
- Methodology
34
- Changes from last audit to the code under audit
35
- Issue 1: `Update and rationalize interface files` and implications
36
- Issue2: Refactor commitment timeout calculation
37
- Issue 3: Duplication of Realito contracts, are they different?
38
- Issue 4: Duplication of Zeppelin ERC20 contracts, are they different?
39
- General observations
40
- Observation 1: Allow later solidity versions
41
- Observation 2: Drop back one minor solc version, deployed with 0.4.25
42
- Observation 3: Duplicate Code IERC20.sol
43
- Observation 4: ERC20Token.sol not latest version
44
- Observation 5: constructor comment not consistent
45
- Audit of CuA
46
- Match Intent of the modifications made
47
- Verify architectural change for ERC20 Tokens
48
- Verify token invariance
49
- Verify token use
50
- Medium: do not suppose tokens are ER20 compliant
51
- MINOR: allowing 0 bounties can spam the log
52
- MEDIUM: correct `require` string
53
- Verify how payments are made
54
- Verify reentrancy protection against token
55
- Verify execution isomorphism of previous changes
56
- MINOR: different Solidity versions in sources
57
- MINOR: there are two BalanceHolder contracts
58
- Results from Mythril
59
- Conclusions
60
- Appendix
61
- List of commits since last audit
62
- Comparing the baseline with the new ERC20 contracts
63
- References
64
- Audit Brief
65
- Audit Clarification
66
- Ethereum Safety
67
- ConsenSys Security Best Practices
68
- DASP
69
- Known Solidity Bugs
70
-
71
-
72
-
73
-
74
- Scope of the audit
75
- ------------------
76
- The reason for the audit is the introduction of ERC20 functionality in the code base.
77
-
78
-
79
- The scope of the audit is the source-code of two solidity smart contract files: (1) the changes in RealitioERC20.sol from Realitio.sol, BalanceHolder.sol and (2) Arbitrator.sol. Everything else is out of scope, for example the deployment of the code.
80
-
81
-
82
- From the Audit Brief (emphasis mine):
83
-
84
-
85
- [...]
86
- The audit consists of changes to 2 files, RealitioERC20.sol (changes from Realitio.sol) and Arbitrator.sol. I've also updated another auditor contract that I was working on, but it's not part of the scope of this audit.
87
-
88
-
89
- The new version is in the branch feature-erc20-audit:
90
- https://github.com/realitio/realitio-contracts/tree/feature-erc20-audit
91
-
92
-
93
- All the solidity code changes are in this commit:
94
- https://github.com/realitio/realitio-contracts/commit/ec8db377d0ef74c5bf599894240f6b54db113338
95
-
96
-
97
- The benevolence of Token is mandatory
98
- From the Audit Brief:
99
- [...] users must implicitly trust that the token the contract is interacting with isn't hostile.
100
-
101
-
102
- Also check previous changes to the Contracts under Audit
103
- From Audit Clarification results the mandate to check the changes since the last audit:
104
-
105
-
106
- However it would be good if you could verify that what I just said is true, ie that Realitio.sol before the commits I mentioned matches the last thing you audited and I'm not trying to sneak another change past you.
107
- Methodology
108
- The main methods of assessment is structured reading and interpretation. While examination of the Code under Audit, the thoughts of the auditors are recorded.
109
- Furthermore a security analysis tool, Mythril v0.21.3 by ConsenSys Diligence, was employed to review the Code under Audit.
110
- First we observe the sanity of the codebase created before the Code under Audit(CuA) was introduced (as described in the Appendix Scope of the Audit section), followed by the audit. Checklists of commonly known vulnerabilities are sourced from EthSafety, ConSysSec and DASP.
111
-
112
-
113
- The following definitions of alert levels are adopted to label vulnerabilities:
114
-
115
-
116
- CRITICAL has potential to harm user or owner
117
- MEDIUM has potential to impede proper functioning of the smart contract
118
- MINOR there is a better way to do this or is just a matter of diverging tastes
119
-
120
-
121
- The audit is documented comprehensively with all the base data and interim results provided in order to allow a reconstruction of the results and to document what has been tested and what has not been tested. This comprehensive information should encourage bug bounty hunters and security researchers to pursue their own inquiries.
122
- The audit does not take any philosophical or opinionated position about smart contract security. Between “Code is law” and “upgradeable, pausable, managed and owned” there is much room for debate.
123
- Changes from last audit to the code under audit
124
- Three previous audits have been conducted over the period from January to October 2018.
125
- Since then, new commits have been made (see Appendix List of commits since last audit). These changes are examined here to verify if the requirements for the audit mandate is given at all. Reviewers mentioned that the word `unrisky` does not exist in the english language. Because it best describes the subjective assessment of little risk, this word has been introduced.
126
-
127
-
128
- Count Description
129
- 30 CAN’T TOUCH CODE UNDER AUDIT
130
- 10 UNRISKY FOR CODE UNDER AUDIT
131
- 3 SOME RISK FOR CODE UNDER AUDIT
132
- Figure: subjective risk statistics for the changes before CuA
133
-
134
-
135
- Issue 1: `Update and rationalize interface files` and implications
136
- * Update and rationalize interface files
137
- * ed authored and ed committed on Oct 20, 2018
138
- * 390f2c9
139
- This commit introduces a `contract Realitio is IBalanceHolder` instead of the old copy & paste of the (1) event and (2) empty `withdraw ()` function.
140
- In the final version of the Code under Audit (CuA) the interface is substituted by an inheritance from an abstract class `BalanceHolderERC20.sol`!
141
- This is an undocumented change not present in Audit Clarification.
142
- The implications will be scrutinized in the AuC and in the main section of this document. {Result after verification: no known risk} .
143
- * Verdict: SOME RISK FOR CODE UNDER AUDIT
144
- Issue2: Refactor commitment timeout calculation
145
- * Break the commitment timeout calculation and storage into its own int…
146
- * Edmund Edgar authored and ed committed on May 17
147
- * 5422046
148
- As the code shows, this is a simple refactoring of a code block into an internal function, as stated in the commit msg.
149
- Verdict: UNRISKY FOR CODE UNDER AUDIT
150
- Issue 3: Duplication of Realito contracts, are they different?
151
- Start ERC20 version with exact copies of our original Realitio.sol co…
152
- ed authored and ed committed 17 days ago
153
- * 4959544
154
- We need to check if the initial versions differ (see Appendix Comparing the baseline with the new ERC20 contracts).
155
-
156
-
157
- Verdict: UNRISKY FOR CODE UNDER AUDIT
158
- Issue 4: Duplication of Zeppelin ERC20 contracts, are they different?
159
- Assuming the latest Zeppelin version for Solidity 0.4.24 was used (Zeppelin ERC20 Framework v2.0.1).
160
-
161
-
162
- Comparing
163
- https://raw.githubusercontent.com/realitio/realitio-contracts/391af7b87145fc5a10555742e931e32b9844f80e/truffle/contracts/ERC20Token.sol
164
-
165
-
166
- with
167
- https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.0.1/contracts/math/SafeMath.sol
168
-
169
-
170
- https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.0.1/contracts/token/ERC20/IERC20.sol
171
-
172
-
173
- https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.0.1/contracts/token/ERC20/ERC20.sol
174
-
175
-
176
- Distilled into a file Zeppelin.sol, we are ready to compare the files with a Unix command:
177
-
178
-
179
- diff --ignore-space-change ERC20Token.sol Zeppelin.sol
180
-
181
-
182
- Result:
183
-
184
-
185
- 7a8
186
- >
187
- 164a166,167
188
- > require(value <= _allowed[from][msg.sender]);
189
- >
190
- 210a214
191
- > require(value <= _balances[from]);
192
- 226,227c230
193
- < require(account != address(0));
194
- <
195
- ---
196
- > require(account != 0);
197
- 240c243,244
198
- < require(account != address(0));
199
- ---
200
- > require(account != 0);
201
- > require(value <= _balances[account]);
202
- 254a259,260
203
- > require(value <= _allowed[account][msg.sender]);
204
- >
205
-
206
-
207
- The sourced contracts do not implement several of the precondition checks Zeppelin has adopted in the latest version of the Solidity 0.4.24 version. It is likely that they are copied from an older commit. Because the code is not inherited or in any other way blended into the logic for the CuA, this is merely a cosmetic issue.
208
-
209
-
210
- Verdict: UNRISKY FOR CODE UNDER AUDIT
211
- General observations
212
- Some observations not critical for smart contract security.
213
- Observation 1: Allow later solidity versions
214
- * Allow later solidity versions
215
- * ed authored and ed committed on Nov 2, 2018
216
- * 0563976
217
- This is a trade off between security and ease of deployment. Verify at deploy time that the solidity compiler version you deploy to does not expose vulnerabilities. The code base requires different Solidity versions from 0.4.6 to 0.4.25 (Minor: different Solidity versions in sources).
218
- Observation 2: Drop back one minor solc version, deployed with 0.4.25
219
- There are unresolved but no critical bugs in Solidity 0.4.24, please take care (together with Observation 1)
220
- * Drop back one minor solc version, deployed with 0.4.25 but current tr… Edmund Edgar committed on Nov 9, 2018
221
-
222
-
223
- Specification of known Solc vulnerabilities (see Known Solidity Bugs):
224
- "0.4.24": {
225
-
226
-
227
-
228
-
229
- "bugs": [
230
-
231
-
232
- "ABIEncoderV2StorageArrayWithMultiSlotElement",
233
-
234
-
235
- "DynamicConstructorArgumentsClippedABIV2",
236
-
237
-
238
- "UninitializedFunctionPointerInConstructor_0.4.x",
239
-
240
-
241
- "IncorrectEventSignatureInLibraries_0.4.x",
242
-
243
-
244
- "ABIEncoderV2PackedStorage_0.4.x",
245
-
246
-
247
- "ExpExponentCleanup",
248
-
249
-
250
- "EventStructWrongData"
251
-
252
-
253
- ],
254
-
255
-
256
- "released": "2018-05-16"
257
-
258
-
259
- }
260
-
261
-
262
-
263
-
264
- Observation 3: Duplicate Code IERC20.sol
265
- The code in the file IERC20.sol is also found in ERC20Token.sol and can be trimmed in one of the files.
266
- Observation 4: ERC20Token.sol not latest version
267
- Consider updating the ERC20Token to the latest v2.0.1 of Zeppelin ERC20 Framework or annotate a warning in the documentation. See Issue 4: Duplication of Zeppelin ERC20 contracts, are they different?.
268
- Observation 5: constructor comment not consistent
269
-
270
-
271
- Line 193:
272
- /// param _token The token used for everything except arbitration
273
- Maybe intentional as a reminder, but consider to be more explicit.
274
-
275
-
276
- Verdict: Ignore my observations if you need to deploy soon :s)
277
-
278
-
279
-
280
-
281
- Audit of CuA
282
- The verification of the changes made between the last audit and the Code under Audit (CuA) reported an undocumented change.
283
-
284
-
285
- All code relevant to the core Audit are checked in a single commit:
286
- * Realitio ERC20 version uses ERC20 for everything except arbitration. … …
287
- * ed authored and ed committed 19 days ago
288
- * ec8db37
289
- Match Intent of the modifications made
290
- From the Project Description (emphasis mine):
291
-
292
-
293
- The principle is that we will have one RealitioERC20 contract per supported token, and as currently one Arbitrator contract per arbitrator per RealitioERC20 contract. The token is set during initial setup and once set cannot be changed. All question rewards and bonds are denominated in that token.
294
-
295
-
296
- As previously, arbitration is still denominated and requested in ETH.
297
- If the arbitrator sets a per-question fee, which is deducted from the funds sent to the initial bounty set when a question is created, this is denominated in the token.
298
- Accordingly, the Arbitrator contract now has a single additional function allowing its owner to withdraw ERC20 funds that it may have collected in the RealitioERC20 contract.
299
-
300
-
301
- Since a RealitioERC20 contract only handles a single token, which cannot be changed after setup, users must implicitly trust that the token the contract is interacting with isn't hostile. That said, the code is written with the intention that it wouldn't be subject to reentrancy bugs etc in the event that someone did use it with a maliciously coded token.
302
- [...]
303
-
304
-
305
- Verify architectural change for ERC20 Tokens
306
- From Audit Brief:
307
- [...] one RealitioERC20 contract per supported token, and as currently one Arbitrator contract per arbitrator per RealitioERC20 contract
308
-
309
-
310
-
311
-
312
-
313
- Figure: relationships of the contracts under audit
314
-
315
-
316
-
317
-
318
- The interpretation of the statement made in the brief, aligns with the structure and behavior in the code.
319
- Verify token invariance
320
- The token is set during initial setup and once set, cannot be changed.
321
-
322
-
323
- This relationship is enforced In RealitioERC20.sol:
324
-
325
-
326
- @@ -182,8 +181,16 @@ contract Realitio is BalanceHolder {
327
- _;
328
- }
329
-
330
-
331
- function setToken(IERC20 _token)
332
- public
333
- {
334
- require(token ==
335
- IERC20(0x0), "Token can only be initialized once");
336
- token = _token;
337
- }
338
-
339
-
340
- Statement is true if setToken is called on deployment.
341
- Verify token use
342
- [...] All question rewards and bonds are denominated in that token.
343
-
344
-
345
-
346
-
347
- @@ -169,9 +168,9 @@ contract Realitio is BalanceHolder {
348
-
349
-
350
- modifier bondMustDouble(bytes32 question_id) {
351
- require(msg.value > 0, "bond must be positive");
352
- require(msg.value >=
353
- (questions[question_id].bond.mul(2)),
354
- "bond must be double at least previous bond");
355
- modifier bondMustDouble(bytes32 question_id, uint256 tokens) {
356
- require(tokens > 0, "bond must be positive");
357
- require(tokens >=
358
- (questions[question_id].bond.mul(2)),
359
- "bond must be double at least previous bond");
360
- _;
361
- }
362
-
363
-
364
- Line 243: Payable is removed as it is not needed for tokens.
365
-
366
-
367
- function createTemplateAndAskQuestion(
368
- string content,
369
- string question, address arbitrator, uint32 timeout,
370
- uint32 opening_ts, uint256 nonce
371
- )
372
- // stateNotCreated is enforced by the internal _askQuestion
373
- public payable returns (bytes32) {
374
- public returns (bytes32) {
375
-
376
-
377
- Line 284 introduces not only the tokens parameter
378
-
379
-
380
- change:
381
- < /// @notice Ask a new question with a bounty and return the ID
382
- ---
383
- > /// @notice Ask a new question and return the ID
384
- New line:
385
- < /// @param tokens The combined initial question bounty and question fee
386
- Change:
387
- < function askQuestionERC20(uint256 template_id, string question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce, uint256 tokens)
388
- ---
389
- > function askQuestion(uint256 template_id, string question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce)
390
-
391
-
392
-
393
-
394
- < public returns (bytes32) {
395
- <
396
- < _deductTokensOrRevert(tokens);
397
- ---
398
- > public payable returns (bytes32) {
399
-
400
-
401
- < _askQuestion(question_id, content_hash, arbitrator, timeout, opening_ts, tokens);
402
- ---
403
- > _askQuestion(question_id, content_hash, arbitrator, timeout, opening_ts);
404
-
405
-
406
- Line 330 and line 336:
407
-
408
-
409
- + uint256 bounty = tokens;
410
- - uint256 bounty = msg.value;
411
- The replacement of an uint256 value contained in msg.value with one in the parameter tokens, arguably cannot introduce new vulnerabilities as their value range is the same and no gas implication are known.
412
-
413
-
414
- Line 284 Function
415
- function askQuestionERC20(uint256 template_id, string question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce, uint256 tokens)
416
-
417
-
418
- Line 286 payable gone: that's fine
419
- Line 288 _deduceTokensOrRevert()
420
- MEDIUM: do not suppose tokens are ER20 compliant
421
-
422
-
423
- A new function is introduced:
424
- function _deductTokensOrRevert(uint256 tokens)
425
- internal {
426
-
427
-
428
- if (tokens == 0) {
429
- return;
430
- }
431
-
432
-
433
- uint256 bal = balanceOf[msg.sender];
434
-
435
-
436
- // Deduct any tokens you have in your internal balance first
437
- if (bal > 0) {
438
- if (bal >= tokens) {
439
- balanceOf[msg.sender] = bal.sub(tokens);
440
- return;
441
- } else {
442
- tokens = tokens.sub(bal);
443
- balanceOf[msg.sender] = 0;
444
- }
445
- }
446
- // Now we need to charge the rest from
447
- require(token.transferFrom(msg.sender, address(this), tokens), "Transfer of tokens failed, insufficient approved balance?");
448
- return;
449
-
450
-
451
- }
452
-
453
-
454
- If no token exists we stop deducing tokens and allow the function to execute.
455
- Then we retrieve the balance of the sender.
456
- Functions that call this private function are
457
- * fundAnswerBountyERC20
458
- * askQuestionERC20
459
- * submitAnswerERC20
460
- * submitAnswerCommitmentERC20
461
-
462
-
463
- Only if a balance exists, can we look to subtract tokens from the balance of the sender.
464
- But if the balance is less than the tokens suggested, we get all the money from the balance and just use the tokens that are possible. This is defensive and allows a frictionless usage of the function.
465
- Still there is a potential issue with
466
- require(token.transferFrom(msg.sender, address(this), tokens), "Transfer of tokens failed, insufficient approved balance?");
467
-
468
-
469
- Others (Richard Meissner from Gnosis) have acknowledged that not all tokens return the boolean value correctly:
470
- https://github.com/gnosis/safe-contracts/blob/5a8b07326faf30c644361c9d690d57dbeb838698/contracts/common/SecuredTokenTransfer.sol
471
- The fact that Gnosis makes the choice to verify the token transfer in this complicated way indicates that there are tokens that do not implement the return value correctly or that it is seen as a potential threat. This is supported by empirical evidence (see Gitter Chat)
472
-
473
-
474
- From Gnosis Gitter:
475
- Roland Kofler @rolandkofler 15:28
476
- what is the rationale behind SecuredTokenTransfer.sol? especially do you find that transfer functions are not implemented correctly in important token contracts to that you need this functionality? @rmeissner
477
-
478
-
479
- Andrew Redden @androolloyd 15:30
480
- Some tokens aren’t implemented corrected and their return status doesn’t indicate a success.
481
-
482
-
483
- Wrappers are used to catch the diff return codes to ensure that no unintended reverts will occur
484
-
485
-
486
-
487
-
488
- Roland Kofler @rolandkofler 15:31
489
- thank you, can you give an example of such a token @androolloyd ?
490
-
491
-
492
- Andrew Redden @androolloyd 15:33
493
- Off hand I don’t have a list, I believe some implementations in OpenZeppelin were incorrect.
494
-
495
-
496
- Some quick googling should suffice.
497
-
498
-
499
-
500
-
501
- Roland Kofler @rolandkofler 15:34
502
- https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
503
- thank you
504
-
505
-
506
-
507
-
508
- TRST is implemented correctly:
509
- // See ERC20
510
- // WARNING: If you call this with the address of a contract, the contract will receive the
511
- // funds, but will have no idea where they came from. Furthermore, if the contract is
512
- // not aware of TRST, the tokens will remain locked away in the contract forever.
513
- // It is always recommended to call instead compareAndApprove() (or approve()) and have the
514
- // receiving contract withdraw the money using transferFrom().
515
- function transfer(address _to, uint256 _value) public returns (bool) {
516
- if (balances[msg.sender] >= _value) {
517
- balances[msg.sender] -= _value;
518
- balances[_to] += _value;
519
- Transfer(msg.sender, _to, _value);
520
- return true;
521
- }
522
- return false;
523
- }
524
-
525
-
526
- // See ERC20
527
- function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
528
- if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value) {
529
- balances[_from] -= _value;
530
- allowed[_from][msg.sender] -= _value;
531
- balances[_to] += _value;
532
- Transfer(_from, _to, _value);
533
- return true;
534
- }
535
- return false;
536
- }
537
-
538
-
539
-
540
-
541
- Added token parameter 326:
542
- function _askQuestion(bytes32 question_id, bytes32 content_hash, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 tokens)
543
-
544
-
545
- Removed 336: uint256 bounty = msg.value;
546
-
547
-
548
- If msg.sender is not the arbitrator then the question fee is applied and it is that the bounty, is at least the question fee. We then subtract the fee from the bounty.
549
-
550
-
551
- And we add it:
552
-
553
-
554
- Line 361 function fundAnswerBountyERC20(bytes32 question_id, uint256 tokens)
555
-
556
-
557
- Add funds to bounty of a question even after the question is created. Can be done even in arbitration before finalization.
558
- Arguably the arbiter gets no fees from a bounty.
559
- But now it’s with tokens.
560
- Now tokens is deducted, because we have to do accounting now. Not ethereum blocks.
561
- It allows for 0 bounties. That’s strange.
562
- Should it? Mark it minor as it spams the log
563
- MINOR: allowing 0 bounties can spam the log
564
- Consider if it is intentional to allow for zero bounties, it might be contentions to mark this as MEDIUM, but the attitude in this audit is to err on the false positive side.
565
-
566
-
567
-
568
-
569
- questions[question_id].bounty = questions[question_id].bounty.add(msg.value);
570
- emit LogFundAnswerBounty(question_id, msg.value, questions[question_id].bounty, msg.sender);
571
- ------------------
572
- _deductTokensOrRevert(tokens);
573
- questions[question_id].bounty = questions[question_id].bounty.add(tokens);
574
- emit LogFundAnswerBounty(question_id, tokens, questions[question_id].bounty, msg.sender);
575
-
576
-
577
- Accounting and then doing the same with bounty accounting as with normal eth,
578
- cannot really make something more wrong:
579
-
580
-
581
- Line 375:
582
- stateOpen(question_id)
583
- bondMustDouble(question_id, tokens)
584
- previousBondMustNotBeatMaxPrevious
585
- (question_id, max_previous)
586
- external {
587
- _deductTokensOrRevert(tokens);
588
- _addAnswerToHistory(question_id, answer,
589
- msg.sender, tokens, false);
590
- _updateCurrentAnswer(question_id, answer,
591
- questions[question_id].timeout);
592
- }
593
-
594
-
595
- Here also the accounting function is added and the payable removed, this is a pattern.
596
- Cannot introduce new problems.
597
-
598
-
599
- Line 408:
600
- function submitAnswerCommitmentERC20(bytes32 question_id, bytes32 answer_hash, uint256 max_previous, address _answerer, uint256 tokens)
601
- stateOpen(question_id)
602
- bondMustDouble(question_id, tokens)
603
- previousBondMustNotBeatMaxPrevious(question_id,
604
- max_previous)
605
- external {
606
-
607
-
608
- Seems to be the same as we have done until now.
609
- It’s isomorph and therefore can not introduce new problems.
610
- MEDIUM: correct `require` string
611
- https://github.com/realitio/realitio-contracts/blob/77f79aec8e2976c0cf44820ec9daf159991df832/truffle/contracts/RealitioERC20.sol#L344
612
-
613
-
614
- Replace `ETH` with `tokens` or similar
615
- require(bounty >= question_fee, "ETH provided must cover question fee");
616
- Verify how payments are made
617
- arbitration is still denominated and requested in ETH.
618
-
619
-
620
- Found to be true in code, as there is no change here
621
-
622
-
623
- per-question fee, which is deducted from the funds sent to the initial bounty set when a question is created, this is denominated in the token.
624
-
625
-
626
- Found to be true in the newly introduced helper method bounty or revert
627
-
628
-
629
- the Arbitrator contract now has a single additional function allowing its owner to withdraw ERC20 funds that it may have collected in the RealitioERC20 contract.
630
-
631
-
632
- /// @Withdraw any accumulated token fees to the specified address
633
- /// addr The address to which the balance should be sent
634
- /// Only needed if the Realitio contract used is using an ERC20 token
635
- /// Also only normally useful if a per-question fee is set, otherwise we only have ETH.
636
- function withdrawERC20(IERC20 _token, address addr)
637
- onlyOwner
638
- public {
639
- uint256 bal = _token.balanceOf(address(this));
640
- IERC20(_token).transfer(addr, bal);
641
- }
642
-
643
-
644
- So if the arbitrator address has tokens he can transfer it to a certain balance.
645
-
646
-
647
- Verify reentrancy protection against token
648
- the code is written with the intention that it wouldn't be subject to reentrancy bugs etc in the event that someone did use it with a maliciously coded token.
649
-
650
-
651
- This was always the case and did not change. Especially no state change happens after any transfer in the functions RealitionERC20.withdrawToRegisteredWalletERC20(), BalancHolder.withdraw().
652
- Verify execution isomorphism of previous changes
653
- And from Audit Clarification results:
654
-
655
-
656
- https://github.com/realitio/realitio-contracts/commit/5422046c510dc86ea1ede715b77d9a1673f5b72f
657
-
658
-
659
- https://github.com/realitio/realitio-contracts/commit/c64f28ce0c2d292fd2b0835ce8656e26e0d97c27
660
-
661
-
662
- These two changes are made to Realitio.sol that are intended to leave its behaviour unchanged, but make it easier to make the subsequent RealitioERC.sol version work with minimal changes. This is then cloned to RealitioERC20.sol and all the subsequent action is in RealitioERC20.sol, plus an extra function in Arbitrator.sol.
663
-
664
-
665
- This has been shown to be true!
666
- MINOR: different Solidity versions in sources
667
- Issuing cmd find in /truffle/contracts:
668
-
669
-
670
- find . -type f -exec grep "\^0.4" '{}' \; -print
671
-
672
-
673
- Shows that there are many different solidity versions employed. Can be unified. Note
674
- ./SplitterWallet.sol uses pragma solidity ^0.4.25;
675
-
676
-
677
- pragma solidity ^0.4.6;
678
- ./CallbackClient.sol
679
- pragma solidity ^0.4.24;
680
- ./IRealitio.sol
681
- pragma solidity ^0.4.24;
682
- ./Arbitrator.sol
683
- pragma solidity ^0.4.18;
684
- ./IBalanceHolder.sol
685
- pragma solidity ^0.4.6;
686
- ./ExplodingCallbackClient.sol
687
- pragma solidity ^0.4.24;
688
- ./RegisteredWalletArbitrator.sol
689
- pragma solidity ^0.4.2;
690
- ./Migrations.sol
691
- pragma solidity ^0.4.15;
692
- ./MultiSigWallet.sol
693
- pragma solidity ^0.4.24;
694
- ./Zeppelin.sol
695
- pragma solidity ^0.4.24;
696
- ./RealitioSafeMath32.sol
697
- pragma solidity ^0.4.24;
698
- ./RealitioSafeMath256.sol
699
- pragma solidity ^0.4.24;
700
- ./ERC20Token.sol
701
- pragma solidity ^0.4.24;
702
- ./RealitioERC20.sol
703
- pragma solidity ^0.4.18;
704
- ./Owned.sol
705
- pragma solidity ^0.4.24;
706
- ./Realitio.sol
707
- pragma solidity ^0.4.24;
708
- ./IERC20.sol
709
- pragma solidity ^0.4.25;
710
- ./SplitterWallet.sol
711
- pragma solidity ^0.4.18;
712
- ./BalanceHolder.sol
713
- pragma solidity ^0.4.18;
714
- ./BalanceHolderERC20.sol
715
-
716
-
717
- MINOR: there are two BalanceHolder contracts
718
- Both BalanceHolder.sol and BalanceHolderERC20.sol contain a contract named BalanceHolder. The name of a solidity file has no grammatical influence in the compilation process. Consider renaming BalanceHolder for ERC20 to BalanceHolderERC20, to explicitly express the desire to inherit from a specific contract.
719
-
720
-
721
- Results from Mythril
722
- docker run -v $(pwd):/tmp mythril/myth --solv 0.4.24 -x /tmp/RealitioERC20.sol
723
- Executing: wget https://github.com/ethereum/solidity/releases/download/v0.4.24/solc-static-linux -c -O /root/.py-solc/solc-v0.4.24/bin/solc
724
- Checking installed executable version @ /root/.py-solc/solc-v0.4.24/bin/solc
725
- Executing: /root/.py-solc/solc-v0.4.24/bin/solc --version
726
- solc successfully installed at: /root/.py-solc/solc-v0.4.24/bin/solc
727
-
728
-
729
- The analysis was completed successfully. No issues were detected.
730
-
731
-
732
- docker run -v $(pwd):/tmp mythril/myth --solv 0.4.24 -x /tmp/BalanceHolderERC20.sol
733
- [...]
734
- ==== External Call To Fixed Address ====
735
- SWC ID: 107
736
- Severity: Low
737
- Contract: BalanceHolder
738
- Function name: withdraw()
739
- PC address: 625
740
- Estimated Gas Usage: 7038 - 28314
741
- The contract executes an external message call.
742
- An external function call to a fixed contract address is executed. Make sure that the callee contract has been reviewed carefully.
743
- --------------------
744
- In file: /tmp/BalanceHolderERC20.sol:20
745
-
746
-
747
- token.transfer(msg.sender, bal)
748
-
749
-
750
- --------------------
751
-
752
-
753
- The Mythril advice is acknowledged by Realitio and consciously excluded from the audit.
754
- Each Token contract needs to be scrupulously examined as a new potential threat to the security of RealitoERC20.
755
-
756
-
757
- docker run -v $(pwd):/tmp mythril/myth --solv 0.4.24 -x /tmp/Arbitrator.sol
758
- The tool hangs and consumes all the computer resources. I cannot use the tool on Arbitrator.sol.
759
-
760
- Conclusions
761
- -----------
762
-
763
- By current standards of security audits and the best knowledge of the auditor the changes made in the Code under Audit do introduce 2 new potential security threats.
764
- 1. While benevolence of the token contracts are assumed, we can still improve the resilience of the code by checking the successful execution of a transfer: MEDIUM: do not suppose tokens are ER20 compliant. It might be contentions to mark this as MEDIUM, but the attitude in this audit is to err on the false positive side.
765
- 2. There is a documentation error in a `require` string. MEDIUM: correct `require` string. It might be contentions to mark this as MEDIUM, but the attitude in this audit is to err on the false positive side.
766
-
767
-
768
- Minor improvements can be made, consider renaming the BalanceHolder contract for ERC20 to BalanceHolderER20 to explicitly reflect the correct dependency and allow for grammatical checks.
769
- For the changes based on the audit, see also Abstract
770
-
771
-
772
- Roland Kofler Blockchain Consulting is honored to help the pioneering work of Realitio and WeTrust to change our world for the better. Please reach out to me personally any time.
773
-
774
-
775
- roland@ibc.technology
776
- roland.kofler@gmail.com
777
- +4915783430243
778
- Appendix
779
- List of commits since last audit
780
- This is the full assessment of the commits before and after CuA commits.
781
- The colors reflect the first inspection to identify potential problems.
782
-
783
-
784
- Count Description
785
- 30 CAN’T TOUCH CODE UNDER AUDIT
786
- 10 UNRISKY FOR CODE UNDER AUDIT
787
- 3 SOME RISK FOR CODE UNDER AUDIT
788
- Figure: subjective risk statistics for the changes until the audit.
789
-
790
-
791
- Commits on Jun 8, 2019
792
- * tidy, add tests of token balance handling
793
- * ed authored and ed committed 15 days ago
794
- * 77f79ae
795
- * Recompile with ERC20 version
796
- * ed authored and ed committed 15 days ago
797
- * 5c52bd9
798
- * Realitio ERC20 version uses ERC20 for everything except arbitration. … …
799
- * ed authored and ed committed 19 days ago
800
- * ec8db37
801
- Commits on Jun 4, 2019
802
- Add Zeppelin ERC20 interface, plus token contract for tests
803
- ed authored and ed committed 19 days ago
804
- 391af7b
805
- Start ERC20 version with exact copies of our original Realitio.sol co…
806
- ed authored and ed committed 17 days ago
807
- * 4959544
808
- * Remove bondMustBeZero modifier, which as auditor previously pointed o…
809
- * Edmund Edgar authored and ed committed on May 17
810
- * * Break the commitment timeout calculation and storage into its own int…
811
- * Edmund Edgar authored and ed committed on May 17
812
- * 5422046
813
- * ⭐CuA Merge branch 'master' of github.com:realitio/realitio-contracts
814
- ed authored and ed committed 15 days ago
815
- * e5ccb98
816
- * * Test updates: Test compiled code not sourcce code, update to python3 …
817
- * ed authored and ed committed 15 days ago
818
- * 83b4475
819
- Commits on May 28, 2019
820
- * Kleros integration is now ready for prime-time
821
- * Edmund Edgar committed 22 days ago
822
- * 72351a2
823
- * Kleros contract updates
824
- * Edmund Edgar committed 22 days ago
825
- * 771c443
826
- Commits on May 11, 2019
827
- * Update kleros contract addresses
828
- * Edmund Edgar committed on May 11
829
- * 5a8b298
830
- Commits on May 4, 2019
831
- * New kleros arbitrator addresses
832
- * Edmund Edgar committed on May 4
833
- * 477d01b
834
- Commits on Apr 10, 2019
835
- * updated kleros contract addresses, now with metaevidence
836
- * Edmund Edgar committed on Apr 10
837
- * f80e6ca
838
- Commits on Apr 2, 2019
839
- * Add Kleros arbitrator options
840
- * Edmund Edgar committed on Apr 2
841
- * 92cd12e
842
- Commits on Feb 13, 2019
843
- * Add kovan arbitrator setting
844
- * edmundedgar committed on Feb 13
845
- * 97b53b5
846
- * Add Kovan contracts
847
- * edmundedgar committed on Feb 13
848
- * f1a9aa5
849
- Commits on Nov 27, 2018
850
- * Move wrongly-placed contract json definitions
851
- * ed authored and ed committed on Nov 27, 2018
852
- * 6e8173a
853
- * Compiled contracts for a multi-sig arbitrator
854
- * ed authored and ed committed on Nov 27, 2018
855
- * 9b556f9
856
- * Delete MultiSigArbitratorController, we're instead using a combinatio… …
857
- * ed authored and ed committed on Nov 27, 2018
858
- * 3db1ce8
859
- Commits on Nov 17, 2018
860
- * Add Registered Wallet Arbitrator contract for use in arbitration cons… …
861
- * ed authored and ed committed on Nov 17, 2018
862
- Not part of contracts under audit
863
- * 0c2ee2a
864
- * Rename functions and rearrange to clarify how duplicate addresses are… …
865
- ed authored and ed committed on Nov 17, 2018
866
- Changes are isomorph.
867
- By definition isomorphic instructions will produce exactly the sameoutput
868
-
869
-
870
- * f75e802
871
- Commits on Nov 15, 2018
872
- * Test the worst case for gas usage (100 addresses, all new and differe… …
873
- * ed authored and ed committed on Nov 15, 2018
874
- * 7348310
875
- * Add gas test for max recipient limit
876
- * ed authored and ed committed on Nov 15, 2018
877
- * 7d2c999
878
- * Add require error message
879
- * ed authored and ed committed on Nov 15, 2018
880
- * d434d90
881
- * More tests
882
- * ed authored and ed committed on Nov 15, 2018
883
- * ab0ba0a
884
- * Add error messages to require statements
885
- * ed authored and ed committed on Nov 15, 2018
886
- * 80b82fa
887
- * improve comments
888
- * ed authored and ed committed on Nov 15, 2018
889
- * 09f851b
890
- * Add some asserts to make sure we never allocate more money than we ha… …
891
- * ed authored and ed committed on Nov 15, 2018
892
- * bd65641
893
- Commits on Nov 14, 2018
894
- * Tests for splitter wallet
895
- * ed authored and ed committed on Nov 14, 2018
896
- * 106a6ce
897
- * Rename
898
- * ed authored and ed committed on Nov 14, 2018
899
- * 7c863da
900
- * Delete old callback code tests: We didn't get that code audited, and … …
901
- * ed authored and ed committed on Nov 14, 2018
902
- * b55d054
903
- * Fix comment
904
- * ed authored and ed committed on Nov 14, 2018
905
- * a7a34a7
906
- * Multisig arbitration contracts for arbitration consortiums, based on … …
907
- * ed authored and ed committed on Nov 14, 2018
908
- * f633aea
909
- Commits on Nov 9, 2018
910
- * Bump minor version
911
- * Edmund Edgar committed on Nov 9, 2018
912
- * e1a07c5
913
- * Drop back one minor solc version, deployed with 0.4.25 but current tr… …
914
- * Edmund Edgar committed on Nov 9, 2018
915
- * b730748
916
- * Recent contracts need a higher gas limit, don't force the network id
917
- * Edmund Edgar committed on Nov 9, 2018
918
- * bd09d75
919
- Commits on Nov 2, 2018
920
- * Bump version
921
- * Edmund Edgar committed on Nov 2, 2018
922
- * 052af40
923
- * Allow later solidity versions
924
- * ed authored and ed committed on Nov 2, 2018
925
- * 0563976
926
- Commits on Oct 27, 2018
927
- * interface should also inherit interface
928
- * ed authored and ed committed on Oct 27, 2018
929
- * e222de7
930
- * Rename interface contracts as I...
931
- * ed authored and ed committed on Oct 27, 2018
932
- * 872c697
933
- Commits on Oct 26, 2018
934
- * bump version number
935
- * Edmund Edgar committed on Oct 26, 2018
936
- * bcbf35b
937
-
938
-
939
- Commits on Oct 20, 2018
940
- * bump version
941
- * Edmund Edgar committed on Oct 20, 2018
942
- * 033b61a
943
- * Redeploy ganache bootstrap contracts
944
- * ed authored and ed committed on Oct 20, 2018
945
- * 6aafc45
946
- * Rename contract name in migrations
947
- * ed authored and ed committed on Oct 20, 2018
948
- * 40ad612
949
- * Update and rationalize interface files
950
- * ed authored and ed committed on Oct 20, 2018
951
- * 390f2c9
952
- * Add ganache-bootstrap addresses
953
- * ed authored and ed committed on Oct 20, 2018
954
- * cbabddb
955
- * bump version
956
- * Edmund Edgar committed on Oct 20, 2018 8f762f8
957
- * correct mistaken network ID
958
- * Edmund Edgar committed on Oct 20, 2018
959
- * 81f36df
960
- * Newly-deployed contracts in config files
961
- * Edmund Edgar committed on Oct 20, 2018
962
- * b31e9d5
963
- Comparing the baseline with the new ERC20 contracts
964
- git checkout 49595443742afe1d8ae0495110a78d1cc780970e
965
- sdiff BalanceHolder.sol BalanceHolderERC20.sol
966
-
967
-
968
- pragma solidity ^0.4.18; pragma solidity ^0.4.18;
969
-
970
-
971
- contract BalanceHolder { contract BalanceHolder {
972
-
973
-
974
- mapping(address => uint256) public balanceOf; mapping(address => uint256) public balanceOf;
975
-
976
-
977
- event LogWithdraw( event LogWithdraw(
978
- address indexed user, address indexed user,
979
- uint256 amount uint256 amount
980
- ); );
981
-
982
-
983
- function withdraw() function withdraw()
984
- public { public {
985
- uint256 bal = balanceOf[msg.sender]; uint256 bal = balanceOf[msg.sender];
986
- balanceOf[msg.sender] = 0; balanceOf[msg.sender] = 0;
987
- msg.sender.transfer(bal); msg.sender.transfer(bal);
988
- emit LogWithdraw(msg.sender, bal); emit LogWithdraw(msg.sender, bal);
989
- } }
990
-
991
-
992
- } }
993
-
994
-
995
- No differences detected
996
-
997
-
998
- Now I only use `diff` for large files to output only differences:
999
-
1000
-
1001
- diff Arbitrator.sol ArbitratorERC20.sol
1002
- Output:
1003
- No differences detected
1004
-
1005
-
1006
- References
1007
- ----------
1008
-
1009
- Audit Brief
1010
- Email: “Realitio WeTrust integration audit”, Edmund Edgar <ed@socialminds.jp>, 8 June 2019 at 04:51, To: Roland <roland.kofler@gmail.com>, Cc: Hoang Nguyen <hoang@wetrust.io>
1011
-
1012
-
1013
- [...]
1014
- The audit consists of changes to 2 files, RealitioERC20.sol (changes from Realitio.sol) and Arbitrator.sol. I've also updated another auditor contract that i was working on, but it's not part of the scope of this audit.
1015
-
1016
-
1017
- The new version is in the branch feature-erc20-audit
1018
- https://github.com/realitio/realitio-contracts/tree/feature-erc20-audit
1019
-
1020
-
1021
- All the solidity code changes are in this commit:
1022
- https://github.com/realitio/realitio-contracts/commit/ec8db377d0ef74c5bf599894240f6b54db113338
1023
-
1024
-
1025
- The principle is that we will have one RealitioERC20 contract per supported token, and as currently one Arbitrator contract per arbitrator per RealitioERC20 contract. The token is set during initial setup and once set cannot be changed. All question rewards and bonds are denominated in that token.
1026
-
1027
-
1028
- As previously, arbitration is still denominated and requested in ETH.
1029
- If the arbitrator sets a per-question fee, which is deducted from the funds sent to the initial bounty set when a question is created, this is denominated in the token.
1030
- Accordingly, the Arbitrator contract now has a single additional function allowing its owner to withdraw ERC20 funds that it may have collected in the RealitioERC20 contract.
1031
-
1032
-
1033
- Since a RealitioERC20 contract only handles a single token, which cannot be changed after setup, users must implicitly trust that the token the contract is interacting with isn't hostile. That said, the code is written with the intention that it wouldn't be subject to reentrancy bugs etc in the event that someone did use it with a maliciously coded token.
1034
-
1035
-
1036
- I've updated the tests to use python3 and recent versions of the ever-changing python test stuff - unfortunately I haven't yet figured out how to adjust the block gas limit in my test code, and I don't want to keep everyone waiting while I do so if you want to run them you have to hack this file.
1037
- https://github.com/ethereum/eth-tester/blob/b9ad39a9ee8ef041d2ca2d2c2d1d1e28d3f36da9/eth_tester/backends/pyevm/main.py#L66
1038
- [...]
1039
- Audit Clarification
1040
- Email: 15 June 2019 at 22:33 From Edmund Edgar <ed@socialminds.jp>
1041
- To: Roland <roland.kofler@gmail.com> Subject: Realitio WeTrust integration audit
1042
-
1043
-
1044
- Yes, that chain of kleros commits should just be changes to the arbitrators list, and the kleros arbitration contract that's the subject of those changes (along with kleros itself) is out of scope. There shouldn't be any changes to the contracts in scope (Realitio.sol, duplicated to RealitioERC20.sol and Arbitrator.sol) until you get to:
1045
-
1046
-
1047
- https://github.com/realitio/realitio-contracts/commit/5422046c510dc86ea1ede715b77d9a1673f5b72f
1048
-
1049
-
1050
- https://github.com/realitio/realitio-contracts/commit/c64f28ce0c2d292fd2b0835ce8656e26e0d97c27
1051
-
1052
-
1053
- These two are changes made to Realitio.sol that are intended to leave its behaviour unchanged but make it easier to make the subsequent RealitioERC.sol version work with minimal changes. This is then cloned to RealitioERC20.sol and all the subsequent action is in RealitioERC20.sol, plus an extra function in Arbitrator.sol.
1054
-
1055
-
1056
- However it would be good if you could verify that what I just said is true, ie that Realitio.sol before the commits I mentioned matches the last thing you audited and I'm not trying to sneak another change past you.
1057
- [...]
1058
- Ethereum Safety
1059
- https://github.com/ethereum/wiki/wiki/Safety
1060
- ConsenSys Security Best Practices
1061
- ConsenSys Security Best Practice
1062
- https://consensys.github.io/smart-contract-best-practices/
1063
- DASP
1064
- Decentralised Application Security Project
1065
- https://dasp.co/
1066
- Known Solidity Bugs
1067
- https://solidity.readthedocs.io/en/v0.5.9/bugs.html
1068
- https://github.com/ethereum/solidity/blob/develop/docs/bugs_by_version.json
1069
-
1070
-
1071
-
1072
-
1073
-
1074
-
1075
- /