@gnosis-guild/zodiac 4.0.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 (356) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +141 -0
  3. package/contracts/core/GuardableModifier.sol +96 -0
  4. package/contracts/core/GuardableModule.sol +95 -0
  5. package/contracts/core/Modifier.sol +204 -0
  6. package/contracts/core/Module.sol +73 -0
  7. package/contracts/factory/FactoryFriendly.sol +10 -0
  8. package/contracts/factory/ModuleProxyFactory.sol +51 -0
  9. package/contracts/guard/BaseGuard.sol +36 -0
  10. package/contracts/guard/Guardable.sol +32 -0
  11. package/contracts/interfaces/IAvatar.sol +71 -0
  12. package/contracts/interfaces/IGuard.sol +22 -0
  13. package/contracts/signature/ExecutionTracker.sol +17 -0
  14. package/contracts/signature/IERC1271.sol +19 -0
  15. package/contracts/signature/SignatureChecker.sol +154 -0
  16. package/contracts/test/TestAvatar.sol +64 -0
  17. package/contracts/test/TestGuard.sol +82 -0
  18. package/contracts/test/TestGuardableModifier.sol +82 -0
  19. package/contracts/test/TestModifier.sol +88 -0
  20. package/contracts/test/TestModule.sol +66 -0
  21. package/contracts/test/TestSignature.sol +71 -0
  22. package/dist/cjs/abi/Bridge.json +382 -0
  23. package/dist/cjs/abi/CirculatingSupplyErc20.json +245 -0
  24. package/dist/cjs/abi/CirculatingSupplyErc721.json +245 -0
  25. package/dist/cjs/abi/Connext.json +493 -0
  26. package/dist/cjs/abi/Delay.json +728 -0
  27. package/dist/cjs/abi/Erc20Votes.json +797 -0
  28. package/dist/cjs/abi/Erc721Votes.json +792 -0
  29. package/dist/cjs/abi/ExitErc20.json +419 -0
  30. package/dist/cjs/abi/ExitErc721.json +419 -0
  31. package/dist/cjs/abi/MetaGuard.json +471 -0
  32. package/dist/cjs/abi/ModuleProxyFactory.json +77 -0
  33. package/dist/cjs/abi/MultisendEncoder.json +61 -0
  34. package/dist/cjs/abi/OptimisticGovernor.json +938 -0
  35. package/dist/cjs/abi/OzGovernor.json +706 -0
  36. package/dist/cjs/abi/Permissions.json +520 -0
  37. package/dist/cjs/abi/RealityErc20.json +871 -0
  38. package/dist/cjs/abi/RealityEth.json +871 -0
  39. package/dist/cjs/abi/RolesV1.json +990 -0
  40. package/dist/cjs/abi/RolesV2.json +1484 -0
  41. package/dist/cjs/abi/ScopeGuard.json +592 -0
  42. package/dist/cjs/abi/Tellor.json +978 -0
  43. package/dist/cjs/contracts.d.ts +61 -0
  44. package/dist/cjs/contracts.js +309 -0
  45. package/dist/cjs/factory/deployModuleFactory.d.ts +9 -0
  46. package/dist/cjs/factory/deployModuleFactory.js +44 -0
  47. package/dist/cjs/factory/index.d.ts +5 -0
  48. package/dist/cjs/factory/index.js +21 -0
  49. package/dist/cjs/factory/mastercopyDeployer.d.ts +27 -0
  50. package/dist/cjs/factory/mastercopyDeployer.js +97 -0
  51. package/dist/cjs/factory/moduleDeployer.d.ts +105 -0
  52. package/dist/cjs/factory/moduleDeployer.js +90 -0
  53. package/dist/cjs/factory/singletonFactory.d.ts +11 -0
  54. package/dist/cjs/factory/singletonFactory.js +39 -0
  55. package/dist/cjs/factory/types.d.ts +25 -0
  56. package/dist/cjs/factory/types.js +58 -0
  57. package/dist/cjs/index.d.ts +1 -0
  58. package/dist/cjs/index.js +17 -0
  59. package/dist/cjs/initData/Bridge.d.ts +2 -0
  60. package/dist/cjs/initData/Bridge.js +5 -0
  61. package/dist/cjs/initData/CirculatingSupplyErc20.d.ts +2 -0
  62. package/dist/cjs/initData/CirculatingSupplyErc20.js +5 -0
  63. package/dist/cjs/initData/CirculatingSupplyErc721.d.ts +2 -0
  64. package/dist/cjs/initData/CirculatingSupplyErc721.js +5 -0
  65. package/dist/cjs/initData/Connext.d.ts +2 -0
  66. package/dist/cjs/initData/Connext.js +5 -0
  67. package/dist/cjs/initData/Delay.d.ts +2 -0
  68. package/dist/cjs/initData/Delay.js +5 -0
  69. package/dist/cjs/initData/Erc20Votes.d.ts +2 -0
  70. package/dist/cjs/initData/Erc20Votes.js +5 -0
  71. package/dist/cjs/initData/Erc721Votes.d.ts +2 -0
  72. package/dist/cjs/initData/Erc721Votes.js +5 -0
  73. package/dist/cjs/initData/ExitErc20.d.ts +2 -0
  74. package/dist/cjs/initData/ExitErc20.js +5 -0
  75. package/dist/cjs/initData/ExitErc721.d.ts +2 -0
  76. package/dist/cjs/initData/ExitErc721.js +5 -0
  77. package/dist/cjs/initData/ModuleProxyFactory.d.ts +2 -0
  78. package/dist/cjs/initData/ModuleProxyFactory.js +5 -0
  79. package/dist/cjs/initData/MultisendEncoder.d.ts +2 -0
  80. package/dist/cjs/initData/MultisendEncoder.js +5 -0
  81. package/dist/cjs/initData/OzGovernor.d.ts +2 -0
  82. package/dist/cjs/initData/OzGovernor.js +5 -0
  83. package/dist/cjs/initData/Permissions.d.ts +2 -0
  84. package/dist/cjs/initData/Permissions.js +5 -0
  85. package/dist/cjs/initData/RealityErc20.d.ts +2 -0
  86. package/dist/cjs/initData/RealityErc20.js +5 -0
  87. package/dist/cjs/initData/RealityEth.d.ts +2 -0
  88. package/dist/cjs/initData/RealityEth.js +5 -0
  89. package/dist/cjs/initData/RolesV1.d.ts +2 -0
  90. package/dist/cjs/initData/RolesV1.js +5 -0
  91. package/dist/cjs/initData/RolesV2.d.ts +2 -0
  92. package/dist/cjs/initData/RolesV2.js +5 -0
  93. package/dist/cjs/initData/ScopeGuard.d.ts +2 -0
  94. package/dist/cjs/initData/ScopeGuard.js +5 -0
  95. package/dist/cjs/types/Bridge.d.ts +208 -0
  96. package/dist/cjs/types/Bridge.js +2 -0
  97. package/dist/cjs/types/CirculatingSupplyErc20.d.ts +158 -0
  98. package/dist/cjs/types/CirculatingSupplyErc20.js +2 -0
  99. package/dist/cjs/types/CirculatingSupplyErc721.d.ts +158 -0
  100. package/dist/cjs/types/CirculatingSupplyErc721.js +2 -0
  101. package/dist/cjs/types/Connext.d.ts +289 -0
  102. package/dist/cjs/types/Connext.js +2 -0
  103. package/dist/cjs/types/Delay.d.ts +407 -0
  104. package/dist/cjs/types/Delay.js +2 -0
  105. package/dist/cjs/types/Erc20Votes.d.ts +475 -0
  106. package/dist/cjs/types/Erc20Votes.js +2 -0
  107. package/dist/cjs/types/Erc721Votes.d.ts +455 -0
  108. package/dist/cjs/types/Erc721Votes.js +2 -0
  109. package/dist/cjs/types/ExitErc20.d.ts +238 -0
  110. package/dist/cjs/types/ExitErc20.js +2 -0
  111. package/dist/cjs/types/ExitErc721.d.ts +238 -0
  112. package/dist/cjs/types/ExitErc721.js +2 -0
  113. package/dist/cjs/types/MetaGuard.d.ts +274 -0
  114. package/dist/cjs/types/MetaGuard.js +2 -0
  115. package/dist/cjs/types/ModuleProxyFactory.d.ts +54 -0
  116. package/dist/cjs/types/ModuleProxyFactory.js +2 -0
  117. package/dist/cjs/types/MultisendEncoder.d.ts +59 -0
  118. package/dist/cjs/types/MultisendEncoder.js +2 -0
  119. package/dist/cjs/types/OptimisticGovernor.d.ts +547 -0
  120. package/dist/cjs/types/OptimisticGovernor.js +2 -0
  121. package/dist/cjs/types/OzGovernor.d.ts +645 -0
  122. package/dist/cjs/types/OzGovernor.js +2 -0
  123. package/dist/cjs/types/Permissions.d.ts +341 -0
  124. package/dist/cjs/types/Permissions.js +2 -0
  125. package/dist/cjs/types/RealityErc20.d.ts +471 -0
  126. package/dist/cjs/types/RealityErc20.js +2 -0
  127. package/dist/cjs/types/RealityEth.d.ts +471 -0
  128. package/dist/cjs/types/RealityEth.js +2 -0
  129. package/dist/cjs/types/RolesV1.d.ts +649 -0
  130. package/dist/cjs/types/RolesV1.js +2 -0
  131. package/dist/cjs/types/RolesV2.d.ts +908 -0
  132. package/dist/cjs/types/RolesV2.js +2 -0
  133. package/dist/cjs/types/ScopeGuard.d.ts +405 -0
  134. package/dist/cjs/types/ScopeGuard.js +2 -0
  135. package/dist/cjs/types/Tellor.d.ts +572 -0
  136. package/dist/cjs/types/Tellor.js +2 -0
  137. package/dist/cjs/types/Usul.d.ts +535 -0
  138. package/dist/cjs/types/Usul.js +2 -0
  139. package/dist/cjs/types/common.d.ts +50 -0
  140. package/dist/cjs/types/common.js +2 -0
  141. package/dist/cjs/types/factories/Bridge__factory.d.ts +303 -0
  142. package/dist/cjs/types/factories/Bridge__factory.js +399 -0
  143. package/dist/cjs/types/factories/CirculatingSupplyErc20__factory.d.ts +194 -0
  144. package/dist/cjs/types/factories/CirculatingSupplyErc20__factory.js +262 -0
  145. package/dist/cjs/types/factories/CirculatingSupplyErc721__factory.d.ts +194 -0
  146. package/dist/cjs/types/factories/CirculatingSupplyErc721__factory.js +262 -0
  147. package/dist/cjs/types/factories/Connext__factory.d.ts +389 -0
  148. package/dist/cjs/types/factories/Connext__factory.js +510 -0
  149. package/dist/cjs/types/factories/Delay__factory.d.ts +568 -0
  150. package/dist/cjs/types/factories/Delay__factory.js +745 -0
  151. package/dist/cjs/types/factories/Erc20Votes__factory.d.ts +619 -0
  152. package/dist/cjs/types/factories/Erc20Votes__factory.js +814 -0
  153. package/dist/cjs/types/factories/Erc721Votes__factory.d.ts +616 -0
  154. package/dist/cjs/types/factories/Erc721Votes__factory.js +809 -0
  155. package/dist/cjs/types/factories/ExitErc20__factory.d.ts +329 -0
  156. package/dist/cjs/types/factories/ExitErc20__factory.js +436 -0
  157. package/dist/cjs/types/factories/ExitErc721__factory.d.ts +329 -0
  158. package/dist/cjs/types/factories/ExitErc721__factory.js +436 -0
  159. package/dist/cjs/types/factories/MetaGuard__factory.d.ts +369 -0
  160. package/dist/cjs/types/factories/MetaGuard__factory.js +488 -0
  161. package/dist/cjs/types/factories/ModuleProxyFactory__factory.d.ts +64 -0
  162. package/dist/cjs/types/factories/ModuleProxyFactory__factory.js +94 -0
  163. package/dist/cjs/types/factories/MultisendEncoder__factory.d.ts +53 -0
  164. package/dist/cjs/types/factories/MultisendEncoder__factory.js +78 -0
  165. package/dist/cjs/types/factories/OptimisticGovernor__factory.d.ts +734 -0
  166. package/dist/cjs/types/factories/OptimisticGovernor__factory.js +955 -0
  167. package/dist/cjs/types/factories/OzGovernor__factory.d.ts +827 -0
  168. package/dist/cjs/types/factories/OzGovernor__factory.js +1080 -0
  169. package/dist/cjs/types/factories/Permissions__factory.d.ts +423 -0
  170. package/dist/cjs/types/factories/Permissions__factory.js +537 -0
  171. package/dist/cjs/types/factories/RealityErc20__factory.d.ts +680 -0
  172. package/dist/cjs/types/factories/RealityErc20__factory.js +888 -0
  173. package/dist/cjs/types/factories/RealityEth__factory.d.ts +680 -0
  174. package/dist/cjs/types/factories/RealityEth__factory.js +888 -0
  175. package/dist/cjs/types/factories/RolesV1__factory.d.ts +776 -0
  176. package/dist/cjs/types/factories/RolesV1__factory.js +1007 -0
  177. package/dist/cjs/types/factories/RolesV2__factory.d.ts +1156 -0
  178. package/dist/cjs/types/factories/RolesV2__factory.js +1501 -0
  179. package/dist/cjs/types/factories/ScopeGuard__factory.d.ts +463 -0
  180. package/dist/cjs/types/factories/ScopeGuard__factory.js +609 -0
  181. package/dist/cjs/types/factories/Tellor__factory.d.ts +757 -0
  182. package/dist/cjs/types/factories/Tellor__factory.js +995 -0
  183. package/dist/cjs/types/factories/Usul__factory.d.ts +634 -0
  184. package/dist/cjs/types/factories/Usul__factory.js +829 -0
  185. package/dist/cjs/types/factories/index.d.ts +22 -0
  186. package/dist/cjs/types/factories/index.js +50 -0
  187. package/dist/cjs/types/index.d.ts +45 -0
  188. package/dist/cjs/types/index.js +71 -0
  189. package/dist/esm/abi/Bridge.json +382 -0
  190. package/dist/esm/abi/CirculatingSupplyErc20.json +245 -0
  191. package/dist/esm/abi/CirculatingSupplyErc721.json +245 -0
  192. package/dist/esm/abi/Connext.json +493 -0
  193. package/dist/esm/abi/Delay.json +728 -0
  194. package/dist/esm/abi/Erc20Votes.json +797 -0
  195. package/dist/esm/abi/Erc721Votes.json +792 -0
  196. package/dist/esm/abi/ExitErc20.json +419 -0
  197. package/dist/esm/abi/ExitErc721.json +419 -0
  198. package/dist/esm/abi/MetaGuard.json +471 -0
  199. package/dist/esm/abi/ModuleProxyFactory.json +77 -0
  200. package/dist/esm/abi/MultisendEncoder.json +61 -0
  201. package/dist/esm/abi/OptimisticGovernor.json +938 -0
  202. package/dist/esm/abi/OzGovernor.json +706 -0
  203. package/dist/esm/abi/Permissions.json +520 -0
  204. package/dist/esm/abi/RealityErc20.json +871 -0
  205. package/dist/esm/abi/RealityEth.json +871 -0
  206. package/dist/esm/abi/RolesV1.json +990 -0
  207. package/dist/esm/abi/RolesV2.json +1484 -0
  208. package/dist/esm/abi/ScopeGuard.json +592 -0
  209. package/dist/esm/abi/Tellor.json +978 -0
  210. package/dist/esm/contracts.d.ts +61 -0
  211. package/dist/esm/contracts.js +280 -0
  212. package/dist/esm/factory/deployModuleFactory.d.ts +9 -0
  213. package/dist/esm/factory/deployModuleFactory.js +46 -0
  214. package/dist/esm/factory/index.d.ts +5 -0
  215. package/dist/esm/factory/index.js +5 -0
  216. package/dist/esm/factory/mastercopyDeployer.d.ts +27 -0
  217. package/dist/esm/factory/mastercopyDeployer.js +100 -0
  218. package/dist/esm/factory/moduleDeployer.d.ts +105 -0
  219. package/dist/esm/factory/moduleDeployer.js +91 -0
  220. package/dist/esm/factory/singletonFactory.d.ts +11 -0
  221. package/dist/esm/factory/singletonFactory.js +44 -0
  222. package/dist/esm/factory/types.d.ts +25 -0
  223. package/dist/esm/factory/types.js +55 -0
  224. package/dist/esm/index.d.ts +1 -0
  225. package/dist/esm/index.js +1 -0
  226. package/dist/esm/initData/Bridge.d.ts +2 -0
  227. package/dist/esm/initData/Bridge.js +2 -0
  228. package/dist/esm/initData/CirculatingSupplyErc20.d.ts +2 -0
  229. package/dist/esm/initData/CirculatingSupplyErc20.js +2 -0
  230. package/dist/esm/initData/CirculatingSupplyErc721.d.ts +2 -0
  231. package/dist/esm/initData/CirculatingSupplyErc721.js +2 -0
  232. package/dist/esm/initData/Connext.d.ts +2 -0
  233. package/dist/esm/initData/Connext.js +2 -0
  234. package/dist/esm/initData/Delay.d.ts +2 -0
  235. package/dist/esm/initData/Delay.js +2 -0
  236. package/dist/esm/initData/Erc20Votes.d.ts +2 -0
  237. package/dist/esm/initData/Erc20Votes.js +2 -0
  238. package/dist/esm/initData/Erc721Votes.d.ts +2 -0
  239. package/dist/esm/initData/Erc721Votes.js +2 -0
  240. package/dist/esm/initData/ExitErc20.d.ts +2 -0
  241. package/dist/esm/initData/ExitErc20.js +2 -0
  242. package/dist/esm/initData/ExitErc721.d.ts +2 -0
  243. package/dist/esm/initData/ExitErc721.js +2 -0
  244. package/dist/esm/initData/ModuleProxyFactory.d.ts +2 -0
  245. package/dist/esm/initData/ModuleProxyFactory.js +2 -0
  246. package/dist/esm/initData/MultisendEncoder.d.ts +2 -0
  247. package/dist/esm/initData/MultisendEncoder.js +2 -0
  248. package/dist/esm/initData/OzGovernor.d.ts +2 -0
  249. package/dist/esm/initData/OzGovernor.js +2 -0
  250. package/dist/esm/initData/Permissions.d.ts +2 -0
  251. package/dist/esm/initData/Permissions.js +2 -0
  252. package/dist/esm/initData/RealityErc20.d.ts +2 -0
  253. package/dist/esm/initData/RealityErc20.js +2 -0
  254. package/dist/esm/initData/RealityEth.d.ts +2 -0
  255. package/dist/esm/initData/RealityEth.js +2 -0
  256. package/dist/esm/initData/RolesV1.d.ts +2 -0
  257. package/dist/esm/initData/RolesV1.js +2 -0
  258. package/dist/esm/initData/RolesV2.d.ts +2 -0
  259. package/dist/esm/initData/RolesV2.js +2 -0
  260. package/dist/esm/initData/ScopeGuard.d.ts +2 -0
  261. package/dist/esm/initData/ScopeGuard.js +2 -0
  262. package/dist/esm/types/Bridge.d.ts +208 -0
  263. package/dist/esm/types/Bridge.js +1 -0
  264. package/dist/esm/types/CirculatingSupplyErc20.d.ts +158 -0
  265. package/dist/esm/types/CirculatingSupplyErc20.js +1 -0
  266. package/dist/esm/types/CirculatingSupplyErc721.d.ts +158 -0
  267. package/dist/esm/types/CirculatingSupplyErc721.js +1 -0
  268. package/dist/esm/types/Connext.d.ts +289 -0
  269. package/dist/esm/types/Connext.js +1 -0
  270. package/dist/esm/types/Delay.d.ts +407 -0
  271. package/dist/esm/types/Delay.js +1 -0
  272. package/dist/esm/types/Erc20Votes.d.ts +475 -0
  273. package/dist/esm/types/Erc20Votes.js +1 -0
  274. package/dist/esm/types/Erc721Votes.d.ts +455 -0
  275. package/dist/esm/types/Erc721Votes.js +1 -0
  276. package/dist/esm/types/ExitErc20.d.ts +238 -0
  277. package/dist/esm/types/ExitErc20.js +1 -0
  278. package/dist/esm/types/ExitErc721.d.ts +238 -0
  279. package/dist/esm/types/ExitErc721.js +1 -0
  280. package/dist/esm/types/MetaGuard.d.ts +274 -0
  281. package/dist/esm/types/MetaGuard.js +1 -0
  282. package/dist/esm/types/ModuleProxyFactory.d.ts +54 -0
  283. package/dist/esm/types/ModuleProxyFactory.js +1 -0
  284. package/dist/esm/types/MultisendEncoder.d.ts +59 -0
  285. package/dist/esm/types/MultisendEncoder.js +1 -0
  286. package/dist/esm/types/OptimisticGovernor.d.ts +547 -0
  287. package/dist/esm/types/OptimisticGovernor.js +1 -0
  288. package/dist/esm/types/OzGovernor.d.ts +645 -0
  289. package/dist/esm/types/OzGovernor.js +1 -0
  290. package/dist/esm/types/Permissions.d.ts +341 -0
  291. package/dist/esm/types/Permissions.js +1 -0
  292. package/dist/esm/types/RealityErc20.d.ts +471 -0
  293. package/dist/esm/types/RealityErc20.js +1 -0
  294. package/dist/esm/types/RealityEth.d.ts +471 -0
  295. package/dist/esm/types/RealityEth.js +1 -0
  296. package/dist/esm/types/RolesV1.d.ts +649 -0
  297. package/dist/esm/types/RolesV1.js +1 -0
  298. package/dist/esm/types/RolesV2.d.ts +908 -0
  299. package/dist/esm/types/RolesV2.js +1 -0
  300. package/dist/esm/types/ScopeGuard.d.ts +405 -0
  301. package/dist/esm/types/ScopeGuard.js +1 -0
  302. package/dist/esm/types/Tellor.d.ts +572 -0
  303. package/dist/esm/types/Tellor.js +1 -0
  304. package/dist/esm/types/Usul.d.ts +535 -0
  305. package/dist/esm/types/Usul.js +1 -0
  306. package/dist/esm/types/common.d.ts +50 -0
  307. package/dist/esm/types/common.js +1 -0
  308. package/dist/esm/types/factories/Bridge__factory.d.ts +303 -0
  309. package/dist/esm/types/factories/Bridge__factory.js +395 -0
  310. package/dist/esm/types/factories/CirculatingSupplyErc20__factory.d.ts +194 -0
  311. package/dist/esm/types/factories/CirculatingSupplyErc20__factory.js +258 -0
  312. package/dist/esm/types/factories/CirculatingSupplyErc721__factory.d.ts +194 -0
  313. package/dist/esm/types/factories/CirculatingSupplyErc721__factory.js +258 -0
  314. package/dist/esm/types/factories/Connext__factory.d.ts +389 -0
  315. package/dist/esm/types/factories/Connext__factory.js +506 -0
  316. package/dist/esm/types/factories/Delay__factory.d.ts +568 -0
  317. package/dist/esm/types/factories/Delay__factory.js +741 -0
  318. package/dist/esm/types/factories/Erc20Votes__factory.d.ts +619 -0
  319. package/dist/esm/types/factories/Erc20Votes__factory.js +810 -0
  320. package/dist/esm/types/factories/Erc721Votes__factory.d.ts +616 -0
  321. package/dist/esm/types/factories/Erc721Votes__factory.js +805 -0
  322. package/dist/esm/types/factories/ExitErc20__factory.d.ts +329 -0
  323. package/dist/esm/types/factories/ExitErc20__factory.js +432 -0
  324. package/dist/esm/types/factories/ExitErc721__factory.d.ts +329 -0
  325. package/dist/esm/types/factories/ExitErc721__factory.js +432 -0
  326. package/dist/esm/types/factories/MetaGuard__factory.d.ts +369 -0
  327. package/dist/esm/types/factories/MetaGuard__factory.js +484 -0
  328. package/dist/esm/types/factories/ModuleProxyFactory__factory.d.ts +64 -0
  329. package/dist/esm/types/factories/ModuleProxyFactory__factory.js +90 -0
  330. package/dist/esm/types/factories/MultisendEncoder__factory.d.ts +53 -0
  331. package/dist/esm/types/factories/MultisendEncoder__factory.js +74 -0
  332. package/dist/esm/types/factories/OptimisticGovernor__factory.d.ts +734 -0
  333. package/dist/esm/types/factories/OptimisticGovernor__factory.js +951 -0
  334. package/dist/esm/types/factories/OzGovernor__factory.d.ts +827 -0
  335. package/dist/esm/types/factories/OzGovernor__factory.js +1076 -0
  336. package/dist/esm/types/factories/Permissions__factory.d.ts +423 -0
  337. package/dist/esm/types/factories/Permissions__factory.js +533 -0
  338. package/dist/esm/types/factories/RealityErc20__factory.d.ts +680 -0
  339. package/dist/esm/types/factories/RealityErc20__factory.js +884 -0
  340. package/dist/esm/types/factories/RealityEth__factory.d.ts +680 -0
  341. package/dist/esm/types/factories/RealityEth__factory.js +884 -0
  342. package/dist/esm/types/factories/RolesV1__factory.d.ts +776 -0
  343. package/dist/esm/types/factories/RolesV1__factory.js +1003 -0
  344. package/dist/esm/types/factories/RolesV2__factory.d.ts +1156 -0
  345. package/dist/esm/types/factories/RolesV2__factory.js +1497 -0
  346. package/dist/esm/types/factories/ScopeGuard__factory.d.ts +463 -0
  347. package/dist/esm/types/factories/ScopeGuard__factory.js +605 -0
  348. package/dist/esm/types/factories/Tellor__factory.d.ts +757 -0
  349. package/dist/esm/types/factories/Tellor__factory.js +991 -0
  350. package/dist/esm/types/factories/Usul__factory.d.ts +634 -0
  351. package/dist/esm/types/factories/Usul__factory.js +825 -0
  352. package/dist/esm/types/factories/index.d.ts +22 -0
  353. package/dist/esm/types/factories/index.js +25 -0
  354. package/dist/esm/types/index.d.ts +45 -0
  355. package/dist/esm/types/index.js +24 -0
  356. package/package.json +98 -0
package/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # Zodiac: The expansion pack for DAOs
2
+
3
+ [![Build Status](https://github.com/gnosisguild/zodiac/workflows/zodiac/badge.svg?branch=master)](https://github.com/gnosisguild/zodiac/actions?branch=master)
4
+ [![Coverage Status](https://coveralls.io/repos/github/gnosis/zodiac/badge.svg?branch=master)](https://coveralls.io/github/gnosisguild/zodiac?branch=master)
5
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/gnosisguild/CODE_OF_CONDUCT)
6
+
7
+ A composable design philosophy for DAOs, [Zodiac](https://gnosisguild.mirror.xyz/OuhG5s2X5uSVBx1EK4tKPhnUc91Wh9YM0fwSnC8UNcg) is a collection of tools built according to an open standard.
8
+
9
+ ![Zodiac Icons](https://images.mirror-media.xyz/nft/c8c9031b-06b1-4344-baf2-c1d2d24cfc4f.png)
10
+
11
+ The Zodiac collection of tools can be accessed through the Zodiac App available on [Safe](https://safe.global/), as well as through the repositories below. If you have any questions about Zodiac, join the [Gnosis Guild Discord](https://discord.gnosisguild.org).
12
+
13
+ This repository links to technical tutorials on how to configure each using the CLI. (For operator tutorials, visit [zodiac.wiki](https://zodiac.wiki/index.php?title=Category:Documentation).)
14
+
15
+ Zodiac enables:
16
+
17
+ - Flexible, module-based control of programmable accounts
18
+ - Un-opinionated standards for programmable account interaction
19
+ - Reusable implementations of core and factory logic
20
+
21
+ The Zodiac open standard consists of Avatars, Modules, Modifiers, and Guards architecture:
22
+
23
+ **1. Avatars** are programmable Ethereum accounts, like [Safe](https://safe.global/). Avatars are the address that holds balances, owns systems, executes transaction, is referenced externally, and ultimately represents your DAO. Avatars must expose an interface like `IAvatar.sol`.
24
+
25
+ **2. Modules** are contracts enabled by an Avatar that implement some decision making logic. They should import `Module.sol`.
26
+
27
+ **3. Modifiers** are contracts that sit between Modules and Avatars to modify the Module's behavior. For example, they might enforce a delay on all functions a Module attempts to execute. Modifiers should import `Modifier.sol` and must expose an interface like `IAvatar.sol`
28
+
29
+ **4. Guards** are contracts that can be enabled on Modules and implement pre- or post-checks on each transaction that the Module executes. This allows Avatars to do things like limit the scope of addresses and functions that a module can call or ensure a certain state is never changed by a module. Guards should import `BaseGuard.sol`.
30
+
31
+ ## Overview
32
+
33
+ ### Installation
34
+
35
+ ```bash
36
+ yarn add @gnosis-guild/zodiac
37
+ ```
38
+
39
+ ### Usage
40
+
41
+ Once installed, you can use the contracts in the library by importing them to your contract:
42
+
43
+ ```solidity
44
+ pragma solidity ^0.8.6;
45
+
46
+ import "@gnosis-guild/zodiac/contracts/core/Module.sol";
47
+
48
+ contract MyModule is Module {
49
+ /// insert your code here
50
+ }
51
+
52
+ ```
53
+
54
+ ### Zodiac compliant tools
55
+
56
+ #### Avatars
57
+
58
+ - **[Safe](https://safe.global)**: The most trusted platform for managing digital assets on Ethereum. Zodiac embraces Safe as a powerful, extensible and programmable account standard. Safe is the reference implementation of the [IAvatar.sol](contracts/interfaces/IAvatar.sol) interface specified in this library. However, all Zodiac tools are framework agnostic, and they can be plugged into any programmable account that implements the IAvatar interface.
59
+
60
+ #### Modules
61
+
62
+ - **[Bridge](https://github.com/gnosisguild/zodiac-module-bridge)** (developed by [Gnosis Guild](https://twitter.com/gnosisguild)): This module allows an address on one chain to control an avatar on another chain using an Arbitrary Message Bridge (AMB). This enables a DAO on one chain to control assets and interact with systems like a Safe on a different chain.
63
+ - **[Exit](https://github.com/gnosisguild/zodiac-module-exit)** (developed by [Gnosis Guild](https://twitter.com/gnosisguild)): This module allows users to redeem a designated token for a relative share of an avatar's assets, similar to MolochDAO's infamous rageQuit() function.
64
+ - **[Governor](https://github.com/gnosisguild/zodiac-module-oz-governor/)** (Developed by [Gnosis Guild](https://twitter.com/gnosisguild)): An opinionated implementation of [OpenZeppelin's Governor contracts](https://docs.openzeppelin.com/contracts/4.x/api/governance) designed to be used in a Zodiac-style setup, allowing a Avatar (like a Safe) to controlled by on-chain governance similar to [Compound's Governor Alpha and Bravo](https://compound.finance/docs/governance).
65
+ - **[Optimistic Governor](https://docs.outcome.finance/optimistic-governance/what-is-the-optimistic-governor)** (developed by [Outcome Finance](https://www.outcome.finance/): This module allows on-chain executions based on Snapshot proposal results. The module utilizes UMA's optimistic oracle to govern a Safe based on a set of rules defined off-chain.
66
+ - **[Reality](https://github.com/gnosisguild/zodiac-module-reality)** (developed by [Gnosis Guild](https://twitter.com/gnosisguild)): This module allows on-chain execution based on the outcome of events reported by Reality.eth. While built initially to execute Safe transactions according to Snapshot proposals, this module is framework agnostic. It can enable proposal execution from just about anywhere. For example, it can bring Discord polls on-chain.
67
+ - **[Safe Minion](https://github.com/HausDAO/MinionSummonerV2/blob/main/contracts/SafeMinion.sol)** (developed by [DAOHaus](https://daohaus.club)): This module allows Moloch DAOs to manage the assets in a Safe based on the outcome of v2 Moloch DAO proposals. Safe Minion enables Moloch DAOs to manage collections of NFTs, manage LP positions with AMMs, and initiate any other arbitrary interactions. It enables DAOs that start as a Safe to later delegate governance to a Moloch DAO.
68
+ - **[Tellor](https://github.com/tellor-io/snapshot-zodiac-module)** (developed by [Tellor](https://tellor.io)): This module allows on-chain executions based on Snapshot proposal results, it uses the Tellor oracle to retrieve the data in a secure and decentralized manner.
69
+ - **[Usul](https://github.com/SekerDAO/Usul)** (developed by [SekerDAO](https://github.com/SekerDAO)): This module allows avatars to operate with trustless tokenized DeGov, similar to Compound or Gitcoin, with a time-boxed proposal core that can register swappable voting contracts. This enables DAOs to choose from various on-chain voting methods that best suit their needs.
70
+
71
+ #### Modifiers
72
+
73
+ - **[Delay](https://github.com/gnosisguild/zodiac-modifier-delay)** (developed by [Gnosis Guild](https://twitter.com/gnosisguild)): This modifier allows avatars to enforce a time delay between when a module initiates a transaction and when it will be executed by an avatar.
74
+ - **[Roles](https://github.com/gnosisguild/zodiac-modifier-roles)** (developed by [Gnosis Guild](https://twitter.com/gnosisguild)): This modifier allows for fine-grained, role-based, access control for enabled modules. Scopes for a given role include allowed addresses, and optionally include allowed functions on allowed addresses, allowed parameters on allowed functions, whether or not delegate calls are allowed to an allowed address, and whether or not value (ETH) can be sent to an allowed address.
75
+
76
+ #### Guards
77
+
78
+ - **[Meta](https://github.com/cardstack/cardstack-meta-guard)** (developed by [Cardstack](https://twitter.com/cardstack)): This guard allows an avatar to have multiple checking processes by registering multiple guards to this meta guard.
79
+ - **[Scope](https://github.com/gnosisguild/zodiac-guard-scope)** (developed by [Gnosis Guild](https://twitter.com/gnosisguild)): This guard allows an avatar to limit the scope of the addressable functions with which its owners can interact. This enables the avatar to define granular permissions for different control mechanisms.
80
+
81
+ ## Support and Contributions
82
+
83
+ Have you built something cool that belongs in this collection of Zodiac tools and want to add it to the list? Follow our [contribution guidelines](/CONTRIBUTING.md) to open a PR!
84
+
85
+ If you have any questions about Zodiac, join the [Gnosis Guild Discord](https://discord.gnosisguild.org/). Follow [@GnosisGuild](https://twitter.com/gnosisguild) on Twitter for updates.
86
+
87
+ The [Zodiac documentation](https://github.com/gnosisguild/zodiac) offers tutorials on how to use the Zodiac App, and detailed developer resources on how to build your own Zodiac module, modifier, or guard will be available soon.
88
+
89
+ ### Zodiac Banners and Badges
90
+
91
+ Show your support for Zodiac by adding a badge or banner to your website or repository. Check out the preview images below, and select your preferred design for download. Please wrap the image with a hyperlink to [Zodiac](https://github.com/gnosisguild/zodiac).
92
+
93
+ NOTE: To guarantee the most current design, copy the image URL and use the hosted version for embedding on your platform.
94
+
95
+ Your support through these badges and banners is greatly appreciated!
96
+
97
+ **Banners**
98
+
99
+ ![White on Black Banner](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-banner-black-white.svg)
100
+ ![Black on White Banner](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-banner-white-black.svg)
101
+
102
+ ![Light Gradient Banner](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-banner-gradient-light.svg)
103
+ ![Dark Gradient Banner](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-banner-gradient-dark.svg)
104
+
105
+ **Badges**
106
+
107
+ ![White on Black Badge](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-badge-black-white.svg)
108
+ ![Black on White Badge](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-badge-white-black.svg)
109
+ ![Light Gradient Badge](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-badge-gradient-light.svg)
110
+ ![Dark Gradient Badge](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-badge-gradient-dark.svg)
111
+
112
+ **Copy and paste markdown** (for README's)
113
+ These snippets will render an image that links to this github repo.
114
+
115
+ [![White on black banner](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-badge-black-white.svg)](https://github.com/gnosisguild/zodiac)
116
+
117
+ ```
118
+ [![White on black banner](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-badge-black-white.svg)](https://github.com/gnosisguild/zodiac)
119
+ ```
120
+
121
+ [![Black on White Banner](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-banner-white-black.svg)](https://github.com/gnosisguild/zodiac)
122
+
123
+ ```
124
+ [![Black on White Banner](https://raw.githubusercontent.com/gnosisguild/zodiac/master/branding/zodiac-banner-white-black.svg)](https://github.com/gnosisguild/zodiac)
125
+ ```
126
+
127
+ ### Audits
128
+
129
+ Zodiac has been audited by the [G0 group](https://github.com/g0-group).
130
+
131
+ All issues and notes of the audit have been addressed in the release candidate [v0.1.0](https://github.com/gnosisguild/zodiac/releases/tag/v0.1.0) with commit hash [8a77e7b224af8004bd9f2ff4e2919642e93ffd85](https://github.com/gnosisguild/zodiac/commit/8a77e7b224af8004bd9f2ff4e2919642e93ffd85) and the subsequent release [v1.0.0](https://github.com/gnosisguild/zodiac/releases/tag/v1.0.0).
132
+
133
+ The audit results are available as a pdf [in this repo](./audits/GnosisZodiac2021Sep.pdf) or in the [g0-group's github repo](https://github.com/g0-group/Audits/blob/master/GnosisZodiac2021Sep.pdf).
134
+
135
+ ### Security and Liability
136
+
137
+ All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
138
+
139
+ ### License
140
+
141
+ Zodiac is created under the [LGPL-3.0+ license](LICENSE).
@@ -0,0 +1,96 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ pragma solidity >=0.7.0 <0.9.0;
3
+
4
+ import {Enum} from "@gnosis.pm/safe-contracts/contracts/common/Enum.sol";
5
+
6
+ import {Guardable} from "../guard/Guardable.sol";
7
+ import {IAvatar} from "../interfaces/IAvatar.sol";
8
+ import {IGuard} from "../interfaces/IGuard.sol";
9
+ import {Modifier} from "./Modifier.sol";
10
+ import {Module} from "./Module.sol";
11
+
12
+ abstract contract GuardableModifier is Module, Guardable, Modifier {
13
+ /// @dev Passes a transaction to be executed by the avatar.
14
+ /// @notice Can only be called by this contract.
15
+ /// @param to Destination address of module transaction.
16
+ /// @param value Ether value of module transaction.
17
+ /// @param data Data payload of module transaction.
18
+ /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.
19
+ function exec(
20
+ address to,
21
+ uint256 value,
22
+ bytes memory data,
23
+ Enum.Operation operation
24
+ ) internal virtual override returns (bool success) {
25
+ address currentGuard = guard;
26
+ if (currentGuard != address(0)) {
27
+ IGuard(currentGuard).checkTransaction(
28
+ /// Transaction info used by module transactions.
29
+ to,
30
+ value,
31
+ data,
32
+ operation,
33
+ /// Zero out the redundant transaction information only used for Safe multisig transctions.
34
+ 0,
35
+ 0,
36
+ 0,
37
+ address(0),
38
+ payable(0),
39
+ "",
40
+ sentOrSignedByModule()
41
+ );
42
+ }
43
+ success = IAvatar(target).execTransactionFromModule(
44
+ to,
45
+ value,
46
+ data,
47
+ operation
48
+ );
49
+ if (currentGuard != address(0)) {
50
+ IGuard(currentGuard).checkAfterExecution(bytes32(0), success);
51
+ }
52
+ }
53
+
54
+ /// @dev Passes a transaction to be executed by the target and returns data.
55
+ /// @notice Can only be called by this contract.
56
+ /// @param to Destination address of module transaction.
57
+ /// @param value Ether value of module transaction.
58
+ /// @param data Data payload of module transaction.
59
+ /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.
60
+ function execAndReturnData(
61
+ address to,
62
+ uint256 value,
63
+ bytes memory data,
64
+ Enum.Operation operation
65
+ ) internal virtual override returns (bool success, bytes memory returnData) {
66
+ address currentGuard = guard;
67
+ if (currentGuard != address(0)) {
68
+ IGuard(currentGuard).checkTransaction(
69
+ /// Transaction info used by module transactions.
70
+ to,
71
+ value,
72
+ data,
73
+ operation,
74
+ /// Zero out the redundant transaction information only used for Safe multisig transctions.
75
+ 0,
76
+ 0,
77
+ 0,
78
+ address(0),
79
+ payable(0),
80
+ "",
81
+ sentOrSignedByModule()
82
+ );
83
+ }
84
+
85
+ (success, returnData) = IAvatar(target).execTransactionFromModuleReturnData(
86
+ to,
87
+ value,
88
+ data,
89
+ operation
90
+ );
91
+
92
+ if (currentGuard != address(0)) {
93
+ IGuard(currentGuard).checkAfterExecution(bytes32(0), success);
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,95 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ pragma solidity >=0.7.0 <0.9.0;
3
+
4
+ import {Enum} from "@gnosis.pm/safe-contracts/contracts/common/Enum.sol";
5
+ import {IGuard} from "../interfaces/IGuard.sol";
6
+ import {Guardable} from "../guard/Guardable.sol";
7
+ import {Module} from "./Module.sol";
8
+ import {IAvatar} from "../interfaces/IAvatar.sol";
9
+
10
+ /// @title GuardableModule - A contract that can pass messages to a Module Manager contract if enabled by that contract.
11
+ abstract contract GuardableModule is Module, Guardable {
12
+ /// @dev Passes a transaction to be executed by the avatar.
13
+ /// @notice Can only be called by this contract.
14
+ /// @param to Destination address of module transaction.
15
+ /// @param value Ether value of module transaction.
16
+ /// @param data Data payload of module transaction.
17
+ /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.
18
+ function exec(
19
+ address to,
20
+ uint256 value,
21
+ bytes memory data,
22
+ Enum.Operation operation
23
+ ) internal override returns (bool success) {
24
+ address currentGuard = guard;
25
+ if (currentGuard != address(0)) {
26
+ IGuard(currentGuard).checkTransaction(
27
+ /// Transaction info used by module transactions.
28
+ to,
29
+ value,
30
+ data,
31
+ operation,
32
+ /// Zero out the redundant transaction information only used for Safe multisig transctions.
33
+ 0,
34
+ 0,
35
+ 0,
36
+ address(0),
37
+ payable(0),
38
+ "",
39
+ msg.sender
40
+ );
41
+ }
42
+ success = IAvatar(target).execTransactionFromModule(
43
+ to,
44
+ value,
45
+ data,
46
+ operation
47
+ );
48
+ if (currentGuard != address(0)) {
49
+ IGuard(currentGuard).checkAfterExecution(bytes32(0), success);
50
+ }
51
+ }
52
+
53
+ /// @dev Passes a transaction to be executed by the target and returns data.
54
+ /// @notice Can only be called by this contract.
55
+ /// @param to Destination address of module transaction.
56
+ /// @param value Ether value of module transaction.
57
+ /// @param data Data payload of module transaction.
58
+ /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.
59
+ function execAndReturnData(
60
+ address to,
61
+ uint256 value,
62
+ bytes memory data,
63
+ Enum.Operation operation
64
+ ) internal virtual override returns (bool success, bytes memory returnData) {
65
+ address currentGuard = guard;
66
+ if (currentGuard != address(0)) {
67
+ IGuard(currentGuard).checkTransaction(
68
+ /// Transaction info used by module transactions.
69
+ to,
70
+ value,
71
+ data,
72
+ operation,
73
+ /// Zero out the redundant transaction information only used for Safe multisig transctions.
74
+ 0,
75
+ 0,
76
+ 0,
77
+ address(0),
78
+ payable(0),
79
+ "",
80
+ msg.sender
81
+ );
82
+ }
83
+
84
+ (success, returnData) = IAvatar(target).execTransactionFromModuleReturnData(
85
+ to,
86
+ value,
87
+ data,
88
+ operation
89
+ );
90
+
91
+ if (currentGuard != address(0)) {
92
+ IGuard(currentGuard).checkAfterExecution(bytes32(0), success);
93
+ }
94
+ }
95
+ }