ETH Price: $1,948.35 (-1.77%)

Transaction Decoder

Block:
24349986 at Jan-30-2026 08:11:11 PM +UTC
Transaction Fee:
0.005979984401762488 ETH $11.65
Gas Used:
5,926,661 Gas / 1.008997208 Gwei

Emitted Events:

174 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 98c327d19dd5cf4af4225e9fcf377331c1bed35792ea695014d71b3ea8b78e98, 76d565728d484a28f10079ac348c3e9900000000000000000000000000000000 )
175 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, abbba5dff743d239fd02ff5e25a5e3140f052bb12a855c625a8a0d90a7f0d02e, e9711fe0853c994cdca59c8713e23afa00000000000000000000000000000000 )
176 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a03b8450cc59d2a80652e059f0748ee3a8237b945c238472c2a62c20cf287168, 612696a223610ec5b2f6951e91db217b00000000000000000000000000000000 )
177 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a06f7a804f1c08058f8a4a9b3e22adfd3eef6f8e1a8a0eebcf0af7fc5ca12b47, 19efc89da144e5934dd903e2ac38a48200000000000000000000000000000000 )
178 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 85c593c64618529bc5111ea3f69d08105dc57e43d8aa7fad1e9c8db0235de3e3, 712ee3a5ac4653104ed0cc604c39324f00000000000000000000000000000000 )
179 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, b33fbadd42b1eb46858ee6882b2c090bd952f277cac0cc3aa7af8daf71891368, e7bc93962fb9bad7e82d91b6609cb5ea00000000000000000000000000000000 )
180 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 8a190eb9e126a89a93192f4aa6625996a528276481e903b04361f35d9f9bc2af, f6de21bb8fe288ab786145d1be40dbcb00000000000000000000000000000000 )
181 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 8b055fd070b08512e08dc392aee7fd0c97360af031b9c42524b985d61455f7d9, 5561126f7804b2605c369f5dd14f616200000000000000000000000000000000 )
182 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 97e24460cc102b3bdd3311b4b7ffa7e1678940c645d5e3ad1fa6e95309c7987e, 6a3c75fc42c0c447d660a0eea7d3f1ff00000000000000000000000000000000 )
183 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 881e1c01a68d030036e2d5a0e936d0910518c5005e9ae3981b71e6e4e6fece92, 6ed24d6a2355288de684617754ee524400000000000000000000000000000000 )
184 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, aeacfdf695fb900323c638c30fef9311f2271bfcea32cdab7cf97d6b0ad59af6, 5301e972fba15dcbbc3ee4c8f1a3a19c00000000000000000000000000000000 )
185 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a0a6cc30a43ee91f88ce20660012b2ec9e40f9829a1a349da48558afa9484ccf, 18366942fe25a9a4dd52b0570b6f8dd200000000000000000000000000000000 )
186 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 838dbf0cdc013c9e93b435ded55bf4e9d42eb57c980a40fda3b6d43e96f9e61d, 37873c23e8ac63bc17f51ef564e83a4700000000000000000000000000000000 )
187 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a741ca85ebfe85a292b75fac01368a6c501448e29fe79bf936f78f1a7a7f326a, 36346bccc767dbb50ea5276bde8f774f00000000000000000000000000000000 )
188 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 991646d43277d7e5832176eec90233334b8720fc2288c16f6de582fdcb788405, e1b86c655a9d4cc4f8ae3f02e31174a300000000000000000000000000000000 )
189 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 9806d438af15b96f4fd050af9c9203381bd5b1bd385e323393666a8e1b0b10a7, 751c5de1d1303fea866965b4257b009900000000000000000000000000000000 )
190 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, b445dccb605d6d00bfb21720a364571c15fa84065a39f301e9df09f203c29437, 93a858b4b3aea7fe2b2971344b2e6c5e00000000000000000000000000000000 )
191 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, b26499578f49e048a40290b040213ef6d64241b526e69030d3682a62856428e5, ca71481b7455d0c28536dbef4bba991e00000000000000000000000000000000 )
192 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 9348cbd034c7d7d54e3bd5a2dafd99d1d4414ea0c716982cf3f7f3a71fb76b24, d91aae86fcabfb218d5ced6d46c6cc7500000000000000000000000000000000 )
193 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, ab938c4637f0b8071c82c1828386f2c646d4f76bf6bfcd1ea9f94468df46f025, 6b6bebb3bdfd72f07abb7d16ab2eb53800000000000000000000000000000000 )
194 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 8ddbc54fbaf13ebbf37e1710049c141642b36fd6622140407bdcb09e5d87d578, 2ac48acc1ecb7e381ddace1a9c4425f300000000000000000000000000000000 )
195 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 83a578cab7dff55354a8659fba3287f3f7b78f14a036bd5f3b3ecd19d0cb58b2, c73dd0ae0efc8705c5d749ef1074335800000000000000000000000000000000 )
196 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 8260ea6b870acaa3a02e9f086226139e23af6a26e1699dc0071e12973edb3420, fecaf6cabc05fd62ba265dfcdccad92700000000000000000000000000000000 )
197 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 832cb7f2d54a33d25d5d69a5a9c6a0fd2143b48b17a1ab5156ba8e47fb63fdda, 18a05c5f20ac7278b2909e5c6e80496900000000000000000000000000000000 )
198 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 8a5db03506dff8f0d77a13ae24504c4243d614ed5b37ff8c04c4663b79e68c2b, 9c3805d458ab2284fe10020a4f21d15e00000000000000000000000000000000 )
199 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, b3689252acbaa1c27dfb08f1a1e62d21cbe6360f872a2e51cce7416682592777, 720b322d7d014c072b2f491e1852632b00000000000000000000000000000000 )
200 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a41faa86fe8e95cda16b0d8073cd10b3c22b88ec72350b51592501584d029db1, 370f570cf40f63c150382dd8544c13cd00000000000000000000000000000000 )
201 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, b1c063d9a22a80f631bea70210b31f5b6085fdcce13bf0e42c6eb854f7e66295, e9c2e87886ca69d12c004dbc087d931b00000000000000000000000000000000 )
202 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 80914163facd8babd13b9980c8ce976b4ba6ae464b933c7ff5383a0fcbd08d47, c7183add13658d80e70e1a9599787d8c00000000000000000000000000000000 )
203 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 8ecfbdd5e28a16ab3101d13839f5894713e67e4b20229e4cd7a45027f8f9a8d5, 261ee69508b64924968a66eb2536a78d00000000000000000000000000000000 )
204 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 81722383d984b05e7317d6206168536f2d34f8b51b397a667e4b2d08c84e8304, 2a0cacaa808dc098550d5b8dbe3a66dc00000000000000000000000000000000 )
205 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a44286c3e632fb9e38fc505836aa323c41e866a68d23e29a9ec96c6d85543c53, 9b45ff59aa581ae38d1fb80a93af56af00000000000000000000000000000000 )
206 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a2ef0ef10b85392612ed1885c2f1bdbd2da939d1d93da8e71e16dfa74c3a1f4b, 22258ad65b135aba3e44f18e3a4ed3cd00000000000000000000000000000000 )
207 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, b03697441c241743fff2e39ed1812bebb18a41dbc26cd0d987b3c75c3bc66c6a, ab4c2e10d3bd9ab1d648d625acdea32900000000000000000000000000000000 )
208 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a0623cab26356ac1c63fd0d1dc14d4a802a36dcef61edb42e859c24a4f7966ed, 7f8a7a84f8bd4e8632e6c6d851f726d600000000000000000000000000000000 )
209 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a1ea03f4f6b34376f6ac2f7463dca3f1d29059973c08793036adfa7d1b5cdd79, 1f22814096fa2f98905b1100a9811f6e00000000000000000000000000000000 )
210 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a690bf5dd2db8dd7dc2dd750581e18cdc4aa8fc996f6c2809557b31e46c77223, 7f79794e7a6f8c4d7bc3f5ccee02af2500000000000000000000000000000000 )
211 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, ab1ae7624096818863ec8d596b1369b9b698abba0b520e10e9bb0469df679400, 47e9315d78adf5a63ceed6b98830733400000000000000000000000000000000 )
212 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a38c893d9d822a2e1c40352afe2197788899123565fd13f8adc0e7a12fe1a57f, 80e266056c629c8261e9c879cda9094800000000000000000000000000000000 )
213 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a112ebf00b04f75693545dd7d24ded6c5fe3edc1baa25b62b49097f800f0bda3, c5df3f94b65d4d251607ce96d7e4a4c100000000000000000000000000000000 )
214 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a14b0c90b14bace6f8d2c10250b9a9ac755ba78a36c1afb97419e00fff017509, abad3c62ee13437b5f5136c1b794fd2a00000000000000000000000000000000 )
215 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a70e9f308ca1b2e7c06aaa1e6e96fb3a99269fb011d3501deb088ae42afea14e, d0545523b1c3ef4be40932ee0941b66e00000000000000000000000000000000 )
216 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a4c56aefa4899ec26737bad468e3428768b33cd084cd46d0753464e49a870578, 677b7300c913a7c3e30c34e58a1ea25d00000000000000000000000000000000 )
217 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a9f5ac521e1aab9b2c2af52cf9cd83fc5a7a62971047bd2180196c8cccc00bda, 9ec0e1be9bb67e4df0c053f2b1de5c3400000000000000000000000000000000 )
218 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 938a0ae556f9eb37948d61f1c66b6ada284af5b35716becd0617813efd175109, f40a483defb6532e56bf99594ec3d12500000000000000000000000000000000 )
219 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, b12fa5c3ea3b3e2b64f233d38bc5fb23555c07412d8370049d671379f82f1b7c, f9dc99250122400c5066c969856e896700000000000000000000000000000000 )
220 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, 8206a25d879d65f4a9c1f91fa3d103d8ab566756d33ff0ba8de00a03f649fd65, c015589eec08fc1138bb2b8b4410b84200000000000000000000000000000000 )
221 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, b192070757a9b3010f2f26d0ed20078a9f424929410c6349675b5b95739ceddf, 44af54ae2c156baa755c7b3e0c36e24400000000000000000000000000000000 )
222 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, a271ea61c8f57119b1568507a35f8ab3f6677b116463aaff8b68fb7647d9f6f8, 78a6b28a2f9c2a64d1ce83131cb2160e00000000000000000000000000000000 )
223 AppProxyUpgradeable.0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89( 0xc77a17d6b857abe6d6e6c37301621bc72c4dd52fa8830fb54dfa715c04911a89, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000000020, 0000000000000000000000000000000000000000000000000000000000000030, b62381a88e56cc53168058c84d40e51d4f6551ece9f0c114a59019b75e836cf5, 57232f84578bf7cd4362f773719c33f900000000000000000000000000000000 )
224 AppProxyUpgradeable.0xdd01838a366ae4dc9a86e1922512c0716abebc9a440baae0e22d2dec578223f0( 0xdd01838a366ae4dc9a86e1922512c0716abebc9a440baae0e22d2dec578223f0, 0x0000000000000000000000000000000000000000000000000000000000000012, 0000000000000000000000000000000000000000000000000000000000002e4a )
225 AppProxyUpgradeable.0xfb992daec9d46d64898e3a9336d02811349df6cbea8b95d4deb2fa6c7b454f0d( 0xfb992daec9d46d64898e3a9336d02811349df6cbea8b95d4deb2fa6c7b454f0d, 000000000000000000000000000000000000000000000000000000000000449f )
226 AppProxyUpgradeable.0x7220970e1f1f12864ecccd8942690a837c7a8dd45d158cb891eb45a8a69134aa( 0x7220970e1f1f12864ecccd8942690a837c7a8dd45d158cb891eb45a8a69134aa, 000000000000000000000000000000000000000000000000000000000000449f )
227 GnosisSafeProxy.0x442e715f626346e8c54381002da614f62bee8d27386535b2521ec8540898556e( 0x442e715f626346e8c54381002da614f62bee8d27386535b2521ec8540898556e, 30f5c8be0fd36e562f6e93178d9c581d5f66a5a10d095bd3b2e314e6a3757330, 0000000000000000000000000000000000000000000000000000000000000000 )

Account State Difference:

  Address   Before After State Difference Code
0x2B1D879B...8E2F18a42
0.406009151952725078 Eth
Nonce: 295
0.40002916755096259 Eth
Nonce: 296
0.005979984401762488
0x55032650...Af2e028d5
(Lido: Curated Staking Module)
0x77d2CF58...4383193BF
(Stakely: Lido Node Operator)
(BuilderNet)
59.818511686802076887 Eth59.819505028475731724 Eth0.000993341673654837

Execution Trace

GnosisSafeProxy.6a761202( )
  • GnosisSafe.execTransaction( to=0x55032650b14df07b85bF18A3a3eC8E0Af2e028d5, value=0, data=0x805911AE0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000A00000000000000000000000000000000000000000000000000000000000000096098C327D19DD5CF4AF4225E9FCF377331C1BED35792EA695014D71B3EA8B78E9876D565728D484A28F10079AC348C3E99ABBBA5DFF743D239FD02FF5E25A5E3140F052BB12A855C625A8A0D90A7F0D02EE9711FE0853C994CDCA59C8713E23AFAA03B8450CC59D2A80652E059F0748EE3A8237B945C238472C2A62C20CF287168612696A223610EC5B2F6951E91DB217BA06F7A804F1C08058F8A4A9B3E22ADFD3EEF6F8E1A8A0EEBCF0AF7FC5CA12B4719EFC89DA144E5934DD903E2AC38A48285C593C64618529BC5111EA3F69D08105DC57E43D8AA7FAD1E9C8DB0235DE3E3712EE3A5AC4653104ED0CC604C39324FB33FBADD42B1EB46858EE6882B2C090BD952F277CAC0CC3AA7AF8DAF71891368E7BC93962FB9BAD7E82D91B6609CB5EA8A190EB9E126A89A93192F4AA6625996A528276481E903B04361F35D9F9BC2AFF6DE21BB8FE288AB786145D1BE40DBCB8B055FD070B08512E08DC392AEE7FD0C97360AF031B9C42524B985D61455F7D95561126F7804B2605C369F5DD14F616297E24460CC102B3BDD3311B4B7FFA7E1678940C645D5E3AD1FA6E95309C7987E6A3C75FC42C0C447D660A0EEA7D3F1FF881E1C01A68D030036E2D5A0E936D0910518C5005E9AE3981B71E6E4E6FECE926ED24D6A2355288DE684617754EE5244AEACFDF695FB900323C638C30FEF9311F2271BFCEA32CDAB7CF97D6B0AD59AF65301E972FBA15DCBBC3EE4C8F1A3A19CA0A6CC30A43EE91F88CE20660012B2EC9E40F9829A1A349DA48558AFA9484CCF18366942FE25A9A4DD52B0570B6F8DD2838DBF0CDC013C9E93B435DED55BF4E9D42EB57C980A40FDA3B6D43E96F9E61D37873C23E8AC63BC17F51EF564E83A47A741CA85EBFE85A292B75FAC01368A6C501448E29FE79BF936F78F1A7A7F326A36346BCCC767DBB50EA5276BDE8F774F991646D43277D7E5832176EEC90233334B8720FC2288C16F6DE582FDCB788405E1B86C655A9D4CC4F8AE3F02E31174A39806D438AF15B96F4FD050AF9C9203381BD5B1BD385E323393666A8E1B0B10A7751C5DE1D1303FEA866965B4257B0099B445DCCB605D6D00BFB21720A364571C15FA84065A39F301E9DF09F203C2943793A858B4B3AEA7FE2B2971344B2E6C5EB26499578F49E048A40290B040213EF6D64241B526E69030D3682A62856428E5CA71481B7455D0C28536DBEF4BBA991E9348CBD034C7D7D54E3BD5A2DAFD99D1D4414EA0C716982CF3F7F3A71FB76B24D91AAE86FCABFB218D5CED6D46C6CC75AB938C4637F0B8071C82C1828386F2C646D4F76BF6BFCD1EA9F94468DF46F0256B6BEBB3BDFD72F07ABB7D16AB2EB5388DDBC54FBAF13EBBF37E1710049C141642B36FD6622140407BDCB09E5D87D5782AC48ACC1ECB7E381DDACE1A9C4425F383A578CAB7DFF55354A8659FBA3287F3F7B78F14A036BD5F3B3ECD19D0CB58B2C73DD0AE0EFC8705C5D749EF107433588260EA6B870ACAA3A02E9F086226139E23AF6A26E1699DC0071E12973EDB3420FECAF6CABC05FD62BA265DFCDCCAD927832CB7F2D54A33D25D5D69A5A9C6A0FD2143B48B17A1AB5156BA8E47FB63FDDA18A05C5F20AC7278B2909E5C6E8049698A5DB03506DFF8F0D77A13AE24504C4243D614ED5B37FF8C04C4663B79E68C2B9C3805D458AB2284FE10020A4F21D15EB3689252ACBAA1C27DFB08F1A1E62D21CBE6360F872A2E51CCE7416682592777720B322D7D014C072B2F491E1852632BA41FAA86FE8E95CDA16B0D8073CD10B3C22B88EC72350B51592501584D029DB1370F570CF40F63C150382DD8544C13CDB1C063D9A22A80F631BEA70210B31F5B6085FDCCE13BF0E42C6EB854F7E66295E9C2E87886CA69D12C004DBC087D931B80914163FACD8BABD13B9980C8CE976B4BA6AE464B933C7FF5383A0FCBD08D47C7183ADD13658D80E70E1A9599787D8C8ECFBDD5E28A16AB3101D13839F5894713E67E4B20229E4CD7A45027F8F9A8D5261EE69508B64924968A66EB2536A78D81722383D984B05E7317D6206168536F2D34F8B51B397A667E4B2D08C84E83042A0CACAA808DC098550D5B8DBE3A66DCA44286C3E632FB9E38FC505836AA323C41E866A68D23E29A9EC96C6D85543C539B45FF59AA581AE38D1FB80A93AF56AFA2EF0EF10B85392612ED1885C2F1BDBD2DA939D1D93DA8E71E16DFA74C3A1F4B22258AD65B135ABA3E44F18E3A4ED3CDB03697441C241743FFF2E39ED1812BEBB18A41DBC26CD0D987B3C75C3BC66C6AAB4C2E10D3BD9AB1D648D625ACDEA329A0623CAB26356AC1C63FD0D1DC14D4A802A36DCEF61EDB42E859C24A4F7966ED7F8A7A84F8BD4E8632E6C6D851F726D6A1EA03F4F6B34376F6AC2F7463DCA3F1D29059973C08793036ADFA7D1B5CDD791F22814096FA2F98905B1100A9811F6EA690BF5DD2DB8DD7DC2DD750581E18CDC4AA8FC996F6C2809557B31E46C772237F79794E7A6F8C4D7BC3F5CCEE02AF25AB1AE7624096818863EC8D596B1369B9B698ABBA0B520E10E9BB0469DF67940047E9315D78ADF5A63CEED6B988307334A38C893D9D822A2E1C40352AFE2197788899123565FD13F8ADC0E7A12FE1A57F80E266056C629C8261E9C879CDA90948A112EBF00B04F75693545DD7D24DED6C5FE3EDC1BAA25B62B49097F800F0BDA3C5DF3F94B65D4D251607CE96D7E4A4C1A14B0C90B14BACE6F8D2C10250B9A9AC755BA78A36C1AFB97419E00FFF017509ABAD3C62EE13437B5F5136C1B794FD2AA70E9F308CA1B2E7C06AAA1E6E96FB3A99269FB011D3501DEB088AE42AFEA14ED0545523B1C3EF4BE40932EE0941B66EA4C56AEFA4899EC26737BAD468E3428768B33CD084CD46D0753464E49A870578677B7300C913A7C3E30C34E58A1EA25DA9F5AC521E1AAB9B2C2AF52CF9CD83FC5A7A62971047BD2180196C8CCCC00BDA9EC0E1BE9BB67E4DF0C053F2B1DE5C34938A0AE556F9EB37948D61F1C66B6ADA284AF5B35716BECD0617813EFD175109F40A483DEFB6532E56BF99594EC3D125B12FA5C3EA3B3E2B64F233D38BC5FB23555C07412D8370049D671379F82F1B7CF9DC99250122400C5066C969856E89678206A25D879D65F4A9C1F91FA3D103D8AB566756D33FF0BA8DE00A03F649FD65C015589EEC08FC1138BB2B8B4410B842B192070757A9B3010F2F26D0ED20078A9F424929410C6349675B5B95739CEDDF44AF54AE2C156BAA755C7B3E0C36E244A271EA61C8F57119B1568507A35F8AB3F6677B116463AAFF8B68FB7647D9F6F878A6B28A2F9C2A64D1CE83131CB2160EB62381A88E56CC53168058C84D40E51D4F6551ECE9F0C114A59019B75E836CF557232F84578BF7CD4362F773719C33F900000000000000000000000000000000000000000000000000000000000012C0803F92B0A475B30054186ACFC3F473C7D2E50B0A12E2321EA2AE436190C87E1609C338A44F04BD82BBC76B662BF5A5C5090A7E40C7F3AABE20542C1397347EF22AE9581331BAD051E737DB8193157B9F005140E144CD5607EEBF90CF625CAA7AA0F06A929FC8B0F5927C9CF2838658A37BF872ABCDF2EA8940FB65A64BDD7EDC544C77F93F5581FC01C94146A01D5FBC123DF1D54655DF3528A4D1C19D82B584961B1D23B9AAA0FC3DBAA87E1AD42E87DF394FF22D0A824EDDAD5BF3851511CEA4F83EDCF5D2A9E4D976D815479974C1617144CC3811FF5CAC2E9D5C68A3CC0F3FA771E8B1F0D098C198EEB328F9350A0AF2E72423C00A972630F9BFFDE21DCD6B54622153B881D12949823B23864E8980A41E33A29806E07EC32C53F1BC1340B279D513E6E4DC76260D561577264BC686D735F1CB7231DB69353C3D3C3BB188E0AE786BC3ED11E0EF82A84F58AAB7291315B32810C182D03A43A874FAFB0E304CCFED9DA7F6CA8C0D32B30CBB11E9D4058DE9253156B1B30A8D48576E93F0AEA585B3BBCB754732FD238828D837ABA355B2E6EFB1C7AA0882ECD6072692868316E96A944481530EC04F7D10850A062311185B423D8447377C1A714C766164F47139580B9E76A1E20D38CA91B01478F9D31B5049DBB0762BDEAD68EF95BEF0BF99F241BEE8C7D2F13E3D82EC09081C78A5D064C00B6BB026E7F7A19C4D18D3752D8CF5FA03268A7126F46B5DD08A4DA1116B5A6A3B512F2B053B5CF976488FAC4CD3FF7EF5B6C1728671AF265E7C07DE5D19D4AF4ED7436A9B96B66883A2DF4E92EDE72ED8E4C712347DAFA141641F7571A3DD6A0DA0292613D1569645415C7EEB43928EB713D9315FE0A47679C3E4570E25F5D40B39B2D0B92E5A75FF3D10702D80A4B812E048FD0E79624C934B32350B25937AF66E6A7F401C4A936B4236928368423B1CAEDB7792D8A5E5021BC72E66DB8B6AD4A606AF11BB248F37B361829EAFFB41460F7035C2F1E8EBF307A39F02F046658086CD0275B5F019C59E1522547ACFDDDD0DF2368F6D5F85F775AF5C5E411637EB2A67A850B1DD24FF6192DAB4DA3871192E66D924D3ACA62B4225F1B7F9F0AF3DCC3842E4944C624C06D8B68C137ECBD2A8A0FF5827867D44D1E88817F734D879AC623D0B77F4F10EB02F6A4A7C5DC3BC1BBFA2502EEAB7B07130C0E77D1F85A7753BDD2496241F053D148BA9D11E3641955CECB6E1DF251EBD3159B3057241B63B4037C79E60F1A21E2FD96D09B652B68B1DA908ADE389A0263A89117B7ED3B513DA4F720316937343ED991C7CE7495FFBEACCFC1C9B793BA39D09EE60088D37C6F892F8426074A22DB8BA96ECC33792C0BE1A70605580D3BC1955512302E3E9CF3F5FA88C4591549487DFE01B7143BF3DBC66716AE300584BD2EB0C4A64B5541B54008B55FBB8388C8549F652DD35FD530D565EE35334AC5F340289076E2FBF517B279CBAB28EEA3AEEE2896663488CEAC3524378500F4AAB80413A125BD9FE9E0F9416823E50D6CBDF03549125CADC4B7C83562A4467724A228509CBBBAC047ADD6981BEDD9F28F68BDEB28567BC76085B11237DE177E6E6941259760F5B04DC72EF44B8283B1555E93E91C37FB904208843D3CEFF5BBD174923C8496BD7569D96C806A0B92D2378E1A6F24D5B2F823C5152EBBE3C77B7C62CE40CAACA51FAC19135B694A9D06DC9E10719BA99B0D3736EF1114B2264DE503BF3198C6BF0FCCA661DC6A4841BF34FDC848B007443702D2C1AB041F6D6829DA70509B9578E6F8A9C65026BAB2471B15DA92377D975196F530DFE00D1A06FD438500ECA8589A7C78C1ADAD4647AFF58F1F5C3FC710E41BEAE07B2FBA92B2878DA4F208AC9959367E5DD3DA5CF05F8BE5AA7A99B73093DAF5155F8B16F36C35A641D9ACA93C9C35CBC762B4EA97EA08951C8278A9CD0ECE60CA776CFF4C2FB08BBE110D33AA24C1629B19B60C4B2798AC66AA9E46B85C02425EFD1033F5DE110E13F15AFC288F6866CFBF890A5BB9B0F3F32A25DDF76BF61C276FB606BA87EC6AB8DF49F130DF90890D6D754EBA70D455A96EC3D37FD9C023DECA031215B0FB86EFE0B36975BAF03A68AF4F8B773BC15AA05A4A3E088FC855D3179DB525D2B60F58CB3EC5830F6C378A6D98C70D9D4F602E1ABA867A92D42C30F9245DCF7039B10C8F6BA4CC07C1B6A62B11501ECED12B81555EFB2FE671A6A50A3CA09F657076FA316B69E4191C9E645F87A0B1A19E2C397DE405DD93D0B8E2D497FEA73A688FECE3D48FE3ECDF65B8C1C8E15B4CAC59A1FA826235A5C72445D3F144A0C7860807364DEA136D26EE60F0D13CBAF307919145AF08571BE6023F4EC779F8212D9FD0F0080C3D844F48307E1843F89559B65BB1C6F4056D2A8CAF40D314BB94E89417E7F594E6BF73F71F19C0975B98BEDD0B6873DEB559C1A8D0E7FFA8A840205C6F83C4C95747FBDF6E7BE58ABE0321CC7CE8B1826FB180C348521CD04B4C15115F413ECF4A6BFFC9566DE87FD2A70CDCC3E4FB7B6C032FB50A686C069782D1BDBF46D1EF992D29BE2A60E590D5891EC5DAD92CAF20733E2557A0E97F9A710402707EB37BA696524FF3A3F6F0833BB85045C8054E12E16A4696944A935B6A83E5D4614836B85400B7434A216C5766C8DCA00C915BCDE94D1ADF07962C85B4F2275CBD81A80F992DEAE9D5C4CA5CAFDA08A7D815F81558A82F60828511401A83AD9594B6B794B25F9A32CB22933B446368546612B8E5E8D3E06B610ADE72B55B53F1607B31498C770AB915F08ED64B78910C1ADFE15D4A107C3602BBED059356E5984CC73DD7BA5EA34F329CC70F468FF4EC797E712E144541B7CE90CEDCEA9DDDD5FF02A7FED3BE8AAA6B2FF8F6FAF8D6FD99B0B23F30426CB94DEAC29AD4A9986F90D894270C11B8C4E00B5F258C3D26413F52018968B0D0925D61D5C9981B2FAD4BB1218E9FCA23A12EB00751DFB6035998D9FED3675F2DEE1139B2F8CB51A6BFE8EEFBF0EE6D42C9523F9BF50D17CA6C82F5CD83EE07AC9343BA6F044DC5FE2E417CF70CBA25C8E801CF003F172BA92652BEA6E4C7491202C6996DADB5D3BC1BC381E6A2A9DEE4375AED8CA2E9109B9B4956CA51219AAB187946B259FFD5925FE0C9C95A3E4E4D56B7FBE31C85A8E4CA3052911193695421948A02869ADD69B900260CFD41B36A79303FFAC1E47AC356EC5A85A2E9D3FF99CA22D2463B7B7874E2B4F49A1872D01113AE9934FA753B605971CFDEAF9CE82BAB0D78EE76D10891319FCC16934FA5BC2EFFEC64B1A72A3B1345A73C6431CDA5AF2256C72CAF2C62815E7B906B36F2B1EE5BEE6C4661896F671F6213FC6D9AC24540E19D9E9241A4E399B16951FC4D0D279DA3FB4DE1C0AF1AB0B781BE70509806C843477F0FD50AB4BC6F21D9F80368A8CABC4C30F2E47233D2C72FEF6DE0127E1B2D3BAC652B3CE13194A722CAFD3742476793660B531AB7243E23B7D3E0D22BEF803A149BD11F2FB08DC288CB234A4B27F8AE577306EE680B42BE18D233A6705E56D27CDEAFF1A955A797C8A64BE4AF0308264F89BCDDFEB1073B869CFA6813914DDFE0DFBE25F0E8DD7FF2FD1C0B7F543F9AA04E4E96A0468C9AA158A9E07743E47EB9A1E8859F572D686DC8FF42A2FE305B3255567DF98A0F2F59EC5CBF62ACE7F7AE1E83060BB40E1F490831F34CB72792D8D919DC14924FE6CF65F041AE328132FE6C9961F13D37ABF58324DFE82FB22E412E922B4E2CB4CB2C4AC9C70C1F3EF146DD3D99307ECD72A4848799FE8445D0B55EEB38587494D3B8DAB4609C493D76A305B03C301D2967BDA65B49B4C32F6FA196607601845A85EFE8B6998B0DB0AC7D46AFF430474B5B4AC1842BA238EE8EC33A0BB2EE7E9FE774FC9E55AA78A6CAC156CA07875D5B8A8456D32DF2D626F8A98933B82A3F27F5886C3A8786735B4710B1CAA6B2660A19AAED2B87F6E2A09A61C880E651F7BEB1873BFF2946EF61D4613D916661536FE25A3CA1E10613AD9C42B2DC38D3276C2E4AA98EE29D8B66EA32B3B277772900CD423C710BD63ACE8B18CF98C03AD44E616A8BD0B34F09E2B462DF8FCAFF6E76A43EC38CDAA6B990607D28E7603267D4CAB9B3277804988ADF779DA9B23136BDC4B65BA91F50462781C5B880D57B5254FD0C4E535A0D34911C387819039F0799E63F791079F256ED5E2BB781DF5893515BA7C401792EC508E60FA9679A1C434E5CF7A0579D5A5C9B985B21FA2E9DD5CEC9C227E6B209F1E1078A5518D0E0679E5EB70DEFD7EE46C8C36D04AAEF538625D697EF1108F4C37A86D643F74A45397731F260C1D6F4C63407350E82745A76DB0EBD2DCB075F9575C371A625707150CCBB79DD406AAD65273D88E91C22E3740FC0FAF1A7C8491AFFC3476A40470014EC0728FF3FF2C40B95B6488FC8781B3229BEF08E0D93BA2E5235E6A3D192B49C1A1F04F88D64F2AAC59822F76B28CA5BAB41BDE157B116BD61F14C2BF7EF76B58A13A5148C1BB65249FBAE945277B34A14F22D913C68C8BBDC90865891F6019E9789D5575735A0297FA2F75A0A6D99F0AFCB12FDB902E75335AB2BE22235426D630963F92D539572461BA0F6F07C5A51158497B0AFFA760D0408EA851E862BC78F42BB889580F4B6EF04C8C4973D5C009A909DE77E5130982AF32B5B27928111BF97FDDCE33BB06DDA8A1193437B03EBAD5A156367A4B827FC8F21D633CBDCAD2B34540413C1B76C62731962DA57B808BFCC7AB5579C04C87842645567F9A2BB966116D3EC6DA56488C8C3B070ADDE6C61CFD4894D058284B0C9792C514FD13D7E219D37D713E3B6E7832A0863B48A2B771BF4599A47F49BE4899317D1F8682691621D5684ACD83A56E9AD8F9E9E08D542165A828D07054027D53B4587FB77240B450A3CBB4F233AB745AFBB393259ABE5D6504DBA91CCE407C8E2F148C62105F6311B1B81DC96A6EB09D769F4659D9DA52D52B1A15D93C2BB2B5F5AC46330D7D2C899A3C459C76EAA9FB5913BB9CAF4E12244081333BC48D553BC838F6493AC2EEEA5AB343154D45B864277C49D462F0D85AC7546AF7EF417B9C8AA720A10E1B4E4AF1EE7AF08B339552204B4E992E2E08808932894A0300890907C0226BFBB1038BF0D8F53BA894BF6D21AC490DABF6286B42BC9747AC01289C8B0BF1482EE0EB2D21EFE6913A833BFDFA4961AD519D3A4FDA0153BA9B20388EBF55A9D4053A578CA98086DBA099D3048A3D565A026D25975A6B01F7797C9494DD3DC7BC5E6077FFEC963E877061BBBB89064366B64096D5E5BF6A304DA7FBF1CD9A947242EA339F7D078602BA50BBF8E99233820DC5F29238CCCBC7E3A3A8B4087F83F915B6B600A9E7FA0975D186B3E5D9379D30A83B2055DC825BC616855FD654B31B8017967ABDE906DFA33FE5A1C2C788F4B036F0B02AAFB9714B229EC52F414A743F1886213EF8E8A5D41C38F470BBA868294B73E3A25C95FD5DF9670FA2DC80F805665F1ED7B818DF5FA9920FD4842F421DDD07DC2DFDFC367286CE4ED770AB6104A7B5DD9996469C96DFAA94776577D3A51EBCD18690C611E933422F6E1A1736A3325CDD4F4BA01BDFB30D8D042AAF86D13FF2D2B7A2E6F809D44F0C9B9FD2700088F23907355B89280978C7FD615D04BA40D6E94CC5CBCDCD99AF027882A6C31CCC380DBB2B8F07247F78DC1EEF16C0A57934C47FF111B356C8E61B2E46CF53115F41DCDAF80E730D2E558291AA366D16FBB1D49F053915E7F27617A548F0A915431D9928CFE1F3E6CAE9583007BA91EC143D6CBF02354331B3AA58F9C9F22A8A79DC5433036271DEC2839A44DB84BFB32824D59FCA0A2BB30F4A7BED5CD2C65CA4D50C633D4DC977670D714FD6667043FA186EDC72FD23ADB679B5556A30E0113EF51471B1C302112C6BD68CE45DAABA33A89A88348632BE73C6FB92CBD7F79B73108024CCA8730CA57877DDF00ADC95D95FD816BBF9CDF8FFD7512234BA3A87468E9946530584BA6EFD1C1A6AA0968C826DBB78CE76BBF7B05498540F29BA07FFEFD6B234C47FD7679D362809431C58ED6B41F1EBD091C773D57F1D0FF85967AE9388E0E41C3DD8177B9DAE7228E0995165DDA7BC3394213D3637A4A3FD676E15FCF4C303BE1BDC3BD9AB9A1DF298CF04137909D657DA10232B3A8316340F042211D216B62AA5D4603B12571E0D8766DD57E64071CEB8C165DFC078935708F475F989741EFEC279B02E3F898B86C38A2829E34C4431869E6E5A0E47371FE1BE3D0EBC6B9B85E25A4AFE08F7E26764E3736D37B0370D8D2F300CD48ADB453F08F07C97C1187D43A1E1B992441BD9A7CA6D24A00190B7D96B4F911AA4C3E49AD8362A92CA7079682751F2C0A82ABD05A17DBCED870490FB5FC07507B280E0CE5E251DA083C546ADF1B7E122026A52183C504A8D9B38FC40101B3A70687F36A0038682F0571DD9F9C615F2CE8ECA3EB046FDA59474199735C8E8FF827943162A782528DA3F96E050CD03CF9CD2FF82F0871BF4D29FAA4C366D344391103AFFCDD50FB1C4C638A2BE6AA58055C5B89016650CEB44C36B210B1796BECD0596A5240B5B448E8E47F89059EDC9FFDAFB89C18DDF240EBC148504C0D457E96E6812B0EF52FC4AE01C23516BFEB68AD7F8FBD0A952C68A1EBABCEFD9E152EEC71A7F7A7286DBAE73FE49E7CE0815BC0C26E7CB58FC6ECE24E3AF815B06AC0E2B95D7B012BD1C098547E22CDDA77E59FDFB7C1FA893008A7C4596D2ED78EEE07AB7FD93B0F76A34A2E09F128CA120B69B429315, operation=0, safeTxGas=0, baseGas=0, gasPrice=0, gasToken=0x0000000000000000000000000000000000000000, refundReceiver=0x0000000000000000000000000000000000000000, signatures=0x0000000000000000000000002B1D879B5E102E60166202DE79537B48E2F18A42000000000000000000000000000000000000000000000000000000000000000001FF5196408130B5EA83178BE1DAA3615CCD2E75291FD4026C45FDBEACD098FE2053C08BEF6814D2614EB93F02D7F657145E8C366D7D0B96DE90937BB15CEB95481C ) => ( success=True )
    • Null: 0x000...001.30f5c8be( )
    • AppProxyUpgradeable.805911ae( )
      • KernelProxy.be00bbd8( )
        • Kernel.getApp( _namespace=F1F3EB40F5BC1AD1344716CED8B8A0431D840B5783AEA1FD01786BC26F35AC0F, _appId=7071F283424072341F856AC9E947E7EC0EB68719F757A7E785979B6B8717579D ) => ( 0x6828b023e737f96B168aCd0b5c6351971a4F81aE )
        • Lido: Node Operators Registry.805911ae( )
          File 1 of 5: GnosisSafeProxy
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          
          /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain
          /// @author Richard Meissner - <richard@gnosis.io>
          interface IProxy {
              function masterCopy() external view returns (address);
          }
          
          /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.
          /// @author Stefan George - <stefan@gnosis.io>
          /// @author Richard Meissner - <richard@gnosis.io>
          contract GnosisSafeProxy {
              // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
              // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`
              address internal singleton;
          
              /// @dev Constructor function sets address of singleton contract.
              /// @param _singleton Singleton address.
              constructor(address _singleton) {
                  require(_singleton != address(0), "Invalid singleton address provided");
                  singleton = _singleton;
              }
          
              /// @dev Fallback function forwards all transactions and returns all received return data.
              fallback() external payable {
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)
                      // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s
                      if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
                          mstore(0, _singleton)
                          return(0, 0x20)
                      }
                      calldatacopy(0, 0, calldatasize())
                      let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)
                      returndatacopy(0, 0, returndatasize())
                      if eq(success, 0) {
                          revert(0, returndatasize())
                      }
                      return(0, returndatasize())
                  }
              }
          }
          
          /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
          /// @author Stefan George - <stefan@gnosis.pm>
          contract GnosisSafeProxyFactory {
              event ProxyCreation(GnosisSafeProxy proxy, address singleton);
          
              /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
              /// @param singleton Address of singleton contract.
              /// @param data Payload for message call sent to new proxy contract.
              function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {
                  proxy = new GnosisSafeProxy(singleton);
                  if (data.length > 0)
                      // solhint-disable-next-line no-inline-assembly
                      assembly {
                          if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {
                              revert(0, 0)
                          }
                      }
                  emit ProxyCreation(proxy, singleton);
              }
          
              /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.
              function proxyRuntimeCode() public pure returns (bytes memory) {
                  return type(GnosisSafeProxy).runtimeCode;
              }
          
              /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.
              function proxyCreationCode() public pure returns (bytes memory) {
                  return type(GnosisSafeProxy).creationCode;
              }
          
              /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.
              ///      This method is only meant as an utility to be called from other methods
              /// @param _singleton Address of singleton contract.
              /// @param initializer Payload for message call sent to new proxy contract.
              /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
              function deployProxyWithNonce(
                  address _singleton,
                  bytes memory initializer,
                  uint256 saltNonce
              ) internal returns (GnosisSafeProxy proxy) {
                  // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it
                  bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));
                  bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)
                  }
                  require(address(proxy) != address(0), "Create2 call failed");
              }
          
              /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
              /// @param _singleton Address of singleton contract.
              /// @param initializer Payload for message call sent to new proxy contract.
              /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
              function createProxyWithNonce(
                  address _singleton,
                  bytes memory initializer,
                  uint256 saltNonce
              ) public returns (GnosisSafeProxy proxy) {
                  proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);
                  if (initializer.length > 0)
                      // solhint-disable-next-line no-inline-assembly
                      assembly {
                          if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {
                              revert(0, 0)
                          }
                      }
                  emit ProxyCreation(proxy, _singleton);
              }
          
              /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction
              /// @param _singleton Address of singleton contract.
              /// @param initializer Payload for message call sent to new proxy contract.
              /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
              /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.
              function createProxyWithCallback(
                  address _singleton,
                  bytes memory initializer,
                  uint256 saltNonce,
                  IProxyCreationCallback callback
              ) public returns (GnosisSafeProxy proxy) {
                  uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));
                  proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);
                  if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);
              }
          
              /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`
              ///      This method is only meant for address calculation purpose when you use an initializer that would revert,
              ///      therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.
              /// @param _singleton Address of singleton contract.
              /// @param initializer Payload for message call sent to new proxy contract.
              /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
              function calculateCreateProxyWithNonceAddress(
                  address _singleton,
                  bytes calldata initializer,
                  uint256 saltNonce
              ) external returns (GnosisSafeProxy proxy) {
                  proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);
                  revert(string(abi.encodePacked(proxy)));
              }
          }
          
          interface IProxyCreationCallback {
              function proxyCreated(
                  GnosisSafeProxy proxy,
                  address _singleton,
                  bytes calldata initializer,
                  uint256 saltNonce
              ) external;
          }

          File 2 of 5: AppProxyUpgradeable
          // File: contracts/common/UnstructuredStorage.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          library UnstructuredStorage {
              function getStorageBool(bytes32 position) internal view returns (bool data) {
                  assembly { data := sload(position) }
              }
          
              function getStorageAddress(bytes32 position) internal view returns (address data) {
                  assembly { data := sload(position) }
              }
          
              function getStorageBytes32(bytes32 position) internal view returns (bytes32 data) {
                  assembly { data := sload(position) }
              }
          
              function getStorageUint256(bytes32 position) internal view returns (uint256 data) {
                  assembly { data := sload(position) }
              }
          
              function setStorageBool(bytes32 position, bool data) internal {
                  assembly { sstore(position, data) }
              }
          
              function setStorageAddress(bytes32 position, address data) internal {
                  assembly { sstore(position, data) }
              }
          
              function setStorageBytes32(bytes32 position, bytes32 data) internal {
                  assembly { sstore(position, data) }
              }
          
              function setStorageUint256(bytes32 position, uint256 data) internal {
                  assembly { sstore(position, data) }
              }
          }
          
          // File: contracts/acl/IACL.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          interface IACL {
              function initialize(address permissionsCreator) external;
          
              // TODO: this should be external
              // See https://github.com/ethereum/solidity/issues/4832
              function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);
          }
          
          // File: contracts/common/IVaultRecoverable.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          interface IVaultRecoverable {
              event RecoverToVault(address indexed vault, address indexed token, uint256 amount);
          
              function transferToVault(address token) external;
          
              function allowRecoverability(address token) external view returns (bool);
              function getRecoveryVault() external view returns (address);
          }
          
          // File: contracts/kernel/IKernel.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          interface IKernelEvents {
              event SetApp(bytes32 indexed namespace, bytes32 indexed appId, address app);
          }
          
          
          // This should be an interface, but interfaces can't inherit yet :(
          contract IKernel is IKernelEvents, IVaultRecoverable {
              function acl() public view returns (IACL);
              function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);
          
              function setApp(bytes32 namespace, bytes32 appId, address app) public;
              function getApp(bytes32 namespace, bytes32 appId) public view returns (address);
          }
          
          // File: contracts/apps/AppStorage.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          contract AppStorage {
              using UnstructuredStorage for bytes32;
          
              /* Hardcoded constants to save gas
              bytes32 internal constant KERNEL_POSITION = keccak256("aragonOS.appStorage.kernel");
              bytes32 internal constant APP_ID_POSITION = keccak256("aragonOS.appStorage.appId");
              */
              bytes32 internal constant KERNEL_POSITION = 0x4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b;
              bytes32 internal constant APP_ID_POSITION = 0xd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b;
          
              function kernel() public view returns (IKernel) {
                  return IKernel(KERNEL_POSITION.getStorageAddress());
              }
          
              function appId() public view returns (bytes32) {
                  return APP_ID_POSITION.getStorageBytes32();
              }
          
              function setKernel(IKernel _kernel) internal {
                  KERNEL_POSITION.setStorageAddress(address(_kernel));
              }
          
              function setAppId(bytes32 _appId) internal {
                  APP_ID_POSITION.setStorageBytes32(_appId);
              }
          }
          
          // File: contracts/common/IsContract.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract IsContract {
              /*
              * NOTE: this should NEVER be used for authentication
              * (see pitfalls: https://github.com/fergarrui/ethereum-security/tree/master/contracts/extcodesize).
              *
              * This is only intended to be used as a sanity check that an address is actually a contract,
              * RATHER THAN an address not being a contract.
              */
              function isContract(address _target) internal view returns (bool) {
                  if (_target == address(0)) {
                      return false;
                  }
          
                  uint256 size;
                  assembly { size := extcodesize(_target) }
                  return size > 0;
              }
          }
          
          // File: contracts/lib/misc/ERCProxy.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract ERCProxy {
              uint256 internal constant FORWARDING = 1;
              uint256 internal constant UPGRADEABLE = 2;
          
              function proxyType() public pure returns (uint256 proxyTypeId);
              function implementation() public view returns (address codeAddr);
          }
          
          // File: contracts/common/DelegateProxy.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          contract DelegateProxy is ERCProxy, IsContract {
              uint256 internal constant FWD_GAS_LIMIT = 10000;
          
              /**
              * @dev Performs a delegatecall and returns whatever the delegatecall returned (entire context execution will return!)
              * @param _dst Destination address to perform the delegatecall
              * @param _calldata Calldata for the delegatecall
              */
              function delegatedFwd(address _dst, bytes _calldata) internal {
                  require(isContract(_dst));
                  uint256 fwdGasLimit = FWD_GAS_LIMIT;
          
                  assembly {
                      let result := delegatecall(sub(gas, fwdGasLimit), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)
                      let size := returndatasize
                      let ptr := mload(0x40)
                      returndatacopy(ptr, 0, size)
          
                      // revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas.
                      // if the call returned error data, forward it
                      switch result case 0 { revert(ptr, size) }
                      default { return(ptr, size) }
                  }
              }
          }
          
          // File: contracts/common/DepositableStorage.sol
          
          pragma solidity 0.4.24;
          
          
          
          contract DepositableStorage {
              using UnstructuredStorage for bytes32;
          
              // keccak256("aragonOS.depositableStorage.depositable")
              bytes32 internal constant DEPOSITABLE_POSITION = 0x665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea;
          
              function isDepositable() public view returns (bool) {
                  return DEPOSITABLE_POSITION.getStorageBool();
              }
          
              function setDepositable(bool _depositable) internal {
                  DEPOSITABLE_POSITION.setStorageBool(_depositable);
              }
          }
          
          // File: contracts/common/DepositableDelegateProxy.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          contract DepositableDelegateProxy is DepositableStorage, DelegateProxy {
              event ProxyDeposit(address sender, uint256 value);
          
              function () external payable {
                  uint256 forwardGasThreshold = FWD_GAS_LIMIT;
                  bytes32 isDepositablePosition = DEPOSITABLE_POSITION;
          
                  // Optimized assembly implementation to prevent EIP-1884 from breaking deposits, reference code in Solidity:
                  // https://github.com/aragon/aragonOS/blob/v4.2.1/contracts/common/DepositableDelegateProxy.sol#L10-L20
                  assembly {
                      // Continue only if the gas left is lower than the threshold for forwarding to the implementation code,
                      // otherwise continue outside of the assembly block.
                      if lt(gas, forwardGasThreshold) {
                          // Only accept the deposit and emit an event if all of the following are true:
                          // the proxy accepts deposits (isDepositable), msg.data.length == 0, and msg.value > 0
                          if and(and(sload(isDepositablePosition), iszero(calldatasize)), gt(callvalue, 0)) {
                              // Equivalent Solidity code for emitting the event:
                              // emit ProxyDeposit(msg.sender, msg.value);
          
                              let logData := mload(0x40) // free memory pointer
                              mstore(logData, caller) // add 'msg.sender' to the log data (first event param)
                              mstore(add(logData, 0x20), callvalue) // add 'msg.value' to the log data (second event param)
          
                              // Emit an event with one topic to identify the event: keccak256('ProxyDeposit(address,uint256)') = 0x15ee...dee1
                              log1(logData, 0x40, 0x15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1)
          
                              stop() // Stop. Exits execution context
                          }
          
                          // If any of above checks failed, revert the execution (if ETH was sent, it is returned to the sender)
                          revert(0, 0)
                      }
                  }
          
                  address target = implementation();
                  delegatedFwd(target, msg.data);
              }
          }
          
          // File: contracts/kernel/KernelConstants.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract KernelAppIds {
              /* Hardcoded constants to save gas
              bytes32 internal constant KERNEL_CORE_APP_ID = apmNamehash("kernel");
              bytes32 internal constant KERNEL_DEFAULT_ACL_APP_ID = apmNamehash("acl");
              bytes32 internal constant KERNEL_DEFAULT_VAULT_APP_ID = apmNamehash("vault");
              */
              bytes32 internal constant KERNEL_CORE_APP_ID = 0x3b4bf6bf3ad5000ecf0f989d5befde585c6860fea3e574a4fab4c49d1c177d9c;
              bytes32 internal constant KERNEL_DEFAULT_ACL_APP_ID = 0xe3262375f45a6e2026b7e7b18c2b807434f2508fe1a2a3dfb493c7df8f4aad6a;
              bytes32 internal constant KERNEL_DEFAULT_VAULT_APP_ID = 0x7e852e0fcfce6551c13800f1e7476f982525c2b5277ba14b24339c68416336d1;
          }
          
          
          contract KernelNamespaceConstants {
              /* Hardcoded constants to save gas
              bytes32 internal constant KERNEL_CORE_NAMESPACE = keccak256("core");
              bytes32 internal constant KERNEL_APP_BASES_NAMESPACE = keccak256("base");
              bytes32 internal constant KERNEL_APP_ADDR_NAMESPACE = keccak256("app");
              */
              bytes32 internal constant KERNEL_CORE_NAMESPACE = 0xc681a85306374a5ab27f0bbc385296a54bcd314a1948b6cf61c4ea1bc44bb9f8;
              bytes32 internal constant KERNEL_APP_BASES_NAMESPACE = 0xf1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f;
              bytes32 internal constant KERNEL_APP_ADDR_NAMESPACE = 0xd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb;
          }
          
          // File: contracts/apps/AppProxyBase.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          contract AppProxyBase is AppStorage, DepositableDelegateProxy, KernelNamespaceConstants {
              /**
              * @dev Initialize AppProxy
              * @param _kernel Reference to organization kernel for the app
              * @param _appId Identifier for app
              * @param _initializePayload Payload for call to be made after setup to initialize
              */
              constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload) public {
                  setKernel(_kernel);
                  setAppId(_appId);
          
                  // Implicit check that kernel is actually a Kernel
                  // The EVM doesn't actually provide a way for us to make sure, but we can force a revert to
                  // occur if the kernel is set to 0x0 or a non-code address when we try to call a method on
                  // it.
                  address appCode = getAppBase(_appId);
          
                  // If initialize payload is provided, it will be executed
                  if (_initializePayload.length > 0) {
                      require(isContract(appCode));
                      // Cannot make delegatecall as a delegateproxy.delegatedFwd as it
                      // returns ending execution context and halts contract deployment
                      require(appCode.delegatecall(_initializePayload));
                  }
              }
          
              function getAppBase(bytes32 _appId) internal view returns (address) {
                  return kernel().getApp(KERNEL_APP_BASES_NAMESPACE, _appId);
              }
          }
          
          // File: contracts/apps/AppProxyUpgradeable.sol
          
          pragma solidity 0.4.24;
          
          
          
          contract AppProxyUpgradeable is AppProxyBase {
              /**
              * @dev Initialize AppProxyUpgradeable (makes it an upgradeable Aragon app)
              * @param _kernel Reference to organization kernel for the app
              * @param _appId Identifier for app
              * @param _initializePayload Payload for call to be made after setup to initialize
              */
              constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload)
                  AppProxyBase(_kernel, _appId, _initializePayload)
                  public // solium-disable-line visibility-first
              {
                  // solium-disable-previous-line no-empty-blocks
              }
          
              /**
               * @dev ERC897, the address the proxy would delegate calls to
               */
              function implementation() public view returns (address) {
                  return getAppBase(appId());
              }
          
              /**
               * @dev ERC897, whether it is a forwarding (1) or an upgradeable (2) proxy
               */
              function proxyType() public pure returns (uint256 proxyTypeId) {
                  return UPGRADEABLE;
              }
          }

          File 3 of 5: GnosisSafe
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          import "./base/ModuleManager.sol";
          import "./base/OwnerManager.sol";
          import "./base/FallbackManager.sol";
          import "./base/GuardManager.sol";
          import "./common/EtherPaymentFallback.sol";
          import "./common/Singleton.sol";
          import "./common/SignatureDecoder.sol";
          import "./common/SecuredTokenTransfer.sol";
          import "./common/StorageAccessible.sol";
          import "./interfaces/ISignatureValidator.sol";
          import "./external/GnosisSafeMath.sol";
          /// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.
          /// @author Stefan George - <stefan@gnosis.io>
          /// @author Richard Meissner - <richard@gnosis.io>
          contract GnosisSafe is
              EtherPaymentFallback,
              Singleton,
              ModuleManager,
              OwnerManager,
              SignatureDecoder,
              SecuredTokenTransfer,
              ISignatureValidatorConstants,
              FallbackManager,
              StorageAccessible,
              GuardManager
          {
              using GnosisSafeMath for uint256;
              string public constant VERSION = "1.3.0";
              // keccak256(
              //     "EIP712Domain(uint256 chainId,address verifyingContract)"
              // );
              bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;
              // keccak256(
              //     "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)"
              // );
              bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;
              event SafeSetup(address indexed initiator, address[] owners, uint256 threshold, address initializer, address fallbackHandler);
              event ApproveHash(bytes32 indexed approvedHash, address indexed owner);
              event SignMsg(bytes32 indexed msgHash);
              event ExecutionFailure(bytes32 txHash, uint256 payment);
              event ExecutionSuccess(bytes32 txHash, uint256 payment);
              uint256 public nonce;
              bytes32 private _deprecatedDomainSeparator;
              // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners
              mapping(bytes32 => uint256) public signedMessages;
              // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners
              mapping(address => mapping(bytes32 => uint256)) public approvedHashes;
              // This constructor ensures that this contract can only be used as a master copy for Proxy contracts
              constructor() {
                  // By setting the threshold it is not possible to call setup anymore,
                  // so we create a Safe with 0 owners and threshold 1.
                  // This is an unusable Safe, perfect for the singleton
                  threshold = 1;
              }
              /// @dev Setup function sets initial storage of contract.
              /// @param _owners List of Safe owners.
              /// @param _threshold Number of required confirmations for a Safe transaction.
              /// @param to Contract address for optional delegate call.
              /// @param data Data payload for optional delegate call.
              /// @param fallbackHandler Handler for fallback calls to this contract
              /// @param paymentToken Token that should be used for the payment (0 is ETH)
              /// @param payment Value that should be paid
              /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin)
              function setup(
                  address[] calldata _owners,
                  uint256 _threshold,
                  address to,
                  bytes calldata data,
                  address fallbackHandler,
                  address paymentToken,
                  uint256 payment,
                  address payable paymentReceiver
              ) external {
                  // setupOwners checks if the Threshold is already set, therefore preventing that this method is called twice
                  setupOwners(_owners, _threshold);
                  if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler);
                  // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules
                  setupModules(to, data);
                  if (payment > 0) {
                      // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself)
                      // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment
                      handlePayment(payment, 0, 1, paymentToken, paymentReceiver);
                  }
                  emit SafeSetup(msg.sender, _owners, _threshold, to, fallbackHandler);
              }
              /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.
              ///      Note: The fees are always transferred, even if the user transaction fails.
              /// @param to Destination address of Safe transaction.
              /// @param value Ether value of Safe transaction.
              /// @param data Data payload of Safe transaction.
              /// @param operation Operation type of Safe transaction.
              /// @param safeTxGas Gas that should be used for the Safe transaction.
              /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
              /// @param gasPrice Gas price that should be used for the payment calculation.
              /// @param gasToken Token address (or 0 if ETH) that is used for the payment.
              /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
              /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
              function execTransaction(
                  address to,
                  uint256 value,
                  bytes calldata data,
                  Enum.Operation operation,
                  uint256 safeTxGas,
                  uint256 baseGas,
                  uint256 gasPrice,
                  address gasToken,
                  address payable refundReceiver,
                  bytes memory signatures
              ) public payable virtual returns (bool success) {
                  bytes32 txHash;
                  // Use scope here to limit variable lifetime and prevent `stack too deep` errors
                  {
                      bytes memory txHashData =
                          encodeTransactionData(
                              // Transaction info
                              to,
                              value,
                              data,
                              operation,
                              safeTxGas,
                              // Payment info
                              baseGas,
                              gasPrice,
                              gasToken,
                              refundReceiver,
                              // Signature info
                              nonce
                          );
                      // Increase nonce and execute transaction.
                      nonce++;
                      txHash = keccak256(txHashData);
                      checkSignatures(txHash, txHashData, signatures);
                  }
                  address guard = getGuard();
                  {
                      if (guard != address(0)) {
                          Guard(guard).checkTransaction(
                              // Transaction info
                              to,
                              value,
                              data,
                              operation,
                              safeTxGas,
                              // Payment info
                              baseGas,
                              gasPrice,
                              gasToken,
                              refundReceiver,
                              // Signature info
                              signatures,
                              msg.sender
                          );
                      }
                  }
                  // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)
                  // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150
                  require(gasleft() >= ((safeTxGas * 64) / 63).max(safeTxGas + 2500) + 500, "GS010");
                  // Use scope here to limit variable lifetime and prevent `stack too deep` errors
                  {
                      uint256 gasUsed = gasleft();
                      // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas)
                      // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas
                      success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);
                      gasUsed = gasUsed.sub(gasleft());
                      // If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful
                      // This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert
                      require(success || safeTxGas != 0 || gasPrice != 0, "GS013");
                      // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls
                      uint256 payment = 0;
                      if (gasPrice > 0) {
                          payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);
                      }
                      if (success) emit ExecutionSuccess(txHash, payment);
                      else emit ExecutionFailure(txHash, payment);
                  }
                  {
                      if (guard != address(0)) {
                          Guard(guard).checkAfterExecution(txHash, success);
                      }
                  }
              }
              function handlePayment(
                  uint256 gasUsed,
                  uint256 baseGas,
                  uint256 gasPrice,
                  address gasToken,
                  address payable refundReceiver
              ) private returns (uint256 payment) {
                  // solhint-disable-next-line avoid-tx-origin
                  address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;
                  if (gasToken == address(0)) {
                      // For ETH we will only adjust the gas price to not be higher than the actual used gas price
                      payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice);
                      require(receiver.send(payment), "GS011");
                  } else {
                      payment = gasUsed.add(baseGas).mul(gasPrice);
                      require(transferToken(gasToken, receiver, payment), "GS012");
                  }
              }
              /**
               * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.
               * @param dataHash Hash of the data (could be either a message hash or transaction hash)
               * @param data That should be signed (this is passed to an external validator contract)
               * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.
               */
              function checkSignatures(
                  bytes32 dataHash,
                  bytes memory data,
                  bytes memory signatures
              ) public view {
                  // Load threshold to avoid multiple storage loads
                  uint256 _threshold = threshold;
                  // Check that a threshold is set
                  require(_threshold > 0, "GS001");
                  checkNSignatures(dataHash, data, signatures, _threshold);
              }
              /**
               * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.
               * @param dataHash Hash of the data (could be either a message hash or transaction hash)
               * @param data That should be signed (this is passed to an external validator contract)
               * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.
               * @param requiredSignatures Amount of required valid signatures.
               */
              function checkNSignatures(
                  bytes32 dataHash,
                  bytes memory data,
                  bytes memory signatures,
                  uint256 requiredSignatures
              ) public view {
                  // Check that the provided signature data is not too short
                  require(signatures.length >= requiredSignatures.mul(65), "GS020");
                  // There cannot be an owner with address 0.
                  address lastOwner = address(0);
                  address currentOwner;
                  uint8 v;
                  bytes32 r;
                  bytes32 s;
                  uint256 i;
                  for (i = 0; i < requiredSignatures; i++) {
                      (v, r, s) = signatureSplit(signatures, i);
                      if (v == 0) {
                          // If v is 0 then it is a contract signature
                          // When handling contract signatures the address of the contract is encoded into r
                          currentOwner = address(uint160(uint256(r)));
                          // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes
                          // This check is not completely accurate, since it is possible that more signatures than the threshold are send.
                          // Here we only check that the pointer is not pointing inside the part that is being processed
                          require(uint256(s) >= requiredSignatures.mul(65), "GS021");
                          // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)
                          require(uint256(s).add(32) <= signatures.length, "GS022");
                          // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length
                          uint256 contractSignatureLen;
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              contractSignatureLen := mload(add(add(signatures, s), 0x20))
                          }
                          require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, "GS023");
                          // Check signature
                          bytes memory contractSignature;
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s
                              contractSignature := add(add(signatures, s), 0x20)
                          }
                          require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, "GS024");
                      } else if (v == 1) {
                          // If v is 1 then it is an approved hash
                          // When handling approved hashes the address of the approver is encoded into r
                          currentOwner = address(uint160(uint256(r)));
                          // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction
                          require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "GS025");
                      } else if (v > 30) {
                          // If v > 30 then default va (27,28) has been adjusted for eth_sign flow
                          // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover
                          currentOwner = ecrecover(keccak256(abi.encodePacked("\\x19Ethereum Signed Message:\
          32", dataHash)), v - 4, r, s);
                      } else {
                          // Default is the ecrecover flow with the provided data hash
                          // Use ecrecover with the messageHash for EOA signatures
                          currentOwner = ecrecover(dataHash, v, r, s);
                      }
                      require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, "GS026");
                      lastOwner = currentOwner;
                  }
              }
              /// @dev Allows to estimate a Safe transaction.
              ///      This method is only meant for estimation purpose, therefore the call will always revert and encode the result in the revert data.
              ///      Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction`
              /// @param to Destination address of Safe transaction.
              /// @param value Ether value of Safe transaction.
              /// @param data Data payload of Safe transaction.
              /// @param operation Operation type of Safe transaction.
              /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs).
              /// @notice Deprecated in favor of common/StorageAccessible.sol and will be removed in next version.
              function requiredTxGas(
                  address to,
                  uint256 value,
                  bytes calldata data,
                  Enum.Operation operation
              ) external returns (uint256) {
                  uint256 startGas = gasleft();
                  // We don't provide an error message here, as we use it to return the estimate
                  require(execute(to, value, data, operation, gasleft()));
                  uint256 requiredGas = startGas - gasleft();
                  // Convert response to string and return via error message
                  revert(string(abi.encodePacked(requiredGas)));
              }
              /**
               * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature.
               * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract.
               */
              function approveHash(bytes32 hashToApprove) external {
                  require(owners[msg.sender] != address(0), "GS030");
                  approvedHashes[msg.sender][hashToApprove] = 1;
                  emit ApproveHash(hashToApprove, msg.sender);
              }
              /// @dev Returns the chain id used by this contract.
              function getChainId() public view returns (uint256) {
                  uint256 id;
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      id := chainid()
                  }
                  return id;
              }
              function domainSeparator() public view returns (bytes32) {
                  return keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, getChainId(), this));
              }
              /// @dev Returns the bytes that are hashed to be signed by owners.
              /// @param to Destination address.
              /// @param value Ether value.
              /// @param data Data payload.
              /// @param operation Operation type.
              /// @param safeTxGas Gas that should be used for the safe transaction.
              /// @param baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
              /// @param gasPrice Maximum gas price that should be used for this transaction.
              /// @param gasToken Token address (or 0 if ETH) that is used for the payment.
              /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
              /// @param _nonce Transaction nonce.
              /// @return Transaction hash bytes.
              function encodeTransactionData(
                  address to,
                  uint256 value,
                  bytes calldata data,
                  Enum.Operation operation,
                  uint256 safeTxGas,
                  uint256 baseGas,
                  uint256 gasPrice,
                  address gasToken,
                  address refundReceiver,
                  uint256 _nonce
              ) public view returns (bytes memory) {
                  bytes32 safeTxHash =
                      keccak256(
                          abi.encode(
                              SAFE_TX_TYPEHASH,
                              to,
                              value,
                              keccak256(data),
                              operation,
                              safeTxGas,
                              baseGas,
                              gasPrice,
                              gasToken,
                              refundReceiver,
                              _nonce
                          )
                      );
                  return abi.encodePacked(bytes1(0x19), bytes1(0x01), domainSeparator(), safeTxHash);
              }
              /// @dev Returns hash to be signed by owners.
              /// @param to Destination address.
              /// @param value Ether value.
              /// @param data Data payload.
              /// @param operation Operation type.
              /// @param safeTxGas Fas that should be used for the safe transaction.
              /// @param baseGas Gas costs for data used to trigger the safe transaction.
              /// @param gasPrice Maximum gas price that should be used for this transaction.
              /// @param gasToken Token address (or 0 if ETH) that is used for the payment.
              /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
              /// @param _nonce Transaction nonce.
              /// @return Transaction hash.
              function getTransactionHash(
                  address to,
                  uint256 value,
                  bytes calldata data,
                  Enum.Operation operation,
                  uint256 safeTxGas,
                  uint256 baseGas,
                  uint256 gasPrice,
                  address gasToken,
                  address refundReceiver,
                  uint256 _nonce
              ) public view returns (bytes32) {
                  return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce));
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          import "../common/Enum.sol";
          /// @title Executor - A contract that can execute transactions
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract Executor {
              function execute(
                  address to,
                  uint256 value,
                  bytes memory data,
                  Enum.Operation operation,
                  uint256 txGas
              ) internal returns (bool success) {
                  if (operation == Enum.Operation.DelegateCall) {
                      // solhint-disable-next-line no-inline-assembly
                      assembly {
                          success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)
                      }
                  } else {
                      // solhint-disable-next-line no-inline-assembly
                      assembly {
                          success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)
                      }
                  }
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          import "../common/SelfAuthorized.sol";
          /// @title Fallback Manager - A contract that manages fallback calls made to this contract
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract FallbackManager is SelfAuthorized {
              event ChangedFallbackHandler(address handler);
              // keccak256("fallback_manager.handler.address")
              bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;
              function internalSetFallbackHandler(address handler) internal {
                  bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      sstore(slot, handler)
                  }
              }
              /// @dev Allows to add a contract to handle fallback calls.
              ///      Only fallback calls without value and with data will be forwarded.
              ///      This can only be done via a Safe transaction.
              /// @param handler contract to handle fallbacks calls.
              function setFallbackHandler(address handler) public authorized {
                  internalSetFallbackHandler(handler);
                  emit ChangedFallbackHandler(handler);
              }
              // solhint-disable-next-line payable-fallback,no-complex-fallback
              fallback() external {
                  bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      let handler := sload(slot)
                      if iszero(handler) {
                          return(0, 0)
                      }
                      calldatacopy(0, 0, calldatasize())
                      // The msg.sender address is shifted to the left by 12 bytes to remove the padding
                      // Then the address without padding is stored right after the calldata
                      mstore(calldatasize(), shl(96, caller()))
                      // Add 20 bytes for the address appended add the end
                      let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)
                      returndatacopy(0, 0, returndatasize())
                      if iszero(success) {
                          revert(0, returndatasize())
                      }
                      return(0, returndatasize())
                  }
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          import "../common/Enum.sol";
          import "../common/SelfAuthorized.sol";
          interface Guard {
              function checkTransaction(
                  address to,
                  uint256 value,
                  bytes memory data,
                  Enum.Operation operation,
                  uint256 safeTxGas,
                  uint256 baseGas,
                  uint256 gasPrice,
                  address gasToken,
                  address payable refundReceiver,
                  bytes memory signatures,
                  address msgSender
              ) external;
              function checkAfterExecution(bytes32 txHash, bool success) external;
          }
          /// @title Fallback Manager - A contract that manages fallback calls made to this contract
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract GuardManager is SelfAuthorized {
              event ChangedGuard(address guard);
              // keccak256("guard_manager.guard.address")
              bytes32 internal constant GUARD_STORAGE_SLOT = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8;
              /// @dev Set a guard that checks transactions before execution
              /// @param guard The address of the guard to be used or the 0 address to disable the guard
              function setGuard(address guard) external authorized {
                  bytes32 slot = GUARD_STORAGE_SLOT;
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      sstore(slot, guard)
                  }
                  emit ChangedGuard(guard);
              }
              function getGuard() internal view returns (address guard) {
                  bytes32 slot = GUARD_STORAGE_SLOT;
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      guard := sload(slot)
                  }
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          import "../common/Enum.sol";
          import "../common/SelfAuthorized.sol";
          import "./Executor.sol";
          /// @title Module Manager - A contract that manages modules that can execute transactions via this contract
          /// @author Stefan George - <stefan@gnosis.pm>
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract ModuleManager is SelfAuthorized, Executor {
              event EnabledModule(address module);
              event DisabledModule(address module);
              event ExecutionFromModuleSuccess(address indexed module);
              event ExecutionFromModuleFailure(address indexed module);
              address internal constant SENTINEL_MODULES = address(0x1);
              mapping(address => address) internal modules;
              function setupModules(address to, bytes memory data) internal {
                  require(modules[SENTINEL_MODULES] == address(0), "GS100");
                  modules[SENTINEL_MODULES] = SENTINEL_MODULES;
                  if (to != address(0))
                      // Setup has to complete successfully or transaction fails.
                      require(execute(to, 0, data, Enum.Operation.DelegateCall, gasleft()), "GS000");
              }
              /// @dev Allows to add a module to the whitelist.
              ///      This can only be done via a Safe transaction.
              /// @notice Enables the module `module` for the Safe.
              /// @param module Module to be whitelisted.
              function enableModule(address module) public authorized {
                  // Module address cannot be null or sentinel.
                  require(module != address(0) && module != SENTINEL_MODULES, "GS101");
                  // Module cannot be added twice.
                  require(modules[module] == address(0), "GS102");
                  modules[module] = modules[SENTINEL_MODULES];
                  modules[SENTINEL_MODULES] = module;
                  emit EnabledModule(module);
              }
              /// @dev Allows to remove a module from the whitelist.
              ///      This can only be done via a Safe transaction.
              /// @notice Disables the module `module` for the Safe.
              /// @param prevModule Module that pointed to the module to be removed in the linked list
              /// @param module Module to be removed.
              function disableModule(address prevModule, address module) public authorized {
                  // Validate module address and check that it corresponds to module index.
                  require(module != address(0) && module != SENTINEL_MODULES, "GS101");
                  require(modules[prevModule] == module, "GS103");
                  modules[prevModule] = modules[module];
                  modules[module] = address(0);
                  emit DisabledModule(module);
              }
              /// @dev Allows a Module to execute a Safe transaction without any further confirmations.
              /// @param to Destination address of module transaction.
              /// @param value Ether value of module transaction.
              /// @param data Data payload of module transaction.
              /// @param operation Operation type of module transaction.
              function execTransactionFromModule(
                  address to,
                  uint256 value,
                  bytes memory data,
                  Enum.Operation operation
              ) public virtual returns (bool success) {
                  // Only whitelisted modules are allowed.
                  require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "GS104");
                  // Execute transaction without further confirmations.
                  success = execute(to, value, data, operation, gasleft());
                  if (success) emit ExecutionFromModuleSuccess(msg.sender);
                  else emit ExecutionFromModuleFailure(msg.sender);
              }
              /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data
              /// @param to Destination address of module transaction.
              /// @param value Ether value of module transaction.
              /// @param data Data payload of module transaction.
              /// @param operation Operation type of module transaction.
              function execTransactionFromModuleReturnData(
                  address to,
                  uint256 value,
                  bytes memory data,
                  Enum.Operation operation
              ) public returns (bool success, bytes memory returnData) {
                  success = execTransactionFromModule(to, value, data, operation);
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      // Load free memory location
                      let ptr := mload(0x40)
                      // We allocate memory for the return data by setting the free memory location to
                      // current free memory location + data size + 32 bytes for data size value
                      mstore(0x40, add(ptr, add(returndatasize(), 0x20)))
                      // Store the size
                      mstore(ptr, returndatasize())
                      // Store the data
                      returndatacopy(add(ptr, 0x20), 0, returndatasize())
                      // Point the return data to the correct memory location
                      returnData := ptr
                  }
              }
              /// @dev Returns if an module is enabled
              /// @return True if the module is enabled
              function isModuleEnabled(address module) public view returns (bool) {
                  return SENTINEL_MODULES != module && modules[module] != address(0);
              }
              /// @dev Returns array of modules.
              /// @param start Start of the page.
              /// @param pageSize Maximum number of modules that should be returned.
              /// @return array Array of modules.
              /// @return next Start of the next page.
              function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) {
                  // Init array with max page size
                  array = new address[](pageSize);
                  // Populate return array
                  uint256 moduleCount = 0;
                  address currentModule = modules[start];
                  while (currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {
                      array[moduleCount] = currentModule;
                      currentModule = modules[currentModule];
                      moduleCount++;
                  }
                  next = currentModule;
                  // Set correct size of returned array
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      mstore(array, moduleCount)
                  }
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          import "../common/SelfAuthorized.sol";
          /// @title OwnerManager - Manages a set of owners and a threshold to perform actions.
          /// @author Stefan George - <stefan@gnosis.pm>
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract OwnerManager is SelfAuthorized {
              event AddedOwner(address owner);
              event RemovedOwner(address owner);
              event ChangedThreshold(uint256 threshold);
              address internal constant SENTINEL_OWNERS = address(0x1);
              mapping(address => address) internal owners;
              uint256 internal ownerCount;
              uint256 internal threshold;
              /// @dev Setup function sets initial storage of contract.
              /// @param _owners List of Safe owners.
              /// @param _threshold Number of required confirmations for a Safe transaction.
              function setupOwners(address[] memory _owners, uint256 _threshold) internal {
                  // Threshold can only be 0 at initialization.
                  // Check ensures that setup function can only be called once.
                  require(threshold == 0, "GS200");
                  // Validate that threshold is smaller than number of added owners.
                  require(_threshold <= _owners.length, "GS201");
                  // There has to be at least one Safe owner.
                  require(_threshold >= 1, "GS202");
                  // Initializing Safe owners.
                  address currentOwner = SENTINEL_OWNERS;
                  for (uint256 i = 0; i < _owners.length; i++) {
                      // Owner address cannot be null.
                      address owner = _owners[i];
                      require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, "GS203");
                      // No duplicate owners allowed.
                      require(owners[owner] == address(0), "GS204");
                      owners[currentOwner] = owner;
                      currentOwner = owner;
                  }
                  owners[currentOwner] = SENTINEL_OWNERS;
                  ownerCount = _owners.length;
                  threshold = _threshold;
              }
              /// @dev Allows to add a new owner to the Safe and update the threshold at the same time.
              ///      This can only be done via a Safe transaction.
              /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.
              /// @param owner New owner address.
              /// @param _threshold New threshold.
              function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized {
                  // Owner address cannot be null, the sentinel or the Safe itself.
                  require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), "GS203");
                  // No duplicate owners allowed.
                  require(owners[owner] == address(0), "GS204");
                  owners[owner] = owners[SENTINEL_OWNERS];
                  owners[SENTINEL_OWNERS] = owner;
                  ownerCount++;
                  emit AddedOwner(owner);
                  // Change threshold if threshold was changed.
                  if (threshold != _threshold) changeThreshold(_threshold);
              }
              /// @dev Allows to remove an owner from the Safe and update the threshold at the same time.
              ///      This can only be done via a Safe transaction.
              /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.
              /// @param prevOwner Owner that pointed to the owner to be removed in the linked list
              /// @param owner Owner address to be removed.
              /// @param _threshold New threshold.
              function removeOwner(
                  address prevOwner,
                  address owner,
                  uint256 _threshold
              ) public authorized {
                  // Only allow to remove an owner, if threshold can still be reached.
                  require(ownerCount - 1 >= _threshold, "GS201");
                  // Validate owner address and check that it corresponds to owner index.
                  require(owner != address(0) && owner != SENTINEL_OWNERS, "GS203");
                  require(owners[prevOwner] == owner, "GS205");
                  owners[prevOwner] = owners[owner];
                  owners[owner] = address(0);
                  ownerCount--;
                  emit RemovedOwner(owner);
                  // Change threshold if threshold was changed.
                  if (threshold != _threshold) changeThreshold(_threshold);
              }
              /// @dev Allows to swap/replace an owner from the Safe with another address.
              ///      This can only be done via a Safe transaction.
              /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`.
              /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list
              /// @param oldOwner Owner address to be replaced.
              /// @param newOwner New owner address.
              function swapOwner(
                  address prevOwner,
                  address oldOwner,
                  address newOwner
              ) public authorized {
                  // Owner address cannot be null, the sentinel or the Safe itself.
                  require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), "GS203");
                  // No duplicate owners allowed.
                  require(owners[newOwner] == address(0), "GS204");
                  // Validate oldOwner address and check that it corresponds to owner index.
                  require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "GS203");
                  require(owners[prevOwner] == oldOwner, "GS205");
                  owners[newOwner] = owners[oldOwner];
                  owners[prevOwner] = newOwner;
                  owners[oldOwner] = address(0);
                  emit RemovedOwner(oldOwner);
                  emit AddedOwner(newOwner);
              }
              /// @dev Allows to update the number of required confirmations by Safe owners.
              ///      This can only be done via a Safe transaction.
              /// @notice Changes the threshold of the Safe to `_threshold`.
              /// @param _threshold New threshold.
              function changeThreshold(uint256 _threshold) public authorized {
                  // Validate that threshold is smaller than number of owners.
                  require(_threshold <= ownerCount, "GS201");
                  // There has to be at least one Safe owner.
                  require(_threshold >= 1, "GS202");
                  threshold = _threshold;
                  emit ChangedThreshold(threshold);
              }
              function getThreshold() public view returns (uint256) {
                  return threshold;
              }
              function isOwner(address owner) public view returns (bool) {
                  return owner != SENTINEL_OWNERS && owners[owner] != address(0);
              }
              /// @dev Returns array of owners.
              /// @return Array of Safe owners.
              function getOwners() public view returns (address[] memory) {
                  address[] memory array = new address[](ownerCount);
                  // populate return array
                  uint256 index = 0;
                  address currentOwner = owners[SENTINEL_OWNERS];
                  while (currentOwner != SENTINEL_OWNERS) {
                      array[index] = currentOwner;
                      currentOwner = owners[currentOwner];
                      index++;
                  }
                  return array;
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          /// @title Enum - Collection of enums
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract Enum {
              enum Operation {Call, DelegateCall}
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          /// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract EtherPaymentFallback {
              event SafeReceived(address indexed sender, uint256 value);
              /// @dev Fallback function accepts Ether transactions.
              receive() external payable {
                  emit SafeReceived(msg.sender, msg.value);
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          /// @title SecuredTokenTransfer - Secure token transfer
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract SecuredTokenTransfer {
              /// @dev Transfers a token and returns if it was a success
              /// @param token Token that should be transferred
              /// @param receiver Receiver to whom the token should be transferred
              /// @param amount The amount of tokens that should be transferred
              function transferToken(
                  address token,
                  address receiver,
                  uint256 amount
              ) internal returns (bool transferred) {
                  // 0xa9059cbb - keccack("transfer(address,uint256)")
                  bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount);
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      // We write the return value to scratch space.
                      // See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory
                      let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)
                      switch returndatasize()
                          case 0 {
                              transferred := success
                          }
                          case 0x20 {
                              transferred := iszero(or(iszero(success), iszero(mload(0))))
                          }
                          default {
                              transferred := 0
                          }
                  }
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          /// @title SelfAuthorized - authorizes current contract to perform actions
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract SelfAuthorized {
              function requireSelfCall() private view {
                  require(msg.sender == address(this), "GS031");
              }
              modifier authorized() {
                  // This is a function call as it minimized the bytecode size
                  requireSelfCall();
                  _;
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          /// @title SignatureDecoder - Decodes signatures that a encoded as bytes
          /// @author Richard Meissner - <richard@gnosis.pm>
          contract SignatureDecoder {
              /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`.
              /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures
              /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access
              /// @param signatures concatenated rsv signatures
              function signatureSplit(bytes memory signatures, uint256 pos)
                  internal
                  pure
                  returns (
                      uint8 v,
                      bytes32 r,
                      bytes32 s
                  )
              {
                  // The signature format is a compact form of:
                  //   {bytes32 r}{bytes32 s}{uint8 v}
                  // Compact means, uint8 is not padded to 32 bytes.
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      let signaturePos := mul(0x41, pos)
                      r := mload(add(signatures, add(signaturePos, 0x20)))
                      s := mload(add(signatures, add(signaturePos, 0x40)))
                      // Here we are loading the last 32 bytes, including 31 bytes
                      // of 's'. There is no 'mload8' to do this.
                      //
                      // 'byte' is not working due to the Solidity parser, so lets
                      // use the second best option, 'and'
                      v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff)
                  }
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          /// @title Singleton - Base for singleton contracts (should always be first super contract)
          ///         This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`)
          /// @author Richard Meissner - <richard@gnosis.io>
          contract Singleton {
              // singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.
              // It should also always be ensured that the address is stored alone (uses a full word)
              address private singleton;
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          /// @title StorageAccessible - generic base contract that allows callers to access all internal storage.
          /// @notice See https://github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol
          contract StorageAccessible {
              /**
               * @dev Reads `length` bytes of storage in the currents contract
               * @param offset - the offset in the current contract's storage in words to start reading from
               * @param length - the number of words (32 bytes) of data to read
               * @return the bytes that were read.
               */
              function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {
                  bytes memory result = new bytes(length * 32);
                  for (uint256 index = 0; index < length; index++) {
                      // solhint-disable-next-line no-inline-assembly
                      assembly {
                          let word := sload(add(offset, index))
                          mstore(add(add(result, 0x20), mul(index, 0x20)), word)
                      }
                  }
                  return result;
              }
              /**
               * @dev Performs a delegetecall on a targetContract in the context of self.
               * Internally reverts execution to avoid side effects (making it static).
               *
               * This method reverts with data equal to `abi.encode(bool(success), bytes(response))`.
               * Specifically, the `returndata` after a call to this method will be:
               * `success:bool || response.length:uint256 || response:bytes`.
               *
               * @param targetContract Address of the contract containing the code to execute.
               * @param calldataPayload Calldata that should be sent to the target contract (encoded method name and arguments).
               */
              function simulateAndRevert(address targetContract, bytes memory calldataPayload) external {
                  // solhint-disable-next-line no-inline-assembly
                  assembly {
                      let success := delegatecall(gas(), targetContract, add(calldataPayload, 0x20), mload(calldataPayload), 0, 0)
                      mstore(0x00, success)
                      mstore(0x20, returndatasize())
                      returndatacopy(0x40, 0, returndatasize())
                      revert(0, add(returndatasize(), 0x40))
                  }
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          /**
           * @title GnosisSafeMath
           * @dev Math operations with safety checks that revert on error
           * Renamed from SafeMath to GnosisSafeMath to avoid conflicts
           * TODO: remove once open zeppelin update to solc 0.5.0
           */
          library GnosisSafeMath {
              /**
               * @dev Multiplies two numbers, reverts on overflow.
               */
              function mul(uint256 a, uint256 b) internal pure returns (uint256) {
                  // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
                  // benefit is lost if 'b' is also tested.
                  // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
                  if (a == 0) {
                      return 0;
                  }
                  uint256 c = a * b;
                  require(c / a == b);
                  return c;
              }
              /**
               * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
               */
              function sub(uint256 a, uint256 b) internal pure returns (uint256) {
                  require(b <= a);
                  uint256 c = a - b;
                  return c;
              }
              /**
               * @dev Adds two numbers, reverts on overflow.
               */
              function add(uint256 a, uint256 b) internal pure returns (uint256) {
                  uint256 c = a + b;
                  require(c >= a);
                  return c;
              }
              /**
               * @dev Returns the largest of two numbers.
               */
              function max(uint256 a, uint256 b) internal pure returns (uint256) {
                  return a >= b ? a : b;
              }
          }
          // SPDX-License-Identifier: LGPL-3.0-only
          pragma solidity >=0.7.0 <0.9.0;
          contract ISignatureValidatorConstants {
              // bytes4(keccak256("isValidSignature(bytes,bytes)")
              bytes4 internal constant EIP1271_MAGIC_VALUE = 0x20c13b0b;
          }
          abstract contract ISignatureValidator is ISignatureValidatorConstants {
              /**
               * @dev Should return whether the signature provided is valid for the provided data
               * @param _data Arbitrary length data signed on the behalf of address(this)
               * @param _signature Signature byte array associated with _data
               *
               * MUST return the bytes4 magic value 0x20c13b0b when function passes.
               * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)
               * MUST allow external calls
               */
              function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);
          }
          

          File 4 of 5: KernelProxy
          /**
           *Submitted for verification at Etherscan.io on 2020-02-06
          */
          
          // File: contracts/acl/IACL.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          interface IACL {
              function initialize(address permissionsCreator) external;
          
              // TODO: this should be external
              // See https://github.com/ethereum/solidity/issues/4832
              function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);
          }
          
          // File: contracts/common/IVaultRecoverable.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          interface IVaultRecoverable {
              event RecoverToVault(address indexed vault, address indexed token, uint256 amount);
          
              function transferToVault(address token) external;
          
              function allowRecoverability(address token) external view returns (bool);
              function getRecoveryVault() external view returns (address);
          }
          
          // File: contracts/kernel/IKernel.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          interface IKernelEvents {
              event SetApp(bytes32 indexed namespace, bytes32 indexed appId, address app);
          }
          
          
          // This should be an interface, but interfaces can't inherit yet :(
          contract IKernel is IKernelEvents, IVaultRecoverable {
              function acl() public view returns (IACL);
              function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);
          
              function setApp(bytes32 namespace, bytes32 appId, address app) public;
              function getApp(bytes32 namespace, bytes32 appId) public view returns (address);
          }
          
          // File: contracts/kernel/KernelConstants.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract KernelAppIds {
              /* Hardcoded constants to save gas
              bytes32 internal constant KERNEL_CORE_APP_ID = apmNamehash("kernel");
              bytes32 internal constant KERNEL_DEFAULT_ACL_APP_ID = apmNamehash("acl");
              bytes32 internal constant KERNEL_DEFAULT_VAULT_APP_ID = apmNamehash("vault");
              */
              bytes32 internal constant KERNEL_CORE_APP_ID = 0x3b4bf6bf3ad5000ecf0f989d5befde585c6860fea3e574a4fab4c49d1c177d9c;
              bytes32 internal constant KERNEL_DEFAULT_ACL_APP_ID = 0xe3262375f45a6e2026b7e7b18c2b807434f2508fe1a2a3dfb493c7df8f4aad6a;
              bytes32 internal constant KERNEL_DEFAULT_VAULT_APP_ID = 0x7e852e0fcfce6551c13800f1e7476f982525c2b5277ba14b24339c68416336d1;
          }
          
          
          contract KernelNamespaceConstants {
              /* Hardcoded constants to save gas
              bytes32 internal constant KERNEL_CORE_NAMESPACE = keccak256("core");
              bytes32 internal constant KERNEL_APP_BASES_NAMESPACE = keccak256("base");
              bytes32 internal constant KERNEL_APP_ADDR_NAMESPACE = keccak256("app");
              */
              bytes32 internal constant KERNEL_CORE_NAMESPACE = 0xc681a85306374a5ab27f0bbc385296a54bcd314a1948b6cf61c4ea1bc44bb9f8;
              bytes32 internal constant KERNEL_APP_BASES_NAMESPACE = 0xf1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f;
              bytes32 internal constant KERNEL_APP_ADDR_NAMESPACE = 0xd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb;
          }
          
          // File: contracts/kernel/KernelStorage.sol
          
          pragma solidity 0.4.24;
          
          
          contract KernelStorage {
              // namespace => app id => address
              mapping (bytes32 => mapping (bytes32 => address)) public apps;
              bytes32 public recoveryVaultAppId;
          }
          
          // File: contracts/acl/ACLSyntaxSugar.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract ACLSyntaxSugar {
              function arr() internal pure returns (uint256[]) {
                  return new uint256[](0);
              }
          
              function arr(bytes32 _a) internal pure returns (uint256[] r) {
                  return arr(uint256(_a));
              }
          
              function arr(bytes32 _a, bytes32 _b) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b));
              }
          
              function arr(address _a) internal pure returns (uint256[] r) {
                  return arr(uint256(_a));
              }
          
              function arr(address _a, address _b) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b));
              }
          
              function arr(address _a, uint256 _b, uint256 _c) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), _b, _c);
              }
          
              function arr(address _a, uint256 _b, uint256 _c, uint256 _d) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), _b, _c, _d);
              }
          
              function arr(address _a, uint256 _b) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b));
              }
          
              function arr(address _a, address _b, uint256 _c, uint256 _d, uint256 _e) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b), _c, _d, _e);
              }
          
              function arr(address _a, address _b, address _c) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b), uint256(_c));
              }
          
              function arr(address _a, address _b, uint256 _c) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b), uint256(_c));
              }
          
              function arr(uint256 _a) internal pure returns (uint256[] r) {
                  r = new uint256[](1);
                  r[0] = _a;
              }
          
              function arr(uint256 _a, uint256 _b) internal pure returns (uint256[] r) {
                  r = new uint256[](2);
                  r[0] = _a;
                  r[1] = _b;
              }
          
              function arr(uint256 _a, uint256 _b, uint256 _c) internal pure returns (uint256[] r) {
                  r = new uint256[](3);
                  r[0] = _a;
                  r[1] = _b;
                  r[2] = _c;
              }
          
              function arr(uint256 _a, uint256 _b, uint256 _c, uint256 _d) internal pure returns (uint256[] r) {
                  r = new uint256[](4);
                  r[0] = _a;
                  r[1] = _b;
                  r[2] = _c;
                  r[3] = _d;
              }
          
              function arr(uint256 _a, uint256 _b, uint256 _c, uint256 _d, uint256 _e) internal pure returns (uint256[] r) {
                  r = new uint256[](5);
                  r[0] = _a;
                  r[1] = _b;
                  r[2] = _c;
                  r[3] = _d;
                  r[4] = _e;
              }
          }
          
          
          contract ACLHelpers {
              function decodeParamOp(uint256 _x) internal pure returns (uint8 b) {
                  return uint8(_x >> (8 * 30));
              }
          
              function decodeParamId(uint256 _x) internal pure returns (uint8 b) {
                  return uint8(_x >> (8 * 31));
              }
          
              function decodeParamsList(uint256 _x) internal pure returns (uint32 a, uint32 b, uint32 c) {
                  a = uint32(_x);
                  b = uint32(_x >> (8 * 4));
                  c = uint32(_x >> (8 * 8));
              }
          }
          
          // File: contracts/common/ConversionHelpers.sol
          
          pragma solidity ^0.4.24;
          
          
          library ConversionHelpers {
              string private constant ERROR_IMPROPER_LENGTH = "CONVERSION_IMPROPER_LENGTH";
          
              function dangerouslyCastUintArrayToBytes(uint256[] memory _input) internal pure returns (bytes memory output) {
                  // Force cast the uint256[] into a bytes array, by overwriting its length
                  // Note that the bytes array doesn't need to be initialized as we immediately overwrite it
                  // with the input and a new length. The input becomes invalid from this point forward.
                  uint256 byteLength = _input.length * 32;
                  assembly {
                      output := _input
                      mstore(output, byteLength)
                  }
              }
          
              function dangerouslyCastBytesToUintArray(bytes memory _input) internal pure returns (uint256[] memory output) {
                  // Force cast the bytes array into a uint256[], by overwriting its length
                  // Note that the uint256[] doesn't need to be initialized as we immediately overwrite it
                  // with the input and a new length. The input becomes invalid from this point forward.
                  uint256 intsLength = _input.length / 32;
                  require(_input.length == intsLength * 32, ERROR_IMPROPER_LENGTH);
          
                  assembly {
                      output := _input
                      mstore(output, intsLength)
                  }
              }
          }
          
          // File: contracts/common/IsContract.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract IsContract {
              /*
              * NOTE: this should NEVER be used for authentication
              * (see pitfalls: https://github.com/fergarrui/ethereum-security/tree/master/contracts/extcodesize).
              *
              * This is only intended to be used as a sanity check that an address is actually a contract,
              * RATHER THAN an address not being a contract.
              */
              function isContract(address _target) internal view returns (bool) {
                  if (_target == address(0)) {
                      return false;
                  }
          
                  uint256 size;
                  assembly { size := extcodesize(_target) }
                  return size > 0;
              }
          }
          
          // File: contracts/common/Uint256Helpers.sol
          
          pragma solidity ^0.4.24;
          
          
          library Uint256Helpers {
              uint256 private constant MAX_UINT64 = uint64(-1);
          
              string private constant ERROR_NUMBER_TOO_BIG = "UINT64_NUMBER_TOO_BIG";
          
              function toUint64(uint256 a) internal pure returns (uint64) {
                  require(a <= MAX_UINT64, ERROR_NUMBER_TOO_BIG);
                  return uint64(a);
              }
          }
          
          // File: contracts/common/TimeHelpers.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          contract TimeHelpers {
              using Uint256Helpers for uint256;
          
              /**
              * @dev Returns the current block number.
              *      Using a function rather than `block.number` allows us to easily mock the block number in
              *      tests.
              */
              function getBlockNumber() internal view returns (uint256) {
                  return block.number;
              }
          
              /**
              * @dev Returns the current block number, converted to uint64.
              *      Using a function rather than `block.number` allows us to easily mock the block number in
              *      tests.
              */
              function getBlockNumber64() internal view returns (uint64) {
                  return getBlockNumber().toUint64();
              }
          
              /**
              * @dev Returns the current timestamp.
              *      Using a function rather than `block.timestamp` allows us to easily mock it in
              *      tests.
              */
              function getTimestamp() internal view returns (uint256) {
                  return block.timestamp; // solium-disable-line security/no-block-members
              }
          
              /**
              * @dev Returns the current timestamp, converted to uint64.
              *      Using a function rather than `block.timestamp` allows us to easily mock it in
              *      tests.
              */
              function getTimestamp64() internal view returns (uint64) {
                  return getTimestamp().toUint64();
              }
          }
          
          // File: contracts/common/UnstructuredStorage.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          library UnstructuredStorage {
              function getStorageBool(bytes32 position) internal view returns (bool data) {
                  assembly { data := sload(position) }
              }
          
              function getStorageAddress(bytes32 position) internal view returns (address data) {
                  assembly { data := sload(position) }
              }
          
              function getStorageBytes32(bytes32 position) internal view returns (bytes32 data) {
                  assembly { data := sload(position) }
              }
          
              function getStorageUint256(bytes32 position) internal view returns (uint256 data) {
                  assembly { data := sload(position) }
              }
          
              function setStorageBool(bytes32 position, bool data) internal {
                  assembly { sstore(position, data) }
              }
          
              function setStorageAddress(bytes32 position, address data) internal {
                  assembly { sstore(position, data) }
              }
          
              function setStorageBytes32(bytes32 position, bytes32 data) internal {
                  assembly { sstore(position, data) }
              }
          
              function setStorageUint256(bytes32 position, uint256 data) internal {
                  assembly { sstore(position, data) }
              }
          }
          
          // File: contracts/common/Initializable.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          contract Initializable is TimeHelpers {
              using UnstructuredStorage for bytes32;
          
              // keccak256("aragonOS.initializable.initializationBlock")
              bytes32 internal constant INITIALIZATION_BLOCK_POSITION = 0xebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e;
          
              string private constant ERROR_ALREADY_INITIALIZED = "INIT_ALREADY_INITIALIZED";
              string private constant ERROR_NOT_INITIALIZED = "INIT_NOT_INITIALIZED";
          
              modifier onlyInit {
                  require(getInitializationBlock() == 0, ERROR_ALREADY_INITIALIZED);
                  _;
              }
          
              modifier isInitialized {
                  require(hasInitialized(), ERROR_NOT_INITIALIZED);
                  _;
              }
          
              /**
              * @return Block number in which the contract was initialized
              */
              function getInitializationBlock() public view returns (uint256) {
                  return INITIALIZATION_BLOCK_POSITION.getStorageUint256();
              }
          
              /**
              * @return Whether the contract has been initialized by the time of the current block
              */
              function hasInitialized() public view returns (bool) {
                  uint256 initializationBlock = getInitializationBlock();
                  return initializationBlock != 0 && getBlockNumber() >= initializationBlock;
              }
          
              /**
              * @dev Function to be called by top level contract after initialization has finished.
              */
              function initialized() internal onlyInit {
                  INITIALIZATION_BLOCK_POSITION.setStorageUint256(getBlockNumber());
              }
          
              /**
              * @dev Function to be called by top level contract after initialization to enable the contract
              *      at a future block number rather than immediately.
              */
              function initializedAt(uint256 _blockNumber) internal onlyInit {
                  INITIALIZATION_BLOCK_POSITION.setStorageUint256(_blockNumber);
              }
          }
          
          // File: contracts/common/Petrifiable.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          contract Petrifiable is Initializable {
              // Use block UINT256_MAX (which should be never) as the initializable date
              uint256 internal constant PETRIFIED_BLOCK = uint256(-1);
          
              function isPetrified() public view returns (bool) {
                  return getInitializationBlock() == PETRIFIED_BLOCK;
              }
          
              /**
              * @dev Function to be called by top level contract to prevent being initialized.
              *      Useful for freezing base contracts when they're used behind proxies.
              */
              function petrify() internal onlyInit {
                  initializedAt(PETRIFIED_BLOCK);
              }
          }
          
          // File: contracts/lib/token/ERC20.sol
          
          // See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/a9f910d34f0ab33a1ae5e714f69f9596a02b4d91/contracts/token/ERC20/ERC20.sol
          
          pragma solidity ^0.4.24;
          
          
          /**
           * @title ERC20 interface
           * @dev see https://github.com/ethereum/EIPs/issues/20
           */
          contract ERC20 {
              function totalSupply() public view returns (uint256);
          
              function balanceOf(address _who) public view returns (uint256);
          
              function allowance(address _owner, address _spender)
                  public view returns (uint256);
          
              function transfer(address _to, uint256 _value) public returns (bool);
          
              function approve(address _spender, uint256 _value)
                  public returns (bool);
          
              function transferFrom(address _from, address _to, uint256 _value)
                  public returns (bool);
          
              event Transfer(
                  address indexed from,
                  address indexed to,
                  uint256 value
              );
          
              event Approval(
                  address indexed owner,
                  address indexed spender,
                  uint256 value
              );
          }
          
          // File: contracts/common/EtherTokenConstant.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          // aragonOS and aragon-apps rely on address(0) to denote native ETH, in
          // contracts where both tokens and ETH are accepted
          contract EtherTokenConstant {
              address internal constant ETH = address(0);
          }
          
          // File: contracts/common/SafeERC20.sol
          
          // Inspired by AdEx (https://github.com/AdExNetwork/adex-protocol-eth/blob/b9df617829661a7518ee10f4cb6c4108659dd6d5/contracts/libs/SafeERC20.sol)
          // and 0x (https://github.com/0xProject/0x-monorepo/blob/737d1dc54d72872e24abce5a1dbe1b66d35fa21a/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol#L143)
          
          pragma solidity ^0.4.24;
          
          
          
          library SafeERC20 {
              // Before 0.5, solidity has a mismatch between `address.transfer()` and `token.transfer()`:
              // https://github.com/ethereum/solidity/issues/3544
              bytes4 private constant TRANSFER_SELECTOR = 0xa9059cbb;
          
              string private constant ERROR_TOKEN_BALANCE_REVERTED = "SAFE_ERC_20_BALANCE_REVERTED";
              string private constant ERROR_TOKEN_ALLOWANCE_REVERTED = "SAFE_ERC_20_ALLOWANCE_REVERTED";
          
              function invokeAndCheckSuccess(address _addr, bytes memory _calldata)
                  private
                  returns (bool)
              {
                  bool ret;
                  assembly {
                      let ptr := mload(0x40)    // free memory pointer
          
                      let success := call(
                          gas,                  // forward all gas
                          _addr,                // address
                          0,                    // no value
                          add(_calldata, 0x20), // calldata start
                          mload(_calldata),     // calldata length
                          ptr,                  // write output over free memory
                          0x20                  // uint256 return
                      )
          
                      if gt(success, 0) {
                          // Check number of bytes returned from last function call
                          switch returndatasize
          
                          // No bytes returned: assume success
                          case 0 {
                              ret := 1
                          }
          
                          // 32 bytes returned: check if non-zero
                          case 0x20 {
                              // Only return success if returned data was true
                              // Already have output in ptr
                              ret := eq(mload(ptr), 1)
                          }
          
                          // Not sure what was returned: don't mark as success
                          default { }
                      }
                  }
                  return ret;
              }
          
              function staticInvoke(address _addr, bytes memory _calldata)
                  private
                  view
                  returns (bool, uint256)
              {
                  bool success;
                  uint256 ret;
                  assembly {
                      let ptr := mload(0x40)    // free memory pointer
          
                      success := staticcall(
                          gas,                  // forward all gas
                          _addr,                // address
                          add(_calldata, 0x20), // calldata start
                          mload(_calldata),     // calldata length
                          ptr,                  // write output over free memory
                          0x20                  // uint256 return
                      )
          
                      if gt(success, 0) {
                          ret := mload(ptr)
                      }
                  }
                  return (success, ret);
              }
          
              /**
              * @dev Same as a standards-compliant ERC20.transfer() that never reverts (returns false).
              *      Note that this makes an external call to the token.
              */
              function safeTransfer(ERC20 _token, address _to, uint256 _amount) internal returns (bool) {
                  bytes memory transferCallData = abi.encodeWithSelector(
                      TRANSFER_SELECTOR,
                      _to,
                      _amount
                  );
                  return invokeAndCheckSuccess(_token, transferCallData);
              }
          
              /**
              * @dev Same as a standards-compliant ERC20.transferFrom() that never reverts (returns false).
              *      Note that this makes an external call to the token.
              */
              function safeTransferFrom(ERC20 _token, address _from, address _to, uint256 _amount) internal returns (bool) {
                  bytes memory transferFromCallData = abi.encodeWithSelector(
                      _token.transferFrom.selector,
                      _from,
                      _to,
                      _amount
                  );
                  return invokeAndCheckSuccess(_token, transferFromCallData);
              }
          
              /**
              * @dev Same as a standards-compliant ERC20.approve() that never reverts (returns false).
              *      Note that this makes an external call to the token.
              */
              function safeApprove(ERC20 _token, address _spender, uint256 _amount) internal returns (bool) {
                  bytes memory approveCallData = abi.encodeWithSelector(
                      _token.approve.selector,
                      _spender,
                      _amount
                  );
                  return invokeAndCheckSuccess(_token, approveCallData);
              }
          
              /**
              * @dev Static call into ERC20.balanceOf().
              * Reverts if the call fails for some reason (should never fail).
              */
              function staticBalanceOf(ERC20 _token, address _owner) internal view returns (uint256) {
                  bytes memory balanceOfCallData = abi.encodeWithSelector(
                      _token.balanceOf.selector,
                      _owner
                  );
          
                  (bool success, uint256 tokenBalance) = staticInvoke(_token, balanceOfCallData);
                  require(success, ERROR_TOKEN_BALANCE_REVERTED);
          
                  return tokenBalance;
              }
          
              /**
              * @dev Static call into ERC20.allowance().
              * Reverts if the call fails for some reason (should never fail).
              */
              function staticAllowance(ERC20 _token, address _owner, address _spender) internal view returns (uint256) {
                  bytes memory allowanceCallData = abi.encodeWithSelector(
                      _token.allowance.selector,
                      _owner,
                      _spender
                  );
          
                  (bool success, uint256 allowance) = staticInvoke(_token, allowanceCallData);
                  require(success, ERROR_TOKEN_ALLOWANCE_REVERTED);
          
                  return allowance;
              }
          
              /**
              * @dev Static call into ERC20.totalSupply().
              * Reverts if the call fails for some reason (should never fail).
              */
              function staticTotalSupply(ERC20 _token) internal view returns (uint256) {
                  bytes memory totalSupplyCallData = abi.encodeWithSelector(_token.totalSupply.selector);
          
                  (bool success, uint256 totalSupply) = staticInvoke(_token, totalSupplyCallData);
                  require(success, ERROR_TOKEN_ALLOWANCE_REVERTED);
          
                  return totalSupply;
              }
          }
          
          // File: contracts/common/VaultRecoverable.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          
          
          
          contract VaultRecoverable is IVaultRecoverable, EtherTokenConstant, IsContract {
              using SafeERC20 for ERC20;
          
              string private constant ERROR_DISALLOWED = "RECOVER_DISALLOWED";
              string private constant ERROR_VAULT_NOT_CONTRACT = "RECOVER_VAULT_NOT_CONTRACT";
              string private constant ERROR_TOKEN_TRANSFER_FAILED = "RECOVER_TOKEN_TRANSFER_FAILED";
          
              /**
               * @notice Send funds to recovery Vault. This contract should never receive funds,
               *         but in case it does, this function allows one to recover them.
               * @param _token Token balance to be sent to recovery vault.
               */
              function transferToVault(address _token) external {
                  require(allowRecoverability(_token), ERROR_DISALLOWED);
                  address vault = getRecoveryVault();
                  require(isContract(vault), ERROR_VAULT_NOT_CONTRACT);
          
                  uint256 balance;
                  if (_token == ETH) {
                      balance = address(this).balance;
                      vault.transfer(balance);
                  } else {
                      ERC20 token = ERC20(_token);
                      balance = token.staticBalanceOf(this);
                      require(token.safeTransfer(vault, balance), ERROR_TOKEN_TRANSFER_FAILED);
                  }
          
                  emit RecoverToVault(vault, _token, balance);
              }
          
              /**
              * @dev By default deriving from AragonApp makes it recoverable
              * @param token Token address that would be recovered
              * @return bool whether the app allows the recovery
              */
              function allowRecoverability(address token) public view returns (bool) {
                  return true;
              }
          
              // Cast non-implemented interface to be public so we can use it internally
              function getRecoveryVault() public view returns (address);
          }
          
          // File: contracts/apps/AppStorage.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          contract AppStorage {
              using UnstructuredStorage for bytes32;
          
              /* Hardcoded constants to save gas
              bytes32 internal constant KERNEL_POSITION = keccak256("aragonOS.appStorage.kernel");
              bytes32 internal constant APP_ID_POSITION = keccak256("aragonOS.appStorage.appId");
              */
              bytes32 internal constant KERNEL_POSITION = 0x4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b;
              bytes32 internal constant APP_ID_POSITION = 0xd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b;
          
              function kernel() public view returns (IKernel) {
                  return IKernel(KERNEL_POSITION.getStorageAddress());
              }
          
              function appId() public view returns (bytes32) {
                  return APP_ID_POSITION.getStorageBytes32();
              }
          
              function setKernel(IKernel _kernel) internal {
                  KERNEL_POSITION.setStorageAddress(address(_kernel));
              }
          
              function setAppId(bytes32 _appId) internal {
                  APP_ID_POSITION.setStorageBytes32(_appId);
              }
          }
          
          // File: contracts/lib/misc/ERCProxy.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract ERCProxy {
              uint256 internal constant FORWARDING = 1;
              uint256 internal constant UPGRADEABLE = 2;
          
              function proxyType() public pure returns (uint256 proxyTypeId);
              function implementation() public view returns (address codeAddr);
          }
          
          // File: contracts/common/DelegateProxy.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          contract DelegateProxy is ERCProxy, IsContract {
              uint256 internal constant FWD_GAS_LIMIT = 10000;
          
              /**
              * @dev Performs a delegatecall and returns whatever the delegatecall returned (entire context execution will return!)
              * @param _dst Destination address to perform the delegatecall
              * @param _calldata Calldata for the delegatecall
              */
              function delegatedFwd(address _dst, bytes _calldata) internal {
                  require(isContract(_dst));
                  uint256 fwdGasLimit = FWD_GAS_LIMIT;
          
                  assembly {
                      let result := delegatecall(sub(gas, fwdGasLimit), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)
                      let size := returndatasize
                      let ptr := mload(0x40)
                      returndatacopy(ptr, 0, size)
          
                      // revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas.
                      // if the call returned error data, forward it
                      switch result case 0 { revert(ptr, size) }
                      default { return(ptr, size) }
                  }
              }
          }
          
          // File: contracts/common/DepositableStorage.sol
          
          pragma solidity 0.4.24;
          
          
          
          contract DepositableStorage {
              using UnstructuredStorage for bytes32;
          
              // keccak256("aragonOS.depositableStorage.depositable")
              bytes32 internal constant DEPOSITABLE_POSITION = 0x665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea;
          
              function isDepositable() public view returns (bool) {
                  return DEPOSITABLE_POSITION.getStorageBool();
              }
          
              function setDepositable(bool _depositable) internal {
                  DEPOSITABLE_POSITION.setStorageBool(_depositable);
              }
          }
          
          // File: contracts/common/DepositableDelegateProxy.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          contract DepositableDelegateProxy is DepositableStorage, DelegateProxy {
              event ProxyDeposit(address sender, uint256 value);
          
              function () external payable {
                  uint256 forwardGasThreshold = FWD_GAS_LIMIT;
                  bytes32 isDepositablePosition = DEPOSITABLE_POSITION;
          
                  // Optimized assembly implementation to prevent EIP-1884 from breaking deposits, reference code in Solidity:
                  // https://github.com/aragon/aragonOS/blob/v4.2.1/contracts/common/DepositableDelegateProxy.sol#L10-L20
                  assembly {
                      // Continue only if the gas left is lower than the threshold for forwarding to the implementation code,
                      // otherwise continue outside of the assembly block.
                      if lt(gas, forwardGasThreshold) {
                          // Only accept the deposit and emit an event if all of the following are true:
                          // the proxy accepts deposits (isDepositable), msg.data.length == 0, and msg.value > 0
                          if and(and(sload(isDepositablePosition), iszero(calldatasize)), gt(callvalue, 0)) {
                              // Equivalent Solidity code for emitting the event:
                              // emit ProxyDeposit(msg.sender, msg.value);
          
                              let logData := mload(0x40) // free memory pointer
                              mstore(logData, caller) // add 'msg.sender' to the log data (first event param)
                              mstore(add(logData, 0x20), callvalue) // add 'msg.value' to the log data (second event param)
          
                              // Emit an event with one topic to identify the event: keccak256('ProxyDeposit(address,uint256)') = 0x15ee...dee1
                              log1(logData, 0x40, 0x15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1)
          
                              stop() // Stop. Exits execution context
                          }
          
                          // If any of above checks failed, revert the execution (if ETH was sent, it is returned to the sender)
                          revert(0, 0)
                      }
                  }
          
                  address target = implementation();
                  delegatedFwd(target, msg.data);
              }
          }
          
          // File: contracts/apps/AppProxyBase.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          contract AppProxyBase is AppStorage, DepositableDelegateProxy, KernelNamespaceConstants {
              /**
              * @dev Initialize AppProxy
              * @param _kernel Reference to organization kernel for the app
              * @param _appId Identifier for app
              * @param _initializePayload Payload for call to be made after setup to initialize
              */
              constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload) public {
                  setKernel(_kernel);
                  setAppId(_appId);
          
                  // Implicit check that kernel is actually a Kernel
                  // The EVM doesn't actually provide a way for us to make sure, but we can force a revert to
                  // occur if the kernel is set to 0x0 or a non-code address when we try to call a method on
                  // it.
                  address appCode = getAppBase(_appId);
          
                  // If initialize payload is provided, it will be executed
                  if (_initializePayload.length > 0) {
                      require(isContract(appCode));
                      // Cannot make delegatecall as a delegateproxy.delegatedFwd as it
                      // returns ending execution context and halts contract deployment
                      require(appCode.delegatecall(_initializePayload));
                  }
              }
          
              function getAppBase(bytes32 _appId) internal view returns (address) {
                  return kernel().getApp(KERNEL_APP_BASES_NAMESPACE, _appId);
              }
          }
          
          // File: contracts/apps/AppProxyUpgradeable.sol
          
          pragma solidity 0.4.24;
          
          
          
          contract AppProxyUpgradeable is AppProxyBase {
              /**
              * @dev Initialize AppProxyUpgradeable (makes it an upgradeable Aragon app)
              * @param _kernel Reference to organization kernel for the app
              * @param _appId Identifier for app
              * @param _initializePayload Payload for call to be made after setup to initialize
              */
              constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload)
                  AppProxyBase(_kernel, _appId, _initializePayload)
                  public // solium-disable-line visibility-first
              {
                  // solium-disable-previous-line no-empty-blocks
              }
          
              /**
               * @dev ERC897, the address the proxy would delegate calls to
               */
              function implementation() public view returns (address) {
                  return getAppBase(appId());
              }
          
              /**
               * @dev ERC897, whether it is a forwarding (1) or an upgradeable (2) proxy
               */
              function proxyType() public pure returns (uint256 proxyTypeId) {
                  return UPGRADEABLE;
              }
          }
          
          // File: contracts/apps/AppProxyPinned.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          contract AppProxyPinned is IsContract, AppProxyBase {
              using UnstructuredStorage for bytes32;
          
              // keccak256("aragonOS.appStorage.pinnedCode")
              bytes32 internal constant PINNED_CODE_POSITION = 0xdee64df20d65e53d7f51cb6ab6d921a0a6a638a91e942e1d8d02df28e31c038e;
          
              /**
              * @dev Initialize AppProxyPinned (makes it an un-upgradeable Aragon app)
              * @param _kernel Reference to organization kernel for the app
              * @param _appId Identifier for app
              * @param _initializePayload Payload for call to be made after setup to initialize
              */
              constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload)
                  AppProxyBase(_kernel, _appId, _initializePayload)
                  public // solium-disable-line visibility-first
              {
                  setPinnedCode(getAppBase(_appId));
                  require(isContract(pinnedCode()));
              }
          
              /**
               * @dev ERC897, the address the proxy would delegate calls to
               */
              function implementation() public view returns (address) {
                  return pinnedCode();
              }
          
              /**
               * @dev ERC897, whether it is a forwarding (1) or an upgradeable (2) proxy
               */
              function proxyType() public pure returns (uint256 proxyTypeId) {
                  return FORWARDING;
              }
          
              function setPinnedCode(address _pinnedCode) internal {
                  PINNED_CODE_POSITION.setStorageAddress(_pinnedCode);
              }
          
              function pinnedCode() internal view returns (address) {
                  return PINNED_CODE_POSITION.getStorageAddress();
              }
          }
          
          // File: contracts/factory/AppProxyFactory.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          contract AppProxyFactory {
              event NewAppProxy(address proxy, bool isUpgradeable, bytes32 appId);
          
              /**
              * @notice Create a new upgradeable app instance on `_kernel` with identifier `_appId`
              * @param _kernel App's Kernel reference
              * @param _appId Identifier for app
              * @return AppProxyUpgradeable
              */
              function newAppProxy(IKernel _kernel, bytes32 _appId) public returns (AppProxyUpgradeable) {
                  return newAppProxy(_kernel, _appId, new bytes(0));
              }
          
              /**
              * @notice Create a new upgradeable app instance on `_kernel` with identifier `_appId` and initialization payload `_initializePayload`
              * @param _kernel App's Kernel reference
              * @param _appId Identifier for app
              * @return AppProxyUpgradeable
              */
              function newAppProxy(IKernel _kernel, bytes32 _appId, bytes _initializePayload) public returns (AppProxyUpgradeable) {
                  AppProxyUpgradeable proxy = new AppProxyUpgradeable(_kernel, _appId, _initializePayload);
                  emit NewAppProxy(address(proxy), true, _appId);
                  return proxy;
              }
          
              /**
              * @notice Create a new pinned app instance on `_kernel` with identifier `_appId`
              * @param _kernel App's Kernel reference
              * @param _appId Identifier for app
              * @return AppProxyPinned
              */
              function newAppProxyPinned(IKernel _kernel, bytes32 _appId) public returns (AppProxyPinned) {
                  return newAppProxyPinned(_kernel, _appId, new bytes(0));
              }
          
              /**
              * @notice Create a new pinned app instance on `_kernel` with identifier `_appId` and initialization payload `_initializePayload`
              * @param _kernel App's Kernel reference
              * @param _appId Identifier for app
              * @param _initializePayload Proxy initialization payload
              * @return AppProxyPinned
              */
              function newAppProxyPinned(IKernel _kernel, bytes32 _appId, bytes _initializePayload) public returns (AppProxyPinned) {
                  AppProxyPinned proxy = new AppProxyPinned(_kernel, _appId, _initializePayload);
                  emit NewAppProxy(address(proxy), false, _appId);
                  return proxy;
              }
          }
          
          // File: contracts/kernel/Kernel.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          
          
          
          
          
          
          
          // solium-disable-next-line max-len
          contract Kernel is IKernel, KernelStorage, KernelAppIds, KernelNamespaceConstants, Petrifiable, IsContract, VaultRecoverable, AppProxyFactory, ACLSyntaxSugar {
              /* Hardcoded constants to save gas
              bytes32 public constant APP_MANAGER_ROLE = keccak256("APP_MANAGER_ROLE");
              */
              bytes32 public constant APP_MANAGER_ROLE = 0xb6d92708f3d4817afc106147d969e229ced5c46e65e0a5002a0d391287762bd0;
          
              string private constant ERROR_APP_NOT_CONTRACT = "KERNEL_APP_NOT_CONTRACT";
              string private constant ERROR_INVALID_APP_CHANGE = "KERNEL_INVALID_APP_CHANGE";
              string private constant ERROR_AUTH_FAILED = "KERNEL_AUTH_FAILED";
          
              /**
              * @dev Constructor that allows the deployer to choose if the base instance should be petrified immediately.
              * @param _shouldPetrify Immediately petrify this instance so that it can never be initialized
              */
              constructor(bool _shouldPetrify) public {
                  if (_shouldPetrify) {
                      petrify();
                  }
              }
          
              /**
              * @dev Initialize can only be called once. It saves the block number in which it was initialized.
              * @notice Initialize this kernel instance along with its ACL and set `_permissionsCreator` as the entity that can create other permissions
              * @param _baseAcl Address of base ACL app
              * @param _permissionsCreator Entity that will be given permission over createPermission
              */
              function initialize(IACL _baseAcl, address _permissionsCreator) public onlyInit {
                  initialized();
          
                  // Set ACL base
                  _setApp(KERNEL_APP_BASES_NAMESPACE, KERNEL_DEFAULT_ACL_APP_ID, _baseAcl);
          
                  // Create ACL instance and attach it as the default ACL app
                  IACL acl = IACL(newAppProxy(this, KERNEL_DEFAULT_ACL_APP_ID));
                  acl.initialize(_permissionsCreator);
                  _setApp(KERNEL_APP_ADDR_NAMESPACE, KERNEL_DEFAULT_ACL_APP_ID, acl);
          
                  recoveryVaultAppId = KERNEL_DEFAULT_VAULT_APP_ID;
              }
          
              /**
              * @dev Create a new instance of an app linked to this kernel
              * @notice Create a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`
              * @param _appId Identifier for app
              * @param _appBase Address of the app's base implementation
              * @return AppProxy instance
              */
              function newAppInstance(bytes32 _appId, address _appBase)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
                  returns (ERCProxy appProxy)
              {
                  return newAppInstance(_appId, _appBase, new bytes(0), false);
              }
          
              /**
              * @dev Create a new instance of an app linked to this kernel and set its base
              *      implementation if it was not already set
              * @notice Create a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`
              * @param _appId Identifier for app
              * @param _appBase Address of the app's base implementation
              * @param _initializePayload Payload for call made by the proxy during its construction to initialize
              * @param _setDefault Whether the app proxy app is the default one.
              *        Useful when the Kernel needs to know of an instance of a particular app,
              *        like Vault for escape hatch mechanism.
              * @return AppProxy instance
              */
              function newAppInstance(bytes32 _appId, address _appBase, bytes _initializePayload, bool _setDefault)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
                  returns (ERCProxy appProxy)
              {
                  _setAppIfNew(KERNEL_APP_BASES_NAMESPACE, _appId, _appBase);
                  appProxy = newAppProxy(this, _appId, _initializePayload);
                  // By calling setApp directly and not the internal functions, we make sure the params are checked
                  // and it will only succeed if sender has permissions to set something to the namespace.
                  if (_setDefault) {
                      setApp(KERNEL_APP_ADDR_NAMESPACE, _appId, appProxy);
                  }
              }
          
              /**
              * @dev Create a new pinned instance of an app linked to this kernel
              * @notice Create a new non-upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`.
              * @param _appId Identifier for app
              * @param _appBase Address of the app's base implementation
              * @return AppProxy instance
              */
              function newPinnedAppInstance(bytes32 _appId, address _appBase)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
                  returns (ERCProxy appProxy)
              {
                  return newPinnedAppInstance(_appId, _appBase, new bytes(0), false);
              }
          
              /**
              * @dev Create a new pinned instance of an app linked to this kernel and set
              *      its base implementation if it was not already set
              * @notice Create a new non-upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`
              * @param _appId Identifier for app
              * @param _appBase Address of the app's base implementation
              * @param _initializePayload Payload for call made by the proxy during its construction to initialize
              * @param _setDefault Whether the app proxy app is the default one.
              *        Useful when the Kernel needs to know of an instance of a particular app,
              *        like Vault for escape hatch mechanism.
              * @return AppProxy instance
              */
              function newPinnedAppInstance(bytes32 _appId, address _appBase, bytes _initializePayload, bool _setDefault)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
                  returns (ERCProxy appProxy)
              {
                  _setAppIfNew(KERNEL_APP_BASES_NAMESPACE, _appId, _appBase);
                  appProxy = newAppProxyPinned(this, _appId, _initializePayload);
                  // By calling setApp directly and not the internal functions, we make sure the params are checked
                  // and it will only succeed if sender has permissions to set something to the namespace.
                  if (_setDefault) {
                      setApp(KERNEL_APP_ADDR_NAMESPACE, _appId, appProxy);
                  }
              }
          
              /**
              * @dev Set the resolving address of an app instance or base implementation
              * @notice Set the resolving address of `_appId` in namespace `_namespace` to `_app`
              * @param _namespace App namespace to use
              * @param _appId Identifier for app
              * @param _app Address of the app instance or base implementation
              * @return ID of app
              */
              function setApp(bytes32 _namespace, bytes32 _appId, address _app)
                  public
                  auth(APP_MANAGER_ROLE, arr(_namespace, _appId))
              {
                  _setApp(_namespace, _appId, _app);
              }
          
              /**
              * @dev Set the default vault id for the escape hatch mechanism
              * @param _recoveryVaultAppId Identifier of the recovery vault app
              */
              function setRecoveryVaultAppId(bytes32 _recoveryVaultAppId)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_ADDR_NAMESPACE, _recoveryVaultAppId))
              {
                  recoveryVaultAppId = _recoveryVaultAppId;
              }
          
              // External access to default app id and namespace constants to mimic default getters for constants
              /* solium-disable function-order, mixedcase */
              function CORE_NAMESPACE() external pure returns (bytes32) { return KERNEL_CORE_NAMESPACE; }
              function APP_BASES_NAMESPACE() external pure returns (bytes32) { return KERNEL_APP_BASES_NAMESPACE; }
              function APP_ADDR_NAMESPACE() external pure returns (bytes32) { return KERNEL_APP_ADDR_NAMESPACE; }
              function KERNEL_APP_ID() external pure returns (bytes32) { return KERNEL_CORE_APP_ID; }
              function DEFAULT_ACL_APP_ID() external pure returns (bytes32) { return KERNEL_DEFAULT_ACL_APP_ID; }
              /* solium-enable function-order, mixedcase */
          
              /**
              * @dev Get the address of an app instance or base implementation
              * @param _namespace App namespace to use
              * @param _appId Identifier for app
              * @return Address of the app
              */
              function getApp(bytes32 _namespace, bytes32 _appId) public view returns (address) {
                  return apps[_namespace][_appId];
              }
          
              /**
              * @dev Get the address of the recovery Vault instance (to recover funds)
              * @return Address of the Vault
              */
              function getRecoveryVault() public view returns (address) {
                  return apps[KERNEL_APP_ADDR_NAMESPACE][recoveryVaultAppId];
              }
          
              /**
              * @dev Get the installed ACL app
              * @return ACL app
              */
              function acl() public view returns (IACL) {
                  return IACL(getApp(KERNEL_APP_ADDR_NAMESPACE, KERNEL_DEFAULT_ACL_APP_ID));
              }
          
              /**
              * @dev Function called by apps to check ACL on kernel or to check permission status
              * @param _who Sender of the original call
              * @param _where Address of the app
              * @param _what Identifier for a group of actions in app
              * @param _how Extra data for ACL auth
              * @return Boolean indicating whether the ACL allows the role or not.
              *         Always returns false if the kernel hasn't been initialized yet.
              */
              function hasPermission(address _who, address _where, bytes32 _what, bytes _how) public view returns (bool) {
                  IACL defaultAcl = acl();
                  return address(defaultAcl) != address(0) && // Poor man's initialization check (saves gas)
                      defaultAcl.hasPermission(_who, _where, _what, _how);
              }
          
              function _setApp(bytes32 _namespace, bytes32 _appId, address _app) internal {
                  require(isContract(_app), ERROR_APP_NOT_CONTRACT);
                  apps[_namespace][_appId] = _app;
                  emit SetApp(_namespace, _appId, _app);
              }
          
              function _setAppIfNew(bytes32 _namespace, bytes32 _appId, address _app) internal {
                  address app = getApp(_namespace, _appId);
                  if (app != address(0)) {
                      // The only way to set an app is if it passes the isContract check, so no need to check it again
                      require(app == _app, ERROR_INVALID_APP_CHANGE);
                  } else {
                      _setApp(_namespace, _appId, _app);
                  }
              }
          
              modifier auth(bytes32 _role, uint256[] memory _params) {
                  require(
                      hasPermission(msg.sender, address(this), _role, ConversionHelpers.dangerouslyCastUintArrayToBytes(_params)),
                      ERROR_AUTH_FAILED
                  );
                  _;
              }
          }
          
          // File: contracts/kernel/KernelProxy.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          
          contract KernelProxy is IKernelEvents, KernelStorage, KernelAppIds, KernelNamespaceConstants, IsContract, DepositableDelegateProxy {
              /**
              * @dev KernelProxy is a proxy contract to a kernel implementation. The implementation
              *      can update the reference, which effectively upgrades the contract
              * @param _kernelImpl Address of the contract used as implementation for kernel
              */
              constructor(IKernel _kernelImpl) public {
                  require(isContract(address(_kernelImpl)));
                  apps[KERNEL_CORE_NAMESPACE][KERNEL_CORE_APP_ID] = _kernelImpl;
          
                  // Note that emitting this event is important for verifying that a KernelProxy instance
                  // was never upgraded to a malicious Kernel logic contract over its lifespan.
                  // This starts the "chain of trust", that can be followed through later SetApp() events
                  // emitted during kernel upgrades.
                  emit SetApp(KERNEL_CORE_NAMESPACE, KERNEL_CORE_APP_ID, _kernelImpl);
              }
          
              /**
               * @dev ERC897, whether it is a forwarding (1) or an upgradeable (2) proxy
               */
              function proxyType() public pure returns (uint256 proxyTypeId) {
                  return UPGRADEABLE;
              }
          
              /**
              * @dev ERC897, the address the proxy would delegate calls to
              */
              function implementation() public view returns (address) {
                  return apps[KERNEL_CORE_NAMESPACE][KERNEL_CORE_APP_ID];
              }
          }
          
          // File: contracts/common/Autopetrified.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          contract Autopetrified is Petrifiable {
              constructor() public {
                  // Immediately petrify base (non-proxy) instances of inherited contracts on deploy.
                  // This renders them uninitializable (and unusable without a proxy).
                  petrify();
              }
          }
          
          // File: contracts/common/ReentrancyGuard.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          contract ReentrancyGuard {
              using UnstructuredStorage for bytes32;
          
              /* Hardcoded constants to save gas
              bytes32 internal constant REENTRANCY_MUTEX_POSITION = keccak256("aragonOS.reentrancyGuard.mutex");
              */
              bytes32 private constant REENTRANCY_MUTEX_POSITION = 0xe855346402235fdd185c890e68d2c4ecad599b88587635ee285bce2fda58dacb;
          
              string private constant ERROR_REENTRANT = "REENTRANCY_REENTRANT_CALL";
          
              modifier nonReentrant() {
                  // Ensure mutex is unlocked
                  require(!REENTRANCY_MUTEX_POSITION.getStorageBool(), ERROR_REENTRANT);
          
                  // Lock mutex before function call
                  REENTRANCY_MUTEX_POSITION.setStorageBool(true);
          
                  // Perform function call
                  _;
          
                  // Unlock mutex after function call
                  REENTRANCY_MUTEX_POSITION.setStorageBool(false);
              }
          }
          
          // File: contracts/evmscript/IEVMScriptExecutor.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          interface IEVMScriptExecutor {
              function execScript(bytes script, bytes input, address[] blacklist) external returns (bytes);
              function executorType() external pure returns (bytes32);
          }
          
          // File: contracts/evmscript/IEVMScriptRegistry.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          contract EVMScriptRegistryConstants {
              /* Hardcoded constants to save gas
              bytes32 internal constant EVMSCRIPT_REGISTRY_APP_ID = apmNamehash("evmreg");
              */
              bytes32 internal constant EVMSCRIPT_REGISTRY_APP_ID = 0xddbcfd564f642ab5627cf68b9b7d374fb4f8a36e941a75d89c87998cef03bd61;
          }
          
          
          interface IEVMScriptRegistry {
              function addScriptExecutor(IEVMScriptExecutor executor) external returns (uint id);
              function disableScriptExecutor(uint256 executorId) external;
          
              // TODO: this should be external
              // See https://github.com/ethereum/solidity/issues/4832
              function getScriptExecutor(bytes script) public view returns (IEVMScriptExecutor);
          }
          
          // File: contracts/evmscript/EVMScriptRunner.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          
          
          
          contract EVMScriptRunner is AppStorage, Initializable, EVMScriptRegistryConstants, KernelNamespaceConstants {
              string private constant ERROR_EXECUTOR_UNAVAILABLE = "EVMRUN_EXECUTOR_UNAVAILABLE";
              string private constant ERROR_PROTECTED_STATE_MODIFIED = "EVMRUN_PROTECTED_STATE_MODIFIED";
          
              /* This is manually crafted in assembly
              string private constant ERROR_EXECUTOR_INVALID_RETURN = "EVMRUN_EXECUTOR_INVALID_RETURN";
              */
          
              event ScriptResult(address indexed executor, bytes script, bytes input, bytes returnData);
          
              function getEVMScriptExecutor(bytes _script) public view returns (IEVMScriptExecutor) {
                  return IEVMScriptExecutor(getEVMScriptRegistry().getScriptExecutor(_script));
              }
          
              function getEVMScriptRegistry() public view returns (IEVMScriptRegistry) {
                  address registryAddr = kernel().getApp(KERNEL_APP_ADDR_NAMESPACE, EVMSCRIPT_REGISTRY_APP_ID);
                  return IEVMScriptRegistry(registryAddr);
              }
          
              function runScript(bytes _script, bytes _input, address[] _blacklist)
                  internal
                  isInitialized
                  protectState
                  returns (bytes)
              {
                  IEVMScriptExecutor executor = getEVMScriptExecutor(_script);
                  require(address(executor) != address(0), ERROR_EXECUTOR_UNAVAILABLE);
          
                  bytes4 sig = executor.execScript.selector;
                  bytes memory data = abi.encodeWithSelector(sig, _script, _input, _blacklist);
          
                  bytes memory output;
                  assembly {
                      let success := delegatecall(
                          gas,                // forward all gas
                          executor,           // address
                          add(data, 0x20),    // calldata start
                          mload(data),        // calldata length
                          0,                  // don't write output (we'll handle this ourselves)
                          0                   // don't write output
                      )
          
                      output := mload(0x40) // free mem ptr get
          
                      switch success
                      case 0 {
                          // If the call errored, forward its full error data
                          returndatacopy(output, 0, returndatasize)
                          revert(output, returndatasize)
                      }
                      default {
                          switch gt(returndatasize, 0x3f)
                          case 0 {
                              // Need at least 0x40 bytes returned for properly ABI-encoded bytes values,
                              // revert with "EVMRUN_EXECUTOR_INVALID_RETURN"
                              // See remix: doing a `revert("EVMRUN_EXECUTOR_INVALID_RETURN")` always results in
                              // this memory layout
                              mstore(output, 0x08c379a000000000000000000000000000000000000000000000000000000000)         // error identifier
                              mstore(add(output, 0x04), 0x0000000000000000000000000000000000000000000000000000000000000020) // starting offset
                              mstore(add(output, 0x24), 0x000000000000000000000000000000000000000000000000000000000000001e) // reason length
                              mstore(add(output, 0x44), 0x45564d52554e5f4558454355544f525f494e56414c49445f52455455524e0000) // reason
          
                              revert(output, 100) // 100 = 4 + 3 * 32 (error identifier + 3 words for the ABI encoded error)
                          }
                          default {
                              // Copy result
                              //
                              // Needs to perform an ABI decode for the expected `bytes` return type of
                              // `executor.execScript()` as solidity will automatically ABI encode the returned bytes as:
                              //    [ position of the first dynamic length return value = 0x20 (32 bytes) ]
                              //    [ output length (32 bytes) ]
                              //    [ output content (N bytes) ]
                              //
                              // Perform the ABI decode by ignoring the first 32 bytes of the return data
                              let copysize := sub(returndatasize, 0x20)
                              returndatacopy(output, 0x20, copysize)
          
                              mstore(0x40, add(output, copysize)) // free mem ptr set
                          }
                      }
                  }
          
                  emit ScriptResult(address(executor), _script, _input, output);
          
                  return output;
              }
          
              modifier protectState {
                  address preKernel = address(kernel());
                  bytes32 preAppId = appId();
                  _; // exec
                  require(address(kernel()) == preKernel, ERROR_PROTECTED_STATE_MODIFIED);
                  require(appId() == preAppId, ERROR_PROTECTED_STATE_MODIFIED);
              }
          }
          
          // File: contracts/apps/AragonApp.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          
          
          
          
          
          // Contracts inheriting from AragonApp are, by default, immediately petrified upon deployment so
          // that they can never be initialized.
          // Unless overriden, this behaviour enforces those contracts to be usable only behind an AppProxy.
          // ReentrancyGuard, EVMScriptRunner, and ACLSyntaxSugar are not directly used by this contract, but
          // are included so that they are automatically usable by subclassing contracts
          contract AragonApp is AppStorage, Autopetrified, VaultRecoverable, ReentrancyGuard, EVMScriptRunner, ACLSyntaxSugar {
              string private constant ERROR_AUTH_FAILED = "APP_AUTH_FAILED";
          
              modifier auth(bytes32 _role) {
                  require(canPerform(msg.sender, _role, new uint256[](0)), ERROR_AUTH_FAILED);
                  _;
              }
          
              modifier authP(bytes32 _role, uint256[] _params) {
                  require(canPerform(msg.sender, _role, _params), ERROR_AUTH_FAILED);
                  _;
              }
          
              /**
              * @dev Check whether an action can be performed by a sender for a particular role on this app
              * @param _sender Sender of the call
              * @param _role Role on this app
              * @param _params Permission params for the role
              * @return Boolean indicating whether the sender has the permissions to perform the action.
              *         Always returns false if the app hasn't been initialized yet.
              */
              function canPerform(address _sender, bytes32 _role, uint256[] _params) public view returns (bool) {
                  if (!hasInitialized()) {
                      return false;
                  }
          
                  IKernel linkedKernel = kernel();
                  if (address(linkedKernel) == address(0)) {
                      return false;
                  }
          
                  return linkedKernel.hasPermission(
                      _sender,
                      address(this),
                      _role,
                      ConversionHelpers.dangerouslyCastUintArrayToBytes(_params)
                  );
              }
          
              /**
              * @dev Get the recovery vault for the app
              * @return Recovery vault address for the app
              */
              function getRecoveryVault() public view returns (address) {
                  // Funds recovery via a vault is only available when used with a kernel
                  return kernel().getRecoveryVault(); // if kernel is not set, it will revert
              }
          }
          
          // File: contracts/acl/IACLOracle.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          interface IACLOracle {
              function canPerform(address who, address where, bytes32 what, uint256[] how) external view returns (bool);
          }
          
          // File: contracts/acl/ACL.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          
          
          /* solium-disable function-order */
          // Allow public initialize() to be first
          contract ACL is IACL, TimeHelpers, AragonApp, ACLHelpers {
              /* Hardcoded constants to save gas
              bytes32 public constant CREATE_PERMISSIONS_ROLE = keccak256("CREATE_PERMISSIONS_ROLE");
              */
              bytes32 public constant CREATE_PERMISSIONS_ROLE = 0x0b719b33c83b8e5d300c521cb8b54ae9bd933996a14bef8c2f4e0285d2d2400a;
          
              enum Op { NONE, EQ, NEQ, GT, LT, GTE, LTE, RET, NOT, AND, OR, XOR, IF_ELSE } // op types
          
              struct Param {
                  uint8 id;
                  uint8 op;
                  uint240 value; // even though value is an uint240 it can store addresses
                  // in the case of 32 byte hashes losing 2 bytes precision isn't a huge deal
                  // op and id take less than 1 byte each so it can be kept in 1 sstore
              }
          
              uint8 internal constant BLOCK_NUMBER_PARAM_ID = 200;
              uint8 internal constant TIMESTAMP_PARAM_ID    = 201;
              // 202 is unused
              uint8 internal constant ORACLE_PARAM_ID       = 203;
              uint8 internal constant LOGIC_OP_PARAM_ID     = 204;
              uint8 internal constant PARAM_VALUE_PARAM_ID  = 205;
              // TODO: Add execution times param type?
          
              /* Hardcoded constant to save gas
              bytes32 public constant EMPTY_PARAM_HASH = keccak256(uint256(0));
              */
              bytes32 public constant EMPTY_PARAM_HASH = 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563;
              bytes32 public constant NO_PERMISSION = bytes32(0);
              address public constant ANY_ENTITY = address(-1);
              address public constant BURN_ENTITY = address(1); // address(0) is already used as "no permission manager"
          
              string private constant ERROR_AUTH_INIT_KERNEL = "ACL_AUTH_INIT_KERNEL";
              string private constant ERROR_AUTH_NO_MANAGER = "ACL_AUTH_NO_MANAGER";
              string private constant ERROR_EXISTENT_MANAGER = "ACL_EXISTENT_MANAGER";
          
              // Whether someone has a permission
              mapping (bytes32 => bytes32) internal permissions; // permissions hash => params hash
              mapping (bytes32 => Param[]) internal permissionParams; // params hash => params
          
              // Who is the manager of a permission
              mapping (bytes32 => address) internal permissionManager;
          
              event SetPermission(address indexed entity, address indexed app, bytes32 indexed role, bool allowed);
              event SetPermissionParams(address indexed entity, address indexed app, bytes32 indexed role, bytes32 paramsHash);
              event ChangePermissionManager(address indexed app, bytes32 indexed role, address indexed manager);
          
              modifier onlyPermissionManager(address _app, bytes32 _role) {
                  require(msg.sender == getPermissionManager(_app, _role), ERROR_AUTH_NO_MANAGER);
                  _;
              }
          
              modifier noPermissionManager(address _app, bytes32 _role) {
                  // only allow permission creation (or re-creation) when there is no manager
                  require(getPermissionManager(_app, _role) == address(0), ERROR_EXISTENT_MANAGER);
                  _;
              }
          
              /**
              * @dev Initialize can only be called once. It saves the block number in which it was initialized.
              * @notice Initialize an ACL instance and set `_permissionsCreator` as the entity that can create other permissions
              * @param _permissionsCreator Entity that will be given permission over createPermission
              */
              function initialize(address _permissionsCreator) public onlyInit {
                  initialized();
                  require(msg.sender == address(kernel()), ERROR_AUTH_INIT_KERNEL);
          
                  _createPermission(_permissionsCreator, this, CREATE_PERMISSIONS_ROLE, _permissionsCreator);
              }
          
              /**
              * @dev Creates a permission that wasn't previously set and managed.
              *      If a created permission is removed it is possible to reset it with createPermission.
              *      This is the **ONLY** way to create permissions and set managers to permissions that don't
              *      have a manager.
              *      In terms of the ACL being initialized, this function implicitly protects all the other
              *      state-changing external functions, as they all require the sender to be a manager.
              * @notice Create a new permission granting `_entity` the ability to perform actions requiring `_role` on `_app`, setting `_manager` as the permission's manager
              * @param _entity Address of the whitelisted entity that will be able to perform the role
              * @param _app Address of the app in which the role will be allowed (requires app to depend on kernel for ACL)
              * @param _role Identifier for the group of actions in app given access to perform
              * @param _manager Address of the entity that will be able to grant and revoke the permission further.
              */
              function createPermission(address _entity, address _app, bytes32 _role, address _manager)
                  external
                  auth(CREATE_PERMISSIONS_ROLE)
                  noPermissionManager(_app, _role)
              {
                  _createPermission(_entity, _app, _role, _manager);
              }
          
              /**
              * @dev Grants permission if allowed. This requires `msg.sender` to be the permission manager
              * @notice Grant `_entity` the ability to perform actions requiring `_role` on `_app`
              * @param _entity Address of the whitelisted entity that will be able to perform the role
              * @param _app Address of the app in which the role will be allowed (requires app to depend on kernel for ACL)
              * @param _role Identifier for the group of actions in app given access to perform
              */
              function grantPermission(address _entity, address _app, bytes32 _role)
                  external
              {
                  grantPermissionP(_entity, _app, _role, new uint256[](0));
              }
          
              /**
              * @dev Grants a permission with parameters if allowed. This requires `msg.sender` to be the permission manager
              * @notice Grant `_entity` the ability to perform actions requiring `_role` on `_app`
              * @param _entity Address of the whitelisted entity that will be able to perform the role
              * @param _app Address of the app in which the role will be allowed (requires app to depend on kernel for ACL)
              * @param _role Identifier for the group of actions in app given access to perform
              * @param _params Permission parameters
              */
              function grantPermissionP(address _entity, address _app, bytes32 _role, uint256[] _params)
                  public
                  onlyPermissionManager(_app, _role)
              {
                  bytes32 paramsHash = _params.length > 0 ? _saveParams(_params) : EMPTY_PARAM_HASH;
                  _setPermission(_entity, _app, _role, paramsHash);
              }
          
              /**
              * @dev Revokes permission if allowed. This requires `msg.sender` to be the the permission manager
              * @notice Revoke from `_entity` the ability to perform actions requiring `_role` on `_app`
              * @param _entity Address of the whitelisted entity to revoke access from
              * @param _app Address of the app in which the role will be revoked
              * @param _role Identifier for the group of actions in app being revoked
              */
              function revokePermission(address _entity, address _app, bytes32 _role)
                  external
                  onlyPermissionManager(_app, _role)
              {
                  _setPermission(_entity, _app, _role, NO_PERMISSION);
              }
          
              /**
              * @notice Set `_newManager` as the manager of `_role` in `_app`
              * @param _newManager Address for the new manager
              * @param _app Address of the app in which the permission management is being transferred
              * @param _role Identifier for the group of actions being transferred
              */
              function setPermissionManager(address _newManager, address _app, bytes32 _role)
                  external
                  onlyPermissionManager(_app, _role)
              {
                  _setPermissionManager(_newManager, _app, _role);
              }
          
              /**
              * @notice Remove the manager of `_role` in `_app`
              * @param _app Address of the app in which the permission is being unmanaged
              * @param _role Identifier for the group of actions being unmanaged
              */
              function removePermissionManager(address _app, bytes32 _role)
                  external
                  onlyPermissionManager(_app, _role)
              {
                  _setPermissionManager(address(0), _app, _role);
              }
          
              /**
              * @notice Burn non-existent `_role` in `_app`, so no modification can be made to it (grant, revoke, permission manager)
              * @param _app Address of the app in which the permission is being burned
              * @param _role Identifier for the group of actions being burned
              */
              function createBurnedPermission(address _app, bytes32 _role)
                  external
                  auth(CREATE_PERMISSIONS_ROLE)
                  noPermissionManager(_app, _role)
              {
                  _setPermissionManager(BURN_ENTITY, _app, _role);
              }
          
              /**
              * @notice Burn `_role` in `_app`, so no modification can be made to it (grant, revoke, permission manager)
              * @param _app Address of the app in which the permission is being burned
              * @param _role Identifier for the group of actions being burned
              */
              function burnPermissionManager(address _app, bytes32 _role)
                  external
                  onlyPermissionManager(_app, _role)
              {
                  _setPermissionManager(BURN_ENTITY, _app, _role);
              }
          
              /**
               * @notice Get parameters for permission array length
               * @param _entity Address of the whitelisted entity that will be able to perform the role
               * @param _app Address of the app
               * @param _role Identifier for a group of actions in app
               * @return Length of the array
               */
              function getPermissionParamsLength(address _entity, address _app, bytes32 _role) external view returns (uint) {
                  return permissionParams[permissions[permissionHash(_entity, _app, _role)]].length;
              }
          
              /**
              * @notice Get parameter for permission
              * @param _entity Address of the whitelisted entity that will be able to perform the role
              * @param _app Address of the app
              * @param _role Identifier for a group of actions in app
              * @param _index Index of parameter in the array
              * @return Parameter (id, op, value)
              */
              function getPermissionParam(address _entity, address _app, bytes32 _role, uint _index)
                  external
                  view
                  returns (uint8, uint8, uint240)
              {
                  Param storage param = permissionParams[permissions[permissionHash(_entity, _app, _role)]][_index];
                  return (param.id, param.op, param.value);
              }
          
              /**
              * @dev Get manager for permission
              * @param _app Address of the app
              * @param _role Identifier for a group of actions in app
              * @return address of the manager for the permission
              */
              function getPermissionManager(address _app, bytes32 _role) public view returns (address) {
                  return permissionManager[roleHash(_app, _role)];
              }
          
              /**
              * @dev Function called by apps to check ACL on kernel or to check permission statu
              * @param _who Sender of the original call
              * @param _where Address of the app
              * @param _where Identifier for a group of actions in app
              * @param _how Permission parameters
              * @return boolean indicating whether the ACL allows the role or not
              */
              function hasPermission(address _who, address _where, bytes32 _what, bytes memory _how) public view returns (bool) {
                  return hasPermission(_who, _where, _what, ConversionHelpers.dangerouslyCastBytesToUintArray(_how));
              }
          
              function hasPermission(address _who, address _where, bytes32 _what, uint256[] memory _how) public view returns (bool) {
                  bytes32 whoParams = permissions[permissionHash(_who, _where, _what)];
                  if (whoParams != NO_PERMISSION && evalParams(whoParams, _who, _where, _what, _how)) {
                      return true;
                  }
          
                  bytes32 anyParams = permissions[permissionHash(ANY_ENTITY, _where, _what)];
                  if (anyParams != NO_PERMISSION && evalParams(anyParams, ANY_ENTITY, _where, _what, _how)) {
                      return true;
                  }
          
                  return false;
              }
          
              function hasPermission(address _who, address _where, bytes32 _what) public view returns (bool) {
                  uint256[] memory empty = new uint256[](0);
                  return hasPermission(_who, _where, _what, empty);
              }
          
              function evalParams(
                  bytes32 _paramsHash,
                  address _who,
                  address _where,
                  bytes32 _what,
                  uint256[] _how
              ) public view returns (bool)
              {
                  if (_paramsHash == EMPTY_PARAM_HASH) {
                      return true;
                  }
          
                  return _evalParam(_paramsHash, 0, _who, _where, _what, _how);
              }
          
              /**
              * @dev Internal createPermission for access inside the kernel (on instantiation)
              */
              function _createPermission(address _entity, address _app, bytes32 _role, address _manager) internal {
                  _setPermission(_entity, _app, _role, EMPTY_PARAM_HASH);
                  _setPermissionManager(_manager, _app, _role);
              }
          
              /**
              * @dev Internal function called to actually save the permission
              */
              function _setPermission(address _entity, address _app, bytes32 _role, bytes32 _paramsHash) internal {
                  permissions[permissionHash(_entity, _app, _role)] = _paramsHash;
                  bool entityHasPermission = _paramsHash != NO_PERMISSION;
                  bool permissionHasParams = entityHasPermission && _paramsHash != EMPTY_PARAM_HASH;
          
                  emit SetPermission(_entity, _app, _role, entityHasPermission);
                  if (permissionHasParams) {
                      emit SetPermissionParams(_entity, _app, _role, _paramsHash);
                  }
              }
          
              function _saveParams(uint256[] _encodedParams) internal returns (bytes32) {
                  bytes32 paramHash = keccak256(abi.encodePacked(_encodedParams));
                  Param[] storage params = permissionParams[paramHash];
          
                  if (params.length == 0) { // params not saved before
                      for (uint256 i = 0; i < _encodedParams.length; i++) {
                          uint256 encodedParam = _encodedParams[i];
                          Param memory param = Param(decodeParamId(encodedParam), decodeParamOp(encodedParam), uint240(encodedParam));
                          params.push(param);
                      }
                  }
          
                  return paramHash;
              }
          
              function _evalParam(
                  bytes32 _paramsHash,
                  uint32 _paramId,
                  address _who,
                  address _where,
                  bytes32 _what,
                  uint256[] _how
              ) internal view returns (bool)
              {
                  if (_paramId >= permissionParams[_paramsHash].length) {
                      return false; // out of bounds
                  }
          
                  Param memory param = permissionParams[_paramsHash][_paramId];
          
                  if (param.id == LOGIC_OP_PARAM_ID) {
                      return _evalLogic(param, _paramsHash, _who, _where, _what, _how);
                  }
          
                  uint256 value;
                  uint256 comparedTo = uint256(param.value);
          
                  // get value
                  if (param.id == ORACLE_PARAM_ID) {
                      value = checkOracle(IACLOracle(param.value), _who, _where, _what, _how) ? 1 : 0;
                      comparedTo = 1;
                  } else if (param.id == BLOCK_NUMBER_PARAM_ID) {
                      value = getBlockNumber();
                  } else if (param.id == TIMESTAMP_PARAM_ID) {
                      value = getTimestamp();
                  } else if (param.id == PARAM_VALUE_PARAM_ID) {
                      value = uint256(param.value);
                  } else {
                      if (param.id >= _how.length) {
                          return false;
                      }
                      value = uint256(uint240(_how[param.id])); // force lost precision
                  }
          
                  if (Op(param.op) == Op.RET) {
                      return uint256(value) > 0;
                  }
          
                  return compare(value, Op(param.op), comparedTo);
              }
          
              function _evalLogic(Param _param, bytes32 _paramsHash, address _who, address _where, bytes32 _what, uint256[] _how)
                  internal
                  view
                  returns (bool)
              {
                  if (Op(_param.op) == Op.IF_ELSE) {
                      uint32 conditionParam;
                      uint32 successParam;
                      uint32 failureParam;
          
                      (conditionParam, successParam, failureParam) = decodeParamsList(uint256(_param.value));
                      bool result = _evalParam(_paramsHash, conditionParam, _who, _where, _what, _how);
          
                      return _evalParam(_paramsHash, result ? successParam : failureParam, _who, _where, _what, _how);
                  }
          
                  uint32 param1;
                  uint32 param2;
          
                  (param1, param2,) = decodeParamsList(uint256(_param.value));
                  bool r1 = _evalParam(_paramsHash, param1, _who, _where, _what, _how);
          
                  if (Op(_param.op) == Op.NOT) {
                      return !r1;
                  }
          
                  if (r1 && Op(_param.op) == Op.OR) {
                      return true;
                  }
          
                  if (!r1 && Op(_param.op) == Op.AND) {
                      return false;
                  }
          
                  bool r2 = _evalParam(_paramsHash, param2, _who, _where, _what, _how);
          
                  if (Op(_param.op) == Op.XOR) {
                      return r1 != r2;
                  }
          
                  return r2; // both or and and depend on result of r2 after checks
              }
          
              function compare(uint256 _a, Op _op, uint256 _b) internal pure returns (bool) {
                  if (_op == Op.EQ)  return _a == _b;                              // solium-disable-line lbrace
                  if (_op == Op.NEQ) return _a != _b;                              // solium-disable-line lbrace
                  if (_op == Op.GT)  return _a > _b;                               // solium-disable-line lbrace
                  if (_op == Op.LT)  return _a < _b;                               // solium-disable-line lbrace
                  if (_op == Op.GTE) return _a >= _b;                              // solium-disable-line lbrace
                  if (_op == Op.LTE) return _a <= _b;                              // solium-disable-line lbrace
                  return false;
              }
          
              function checkOracle(IACLOracle _oracleAddr, address _who, address _where, bytes32 _what, uint256[] _how) internal view returns (bool) {
                  bytes4 sig = _oracleAddr.canPerform.selector;
          
                  // a raw call is required so we can return false if the call reverts, rather than reverting
                  bytes memory checkCalldata = abi.encodeWithSelector(sig, _who, _where, _what, _how);
          
                  bool ok;
                  assembly {
                      // send all available gas; if the oracle eats up all the gas, we will eventually revert
                      // note that we are currently guaranteed to still have some gas after the call from
                      // EIP-150's 63/64 gas forward rule
                      ok := staticcall(gas, _oracleAddr, add(checkCalldata, 0x20), mload(checkCalldata), 0, 0)
                  }
          
                  if (!ok) {
                      return false;
                  }
          
                  uint256 size;
                  assembly { size := returndatasize }
                  if (size != 32) {
                      return false;
                  }
          
                  bool result;
                  assembly {
                      let ptr := mload(0x40)       // get next free memory ptr
                      returndatacopy(ptr, 0, size) // copy return from above `staticcall`
                      result := mload(ptr)         // read data at ptr and set it to result
                      mstore(ptr, 0)               // set pointer memory to 0 so it still is the next free ptr
                  }
          
                  return result;
              }
          
              /**
              * @dev Internal function that sets management
              */
              function _setPermissionManager(address _newManager, address _app, bytes32 _role) internal {
                  permissionManager[roleHash(_app, _role)] = _newManager;
                  emit ChangePermissionManager(_app, _role, _newManager);
              }
          
              function roleHash(address _where, bytes32 _what) internal pure returns (bytes32) {
                  return keccak256(abi.encodePacked("ROLE", _where, _what));
              }
          
              function permissionHash(address _who, address _where, bytes32 _what) internal pure returns (bytes32) {
                  return keccak256(abi.encodePacked("PERMISSION", _who, _where, _what));
              }
          }
          
          // File: contracts/evmscript/ScriptHelpers.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          library ScriptHelpers {
              function getSpecId(bytes _script) internal pure returns (uint32) {
                  return uint32At(_script, 0);
              }
          
              function uint256At(bytes _data, uint256 _location) internal pure returns (uint256 result) {
                  assembly {
                      result := mload(add(_data, add(0x20, _location)))
                  }
              }
          
              function addressAt(bytes _data, uint256 _location) internal pure returns (address result) {
                  uint256 word = uint256At(_data, _location);
          
                  assembly {
                      result := div(and(word, 0xffffffffffffffffffffffffffffffffffffffff000000000000000000000000),
                      0x1000000000000000000000000)
                  }
              }
          
              function uint32At(bytes _data, uint256 _location) internal pure returns (uint32 result) {
                  uint256 word = uint256At(_data, _location);
          
                  assembly {
                      result := div(and(word, 0xffffffff00000000000000000000000000000000000000000000000000000000),
                      0x100000000000000000000000000000000000000000000000000000000)
                  }
              }
          
              function locationOf(bytes _data, uint256 _location) internal pure returns (uint256 result) {
                  assembly {
                      result := add(_data, add(0x20, _location))
                  }
              }
          
              function toBytes(bytes4 _sig) internal pure returns (bytes) {
                  bytes memory payload = new bytes(4);
                  assembly { mstore(add(payload, 0x20), _sig) }
                  return payload;
              }
          }
          
          // File: contracts/evmscript/EVMScriptRegistry.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          /* solium-disable function-order */
          // Allow public initialize() to be first
          contract EVMScriptRegistry is IEVMScriptRegistry, EVMScriptRegistryConstants, AragonApp {
              using ScriptHelpers for bytes;
          
              /* Hardcoded constants to save gas
              bytes32 public constant REGISTRY_ADD_EXECUTOR_ROLE = keccak256("REGISTRY_ADD_EXECUTOR_ROLE");
              bytes32 public constant REGISTRY_MANAGER_ROLE = keccak256("REGISTRY_MANAGER_ROLE");
              */
              bytes32 public constant REGISTRY_ADD_EXECUTOR_ROLE = 0xc4e90f38eea8c4212a009ca7b8947943ba4d4a58d19b683417f65291d1cd9ed2;
              // WARN: Manager can censor all votes and the like happening in an org
              bytes32 public constant REGISTRY_MANAGER_ROLE = 0xf7a450ef335e1892cb42c8ca72e7242359d7711924b75db5717410da3f614aa3;
          
              uint256 internal constant SCRIPT_START_LOCATION = 4;
          
              string private constant ERROR_INEXISTENT_EXECUTOR = "EVMREG_INEXISTENT_EXECUTOR";
              string private constant ERROR_EXECUTOR_ENABLED = "EVMREG_EXECUTOR_ENABLED";
              string private constant ERROR_EXECUTOR_DISABLED = "EVMREG_EXECUTOR_DISABLED";
              string private constant ERROR_SCRIPT_LENGTH_TOO_SHORT = "EVMREG_SCRIPT_LENGTH_TOO_SHORT";
          
              struct ExecutorEntry {
                  IEVMScriptExecutor executor;
                  bool enabled;
              }
          
              uint256 private executorsNextIndex;
              mapping (uint256 => ExecutorEntry) public executors;
          
              event EnableExecutor(uint256 indexed executorId, address indexed executorAddress);
              event DisableExecutor(uint256 indexed executorId, address indexed executorAddress);
          
              modifier executorExists(uint256 _executorId) {
                  require(_executorId > 0 && _executorId < executorsNextIndex, ERROR_INEXISTENT_EXECUTOR);
                  _;
              }
          
              /**
              * @notice Initialize the registry
              */
              function initialize() public onlyInit {
                  initialized();
                  // Create empty record to begin executor IDs at 1
                  executorsNextIndex = 1;
              }
          
              /**
              * @notice Add a new script executor with address `_executor` to the registry
              * @param _executor Address of the IEVMScriptExecutor that will be added to the registry
              * @return id Identifier of the executor in the registry
              */
              function addScriptExecutor(IEVMScriptExecutor _executor) external auth(REGISTRY_ADD_EXECUTOR_ROLE) returns (uint256 id) {
                  uint256 executorId = executorsNextIndex++;
                  executors[executorId] = ExecutorEntry(_executor, true);
                  emit EnableExecutor(executorId, _executor);
                  return executorId;
              }
          
              /**
              * @notice Disable script executor with ID `_executorId`
              * @param _executorId Identifier of the executor in the registry
              */
              function disableScriptExecutor(uint256 _executorId)
                  external
                  authP(REGISTRY_MANAGER_ROLE, arr(_executorId))
              {
                  // Note that we don't need to check for an executor's existence in this case, as only
                  // existing executors can be enabled
                  ExecutorEntry storage executorEntry = executors[_executorId];
                  require(executorEntry.enabled, ERROR_EXECUTOR_DISABLED);
                  executorEntry.enabled = false;
                  emit DisableExecutor(_executorId, executorEntry.executor);
              }
          
              /**
              * @notice Enable script executor with ID `_executorId`
              * @param _executorId Identifier of the executor in the registry
              */
              function enableScriptExecutor(uint256 _executorId)
                  external
                  authP(REGISTRY_MANAGER_ROLE, arr(_executorId))
                  executorExists(_executorId)
              {
                  ExecutorEntry storage executorEntry = executors[_executorId];
                  require(!executorEntry.enabled, ERROR_EXECUTOR_ENABLED);
                  executorEntry.enabled = true;
                  emit EnableExecutor(_executorId, executorEntry.executor);
              }
          
              /**
              * @dev Get the script executor that can execute a particular script based on its first 4 bytes
              * @param _script EVMScript being inspected
              */
              function getScriptExecutor(bytes _script) public view returns (IEVMScriptExecutor) {
                  require(_script.length >= SCRIPT_START_LOCATION, ERROR_SCRIPT_LENGTH_TOO_SHORT);
                  uint256 id = _script.getSpecId();
          
                  // Note that we don't need to check for an executor's existence in this case, as only
                  // existing executors can be enabled
                  ExecutorEntry storage entry = executors[id];
                  return entry.enabled ? entry.executor : IEVMScriptExecutor(0);
              }
          }
          
          // File: contracts/evmscript/executors/BaseEVMScriptExecutor.sol
          
          /*
           * SPDX-License-Identifier:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          contract BaseEVMScriptExecutor is IEVMScriptExecutor, Autopetrified {
              uint256 internal constant SCRIPT_START_LOCATION = 4;
          }
          
          // File: contracts/evmscript/executors/CallsScript.sol
          
          pragma solidity 0.4.24;
          
          // Inspired by https://github.com/reverendus/tx-manager
          
          
          
          
          contract CallsScript is BaseEVMScriptExecutor {
              using ScriptHelpers for bytes;
          
              /* Hardcoded constants to save gas
              bytes32 internal constant EXECUTOR_TYPE = keccak256("CALLS_SCRIPT");
              */
              bytes32 internal constant EXECUTOR_TYPE = 0x2dc858a00f3e417be1394b87c07158e989ec681ce8cc68a9093680ac1a870302;
          
              string private constant ERROR_BLACKLISTED_CALL = "EVMCALLS_BLACKLISTED_CALL";
              string private constant ERROR_INVALID_LENGTH = "EVMCALLS_INVALID_LENGTH";
          
              /* This is manually crafted in assembly
              string private constant ERROR_CALL_REVERTED = "EVMCALLS_CALL_REVERTED";
              */
          
              event LogScriptCall(address indexed sender, address indexed src, address indexed dst);
          
              /**
              * @notice Executes a number of call scripts
              * @param _script [ specId (uint32) ] many calls with this structure ->
              *    [ to (address: 20 bytes) ] [ calldataLength (uint32: 4 bytes) ] [ calldata (calldataLength bytes) ]
              * @param _blacklist Addresses the script cannot call to, or will revert.
              * @return Always returns empty byte array
              */
              function execScript(bytes _script, bytes, address[] _blacklist) external isInitialized returns (bytes) {
                  uint256 location = SCRIPT_START_LOCATION; // first 32 bits are spec id
                  while (location < _script.length) {
                      // Check there's at least address + calldataLength available
                      require(_script.length - location >= 0x18, ERROR_INVALID_LENGTH);
          
                      address contractAddress = _script.addressAt(location);
                      // Check address being called is not blacklist
                      for (uint256 i = 0; i < _blacklist.length; i++) {
                          require(contractAddress != _blacklist[i], ERROR_BLACKLISTED_CALL);
                      }
          
                      // logged before execution to ensure event ordering in receipt
                      // if failed entire execution is reverted regardless
                      emit LogScriptCall(msg.sender, address(this), contractAddress);
          
                      uint256 calldataLength = uint256(_script.uint32At(location + 0x14));
                      uint256 startOffset = location + 0x14 + 0x04;
                      uint256 calldataStart = _script.locationOf(startOffset);
          
                      // compute end of script / next location
                      location = startOffset + calldataLength;
                      require(location <= _script.length, ERROR_INVALID_LENGTH);
          
                      bool success;
                      assembly {
                          success := call(
                              sub(gas, 5000),       // forward gas left - 5000
                              contractAddress,      // address
                              0,                    // no value
                              calldataStart,        // calldata start
                              calldataLength,       // calldata length
                              0,                    // don't write output
                              0                     // don't write output
                          )
          
                          switch success
                          case 0 {
                              let ptr := mload(0x40)
          
                              switch returndatasize
                              case 0 {
                                  // No error data was returned, revert with "EVMCALLS_CALL_REVERTED"
                                  // See remix: doing a `revert("EVMCALLS_CALL_REVERTED")` always results in
                                  // this memory layout
                                  mstore(ptr, 0x08c379a000000000000000000000000000000000000000000000000000000000)         // error identifier
                                  mstore(add(ptr, 0x04), 0x0000000000000000000000000000000000000000000000000000000000000020) // starting offset
                                  mstore(add(ptr, 0x24), 0x0000000000000000000000000000000000000000000000000000000000000016) // reason length
                                  mstore(add(ptr, 0x44), 0x45564d43414c4c535f43414c4c5f524556455254454400000000000000000000) // reason
          
                                  revert(ptr, 100) // 100 = 4 + 3 * 32 (error identifier + 3 words for the ABI encoded error)
                              }
                              default {
                                  // Forward the full error data
                                  returndatacopy(ptr, 0, returndatasize)
                                  revert(ptr, returndatasize)
                              }
                          }
                          default { }
                      }
                  }
                  // No need to allocate empty bytes for the return as this can only be called via an delegatecall
                  // (due to the isInitialized modifier)
              }
          
              function executorType() external pure returns (bytes32) {
                  return EXECUTOR_TYPE;
              }
          }
          
          // File: contracts/factory/EVMScriptRegistryFactory.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          
          contract EVMScriptRegistryFactory is EVMScriptRegistryConstants {
              EVMScriptRegistry public baseReg;
              IEVMScriptExecutor public baseCallScript;
          
              /**
              * @notice Create a new EVMScriptRegistryFactory.
              */
              constructor() public {
                  baseReg = new EVMScriptRegistry();
                  baseCallScript = IEVMScriptExecutor(new CallsScript());
              }
          
              /**
              * @notice Install a new pinned instance of EVMScriptRegistry on `_dao`.
              * @param _dao Kernel
              * @return Installed EVMScriptRegistry
              */
              function newEVMScriptRegistry(Kernel _dao) public returns (EVMScriptRegistry reg) {
                  bytes memory initPayload = abi.encodeWithSelector(reg.initialize.selector);
                  reg = EVMScriptRegistry(_dao.newPinnedAppInstance(EVMSCRIPT_REGISTRY_APP_ID, baseReg, initPayload, true));
          
                  ACL acl = ACL(_dao.acl());
          
                  acl.createPermission(this, reg, reg.REGISTRY_ADD_EXECUTOR_ROLE(), this);
          
                  reg.addScriptExecutor(baseCallScript);     // spec 1 = CallsScript
          
                  // Clean up the permissions
                  acl.revokePermission(this, reg, reg.REGISTRY_ADD_EXECUTOR_ROLE());
                  acl.removePermissionManager(reg, reg.REGISTRY_ADD_EXECUTOR_ROLE());
          
                  return reg;
              }
          }
          
          // File: contracts/factory/DAOFactory.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          
          
          contract DAOFactory {
              IKernel public baseKernel;
              IACL public baseACL;
              EVMScriptRegistryFactory public regFactory;
          
              event DeployDAO(address dao);
              event DeployEVMScriptRegistry(address reg);
          
              /**
              * @notice Create a new DAOFactory, creating DAOs with Kernels proxied to `_baseKernel`, ACLs proxied to `_baseACL`, and new EVMScriptRegistries created from `_regFactory`.
              * @param _baseKernel Base Kernel
              * @param _baseACL Base ACL
              * @param _regFactory EVMScriptRegistry factory
              */
              constructor(IKernel _baseKernel, IACL _baseACL, EVMScriptRegistryFactory _regFactory) public {
                  // No need to init as it cannot be killed by devops199
                  if (address(_regFactory) != address(0)) {
                      regFactory = _regFactory;
                  }
          
                  baseKernel = _baseKernel;
                  baseACL = _baseACL;
              }
          
              /**
              * @notice Create a new DAO with `_root` set as the initial admin
              * @param _root Address that will be granted control to setup DAO permissions
              * @return Newly created DAO
              */
              function newDAO(address _root) public returns (Kernel) {
                  Kernel dao = Kernel(new KernelProxy(baseKernel));
          
                  if (address(regFactory) == address(0)) {
                      dao.initialize(baseACL, _root);
                  } else {
                      dao.initialize(baseACL, this);
          
                      ACL acl = ACL(dao.acl());
                      bytes32 permRole = acl.CREATE_PERMISSIONS_ROLE();
                      bytes32 appManagerRole = dao.APP_MANAGER_ROLE();
          
                      acl.grantPermission(regFactory, acl, permRole);
          
                      acl.createPermission(regFactory, dao, appManagerRole, this);
          
                      EVMScriptRegistry reg = regFactory.newEVMScriptRegistry(dao);
                      emit DeployEVMScriptRegistry(address(reg));
          
                      // Clean up permissions
                      // First, completely reset the APP_MANAGER_ROLE
                      acl.revokePermission(regFactory, dao, appManagerRole);
                      acl.removePermissionManager(dao, appManagerRole);
          
                      // Then, make root the only holder and manager of CREATE_PERMISSIONS_ROLE
                      acl.revokePermission(regFactory, acl, permRole);
                      acl.revokePermission(this, acl, permRole);
                      acl.grantPermission(_root, acl, permRole);
                      acl.setPermissionManager(_root, acl, permRole);
                  }
          
                  emit DeployDAO(address(dao));
          
                  return dao;
              }
          }

          File 5 of 5: Kernel
          // File: contracts/acl/IACL.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          interface IACL {
              function initialize(address permissionsCreator) external;
          
              // TODO: this should be external
              // See https://github.com/ethereum/solidity/issues/4832
              function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);
          }
          
          // File: contracts/common/IVaultRecoverable.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          interface IVaultRecoverable {
              event RecoverToVault(address indexed vault, address indexed token, uint256 amount);
          
              function transferToVault(address token) external;
          
              function allowRecoverability(address token) external view returns (bool);
              function getRecoveryVault() external view returns (address);
          }
          
          // File: contracts/kernel/IKernel.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          interface IKernelEvents {
              event SetApp(bytes32 indexed namespace, bytes32 indexed appId, address app);
          }
          
          
          // This should be an interface, but interfaces can't inherit yet :(
          contract IKernel is IKernelEvents, IVaultRecoverable {
              function acl() public view returns (IACL);
              function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);
          
              function setApp(bytes32 namespace, bytes32 appId, address app) public;
              function getApp(bytes32 namespace, bytes32 appId) public view returns (address);
          }
          
          // File: contracts/kernel/KernelConstants.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract KernelAppIds {
              /* Hardcoded constants to save gas
              bytes32 internal constant KERNEL_CORE_APP_ID = apmNamehash("kernel");
              bytes32 internal constant KERNEL_DEFAULT_ACL_APP_ID = apmNamehash("acl");
              bytes32 internal constant KERNEL_DEFAULT_VAULT_APP_ID = apmNamehash("vault");
              */
              bytes32 internal constant KERNEL_CORE_APP_ID = 0x3b4bf6bf3ad5000ecf0f989d5befde585c6860fea3e574a4fab4c49d1c177d9c;
              bytes32 internal constant KERNEL_DEFAULT_ACL_APP_ID = 0xe3262375f45a6e2026b7e7b18c2b807434f2508fe1a2a3dfb493c7df8f4aad6a;
              bytes32 internal constant KERNEL_DEFAULT_VAULT_APP_ID = 0x7e852e0fcfce6551c13800f1e7476f982525c2b5277ba14b24339c68416336d1;
          }
          
          
          contract KernelNamespaceConstants {
              /* Hardcoded constants to save gas
              bytes32 internal constant KERNEL_CORE_NAMESPACE = keccak256("core");
              bytes32 internal constant KERNEL_APP_BASES_NAMESPACE = keccak256("base");
              bytes32 internal constant KERNEL_APP_ADDR_NAMESPACE = keccak256("app");
              */
              bytes32 internal constant KERNEL_CORE_NAMESPACE = 0xc681a85306374a5ab27f0bbc385296a54bcd314a1948b6cf61c4ea1bc44bb9f8;
              bytes32 internal constant KERNEL_APP_BASES_NAMESPACE = 0xf1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f;
              bytes32 internal constant KERNEL_APP_ADDR_NAMESPACE = 0xd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb;
          }
          
          // File: contracts/kernel/KernelStorage.sol
          
          pragma solidity 0.4.24;
          
          
          contract KernelStorage {
              // namespace => app id => address
              mapping (bytes32 => mapping (bytes32 => address)) public apps;
              bytes32 public recoveryVaultAppId;
          }
          
          // File: contracts/acl/ACLSyntaxSugar.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract ACLSyntaxSugar {
              function arr() internal pure returns (uint256[]) {
                  return new uint256[](0);
              }
          
              function arr(bytes32 _a) internal pure returns (uint256[] r) {
                  return arr(uint256(_a));
              }
          
              function arr(bytes32 _a, bytes32 _b) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b));
              }
          
              function arr(address _a) internal pure returns (uint256[] r) {
                  return arr(uint256(_a));
              }
          
              function arr(address _a, address _b) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b));
              }
          
              function arr(address _a, uint256 _b, uint256 _c) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), _b, _c);
              }
          
              function arr(address _a, uint256 _b, uint256 _c, uint256 _d) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), _b, _c, _d);
              }
          
              function arr(address _a, uint256 _b) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b));
              }
          
              function arr(address _a, address _b, uint256 _c, uint256 _d, uint256 _e) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b), _c, _d, _e);
              }
          
              function arr(address _a, address _b, address _c) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b), uint256(_c));
              }
          
              function arr(address _a, address _b, uint256 _c) internal pure returns (uint256[] r) {
                  return arr(uint256(_a), uint256(_b), uint256(_c));
              }
          
              function arr(uint256 _a) internal pure returns (uint256[] r) {
                  r = new uint256[](1);
                  r[0] = _a;
              }
          
              function arr(uint256 _a, uint256 _b) internal pure returns (uint256[] r) {
                  r = new uint256[](2);
                  r[0] = _a;
                  r[1] = _b;
              }
          
              function arr(uint256 _a, uint256 _b, uint256 _c) internal pure returns (uint256[] r) {
                  r = new uint256[](3);
                  r[0] = _a;
                  r[1] = _b;
                  r[2] = _c;
              }
          
              function arr(uint256 _a, uint256 _b, uint256 _c, uint256 _d) internal pure returns (uint256[] r) {
                  r = new uint256[](4);
                  r[0] = _a;
                  r[1] = _b;
                  r[2] = _c;
                  r[3] = _d;
              }
          
              function arr(uint256 _a, uint256 _b, uint256 _c, uint256 _d, uint256 _e) internal pure returns (uint256[] r) {
                  r = new uint256[](5);
                  r[0] = _a;
                  r[1] = _b;
                  r[2] = _c;
                  r[3] = _d;
                  r[4] = _e;
              }
          }
          
          
          contract ACLHelpers {
              function decodeParamOp(uint256 _x) internal pure returns (uint8 b) {
                  return uint8(_x >> (8 * 30));
              }
          
              function decodeParamId(uint256 _x) internal pure returns (uint8 b) {
                  return uint8(_x >> (8 * 31));
              }
          
              function decodeParamsList(uint256 _x) internal pure returns (uint32 a, uint32 b, uint32 c) {
                  a = uint32(_x);
                  b = uint32(_x >> (8 * 4));
                  c = uint32(_x >> (8 * 8));
              }
          }
          
          // File: contracts/common/ConversionHelpers.sol
          
          pragma solidity ^0.4.24;
          
          
          library ConversionHelpers {
              string private constant ERROR_IMPROPER_LENGTH = "CONVERSION_IMPROPER_LENGTH";
          
              function dangerouslyCastUintArrayToBytes(uint256[] memory _input) internal pure returns (bytes memory output) {
                  // Force cast the uint256[] into a bytes array, by overwriting its length
                  // Note that the bytes array doesn't need to be initialized as we immediately overwrite it
                  // with the input and a new length. The input becomes invalid from this point forward.
                  uint256 byteLength = _input.length * 32;
                  assembly {
                      output := _input
                      mstore(output, byteLength)
                  }
              }
          
              function dangerouslyCastBytesToUintArray(bytes memory _input) internal pure returns (uint256[] memory output) {
                  // Force cast the bytes array into a uint256[], by overwriting its length
                  // Note that the uint256[] doesn't need to be initialized as we immediately overwrite it
                  // with the input and a new length. The input becomes invalid from this point forward.
                  uint256 intsLength = _input.length / 32;
                  require(_input.length == intsLength * 32, ERROR_IMPROPER_LENGTH);
          
                  assembly {
                      output := _input
                      mstore(output, intsLength)
                  }
              }
          }
          
          // File: contracts/common/IsContract.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract IsContract {
              /*
              * NOTE: this should NEVER be used for authentication
              * (see pitfalls: https://github.com/fergarrui/ethereum-security/tree/master/contracts/extcodesize).
              *
              * This is only intended to be used as a sanity check that an address is actually a contract,
              * RATHER THAN an address not being a contract.
              */
              function isContract(address _target) internal view returns (bool) {
                  if (_target == address(0)) {
                      return false;
                  }
          
                  uint256 size;
                  assembly { size := extcodesize(_target) }
                  return size > 0;
              }
          }
          
          // File: contracts/common/Uint256Helpers.sol
          
          pragma solidity ^0.4.24;
          
          
          library Uint256Helpers {
              uint256 private constant MAX_UINT64 = uint64(-1);
          
              string private constant ERROR_NUMBER_TOO_BIG = "UINT64_NUMBER_TOO_BIG";
          
              function toUint64(uint256 a) internal pure returns (uint64) {
                  require(a <= MAX_UINT64, ERROR_NUMBER_TOO_BIG);
                  return uint64(a);
              }
          }
          
          // File: contracts/common/TimeHelpers.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          contract TimeHelpers {
              using Uint256Helpers for uint256;
          
              /**
              * @dev Returns the current block number.
              *      Using a function rather than `block.number` allows us to easily mock the block number in
              *      tests.
              */
              function getBlockNumber() internal view returns (uint256) {
                  return block.number;
              }
          
              /**
              * @dev Returns the current block number, converted to uint64.
              *      Using a function rather than `block.number` allows us to easily mock the block number in
              *      tests.
              */
              function getBlockNumber64() internal view returns (uint64) {
                  return getBlockNumber().toUint64();
              }
          
              /**
              * @dev Returns the current timestamp.
              *      Using a function rather than `block.timestamp` allows us to easily mock it in
              *      tests.
              */
              function getTimestamp() internal view returns (uint256) {
                  return block.timestamp; // solium-disable-line security/no-block-members
              }
          
              /**
              * @dev Returns the current timestamp, converted to uint64.
              *      Using a function rather than `block.timestamp` allows us to easily mock it in
              *      tests.
              */
              function getTimestamp64() internal view returns (uint64) {
                  return getTimestamp().toUint64();
              }
          }
          
          // File: contracts/common/UnstructuredStorage.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          library UnstructuredStorage {
              function getStorageBool(bytes32 position) internal view returns (bool data) {
                  assembly { data := sload(position) }
              }
          
              function getStorageAddress(bytes32 position) internal view returns (address data) {
                  assembly { data := sload(position) }
              }
          
              function getStorageBytes32(bytes32 position) internal view returns (bytes32 data) {
                  assembly { data := sload(position) }
              }
          
              function getStorageUint256(bytes32 position) internal view returns (uint256 data) {
                  assembly { data := sload(position) }
              }
          
              function setStorageBool(bytes32 position, bool data) internal {
                  assembly { sstore(position, data) }
              }
          
              function setStorageAddress(bytes32 position, address data) internal {
                  assembly { sstore(position, data) }
              }
          
              function setStorageBytes32(bytes32 position, bytes32 data) internal {
                  assembly { sstore(position, data) }
              }
          
              function setStorageUint256(bytes32 position, uint256 data) internal {
                  assembly { sstore(position, data) }
              }
          }
          
          // File: contracts/common/Initializable.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          contract Initializable is TimeHelpers {
              using UnstructuredStorage for bytes32;
          
              // keccak256("aragonOS.initializable.initializationBlock")
              bytes32 internal constant INITIALIZATION_BLOCK_POSITION = 0xebb05b386a8d34882b8711d156f463690983dc47815980fb82aeeff1aa43579e;
          
              string private constant ERROR_ALREADY_INITIALIZED = "INIT_ALREADY_INITIALIZED";
              string private constant ERROR_NOT_INITIALIZED = "INIT_NOT_INITIALIZED";
          
              modifier onlyInit {
                  require(getInitializationBlock() == 0, ERROR_ALREADY_INITIALIZED);
                  _;
              }
          
              modifier isInitialized {
                  require(hasInitialized(), ERROR_NOT_INITIALIZED);
                  _;
              }
          
              /**
              * @return Block number in which the contract was initialized
              */
              function getInitializationBlock() public view returns (uint256) {
                  return INITIALIZATION_BLOCK_POSITION.getStorageUint256();
              }
          
              /**
              * @return Whether the contract has been initialized by the time of the current block
              */
              function hasInitialized() public view returns (bool) {
                  uint256 initializationBlock = getInitializationBlock();
                  return initializationBlock != 0 && getBlockNumber() >= initializationBlock;
              }
          
              /**
              * @dev Function to be called by top level contract after initialization has finished.
              */
              function initialized() internal onlyInit {
                  INITIALIZATION_BLOCK_POSITION.setStorageUint256(getBlockNumber());
              }
          
              /**
              * @dev Function to be called by top level contract after initialization to enable the contract
              *      at a future block number rather than immediately.
              */
              function initializedAt(uint256 _blockNumber) internal onlyInit {
                  INITIALIZATION_BLOCK_POSITION.setStorageUint256(_blockNumber);
              }
          }
          
          // File: contracts/common/Petrifiable.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          contract Petrifiable is Initializable {
              // Use block UINT256_MAX (which should be never) as the initializable date
              uint256 internal constant PETRIFIED_BLOCK = uint256(-1);
          
              function isPetrified() public view returns (bool) {
                  return getInitializationBlock() == PETRIFIED_BLOCK;
              }
          
              /**
              * @dev Function to be called by top level contract to prevent being initialized.
              *      Useful for freezing base contracts when they're used behind proxies.
              */
              function petrify() internal onlyInit {
                  initializedAt(PETRIFIED_BLOCK);
              }
          }
          
          // File: contracts/lib/token/ERC20.sol
          
          // See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/a9f910d34f0ab33a1ae5e714f69f9596a02b4d91/contracts/token/ERC20/ERC20.sol
          
          pragma solidity ^0.4.24;
          
          
          /**
           * @title ERC20 interface
           * @dev see https://github.com/ethereum/EIPs/issues/20
           */
          contract ERC20 {
              function totalSupply() public view returns (uint256);
          
              function balanceOf(address _who) public view returns (uint256);
          
              function allowance(address _owner, address _spender)
                  public view returns (uint256);
          
              function transfer(address _to, uint256 _value) public returns (bool);
          
              function approve(address _spender, uint256 _value)
                  public returns (bool);
          
              function transferFrom(address _from, address _to, uint256 _value)
                  public returns (bool);
          
              event Transfer(
                  address indexed from,
                  address indexed to,
                  uint256 value
              );
          
              event Approval(
                  address indexed owner,
                  address indexed spender,
                  uint256 value
              );
          }
          
          // File: contracts/common/EtherTokenConstant.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          // aragonOS and aragon-apps rely on address(0) to denote native ETH, in
          // contracts where both tokens and ETH are accepted
          contract EtherTokenConstant {
              address internal constant ETH = address(0);
          }
          
          // File: contracts/common/SafeERC20.sol
          
          // Inspired by AdEx (https://github.com/AdExNetwork/adex-protocol-eth/blob/b9df617829661a7518ee10f4cb6c4108659dd6d5/contracts/libs/SafeERC20.sol)
          // and 0x (https://github.com/0xProject/0x-monorepo/blob/737d1dc54d72872e24abce5a1dbe1b66d35fa21a/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol#L143)
          
          pragma solidity ^0.4.24;
          
          
          
          library SafeERC20 {
              // Before 0.5, solidity has a mismatch between `address.transfer()` and `token.transfer()`:
              // https://github.com/ethereum/solidity/issues/3544
              bytes4 private constant TRANSFER_SELECTOR = 0xa9059cbb;
          
              string private constant ERROR_TOKEN_BALANCE_REVERTED = "SAFE_ERC_20_BALANCE_REVERTED";
              string private constant ERROR_TOKEN_ALLOWANCE_REVERTED = "SAFE_ERC_20_ALLOWANCE_REVERTED";
          
              function invokeAndCheckSuccess(address _addr, bytes memory _calldata)
                  private
                  returns (bool)
              {
                  bool ret;
                  assembly {
                      let ptr := mload(0x40)    // free memory pointer
          
                      let success := call(
                          gas,                  // forward all gas
                          _addr,                // address
                          0,                    // no value
                          add(_calldata, 0x20), // calldata start
                          mload(_calldata),     // calldata length
                          ptr,                  // write output over free memory
                          0x20                  // uint256 return
                      )
          
                      if gt(success, 0) {
                          // Check number of bytes returned from last function call
                          switch returndatasize
          
                          // No bytes returned: assume success
                          case 0 {
                              ret := 1
                          }
          
                          // 32 bytes returned: check if non-zero
                          case 0x20 {
                              // Only return success if returned data was true
                              // Already have output in ptr
                              ret := eq(mload(ptr), 1)
                          }
          
                          // Not sure what was returned: don't mark as success
                          default { }
                      }
                  }
                  return ret;
              }
          
              function staticInvoke(address _addr, bytes memory _calldata)
                  private
                  view
                  returns (bool, uint256)
              {
                  bool success;
                  uint256 ret;
                  assembly {
                      let ptr := mload(0x40)    // free memory pointer
          
                      success := staticcall(
                          gas,                  // forward all gas
                          _addr,                // address
                          add(_calldata, 0x20), // calldata start
                          mload(_calldata),     // calldata length
                          ptr,                  // write output over free memory
                          0x20                  // uint256 return
                      )
          
                      if gt(success, 0) {
                          ret := mload(ptr)
                      }
                  }
                  return (success, ret);
              }
          
              /**
              * @dev Same as a standards-compliant ERC20.transfer() that never reverts (returns false).
              *      Note that this makes an external call to the token.
              */
              function safeTransfer(ERC20 _token, address _to, uint256 _amount) internal returns (bool) {
                  bytes memory transferCallData = abi.encodeWithSelector(
                      TRANSFER_SELECTOR,
                      _to,
                      _amount
                  );
                  return invokeAndCheckSuccess(_token, transferCallData);
              }
          
              /**
              * @dev Same as a standards-compliant ERC20.transferFrom() that never reverts (returns false).
              *      Note that this makes an external call to the token.
              */
              function safeTransferFrom(ERC20 _token, address _from, address _to, uint256 _amount) internal returns (bool) {
                  bytes memory transferFromCallData = abi.encodeWithSelector(
                      _token.transferFrom.selector,
                      _from,
                      _to,
                      _amount
                  );
                  return invokeAndCheckSuccess(_token, transferFromCallData);
              }
          
              /**
              * @dev Same as a standards-compliant ERC20.approve() that never reverts (returns false).
              *      Note that this makes an external call to the token.
              */
              function safeApprove(ERC20 _token, address _spender, uint256 _amount) internal returns (bool) {
                  bytes memory approveCallData = abi.encodeWithSelector(
                      _token.approve.selector,
                      _spender,
                      _amount
                  );
                  return invokeAndCheckSuccess(_token, approveCallData);
              }
          
              /**
              * @dev Static call into ERC20.balanceOf().
              * Reverts if the call fails for some reason (should never fail).
              */
              function staticBalanceOf(ERC20 _token, address _owner) internal view returns (uint256) {
                  bytes memory balanceOfCallData = abi.encodeWithSelector(
                      _token.balanceOf.selector,
                      _owner
                  );
          
                  (bool success, uint256 tokenBalance) = staticInvoke(_token, balanceOfCallData);
                  require(success, ERROR_TOKEN_BALANCE_REVERTED);
          
                  return tokenBalance;
              }
          
              /**
              * @dev Static call into ERC20.allowance().
              * Reverts if the call fails for some reason (should never fail).
              */
              function staticAllowance(ERC20 _token, address _owner, address _spender) internal view returns (uint256) {
                  bytes memory allowanceCallData = abi.encodeWithSelector(
                      _token.allowance.selector,
                      _owner,
                      _spender
                  );
          
                  (bool success, uint256 allowance) = staticInvoke(_token, allowanceCallData);
                  require(success, ERROR_TOKEN_ALLOWANCE_REVERTED);
          
                  return allowance;
              }
          
              /**
              * @dev Static call into ERC20.totalSupply().
              * Reverts if the call fails for some reason (should never fail).
              */
              function staticTotalSupply(ERC20 _token) internal view returns (uint256) {
                  bytes memory totalSupplyCallData = abi.encodeWithSelector(_token.totalSupply.selector);
          
                  (bool success, uint256 totalSupply) = staticInvoke(_token, totalSupplyCallData);
                  require(success, ERROR_TOKEN_ALLOWANCE_REVERTED);
          
                  return totalSupply;
              }
          }
          
          // File: contracts/common/VaultRecoverable.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          
          
          
          contract VaultRecoverable is IVaultRecoverable, EtherTokenConstant, IsContract {
              using SafeERC20 for ERC20;
          
              string private constant ERROR_DISALLOWED = "RECOVER_DISALLOWED";
              string private constant ERROR_VAULT_NOT_CONTRACT = "RECOVER_VAULT_NOT_CONTRACT";
              string private constant ERROR_TOKEN_TRANSFER_FAILED = "RECOVER_TOKEN_TRANSFER_FAILED";
          
              /**
               * @notice Send funds to recovery Vault. This contract should never receive funds,
               *         but in case it does, this function allows one to recover them.
               * @param _token Token balance to be sent to recovery vault.
               */
              function transferToVault(address _token) external {
                  require(allowRecoverability(_token), ERROR_DISALLOWED);
                  address vault = getRecoveryVault();
                  require(isContract(vault), ERROR_VAULT_NOT_CONTRACT);
          
                  uint256 balance;
                  if (_token == ETH) {
                      balance = address(this).balance;
                      vault.transfer(balance);
                  } else {
                      ERC20 token = ERC20(_token);
                      balance = token.staticBalanceOf(this);
                      require(token.safeTransfer(vault, balance), ERROR_TOKEN_TRANSFER_FAILED);
                  }
          
                  emit RecoverToVault(vault, _token, balance);
              }
          
              /**
              * @dev By default deriving from AragonApp makes it recoverable
              * @param token Token address that would be recovered
              * @return bool whether the app allows the recovery
              */
              function allowRecoverability(address token) public view returns (bool) {
                  return true;
              }
          
              // Cast non-implemented interface to be public so we can use it internally
              function getRecoveryVault() public view returns (address);
          }
          
          // File: contracts/apps/AppStorage.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          
          
          contract AppStorage {
              using UnstructuredStorage for bytes32;
          
              /* Hardcoded constants to save gas
              bytes32 internal constant KERNEL_POSITION = keccak256("aragonOS.appStorage.kernel");
              bytes32 internal constant APP_ID_POSITION = keccak256("aragonOS.appStorage.appId");
              */
              bytes32 internal constant KERNEL_POSITION = 0x4172f0f7d2289153072b0a6ca36959e0cbe2efc3afe50fc81636caa96338137b;
              bytes32 internal constant APP_ID_POSITION = 0xd625496217aa6a3453eecb9c3489dc5a53e6c67b444329ea2b2cbc9ff547639b;
          
              function kernel() public view returns (IKernel) {
                  return IKernel(KERNEL_POSITION.getStorageAddress());
              }
          
              function appId() public view returns (bytes32) {
                  return APP_ID_POSITION.getStorageBytes32();
              }
          
              function setKernel(IKernel _kernel) internal {
                  KERNEL_POSITION.setStorageAddress(address(_kernel));
              }
          
              function setAppId(bytes32 _appId) internal {
                  APP_ID_POSITION.setStorageBytes32(_appId);
              }
          }
          
          // File: contracts/lib/misc/ERCProxy.sol
          
          /*
           * SPDX-License-Identitifer:    MIT
           */
          
          pragma solidity ^0.4.24;
          
          
          contract ERCProxy {
              uint256 internal constant FORWARDING = 1;
              uint256 internal constant UPGRADEABLE = 2;
          
              function proxyType() public pure returns (uint256 proxyTypeId);
              function implementation() public view returns (address codeAddr);
          }
          
          // File: contracts/common/DelegateProxy.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          contract DelegateProxy is ERCProxy, IsContract {
              uint256 internal constant FWD_GAS_LIMIT = 10000;
          
              /**
              * @dev Performs a delegatecall and returns whatever the delegatecall returned (entire context execution will return!)
              * @param _dst Destination address to perform the delegatecall
              * @param _calldata Calldata for the delegatecall
              */
              function delegatedFwd(address _dst, bytes _calldata) internal {
                  require(isContract(_dst));
                  uint256 fwdGasLimit = FWD_GAS_LIMIT;
          
                  assembly {
                      let result := delegatecall(sub(gas, fwdGasLimit), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)
                      let size := returndatasize
                      let ptr := mload(0x40)
                      returndatacopy(ptr, 0, size)
          
                      // revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas.
                      // if the call returned error data, forward it
                      switch result case 0 { revert(ptr, size) }
                      default { return(ptr, size) }
                  }
              }
          }
          
          // File: contracts/common/DepositableStorage.sol
          
          pragma solidity 0.4.24;
          
          
          
          contract DepositableStorage {
              using UnstructuredStorage for bytes32;
          
              // keccak256("aragonOS.depositableStorage.depositable")
              bytes32 internal constant DEPOSITABLE_POSITION = 0x665fd576fbbe6f247aff98f5c94a561e3f71ec2d3c988d56f12d342396c50cea;
          
              function isDepositable() public view returns (bool) {
                  return DEPOSITABLE_POSITION.getStorageBool();
              }
          
              function setDepositable(bool _depositable) internal {
                  DEPOSITABLE_POSITION.setStorageBool(_depositable);
              }
          }
          
          // File: contracts/common/DepositableDelegateProxy.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          contract DepositableDelegateProxy is DepositableStorage, DelegateProxy {
              event ProxyDeposit(address sender, uint256 value);
          
              function () external payable {
                  uint256 forwardGasThreshold = FWD_GAS_LIMIT;
                  bytes32 isDepositablePosition = DEPOSITABLE_POSITION;
          
                  // Optimized assembly implementation to prevent EIP-1884 from breaking deposits, reference code in Solidity:
                  // https://github.com/aragon/aragonOS/blob/v4.2.1/contracts/common/DepositableDelegateProxy.sol#L10-L20
                  assembly {
                      // Continue only if the gas left is lower than the threshold for forwarding to the implementation code,
                      // otherwise continue outside of the assembly block.
                      if lt(gas, forwardGasThreshold) {
                          // Only accept the deposit and emit an event if all of the following are true:
                          // the proxy accepts deposits (isDepositable), msg.data.length == 0, and msg.value > 0
                          if and(and(sload(isDepositablePosition), iszero(calldatasize)), gt(callvalue, 0)) {
                              // Equivalent Solidity code for emitting the event:
                              // emit ProxyDeposit(msg.sender, msg.value);
          
                              let logData := mload(0x40) // free memory pointer
                              mstore(logData, caller) // add 'msg.sender' to the log data (first event param)
                              mstore(add(logData, 0x20), callvalue) // add 'msg.value' to the log data (second event param)
          
                              // Emit an event with one topic to identify the event: keccak256('ProxyDeposit(address,uint256)') = 0x15ee...dee1
                              log1(logData, 0x40, 0x15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1)
          
                              stop() // Stop. Exits execution context
                          }
          
                          // If any of above checks failed, revert the execution (if ETH was sent, it is returned to the sender)
                          revert(0, 0)
                      }
                  }
          
                  address target = implementation();
                  delegatedFwd(target, msg.data);
              }
          }
          
          // File: contracts/apps/AppProxyBase.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          contract AppProxyBase is AppStorage, DepositableDelegateProxy, KernelNamespaceConstants {
              /**
              * @dev Initialize AppProxy
              * @param _kernel Reference to organization kernel for the app
              * @param _appId Identifier for app
              * @param _initializePayload Payload for call to be made after setup to initialize
              */
              constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload) public {
                  setKernel(_kernel);
                  setAppId(_appId);
          
                  // Implicit check that kernel is actually a Kernel
                  // The EVM doesn't actually provide a way for us to make sure, but we can force a revert to
                  // occur if the kernel is set to 0x0 or a non-code address when we try to call a method on
                  // it.
                  address appCode = getAppBase(_appId);
          
                  // If initialize payload is provided, it will be executed
                  if (_initializePayload.length > 0) {
                      require(isContract(appCode));
                      // Cannot make delegatecall as a delegateproxy.delegatedFwd as it
                      // returns ending execution context and halts contract deployment
                      require(appCode.delegatecall(_initializePayload));
                  }
              }
          
              function getAppBase(bytes32 _appId) internal view returns (address) {
                  return kernel().getApp(KERNEL_APP_BASES_NAMESPACE, _appId);
              }
          }
          
          // File: contracts/apps/AppProxyUpgradeable.sol
          
          pragma solidity 0.4.24;
          
          
          
          contract AppProxyUpgradeable is AppProxyBase {
              /**
              * @dev Initialize AppProxyUpgradeable (makes it an upgradeable Aragon app)
              * @param _kernel Reference to organization kernel for the app
              * @param _appId Identifier for app
              * @param _initializePayload Payload for call to be made after setup to initialize
              */
              constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload)
                  AppProxyBase(_kernel, _appId, _initializePayload)
                  public // solium-disable-line visibility-first
              {
                  // solium-disable-previous-line no-empty-blocks
              }
          
              /**
               * @dev ERC897, the address the proxy would delegate calls to
               */
              function implementation() public view returns (address) {
                  return getAppBase(appId());
              }
          
              /**
               * @dev ERC897, whether it is a forwarding (1) or an upgradeable (2) proxy
               */
              function proxyType() public pure returns (uint256 proxyTypeId) {
                  return UPGRADEABLE;
              }
          }
          
          // File: contracts/apps/AppProxyPinned.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          contract AppProxyPinned is IsContract, AppProxyBase {
              using UnstructuredStorage for bytes32;
          
              // keccak256("aragonOS.appStorage.pinnedCode")
              bytes32 internal constant PINNED_CODE_POSITION = 0xdee64df20d65e53d7f51cb6ab6d921a0a6a638a91e942e1d8d02df28e31c038e;
          
              /**
              * @dev Initialize AppProxyPinned (makes it an un-upgradeable Aragon app)
              * @param _kernel Reference to organization kernel for the app
              * @param _appId Identifier for app
              * @param _initializePayload Payload for call to be made after setup to initialize
              */
              constructor(IKernel _kernel, bytes32 _appId, bytes _initializePayload)
                  AppProxyBase(_kernel, _appId, _initializePayload)
                  public // solium-disable-line visibility-first
              {
                  setPinnedCode(getAppBase(_appId));
                  require(isContract(pinnedCode()));
              }
          
              /**
               * @dev ERC897, the address the proxy would delegate calls to
               */
              function implementation() public view returns (address) {
                  return pinnedCode();
              }
          
              /**
               * @dev ERC897, whether it is a forwarding (1) or an upgradeable (2) proxy
               */
              function proxyType() public pure returns (uint256 proxyTypeId) {
                  return FORWARDING;
              }
          
              function setPinnedCode(address _pinnedCode) internal {
                  PINNED_CODE_POSITION.setStorageAddress(_pinnedCode);
              }
          
              function pinnedCode() internal view returns (address) {
                  return PINNED_CODE_POSITION.getStorageAddress();
              }
          }
          
          // File: contracts/factory/AppProxyFactory.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          contract AppProxyFactory {
              event NewAppProxy(address proxy, bool isUpgradeable, bytes32 appId);
          
              /**
              * @notice Create a new upgradeable app instance on `_kernel` with identifier `_appId`
              * @param _kernel App's Kernel reference
              * @param _appId Identifier for app
              * @return AppProxyUpgradeable
              */
              function newAppProxy(IKernel _kernel, bytes32 _appId) public returns (AppProxyUpgradeable) {
                  return newAppProxy(_kernel, _appId, new bytes(0));
              }
          
              /**
              * @notice Create a new upgradeable app instance on `_kernel` with identifier `_appId` and initialization payload `_initializePayload`
              * @param _kernel App's Kernel reference
              * @param _appId Identifier for app
              * @return AppProxyUpgradeable
              */
              function newAppProxy(IKernel _kernel, bytes32 _appId, bytes _initializePayload) public returns (AppProxyUpgradeable) {
                  AppProxyUpgradeable proxy = new AppProxyUpgradeable(_kernel, _appId, _initializePayload);
                  emit NewAppProxy(address(proxy), true, _appId);
                  return proxy;
              }
          
              /**
              * @notice Create a new pinned app instance on `_kernel` with identifier `_appId`
              * @param _kernel App's Kernel reference
              * @param _appId Identifier for app
              * @return AppProxyPinned
              */
              function newAppProxyPinned(IKernel _kernel, bytes32 _appId) public returns (AppProxyPinned) {
                  return newAppProxyPinned(_kernel, _appId, new bytes(0));
              }
          
              /**
              * @notice Create a new pinned app instance on `_kernel` with identifier `_appId` and initialization payload `_initializePayload`
              * @param _kernel App's Kernel reference
              * @param _appId Identifier for app
              * @param _initializePayload Proxy initialization payload
              * @return AppProxyPinned
              */
              function newAppProxyPinned(IKernel _kernel, bytes32 _appId, bytes _initializePayload) public returns (AppProxyPinned) {
                  AppProxyPinned proxy = new AppProxyPinned(_kernel, _appId, _initializePayload);
                  emit NewAppProxy(address(proxy), false, _appId);
                  return proxy;
              }
          }
          
          // File: contracts/kernel/Kernel.sol
          
          pragma solidity 0.4.24;
          
          
          
          
          
          
          
          
          
          
          
          
          
          // solium-disable-next-line max-len
          contract Kernel is IKernel, KernelStorage, KernelAppIds, KernelNamespaceConstants, Petrifiable, IsContract, VaultRecoverable, AppProxyFactory, ACLSyntaxSugar {
              /* Hardcoded constants to save gas
              bytes32 public constant APP_MANAGER_ROLE = keccak256("APP_MANAGER_ROLE");
              */
              bytes32 public constant APP_MANAGER_ROLE = 0xb6d92708f3d4817afc106147d969e229ced5c46e65e0a5002a0d391287762bd0;
          
              string private constant ERROR_APP_NOT_CONTRACT = "KERNEL_APP_NOT_CONTRACT";
              string private constant ERROR_INVALID_APP_CHANGE = "KERNEL_INVALID_APP_CHANGE";
              string private constant ERROR_AUTH_FAILED = "KERNEL_AUTH_FAILED";
          
              /**
              * @dev Constructor that allows the deployer to choose if the base instance should be petrified immediately.
              * @param _shouldPetrify Immediately petrify this instance so that it can never be initialized
              */
              constructor(bool _shouldPetrify) public {
                  if (_shouldPetrify) {
                      petrify();
                  }
              }
          
              /**
              * @dev Initialize can only be called once. It saves the block number in which it was initialized.
              * @notice Initialize this kernel instance along with its ACL and set `_permissionsCreator` as the entity that can create other permissions
              * @param _baseAcl Address of base ACL app
              * @param _permissionsCreator Entity that will be given permission over createPermission
              */
              function initialize(IACL _baseAcl, address _permissionsCreator) public onlyInit {
                  initialized();
          
                  // Set ACL base
                  _setApp(KERNEL_APP_BASES_NAMESPACE, KERNEL_DEFAULT_ACL_APP_ID, _baseAcl);
          
                  // Create ACL instance and attach it as the default ACL app
                  IACL acl = IACL(newAppProxy(this, KERNEL_DEFAULT_ACL_APP_ID));
                  acl.initialize(_permissionsCreator);
                  _setApp(KERNEL_APP_ADDR_NAMESPACE, KERNEL_DEFAULT_ACL_APP_ID, acl);
          
                  recoveryVaultAppId = KERNEL_DEFAULT_VAULT_APP_ID;
              }
          
              /**
              * @dev Create a new instance of an app linked to this kernel
              * @notice Create a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`
              * @param _appId Identifier for app
              * @param _appBase Address of the app's base implementation
              * @return AppProxy instance
              */
              function newAppInstance(bytes32 _appId, address _appBase)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
                  returns (ERCProxy appProxy)
              {
                  return newAppInstance(_appId, _appBase, new bytes(0), false);
              }
          
              /**
              * @dev Create a new instance of an app linked to this kernel and set its base
              *      implementation if it was not already set
              * @notice Create a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`
              * @param _appId Identifier for app
              * @param _appBase Address of the app's base implementation
              * @param _initializePayload Payload for call made by the proxy during its construction to initialize
              * @param _setDefault Whether the app proxy app is the default one.
              *        Useful when the Kernel needs to know of an instance of a particular app,
              *        like Vault for escape hatch mechanism.
              * @return AppProxy instance
              */
              function newAppInstance(bytes32 _appId, address _appBase, bytes _initializePayload, bool _setDefault)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
                  returns (ERCProxy appProxy)
              {
                  _setAppIfNew(KERNEL_APP_BASES_NAMESPACE, _appId, _appBase);
                  appProxy = newAppProxy(this, _appId, _initializePayload);
                  // By calling setApp directly and not the internal functions, we make sure the params are checked
                  // and it will only succeed if sender has permissions to set something to the namespace.
                  if (_setDefault) {
                      setApp(KERNEL_APP_ADDR_NAMESPACE, _appId, appProxy);
                  }
              }
          
              /**
              * @dev Create a new pinned instance of an app linked to this kernel
              * @notice Create a new non-upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`.
              * @param _appId Identifier for app
              * @param _appBase Address of the app's base implementation
              * @return AppProxy instance
              */
              function newPinnedAppInstance(bytes32 _appId, address _appBase)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
                  returns (ERCProxy appProxy)
              {
                  return newPinnedAppInstance(_appId, _appBase, new bytes(0), false);
              }
          
              /**
              * @dev Create a new pinned instance of an app linked to this kernel and set
              *      its base implementation if it was not already set
              * @notice Create a new non-upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`
              * @param _appId Identifier for app
              * @param _appBase Address of the app's base implementation
              * @param _initializePayload Payload for call made by the proxy during its construction to initialize
              * @param _setDefault Whether the app proxy app is the default one.
              *        Useful when the Kernel needs to know of an instance of a particular app,
              *        like Vault for escape hatch mechanism.
              * @return AppProxy instance
              */
              function newPinnedAppInstance(bytes32 _appId, address _appBase, bytes _initializePayload, bool _setDefault)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
                  returns (ERCProxy appProxy)
              {
                  _setAppIfNew(KERNEL_APP_BASES_NAMESPACE, _appId, _appBase);
                  appProxy = newAppProxyPinned(this, _appId, _initializePayload);
                  // By calling setApp directly and not the internal functions, we make sure the params are checked
                  // and it will only succeed if sender has permissions to set something to the namespace.
                  if (_setDefault) {
                      setApp(KERNEL_APP_ADDR_NAMESPACE, _appId, appProxy);
                  }
              }
          
              /**
              * @dev Set the resolving address of an app instance or base implementation
              * @notice Set the resolving address of `_appId` in namespace `_namespace` to `_app`
              * @param _namespace App namespace to use
              * @param _appId Identifier for app
              * @param _app Address of the app instance or base implementation
              * @return ID of app
              */
              function setApp(bytes32 _namespace, bytes32 _appId, address _app)
                  public
                  auth(APP_MANAGER_ROLE, arr(_namespace, _appId))
              {
                  _setApp(_namespace, _appId, _app);
              }
          
              /**
              * @dev Set the default vault id for the escape hatch mechanism
              * @param _recoveryVaultAppId Identifier of the recovery vault app
              */
              function setRecoveryVaultAppId(bytes32 _recoveryVaultAppId)
                  public
                  auth(APP_MANAGER_ROLE, arr(KERNEL_APP_ADDR_NAMESPACE, _recoveryVaultAppId))
              {
                  recoveryVaultAppId = _recoveryVaultAppId;
              }
          
              // External access to default app id and namespace constants to mimic default getters for constants
              /* solium-disable function-order, mixedcase */
              function CORE_NAMESPACE() external pure returns (bytes32) { return KERNEL_CORE_NAMESPACE; }
              function APP_BASES_NAMESPACE() external pure returns (bytes32) { return KERNEL_APP_BASES_NAMESPACE; }
              function APP_ADDR_NAMESPACE() external pure returns (bytes32) { return KERNEL_APP_ADDR_NAMESPACE; }
              function KERNEL_APP_ID() external pure returns (bytes32) { return KERNEL_CORE_APP_ID; }
              function DEFAULT_ACL_APP_ID() external pure returns (bytes32) { return KERNEL_DEFAULT_ACL_APP_ID; }
              /* solium-enable function-order, mixedcase */
          
              /**
              * @dev Get the address of an app instance or base implementation
              * @param _namespace App namespace to use
              * @param _appId Identifier for app
              * @return Address of the app
              */
              function getApp(bytes32 _namespace, bytes32 _appId) public view returns (address) {
                  return apps[_namespace][_appId];
              }
          
              /**
              * @dev Get the address of the recovery Vault instance (to recover funds)
              * @return Address of the Vault
              */
              function getRecoveryVault() public view returns (address) {
                  return apps[KERNEL_APP_ADDR_NAMESPACE][recoveryVaultAppId];
              }
          
              /**
              * @dev Get the installed ACL app
              * @return ACL app
              */
              function acl() public view returns (IACL) {
                  return IACL(getApp(KERNEL_APP_ADDR_NAMESPACE, KERNEL_DEFAULT_ACL_APP_ID));
              }
          
              /**
              * @dev Function called by apps to check ACL on kernel or to check permission status
              * @param _who Sender of the original call
              * @param _where Address of the app
              * @param _what Identifier for a group of actions in app
              * @param _how Extra data for ACL auth
              * @return Boolean indicating whether the ACL allows the role or not.
              *         Always returns false if the kernel hasn't been initialized yet.
              */
              function hasPermission(address _who, address _where, bytes32 _what, bytes _how) public view returns (bool) {
                  IACL defaultAcl = acl();
                  return address(defaultAcl) != address(0) && // Poor man's initialization check (saves gas)
                      defaultAcl.hasPermission(_who, _where, _what, _how);
              }
          
              function _setApp(bytes32 _namespace, bytes32 _appId, address _app) internal {
                  require(isContract(_app), ERROR_APP_NOT_CONTRACT);
                  apps[_namespace][_appId] = _app;
                  emit SetApp(_namespace, _appId, _app);
              }
          
              function _setAppIfNew(bytes32 _namespace, bytes32 _appId, address _app) internal {
                  address app = getApp(_namespace, _appId);
                  if (app != address(0)) {
                      // The only way to set an app is if it passes the isContract check, so no need to check it again
                      require(app == _app, ERROR_INVALID_APP_CHANGE);
                  } else {
                      _setApp(_namespace, _appId, _app);
                  }
              }
          
              modifier auth(bytes32 _role, uint256[] memory _params) {
                  require(
                      hasPermission(msg.sender, address(this), _role, ConversionHelpers.dangerouslyCastUintArrayToBytes(_params)),
                      ERROR_AUTH_FAILED
                  );
                  _;
              }
          }