chai-link 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (322) hide show
  1. package/README.md +5 -0
  2. package/contracts/Aggregator.sol +420 -0
  3. package/contracts/AggregatorProxy.sol +99 -0
  4. package/contracts/Chainlink.sol +125 -0
  5. package/contracts/ChainlinkClient.sol +262 -0
  6. package/contracts/Chainlinked.sol +141 -0
  7. package/contracts/Migrations.sol +23 -0
  8. package/contracts/Oracle.sol +320 -0
  9. package/contracts/Pointer.sol +9 -0
  10. package/contracts/interfaces/AggregatorInterface.sol +12 -0
  11. package/contracts/interfaces/ChainlinkRequestInterface.sol +21 -0
  12. package/contracts/interfaces/ENSInterface.sol +26 -0
  13. package/contracts/interfaces/LinkTokenInterface.sol +16 -0
  14. package/contracts/interfaces/OracleInterface.sol +16 -0
  15. package/contracts/interfaces/PointerInterface.sol +5 -0
  16. package/contracts/tests/BasicConsumer.sol +13 -0
  17. package/contracts/tests/ConcreteChainlink.sol +76 -0
  18. package/contracts/tests/ConcreteChainlinked.sol +100 -0
  19. package/contracts/tests/ConcreteSignedSafeMath.sol +16 -0
  20. package/contracts/tests/Consumer.sol +47 -0
  21. package/contracts/tests/EmptyOracle.sol +19 -0
  22. package/contracts/tests/GetterSetter.sol +45 -0
  23. package/contracts/tests/MaliciousChainlink.sol +76 -0
  24. package/contracts/tests/MaliciousChainlinked.sol +109 -0
  25. package/contracts/tests/MaliciousConsumer.sol +54 -0
  26. package/contracts/tests/MaliciousRequester.sol +52 -0
  27. package/contracts/tests/UpdatableConsumer.sol +24 -0
  28. package/contracts/vendor/Buffer.sol +301 -0
  29. package/contracts/vendor/CBOR.sol +71 -0
  30. package/contracts/vendor/ENS.sol +26 -0
  31. package/contracts/vendor/ENSRegistry.sol +99 -0
  32. package/contracts/vendor/ENSResolver.sol +5 -0
  33. package/contracts/vendor/Ownable.sol +64 -0
  34. package/contracts/vendor/PublicResolver.sol +238 -0
  35. package/contracts/vendor/SafeMath.sol +52 -0
  36. package/contracts/vendor/SignedSafeMath.sol +21 -0
  37. package/dist/artifacts/Aggregator.json +580 -0
  38. package/dist/artifacts/AggregatorInterface.json +172 -0
  39. package/dist/artifacts/AggregatorProxy.json +294 -0
  40. package/dist/artifacts/BasicConsumer.json +250 -0
  41. package/dist/artifacts/Buffer.json +52 -0
  42. package/dist/artifacts/CBOR.json +56 -0
  43. package/dist/artifacts/Chainlink.json +60 -0
  44. package/dist/artifacts/ChainlinkClient.json +125 -0
  45. package/dist/artifacts/ChainlinkRequestInterface.json +121 -0
  46. package/dist/artifacts/Chainlinked.json +129 -0
  47. package/dist/artifacts/ConcreteChainlink.json +190 -0
  48. package/dist/artifacts/ConcreteChainlinked.json +387 -0
  49. package/dist/artifacts/ConcreteSignedSafeMath.json +80 -0
  50. package/dist/artifacts/Consumer.json +227 -0
  51. package/dist/artifacts/ENS.json +259 -0
  52. package/dist/artifacts/ENSInterface.json +259 -0
  53. package/dist/artifacts/ENSRegistry.json +269 -0
  54. package/dist/artifacts/ENSResolver.json +72 -0
  55. package/dist/artifacts/EmptyOracle.json +259 -0
  56. package/dist/artifacts/GetterSetter.json +278 -0
  57. package/dist/artifacts/LinkTokenInterface.json +292 -0
  58. package/dist/artifacts/MaliciousChainlink.json +60 -0
  59. package/dist/artifacts/MaliciousChainlinked.json +137 -0
  60. package/dist/artifacts/MaliciousConsumer.json +288 -0
  61. package/dist/artifacts/MaliciousRequester.json +266 -0
  62. package/dist/artifacts/Migrations.json +115 -0
  63. package/dist/artifacts/Oracle.json +426 -0
  64. package/dist/artifacts/OracleInterface.json +161 -0
  65. package/dist/artifacts/Ownable.json +125 -0
  66. package/dist/artifacts/Pointer.json +78 -0
  67. package/dist/artifacts/PointerInterface.json +67 -0
  68. package/dist/artifacts/PublicResolver.json +503 -0
  69. package/dist/artifacts/SafeMath.json +52 -0
  70. package/dist/artifacts/SignedSafeMath.json +52 -0
  71. package/dist/artifacts/UpdatableConsumer.json +287 -0
  72. package/dist/src/LinkToken.d.ts +40 -0
  73. package/dist/src/LinkToken.json +164 -0
  74. package/dist/src/contract.d.ts +13 -0
  75. package/dist/src/contract.js +3 -0
  76. package/dist/src/contract.js.map +1 -0
  77. package/dist/src/debug.d.ts +8 -0
  78. package/dist/src/debug.js +17 -0
  79. package/dist/src/debug.js.map +1 -0
  80. package/dist/src/generated/Aggregator.d.ts +372 -0
  81. package/dist/src/generated/AggregatorFactory.d.ts +13 -0
  82. package/dist/src/generated/AggregatorFactory.js +505 -0
  83. package/dist/src/generated/AggregatorFactory.js.map +1 -0
  84. package/dist/src/generated/AggregatorInterface.d.ts +110 -0
  85. package/dist/src/generated/AggregatorInterfaceFactory.d.ts +6 -0
  86. package/dist/src/generated/AggregatorInterfaceFactory.js +133 -0
  87. package/dist/src/generated/AggregatorInterfaceFactory.js.map +1 -0
  88. package/dist/src/generated/AggregatorProxy.d.ts +196 -0
  89. package/dist/src/generated/AggregatorProxyFactory.d.ts +12 -0
  90. package/dist/src/generated/AggregatorProxyFactory.js +263 -0
  91. package/dist/src/generated/AggregatorProxyFactory.js.map +1 -0
  92. package/dist/src/generated/BasicConsumer.d.ts +154 -0
  93. package/dist/src/generated/BasicConsumerFactory.d.ts +13 -0
  94. package/dist/src/generated/BasicConsumerFactory.js +183 -0
  95. package/dist/src/generated/BasicConsumerFactory.js.map +1 -0
  96. package/dist/src/generated/ChainlinkClient.d.ts +58 -0
  97. package/dist/src/generated/ChainlinkClientFactory.d.ts +12 -0
  98. package/dist/src/generated/ChainlinkClientFactory.js +66 -0
  99. package/dist/src/generated/ChainlinkClientFactory.js.map +1 -0
  100. package/dist/src/generated/ChainlinkRequestInterface.d.ts +139 -0
  101. package/dist/src/generated/ChainlinkRequestInterfaceFactory.d.ts +6 -0
  102. package/dist/src/generated/ChainlinkRequestInterfaceFactory.js +82 -0
  103. package/dist/src/generated/ChainlinkRequestInterfaceFactory.js.map +1 -0
  104. package/dist/src/generated/Chainlinked.d.ts +55 -0
  105. package/dist/src/generated/ChainlinkedFactory.d.ts +12 -0
  106. package/dist/src/generated/ChainlinkedFactory.js +66 -0
  107. package/dist/src/generated/ChainlinkedFactory.js.map +1 -0
  108. package/dist/src/generated/ConcreteChainlink.d.ts +158 -0
  109. package/dist/src/generated/ConcreteChainlinkFactory.d.ts +12 -0
  110. package/dist/src/generated/ConcreteChainlinkFactory.js +155 -0
  111. package/dist/src/generated/ConcreteChainlinkFactory.js.map +1 -0
  112. package/dist/src/generated/ConcreteChainlinked.d.ts +300 -0
  113. package/dist/src/generated/ConcreteChainlinkedFactory.d.ts +12 -0
  114. package/dist/src/generated/ConcreteChainlinkedFactory.js +320 -0
  115. package/dist/src/generated/ConcreteChainlinkedFactory.js.map +1 -0
  116. package/dist/src/generated/ConcreteSignedSafeMath.d.ts +50 -0
  117. package/dist/src/generated/ConcreteSignedSafeMathFactory.d.ts +12 -0
  118. package/dist/src/generated/ConcreteSignedSafeMathFactory.js +53 -0
  119. package/dist/src/generated/ConcreteSignedSafeMathFactory.js.map +1 -0
  120. package/dist/src/generated/Consumer.d.ts +151 -0
  121. package/dist/src/generated/ConsumerFactory.d.ts +12 -0
  122. package/dist/src/generated/ConsumerFactory.js +164 -0
  123. package/dist/src/generated/ConsumerFactory.js.map +1 -0
  124. package/dist/src/generated/ENS.d.ts +171 -0
  125. package/dist/src/generated/ENSFactory.d.ts +6 -0
  126. package/dist/src/generated/ENSFactory.js +220 -0
  127. package/dist/src/generated/ENSFactory.js.map +1 -0
  128. package/dist/src/generated/ENSInterface.d.ts +174 -0
  129. package/dist/src/generated/ENSInterfaceFactory.d.ts +6 -0
  130. package/dist/src/generated/ENSInterfaceFactory.js +220 -0
  131. package/dist/src/generated/ENSInterfaceFactory.js.map +1 -0
  132. package/dist/src/generated/ENSRegistry.d.ts +171 -0
  133. package/dist/src/generated/ENSRegistryFactory.d.ts +12 -0
  134. package/dist/src/generated/ENSRegistryFactory.js +242 -0
  135. package/dist/src/generated/ENSRegistryFactory.js.map +1 -0
  136. package/dist/src/generated/ENSResolver.d.ts +45 -0
  137. package/dist/src/generated/ENSResolverFactory.d.ts +6 -0
  138. package/dist/src/generated/ENSResolverFactory.js +33 -0
  139. package/dist/src/generated/ENSResolverFactory.js.map +1 -0
  140. package/dist/src/generated/EmptyOracle.d.ts +228 -0
  141. package/dist/src/generated/EmptyOracleFactory.d.ts +12 -0
  142. package/dist/src/generated/EmptyOracleFactory.js +228 -0
  143. package/dist/src/generated/EmptyOracleFactory.js.map +1 -0
  144. package/dist/src/generated/GetterSetter.d.ts +207 -0
  145. package/dist/src/generated/GetterSetterFactory.d.ts +12 -0
  146. package/dist/src/generated/GetterSetterFactory.js +255 -0
  147. package/dist/src/generated/GetterSetterFactory.js.map +1 -0
  148. package/dist/src/generated/LinkToken.d.ts +243 -0
  149. package/dist/src/generated/LinkTokenFactory.d.ts +12 -0
  150. package/dist/src/generated/LinkTokenFactory.js +329 -0
  151. package/dist/src/generated/LinkTokenFactory.js.map +1 -0
  152. package/dist/src/generated/LinkTokenInterface.d.ts +230 -0
  153. package/dist/src/generated/LinkTokenInterfaceFactory.d.ts +6 -0
  154. package/dist/src/generated/LinkTokenInterfaceFactory.js +253 -0
  155. package/dist/src/generated/LinkTokenInterfaceFactory.js.map +1 -0
  156. package/dist/src/generated/MaliciousChainlinked.d.ts +58 -0
  157. package/dist/src/generated/MaliciousChainlinkedFactory.d.ts +12 -0
  158. package/dist/src/generated/MaliciousChainlinkedFactory.js +66 -0
  159. package/dist/src/generated/MaliciousChainlinkedFactory.js.map +1 -0
  160. package/dist/src/generated/MaliciousConsumer.d.ts +179 -0
  161. package/dist/src/generated/MaliciousConsumerFactory.d.ts +12 -0
  162. package/dist/src/generated/MaliciousConsumerFactory.js +221 -0
  163. package/dist/src/generated/MaliciousConsumerFactory.js.map +1 -0
  164. package/dist/src/generated/MaliciousRequester.d.ts +161 -0
  165. package/dist/src/generated/MaliciousRequesterFactory.d.ts +12 -0
  166. package/dist/src/generated/MaliciousRequesterFactory.js +191 -0
  167. package/dist/src/generated/MaliciousRequesterFactory.js.map +1 -0
  168. package/dist/src/generated/Migrations.d.ts +87 -0
  169. package/dist/src/generated/MigrationsFactory.d.ts +12 -0
  170. package/dist/src/generated/MigrationsFactory.js +92 -0
  171. package/dist/src/generated/MigrationsFactory.js.map +1 -0
  172. package/dist/src/generated/Oracle.d.ts +362 -0
  173. package/dist/src/generated/OracleFactory.d.ts +12 -0
  174. package/dist/src/generated/OracleFactory.js +383 -0
  175. package/dist/src/generated/OracleFactory.js.map +1 -0
  176. package/dist/src/generated/OracleInterface.d.ts +144 -0
  177. package/dist/src/generated/OracleInterfaceFactory.d.ts +6 -0
  178. package/dist/src/generated/OracleInterfaceFactory.js +122 -0
  179. package/dist/src/generated/OracleInterfaceFactory.js.map +1 -0
  180. package/dist/src/generated/Ownable.d.ts +91 -0
  181. package/dist/src/generated/OwnableFactory.d.ts +12 -0
  182. package/dist/src/generated/OwnableFactory.js +102 -0
  183. package/dist/src/generated/OwnableFactory.js.map +1 -0
  184. package/dist/src/generated/Pointer.d.ts +45 -0
  185. package/dist/src/generated/PointerFactory.d.ts +12 -0
  186. package/dist/src/generated/PointerFactory.js +55 -0
  187. package/dist/src/generated/PointerFactory.js.map +1 -0
  188. package/dist/src/generated/PointerInterface.d.ts +48 -0
  189. package/dist/src/generated/PointerInterfaceFactory.d.ts +6 -0
  190. package/dist/src/generated/PointerInterfaceFactory.js +28 -0
  191. package/dist/src/generated/PointerInterfaceFactory.js.map +1 -0
  192. package/dist/src/generated/PublicResolver.d.ts +336 -0
  193. package/dist/src/generated/PublicResolverFactory.d.ts +12 -0
  194. package/dist/src/generated/PublicResolverFactory.js +476 -0
  195. package/dist/src/generated/PublicResolverFactory.js.map +1 -0
  196. package/dist/src/generated/UpdatableConsumer.d.ts +180 -0
  197. package/dist/src/generated/UpdatableConsumerFactory.d.ts +13 -0
  198. package/dist/src/generated/UpdatableConsumerFactory.js +220 -0
  199. package/dist/src/generated/UpdatableConsumerFactory.js.map +1 -0
  200. package/dist/src/generated/index.d.ts +44 -0
  201. package/dist/src/generated/index.js +41 -0
  202. package/dist/src/generated/index.js.map +1 -0
  203. package/dist/src/helpers.d.ts +144 -0
  204. package/dist/src/helpers.js +358 -0
  205. package/dist/src/helpers.js.map +1 -0
  206. package/dist/src/helpers.test.d.ts +1 -0
  207. package/dist/src/helpers.test.js +21 -0
  208. package/dist/src/helpers.test.js.map +1 -0
  209. package/dist/src/index.d.ts +8 -0
  210. package/dist/src/index.js +27 -0
  211. package/dist/src/index.js.map +1 -0
  212. package/dist/src/matchers.d.ts +2 -0
  213. package/dist/src/matchers.js +7 -0
  214. package/dist/src/matchers.js.map +1 -0
  215. package/dist/src/provider.d.ts +5 -0
  216. package/dist/src/provider.js +15 -0
  217. package/dist/src/provider.js.map +1 -0
  218. package/dist/src/wallet.d.ts +35 -0
  219. package/dist/src/wallet.js +64 -0
  220. package/dist/src/wallet.js.map +1 -0
  221. package/dist/test/Aggregator.test.d.ts +1 -0
  222. package/dist/test/Aggregator.test.js +581 -0
  223. package/dist/test/Aggregator.test.js.map +1 -0
  224. package/dist/test/AggregatorProxy.test.d.ts +1 -0
  225. package/dist/test/AggregatorProxy.test.js +179 -0
  226. package/dist/test/AggregatorProxy.test.js.map +1 -0
  227. package/dist/test/BasicConsumer.test.d.ts +1 -0
  228. package/dist/test/BasicConsumer.test.js +180 -0
  229. package/dist/test/BasicConsumer.test.js.map +1 -0
  230. package/dist/test/Chainlinked.test.d.ts +1 -0
  231. package/dist/test/Chainlinked.test.js +11 -0
  232. package/dist/test/Chainlinked.test.js.map +1 -0
  233. package/dist/test/ConcreteChainlink.test.d.ts +1 -0
  234. package/dist/test/ConcreteChainlink.test.js +163 -0
  235. package/dist/test/ConcreteChainlink.test.js.map +1 -0
  236. package/dist/test/ConcreteChainlinked.test.d.ts +1 -0
  237. package/dist/test/ConcreteChainlinked.test.js +182 -0
  238. package/dist/test/ConcreteChainlinked.test.js.map +1 -0
  239. package/dist/test/GetterSetter.test.d.ts +1 -0
  240. package/dist/test/GetterSetter.test.js +76 -0
  241. package/dist/test/GetterSetter.test.js.map +1 -0
  242. package/dist/test/Oracle.test.d.ts +1 -0
  243. package/dist/test/Oracle.test.js +669 -0
  244. package/dist/test/Oracle.test.js.map +1 -0
  245. package/dist/test/Pointer.test.d.ts +1 -0
  246. package/dist/test/Pointer.test.js +35 -0
  247. package/dist/test/Pointer.test.js.map +1 -0
  248. package/dist/test/SignedSafeMath.test.d.ts +1 -0
  249. package/dist/test/SignedSafeMath.test.js +75 -0
  250. package/dist/test/SignedSafeMath.test.js.map +1 -0
  251. package/dist/test/UpdatableConsumer.test.d.ts +1 -0
  252. package/dist/test/UpdatableConsumer.test.js +144 -0
  253. package/dist/test/UpdatableConsumer.test.js.map +1 -0
  254. package/dist/tsconfig.tsbuildinfo +7737 -0
  255. package/package.json +50 -0
  256. package/r1z9aogk.cjs +1 -0
  257. package/v0.5/contracts/Chainlink.sol +125 -0
  258. package/v0.5/contracts/ChainlinkClient.sol +263 -0
  259. package/v0.5/contracts/LinkTokenReceiver.sol +70 -0
  260. package/v0.5/contracts/Median.sol +108 -0
  261. package/v0.5/contracts/Migrations.sol +23 -0
  262. package/v0.5/contracts/Oracle.sol +273 -0
  263. package/v0.5/contracts/PreCoordinator.sol +305 -0
  264. package/v0.5/contracts/dev/AggregatorInterface.sol +12 -0
  265. package/v0.5/contracts/dev/Coordinator.sol +411 -0
  266. package/v0.5/contracts/dev/CoordinatorInterface.sol +14 -0
  267. package/v0.5/contracts/dev/OracleSignaturesDecoder.sol +24 -0
  268. package/v0.5/contracts/dev/Owned.sol +61 -0
  269. package/v0.5/contracts/dev/PrepaidAggregator.sol +621 -0
  270. package/v0.5/contracts/dev/SafeMath128.sol +110 -0
  271. package/v0.5/contracts/dev/SafeMath32.sol +110 -0
  272. package/v0.5/contracts/dev/SafeMath64.sol +110 -0
  273. package/v0.5/contracts/dev/SchnorrSECP256K1.sol +147 -0
  274. package/v0.5/contracts/dev/ServiceAgreementDecoder.sol +59 -0
  275. package/v0.5/contracts/dev/VRF.sol +382 -0
  276. package/v0.5/contracts/dev/Whitelisted.sol +41 -0
  277. package/v0.5/contracts/dev/WhitelistedAggregator.sol +80 -0
  278. package/v0.5/contracts/interfaces/ChainlinkRequestInterface.sol +21 -0
  279. package/v0.5/contracts/interfaces/ENSInterface.sol +26 -0
  280. package/v0.5/contracts/interfaces/LinkTokenInterface.sol +16 -0
  281. package/v0.5/contracts/interfaces/OracleInterface.sol +16 -0
  282. package/v0.5/contracts/interfaces/PointerInterface.sol +5 -0
  283. package/v0.5/contracts/interfaces/WithdrawalInterface.sol +16 -0
  284. package/v0.5/contracts/tests/BasicConsumer.sol +13 -0
  285. package/v0.5/contracts/tests/ChainlinkTestHelper.sol +75 -0
  286. package/v0.5/contracts/tests/Consumer.sol +55 -0
  287. package/v0.5/contracts/tests/EmptyAggregator.sol +34 -0
  288. package/v0.5/contracts/tests/GetterSetter.sol +45 -0
  289. package/v0.5/contracts/tests/MaliciousChainlink.sol +75 -0
  290. package/v0.5/contracts/tests/MaliciousChainlinkClient.sol +109 -0
  291. package/v0.5/contracts/tests/MaliciousConsumer.sol +54 -0
  292. package/v0.5/contracts/tests/MaliciousRequester.sol +52 -0
  293. package/v0.5/contracts/tests/MeanAggregator.sol +75 -0
  294. package/v0.5/contracts/tests/MedianTestHelper.sol +15 -0
  295. package/v0.5/contracts/tests/OwnedTestHelper.sol +16 -0
  296. package/v0.5/contracts/tests/ServiceAgreementConsumer.sol +30 -0
  297. package/v0.5/contracts/vendor/Buffer.sol +301 -0
  298. package/v0.5/contracts/vendor/CBOR.sol +71 -0
  299. package/v0.5/contracts/vendor/ENSResolver.sol +5 -0
  300. package/v0.5/contracts/vendor/Ownable.sol +65 -0
  301. package/v0.5/contracts/vendor/SafeMath.sol +107 -0
  302. package/v0.5/contracts/vendor/SignedSafeMath.sol +22 -0
  303. package/v0.6/contracts/Chainlink.sol +125 -0
  304. package/v0.6/contracts/ChainlinkClient.sol +263 -0
  305. package/v0.6/contracts/LinkTokenReceiver.sol +70 -0
  306. package/v0.6/contracts/Oracle.sol +276 -0
  307. package/v0.6/contracts/interfaces/ChainlinkRequestInterface.sol +21 -0
  308. package/v0.6/contracts/interfaces/ENSInterface.sol +26 -0
  309. package/v0.6/contracts/interfaces/LinkTokenInterface.sol +16 -0
  310. package/v0.6/contracts/interfaces/OracleInterface.sol +16 -0
  311. package/v0.6/contracts/interfaces/PointerInterface.sol +5 -0
  312. package/v0.6/contracts/interfaces/WithdrawalInterface.sol +16 -0
  313. package/v0.6/contracts/tests/BasicConsumer.sol +13 -0
  314. package/v0.6/contracts/tests/Consumer.sol +55 -0
  315. package/v0.6/contracts/vendor/Buffer.sol +301 -0
  316. package/v0.6/contracts/vendor/CBOR.sol +71 -0
  317. package/v0.6/contracts/vendor/ENSResolver.sol +5 -0
  318. package/v0.6/contracts/vendor/Ownable.sol +65 -0
  319. package/v0.6/contracts/vendor/SafeMath.sol +107 -0
  320. package/zos.json +8 -0
  321. package/zos.rinkeby.json +104 -0
  322. package/zos.ropsten.json +104 -0
@@ -0,0 +1,292 @@
1
+ {
2
+ "schemaVersion": "2.0.0",
3
+ "contractName": "LinkTokenInterface",
4
+ "compilerOutput": {
5
+ "abi": [
6
+ {
7
+ "constant": false,
8
+ "inputs": [],
9
+ "name": "name",
10
+ "outputs": [
11
+ {
12
+ "name": "tokenName",
13
+ "type": "string"
14
+ }
15
+ ],
16
+ "payable": false,
17
+ "stateMutability": "nonpayable",
18
+ "type": "function"
19
+ },
20
+ {
21
+ "constant": false,
22
+ "inputs": [
23
+ {
24
+ "name": "spender",
25
+ "type": "address"
26
+ },
27
+ {
28
+ "name": "value",
29
+ "type": "uint256"
30
+ }
31
+ ],
32
+ "name": "approve",
33
+ "outputs": [
34
+ {
35
+ "name": "success",
36
+ "type": "bool"
37
+ }
38
+ ],
39
+ "payable": false,
40
+ "stateMutability": "nonpayable",
41
+ "type": "function"
42
+ },
43
+ {
44
+ "constant": false,
45
+ "inputs": [],
46
+ "name": "totalSupply",
47
+ "outputs": [
48
+ {
49
+ "name": "totalTokensIssued",
50
+ "type": "uint256"
51
+ }
52
+ ],
53
+ "payable": false,
54
+ "stateMutability": "nonpayable",
55
+ "type": "function"
56
+ },
57
+ {
58
+ "constant": false,
59
+ "inputs": [
60
+ {
61
+ "name": "from",
62
+ "type": "address"
63
+ },
64
+ {
65
+ "name": "to",
66
+ "type": "address"
67
+ },
68
+ {
69
+ "name": "value",
70
+ "type": "uint256"
71
+ }
72
+ ],
73
+ "name": "transferFrom",
74
+ "outputs": [
75
+ {
76
+ "name": "success",
77
+ "type": "bool"
78
+ }
79
+ ],
80
+ "payable": false,
81
+ "stateMutability": "nonpayable",
82
+ "type": "function"
83
+ },
84
+ {
85
+ "constant": false,
86
+ "inputs": [],
87
+ "name": "decimals",
88
+ "outputs": [
89
+ {
90
+ "name": "decimalPlaces",
91
+ "type": "uint8"
92
+ }
93
+ ],
94
+ "payable": false,
95
+ "stateMutability": "nonpayable",
96
+ "type": "function"
97
+ },
98
+ {
99
+ "constant": false,
100
+ "inputs": [
101
+ {
102
+ "name": "to",
103
+ "type": "address"
104
+ },
105
+ {
106
+ "name": "value",
107
+ "type": "uint256"
108
+ },
109
+ {
110
+ "name": "data",
111
+ "type": "bytes"
112
+ }
113
+ ],
114
+ "name": "transferAndCall",
115
+ "outputs": [
116
+ {
117
+ "name": "success",
118
+ "type": "bool"
119
+ }
120
+ ],
121
+ "payable": false,
122
+ "stateMutability": "nonpayable",
123
+ "type": "function"
124
+ },
125
+ {
126
+ "constant": false,
127
+ "inputs": [
128
+ {
129
+ "name": "spender",
130
+ "type": "address"
131
+ },
132
+ {
133
+ "name": "addedValue",
134
+ "type": "uint256"
135
+ }
136
+ ],
137
+ "name": "decreaseApproval",
138
+ "outputs": [
139
+ {
140
+ "name": "success",
141
+ "type": "bool"
142
+ }
143
+ ],
144
+ "payable": false,
145
+ "stateMutability": "nonpayable",
146
+ "type": "function"
147
+ },
148
+ {
149
+ "constant": false,
150
+ "inputs": [
151
+ {
152
+ "name": "owner",
153
+ "type": "address"
154
+ }
155
+ ],
156
+ "name": "balanceOf",
157
+ "outputs": [
158
+ {
159
+ "name": "balance",
160
+ "type": "uint256"
161
+ }
162
+ ],
163
+ "payable": false,
164
+ "stateMutability": "nonpayable",
165
+ "type": "function"
166
+ },
167
+ {
168
+ "constant": false,
169
+ "inputs": [],
170
+ "name": "symbol",
171
+ "outputs": [
172
+ {
173
+ "name": "tokenSymbol",
174
+ "type": "string"
175
+ }
176
+ ],
177
+ "payable": false,
178
+ "stateMutability": "nonpayable",
179
+ "type": "function"
180
+ },
181
+ {
182
+ "constant": false,
183
+ "inputs": [
184
+ {
185
+ "name": "to",
186
+ "type": "address"
187
+ },
188
+ {
189
+ "name": "value",
190
+ "type": "uint256"
191
+ }
192
+ ],
193
+ "name": "transfer",
194
+ "outputs": [
195
+ {
196
+ "name": "success",
197
+ "type": "bool"
198
+ }
199
+ ],
200
+ "payable": false,
201
+ "stateMutability": "nonpayable",
202
+ "type": "function"
203
+ },
204
+ {
205
+ "constant": false,
206
+ "inputs": [
207
+ {
208
+ "name": "spender",
209
+ "type": "address"
210
+ },
211
+ {
212
+ "name": "subtractedValue",
213
+ "type": "uint256"
214
+ }
215
+ ],
216
+ "name": "increaseApproval",
217
+ "outputs": [],
218
+ "payable": false,
219
+ "stateMutability": "nonpayable",
220
+ "type": "function"
221
+ },
222
+ {
223
+ "constant": false,
224
+ "inputs": [
225
+ {
226
+ "name": "owner",
227
+ "type": "address"
228
+ },
229
+ {
230
+ "name": "spender",
231
+ "type": "address"
232
+ }
233
+ ],
234
+ "name": "allowance",
235
+ "outputs": [
236
+ {
237
+ "name": "remaining",
238
+ "type": "uint256"
239
+ }
240
+ ],
241
+ "payable": false,
242
+ "stateMutability": "nonpayable",
243
+ "type": "function"
244
+ }
245
+ ],
246
+ "evm": {
247
+ "bytecode": {
248
+ "linkReferences": {},
249
+ "object": "0x",
250
+ "opcodes": "",
251
+ "sourceMap": ""
252
+ },
253
+ "deployedBytecode": {
254
+ "linkReferences": {},
255
+ "object": "0x",
256
+ "opcodes": "",
257
+ "sourceMap": ""
258
+ }
259
+ }
260
+ },
261
+ "sources": {
262
+ "interfaces/LinkTokenInterface.sol": {
263
+ "id": 11
264
+ }
265
+ },
266
+ "sourceCodes": {
267
+ "interfaces/LinkTokenInterface.sol": "pragma solidity ^0.4.24;\n\ninterface LinkTokenInterface {\n function allowance(address owner, address spender) external returns (uint256 remaining);\n function approve(address spender, uint256 value) external returns (bool success);\n function balanceOf(address owner) external returns (uint256 balance);\n function decimals() external returns (uint8 decimalPlaces);\n function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);\n function increaseApproval(address spender, uint256 subtractedValue) external;\n function name() external returns (string tokenName);\n function symbol() external returns (string tokenSymbol);\n function totalSupply() external returns (uint256 totalTokensIssued);\n function transfer(address to, uint256 value) external returns (bool success);\n function transferAndCall(address to, uint256 value, bytes data) external returns (bool success);\n function transferFrom(address from, address to, uint256 value) external returns (bool success);\n}\n"
268
+ },
269
+ "sourceTreeHashHex": "0xcf91684e6d3a6fda4f29814d5bb353d8a1a8d3a6aef0f49bc5be5592d1114b10",
270
+ "compiler": {
271
+ "name": "solc",
272
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
273
+ "settings": {
274
+ "optimizer": {
275
+ "enabled": false
276
+ },
277
+ "outputSelection": {
278
+ "*": {
279
+ "*": [
280
+ "abi",
281
+ "evm.bytecode.object",
282
+ "evm.bytecode.sourceMap",
283
+ "evm.deployedBytecode.object",
284
+ "evm.deployedBytecode.sourceMap"
285
+ ]
286
+ }
287
+ },
288
+ "remappings": []
289
+ }
290
+ },
291
+ "chains": {}
292
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "schemaVersion": "2.0.0",
3
+ "contractName": "MaliciousChainlink",
4
+ "compilerOutput": {
5
+ "abi": [],
6
+ "evm": {
7
+ "bytecode": {
8
+ "linkReferences": {},
9
+ "object": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a7230582044729f0ae9a8b5ad431cac0cb430ec4c4689bc71b5ff4ebf4b08f5e23ade12260029",
10
+ "opcodes": "PUSH1 0x4C PUSH1 0x2C PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x0 DUP2 EQ PUSH1 0x1C JUMPI PUSH1 0x1E JUMP JUMPDEST INVALID JUMPDEST POP ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN STOP PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 DIFFICULTY PUSH19 0x9F0AE9A8B5AD431CAC0CB430EC4C4689BC71B5 SELFDESTRUCT 0x4e 0xbf 0x4b ADDMOD 0xf5 0xe2 GASPRICE 0xde SLT 0x26 STOP 0x29 ",
11
+ "sourceMap": "56:1693:21:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24"
12
+ },
13
+ "deployedBytecode": {
14
+ "linkReferences": {},
15
+ "object": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a7230582044729f0ae9a8b5ad431cac0cb430ec4c4689bc71b5ff4ebf4b08f5e23ade12260029",
16
+ "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 DIFFICULTY PUSH19 0x9F0AE9A8B5AD431CAC0CB430EC4C4689BC71B5 SELFDESTRUCT 0x4e 0xbf 0x4b ADDMOD 0xf5 0xe2 GASPRICE 0xde SLT 0x26 STOP 0x29 ",
17
+ "sourceMap": "56:1693:21:-;;;;;;;;"
18
+ }
19
+ }
20
+ },
21
+ "sources": {
22
+ "tests/MaliciousChainlink.sol": {
23
+ "id": 21
24
+ },
25
+ "vendor/CBOR.sol": {
26
+ "id": 27
27
+ },
28
+ "vendor/Buffer.sol": {
29
+ "id": 26
30
+ }
31
+ },
32
+ "sourceCodes": {
33
+ "tests/MaliciousChainlink.sol": "pragma solidity 0.4.24;\n\nimport \"../vendor/CBOR.sol\";\n\n\nlibrary MaliciousChainlink {\n using CBOR for Buffer.buffer;\n\n struct Request {\n bytes32 specId;\n address callbackAddress;\n bytes4 callbackFunctionId;\n uint256 nonce;\n Buffer.buffer buf;\n }\n\n struct WithdrawRequest {\n bytes32 specId;\n address callbackAddress;\n bytes4 callbackFunctionId;\n uint256 nonce;\n Buffer.buffer buf;\n }\n\n function initializeWithdraw(\n WithdrawRequest memory self,\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunction\n ) internal pure returns (MaliciousChainlink.WithdrawRequest memory) {\n Buffer.init(self.buf, 128);\n self.specId = _specId;\n self.callbackAddress = _callbackAddress;\n self.callbackFunctionId = _callbackFunction;\n return self;\n }\n\n function add(Request memory self, string _key, string _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeString(_value);\n }\n\n function addBytes(Request memory self, string _key, bytes _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeBytes(_value);\n }\n\n function addInt(Request memory self, string _key, int256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeInt(_value);\n }\n\n function addUint(Request memory self, string _key, uint256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeUInt(_value);\n }\n\n function addStringArray(Request memory self, string _key, string[] memory _values)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.startArray();\n for (uint256 i = 0; i < _values.length; i++) {\n self.buf.encodeString(_values[i]);\n }\n self.buf.endSequence();\n }\n}\n",
34
+ "vendor/CBOR.sol": "pragma solidity ^0.4.19;\n\nimport \"./Buffer.sol\";\n\nlibrary CBOR {\n using Buffer for Buffer.buffer;\n\n uint8 private constant MAJOR_TYPE_INT = 0;\n uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1;\n uint8 private constant MAJOR_TYPE_BYTES = 2;\n uint8 private constant MAJOR_TYPE_STRING = 3;\n uint8 private constant MAJOR_TYPE_ARRAY = 4;\n uint8 private constant MAJOR_TYPE_MAP = 5;\n uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7;\n\n function encodeType(Buffer.buffer memory buf, uint8 major, uint value) private pure {\n if(value <= 23) {\n buf.appendUint8(uint8((major << 5) | value));\n } else if(value <= 0xFF) {\n buf.appendUint8(uint8((major << 5) | 24));\n buf.appendInt(value, 1);\n } else if(value <= 0xFFFF) {\n buf.appendUint8(uint8((major << 5) | 25));\n buf.appendInt(value, 2);\n } else if(value <= 0xFFFFFFFF) {\n buf.appendUint8(uint8((major << 5) | 26));\n buf.appendInt(value, 4);\n } else if(value <= 0xFFFFFFFFFFFFFFFF) {\n buf.appendUint8(uint8((major << 5) | 27));\n buf.appendInt(value, 8);\n }\n }\n\n function encodeIndefiniteLengthType(Buffer.buffer memory buf, uint8 major) private pure {\n buf.appendUint8(uint8((major << 5) | 31));\n }\n\n function encodeUInt(Buffer.buffer memory buf, uint value) internal pure {\n encodeType(buf, MAJOR_TYPE_INT, value);\n }\n\n function encodeInt(Buffer.buffer memory buf, int value) internal pure {\n if(value >= 0) {\n encodeType(buf, MAJOR_TYPE_INT, uint(value));\n } else {\n encodeType(buf, MAJOR_TYPE_NEGATIVE_INT, uint(-1 - value));\n }\n }\n\n function encodeBytes(Buffer.buffer memory buf, bytes value) internal pure {\n encodeType(buf, MAJOR_TYPE_BYTES, value.length);\n buf.append(value);\n }\n\n function encodeString(Buffer.buffer memory buf, string value) internal pure {\n encodeType(buf, MAJOR_TYPE_STRING, bytes(value).length);\n buf.append(bytes(value));\n }\n\n function startArray(Buffer.buffer memory buf) internal pure {\n encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY);\n }\n\n function startMap(Buffer.buffer memory buf) internal pure {\n encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP);\n }\n\n function endSequence(Buffer.buffer memory buf) internal pure {\n encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE);\n }\n}\n",
35
+ "vendor/Buffer.sol": "pragma solidity >0.4.18;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n uint mask = 256 ** (32 - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n"
36
+ },
37
+ "sourceTreeHashHex": "0x11a065b7a1c5f67a7d91db79b75b2c4a92b4d84bf708b5210ab61ca4b15d6d3f",
38
+ "compiler": {
39
+ "name": "solc",
40
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
41
+ "settings": {
42
+ "optimizer": {
43
+ "enabled": false
44
+ },
45
+ "outputSelection": {
46
+ "*": {
47
+ "*": [
48
+ "abi",
49
+ "evm.bytecode.object",
50
+ "evm.bytecode.sourceMap",
51
+ "evm.deployedBytecode.object",
52
+ "evm.deployedBytecode.sourceMap"
53
+ ]
54
+ }
55
+ },
56
+ "remappings": []
57
+ }
58
+ },
59
+ "chains": {}
60
+ }
@@ -0,0 +1,137 @@
1
+ {
2
+ "schemaVersion": "2.0.0",
3
+ "contractName": "MaliciousChainlinked",
4
+ "compilerOutput": {
5
+ "abi": [
6
+ {
7
+ "anonymous": false,
8
+ "inputs": [
9
+ {
10
+ "indexed": true,
11
+ "name": "id",
12
+ "type": "bytes32"
13
+ }
14
+ ],
15
+ "name": "ChainlinkRequested",
16
+ "type": "event"
17
+ },
18
+ {
19
+ "anonymous": false,
20
+ "inputs": [
21
+ {
22
+ "indexed": true,
23
+ "name": "id",
24
+ "type": "bytes32"
25
+ }
26
+ ],
27
+ "name": "ChainlinkFulfilled",
28
+ "type": "event"
29
+ },
30
+ {
31
+ "anonymous": false,
32
+ "inputs": [
33
+ {
34
+ "indexed": true,
35
+ "name": "id",
36
+ "type": "bytes32"
37
+ }
38
+ ],
39
+ "name": "ChainlinkCancelled",
40
+ "type": "event"
41
+ }
42
+ ],
43
+ "evm": {
44
+ "bytecode": {
45
+ "linkReferences": {},
46
+ "object": "0x608060405260016004556001600655348015601957600080fd5b5060358060276000396000f3006080604052600080fd00a165627a7a7230582018f5922a55c32e44f8f501135ae7133fe640ea22fe26021610a383e50cabc8960029",
47
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x1 PUSH1 0x4 SSTORE PUSH1 0x1 PUSH1 0x6 SSTORE CALLVALUE DUP1 ISZERO PUSH1 0x19 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x35 DUP1 PUSH1 0x27 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 XOR 0xf5 SWAP3 0x2a SSTORE 0xc3 0x2e DIFFICULTY 0xf8 0xf5 ADD SGT GAS 0xe7 SGT 0x3f 0xe6 BLOCKHASH 0xea 0x22 INVALID 0x26 MUL AND LT LOG3 DUP4 0xe5 0xc 0xab 0xc8 SWAP7 STOP 0x29 ",
48
+ "sourceMap": "123:3710:22:-;;;1233:1:3;1206:28;;406:1:22;370:37;;123:3710;8:9:-1;5:2;;;30:1;27;20:12;5:2;123:3710:22;;;;;;;"
49
+ },
50
+ "deployedBytecode": {
51
+ "linkReferences": {},
52
+ "object": "0x6080604052600080fd00a165627a7a7230582018f5922a55c32e44f8f501135ae7133fe640ea22fe26021610a383e50cabc8960029",
53
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 XOR 0xf5 SWAP3 0x2a SSTORE 0xc3 0x2e DIFFICULTY 0xf8 0xf5 ADD SGT GAS 0xe7 SGT 0x3f 0xe6 BLOCKHASH 0xea 0x22 INVALID 0x26 MUL AND LT LOG3 DUP4 0xe5 0xc 0xab 0xc8 SWAP7 STOP 0x29 ",
54
+ "sourceMap": "123:3710:22:-;;;;;"
55
+ }
56
+ }
57
+ },
58
+ "sources": {
59
+ "tests/MaliciousChainlinked.sol": {
60
+ "id": 22
61
+ },
62
+ "tests/MaliciousChainlink.sol": {
63
+ "id": 21
64
+ },
65
+ "vendor/CBOR.sol": {
66
+ "id": 27
67
+ },
68
+ "vendor/Buffer.sol": {
69
+ "id": 26
70
+ },
71
+ "Chainlinked.sol": {
72
+ "id": 4
73
+ },
74
+ "ChainlinkClient.sol": {
75
+ "id": 3
76
+ },
77
+ "Chainlink.sol": {
78
+ "id": 2
79
+ },
80
+ "interfaces/ENSInterface.sol": {
81
+ "id": 10
82
+ },
83
+ "interfaces/LinkTokenInterface.sol": {
84
+ "id": 11
85
+ },
86
+ "interfaces/ChainlinkRequestInterface.sol": {
87
+ "id": 9
88
+ },
89
+ "interfaces/PointerInterface.sol": {
90
+ "id": 13
91
+ },
92
+ "vendor/ENSResolver.sol": {
93
+ "id": 30
94
+ },
95
+ "vendor/SafeMath.sol": {
96
+ "id": 33
97
+ }
98
+ },
99
+ "sourceCodes": {
100
+ "tests/MaliciousChainlinked.sol": "pragma solidity 0.4.24;\n\nimport \"./MaliciousChainlink.sol\";\nimport \"../Chainlinked.sol\";\nimport \"../vendor/SafeMath.sol\";\n\ncontract MaliciousChainlinked is Chainlinked {\n using MaliciousChainlink for MaliciousChainlink.Request;\n using MaliciousChainlink for MaliciousChainlink.WithdrawRequest;\n using Chainlink for Chainlink.Request;\n using SafeMath for uint256;\n\n uint256 private maliciousRequests = 1;\n mapping(bytes32 => address) private maliciousPendingRequests;\n\n function newWithdrawRequest(\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunction\n ) internal pure returns (MaliciousChainlink.WithdrawRequest memory) {\n MaliciousChainlink.WithdrawRequest memory req;\n return req.initializeWithdraw(_specId, _callbackAddress, _callbackFunction);\n }\n\n function chainlinkTargetRequest(address _target, Chainlink.Request memory _req, uint256 _amount)\n internal\n returns(bytes32 requestId)\n {\n requestId = keccak256(abi.encodePacked(_target, maliciousRequests));\n _req.nonce = maliciousRequests;\n maliciousPendingRequests[requestId] = oracleAddress();\n emit ChainlinkRequested(requestId);\n LinkTokenInterface link = LinkTokenInterface(chainlinkToken());\n require(link.transferAndCall(oracleAddress(), _amount, encodeTargetRequest(_req)), \"Unable to transferAndCall to oracle\");\n maliciousRequests += 1;\n\n return requestId;\n }\n\n function chainlinkPriceRequest(Chainlink.Request memory _req, uint256 _amount)\n internal\n returns(bytes32 requestId)\n {\n requestId = keccak256(abi.encodePacked(this, maliciousRequests));\n _req.nonce = maliciousRequests;\n maliciousPendingRequests[requestId] = oracleAddress();\n emit ChainlinkRequested(requestId);\n LinkTokenInterface link = LinkTokenInterface(chainlinkToken());\n require(link.transferAndCall(oracleAddress(), _amount, encodePriceRequest(_req)), \"Unable to transferAndCall to oracle\");\n maliciousRequests += 1;\n\n return requestId;\n }\n\n function chainlinkWithdrawRequest(MaliciousChainlink.WithdrawRequest memory _req, uint256 _wei)\n internal\n returns(bytes32 requestId)\n {\n requestId = keccak256(abi.encodePacked(this, maliciousRequests));\n _req.nonce = maliciousRequests;\n maliciousPendingRequests[requestId] = oracleAddress();\n emit ChainlinkRequested(requestId);\n LinkTokenInterface link = LinkTokenInterface(chainlinkToken());\n require(link.transferAndCall(oracleAddress(), _wei, encodeWithdrawRequest(_req)), \"Unable to transferAndCall to oracle\");\n maliciousRequests += 1;\n return requestId;\n }\n\n function encodeWithdrawRequest(MaliciousChainlink.WithdrawRequest memory _req)\n internal pure returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"withdraw(address,uint256)\")),\n _req.callbackAddress,\n _req.callbackFunctionId,\n _req.nonce,\n _req.buf.buf);\n }\n\n function encodeTargetRequest(Chainlink.Request memory _req)\n internal pure returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"oracleRequest(address,uint256,bytes32,address,bytes4,uint256,uint256,bytes)\")),\n 0, // overridden by onTokenTransfer\n 0, // overridden by onTokenTransfer\n _req.id,\n _req.callbackAddress,\n _req.callbackFunctionId,\n _req.nonce,\n 1,\n _req.buf.buf);\n }\n\n function encodePriceRequest(Chainlink.Request memory _req)\n internal pure returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"oracleRequest(address,uint256,bytes32,address,bytes4,uint256,uint256,bytes)\")),\n 0, // overridden by onTokenTransfer\n 2000000000000000000, // overridden by onTokenTransfer\n _req.id,\n _req.callbackAddress,\n _req.callbackFunctionId,\n _req.nonce,\n 1,\n _req.buf.buf);\n }\n}\n",
101
+ "tests/MaliciousChainlink.sol": "pragma solidity 0.4.24;\n\nimport \"../vendor/CBOR.sol\";\n\n\nlibrary MaliciousChainlink {\n using CBOR for Buffer.buffer;\n\n struct Request {\n bytes32 specId;\n address callbackAddress;\n bytes4 callbackFunctionId;\n uint256 nonce;\n Buffer.buffer buf;\n }\n\n struct WithdrawRequest {\n bytes32 specId;\n address callbackAddress;\n bytes4 callbackFunctionId;\n uint256 nonce;\n Buffer.buffer buf;\n }\n\n function initializeWithdraw(\n WithdrawRequest memory self,\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunction\n ) internal pure returns (MaliciousChainlink.WithdrawRequest memory) {\n Buffer.init(self.buf, 128);\n self.specId = _specId;\n self.callbackAddress = _callbackAddress;\n self.callbackFunctionId = _callbackFunction;\n return self;\n }\n\n function add(Request memory self, string _key, string _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeString(_value);\n }\n\n function addBytes(Request memory self, string _key, bytes _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeBytes(_value);\n }\n\n function addInt(Request memory self, string _key, int256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeInt(_value);\n }\n\n function addUint(Request memory self, string _key, uint256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeUInt(_value);\n }\n\n function addStringArray(Request memory self, string _key, string[] memory _values)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.startArray();\n for (uint256 i = 0; i < _values.length; i++) {\n self.buf.encodeString(_values[i]);\n }\n self.buf.endSequence();\n }\n}\n",
102
+ "vendor/CBOR.sol": "pragma solidity ^0.4.19;\n\nimport \"./Buffer.sol\";\n\nlibrary CBOR {\n using Buffer for Buffer.buffer;\n\n uint8 private constant MAJOR_TYPE_INT = 0;\n uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1;\n uint8 private constant MAJOR_TYPE_BYTES = 2;\n uint8 private constant MAJOR_TYPE_STRING = 3;\n uint8 private constant MAJOR_TYPE_ARRAY = 4;\n uint8 private constant MAJOR_TYPE_MAP = 5;\n uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7;\n\n function encodeType(Buffer.buffer memory buf, uint8 major, uint value) private pure {\n if(value <= 23) {\n buf.appendUint8(uint8((major << 5) | value));\n } else if(value <= 0xFF) {\n buf.appendUint8(uint8((major << 5) | 24));\n buf.appendInt(value, 1);\n } else if(value <= 0xFFFF) {\n buf.appendUint8(uint8((major << 5) | 25));\n buf.appendInt(value, 2);\n } else if(value <= 0xFFFFFFFF) {\n buf.appendUint8(uint8((major << 5) | 26));\n buf.appendInt(value, 4);\n } else if(value <= 0xFFFFFFFFFFFFFFFF) {\n buf.appendUint8(uint8((major << 5) | 27));\n buf.appendInt(value, 8);\n }\n }\n\n function encodeIndefiniteLengthType(Buffer.buffer memory buf, uint8 major) private pure {\n buf.appendUint8(uint8((major << 5) | 31));\n }\n\n function encodeUInt(Buffer.buffer memory buf, uint value) internal pure {\n encodeType(buf, MAJOR_TYPE_INT, value);\n }\n\n function encodeInt(Buffer.buffer memory buf, int value) internal pure {\n if(value >= 0) {\n encodeType(buf, MAJOR_TYPE_INT, uint(value));\n } else {\n encodeType(buf, MAJOR_TYPE_NEGATIVE_INT, uint(-1 - value));\n }\n }\n\n function encodeBytes(Buffer.buffer memory buf, bytes value) internal pure {\n encodeType(buf, MAJOR_TYPE_BYTES, value.length);\n buf.append(value);\n }\n\n function encodeString(Buffer.buffer memory buf, string value) internal pure {\n encodeType(buf, MAJOR_TYPE_STRING, bytes(value).length);\n buf.append(bytes(value));\n }\n\n function startArray(Buffer.buffer memory buf) internal pure {\n encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY);\n }\n\n function startMap(Buffer.buffer memory buf) internal pure {\n encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP);\n }\n\n function endSequence(Buffer.buffer memory buf) internal pure {\n encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE);\n }\n}\n",
103
+ "vendor/Buffer.sol": "pragma solidity >0.4.18;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n uint mask = 256 ** (32 - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n",
104
+ "Chainlinked.sol": "pragma solidity ^0.4.24;\n\nimport \"./ChainlinkClient.sol\";\n\n/**\n * @title The Chainlinked contract\n * @notice Contract writers can inherit this contract in order to create requests for the\n * Chainlink network. ChainlinkClient is an alias of the Chainlinked contract.\n */\ncontract Chainlinked is ChainlinkClient {\n /**\n * @notice Creates a request that can hold additional parameters\n * @param _specId The Job Specification ID that the request will be created for\n * @param _callbackAddress The callback address that the response will be sent to\n * @param _callbackFunctionSignature The callback function signature to use for the callback address\n * @return A Chainlink Request struct in memory\n */\n function newRequest(\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunctionSignature\n ) internal pure returns (Chainlink.Request memory) {\n return buildChainlinkRequest(_specId, _callbackAddress, _callbackFunctionSignature);\n }\n\n /**\n * @notice Creates a Chainlink request to the stored oracle address\n * @dev Calls `sendChainlinkRequestTo` with the stored oracle address\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function chainlinkRequest(Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32)\n {\n return sendChainlinkRequest(_req, _payment);\n }\n\n /**\n * @notice Creates a Chainlink request to the specified oracle address\n * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to\n * send LINK which creates a request on the target oracle contract.\n * Emits ChainlinkRequested event.\n * @param _oracle The address of the oracle for the request\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function chainlinkRequestTo(address _oracle, Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32 requestId)\n {\n return sendChainlinkRequestTo(_oracle, _req, _payment);\n }\n\n /**\n * @notice Sets the stored oracle address\n * @param _oracle The address of the oracle contract\n */\n function setOracle(address _oracle) internal {\n setChainlinkOracle(_oracle);\n }\n\n /**\n * @notice Sets the LINK token address\n * @param _link The address of the LINK token contract\n */\n function setLinkToken(address _link) internal {\n setChainlinkToken(_link);\n }\n\n /**\n * @notice Retrieves the stored address of the LINK token\n * @return The address of the LINK token\n */\n function chainlinkToken()\n internal\n view\n returns (address)\n {\n return chainlinkTokenAddress();\n }\n\n /**\n * @notice Retrieves the stored address of the oracle contract\n * @return The address of the oracle contract\n */\n function oracleAddress()\n internal\n view\n returns (address)\n {\n return chainlinkOracleAddress();\n }\n\n /**\n * @notice Ensures that the fulfillment is valid for this contract\n * @dev Use if the contract developer prefers methods instead of modifiers for validation\n * @param _requestId The request ID for fulfillment\n */\n function fulfillChainlinkRequest(bytes32 _requestId)\n internal\n recordChainlinkFulfillment(_requestId)\n // solhint-disable-next-line no-empty-blocks\n {}\n\n /**\n * @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS\n * @dev Accounts for subnodes having different resolvers\n * @param _ens The address of the ENS contract\n * @param _node The ENS node hash\n */\n function setChainlinkWithENS(address _ens, bytes32 _node)\n internal\n {\n useChainlinkWithENS(_ens, _node);\n }\n\n /**\n * @notice Sets the stored oracle contract with the address resolved by ENS\n * @dev This may be called on its own as long as `setChainlinkWithENS` has been called previously\n */\n function setOracleWithENS()\n internal\n {\n updateChainlinkOracleWithENS();\n }\n\n /**\n * @notice Allows for a request which was created on another contract to be fulfilled\n * on this contract\n * @param _oracle The address of the oracle contract that will fulfill the request\n * @param _requestId The request ID used for the response\n */\n function addExternalRequest(address _oracle, bytes32 _requestId)\n internal\n {\n addChainlinkExternalRequest(_oracle, _requestId);\n }\n}\n",
105
+ "ChainlinkClient.sol": "pragma solidity ^0.4.24;\n\nimport \"./Chainlink.sol\";\nimport \"./interfaces/ENSInterface.sol\";\nimport \"./interfaces/LinkTokenInterface.sol\";\nimport \"./interfaces/ChainlinkRequestInterface.sol\";\nimport \"./interfaces/PointerInterface.sol\";\nimport { ENSResolver as ENSResolver_Chainlink } from \"./vendor/ENSResolver.sol\";\nimport { SafeMath as SafeMath_Chainlink } from \"./vendor/SafeMath.sol\";\n\n/**\n * @title The ChainlinkClient contract\n * @notice Contract writers can inherit this contract in order to create requests for the\n * Chainlink network\n */\ncontract ChainlinkClient {\n using Chainlink for Chainlink.Request;\n using SafeMath_Chainlink for uint256;\n\n uint256 constant internal LINK = 10**18;\n uint256 constant private AMOUNT_OVERRIDE = 0;\n address constant private SENDER_OVERRIDE = 0x0;\n uint256 constant private ARGS_VERSION = 1;\n bytes32 constant private ENS_TOKEN_SUBNAME = keccak256(\"link\");\n bytes32 constant private ENS_ORACLE_SUBNAME = keccak256(\"oracle\");\n address constant private LINK_TOKEN_POINTER = 0xC89bD4E1632D3A43CB03AAAd5262cbe4038Bc571;\n\n ENSInterface private ens;\n bytes32 private ensNode;\n LinkTokenInterface private link;\n ChainlinkRequestInterface private oracle;\n uint256 private requests = 1;\n mapping(bytes32 => address) private pendingRequests;\n\n event ChainlinkRequested(bytes32 indexed id);\n event ChainlinkFulfilled(bytes32 indexed id);\n event ChainlinkCancelled(bytes32 indexed id);\n\n /**\n * @notice Creates a request that can hold additional parameters\n * @param _specId The Job Specification ID that the request will be created for\n * @param _callbackAddress The callback address that the response will be sent to\n * @param _callbackFunctionSignature The callback function signature to use for the callback address\n * @return A Chainlink Request struct in memory\n */\n function buildChainlinkRequest(\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunctionSignature\n ) internal pure returns (Chainlink.Request memory) {\n Chainlink.Request memory req;\n return req.initialize(_specId, _callbackAddress, _callbackFunctionSignature);\n }\n\n /**\n * @notice Creates a Chainlink request to the stored oracle address\n * @dev Calls `chainlinkRequestTo` with the stored oracle address\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function sendChainlinkRequest(Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32)\n {\n return sendChainlinkRequestTo(oracle, _req, _payment);\n }\n\n /**\n * @notice Creates a Chainlink request to the specified oracle address\n * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to\n * send LINK which creates a request on the target oracle contract.\n * Emits ChainlinkRequested event.\n * @param _oracle The address of the oracle for the request\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function sendChainlinkRequestTo(address _oracle, Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32 requestId)\n {\n requestId = keccak256(abi.encodePacked(this, requests));\n _req.nonce = requests;\n pendingRequests[requestId] = _oracle;\n emit ChainlinkRequested(requestId);\n require(link.transferAndCall(_oracle, _payment, encodeRequest(_req)), \"unable to transferAndCall to oracle\");\n requests += 1;\n\n return requestId;\n }\n\n /**\n * @notice Allows a request to be cancelled if it has not been fulfilled\n * @dev Requires keeping track of the expiration value emitted from the oracle contract.\n * Deletes the request from the `pendingRequests` mapping.\n * Emits ChainlinkCancelled event.\n * @param _requestId The request ID\n * @param _payment The amount of LINK sent for the request\n * @param _callbackFunc The callback function specified for the request\n * @param _expiration The time of the expiration for the request\n */\n function cancelChainlinkRequest(\n bytes32 _requestId,\n uint256 _payment,\n bytes4 _callbackFunc,\n uint256 _expiration\n )\n internal\n {\n ChainlinkRequestInterface requested = ChainlinkRequestInterface(pendingRequests[_requestId]);\n delete pendingRequests[_requestId];\n emit ChainlinkCancelled(_requestId);\n requested.cancelOracleRequest(_requestId, _payment, _callbackFunc, _expiration);\n }\n\n /**\n * @notice Sets the stored oracle address\n * @param _oracle The address of the oracle contract\n */\n function setChainlinkOracle(address _oracle) internal {\n oracle = ChainlinkRequestInterface(_oracle);\n }\n\n /**\n * @notice Sets the LINK token address\n * @param _link The address of the LINK token contract\n */\n function setChainlinkToken(address _link) internal {\n link = LinkTokenInterface(_link);\n }\n\n /**\n * @notice Sets the Chainlink token address for the public\n * network as given by the Pointer contract\n */\n function setPublicChainlinkToken() internal {\n setChainlinkToken(PointerInterface(LINK_TOKEN_POINTER).getAddress());\n }\n\n /**\n * @notice Retrieves the stored address of the LINK token\n * @return The address of the LINK token\n */\n function chainlinkTokenAddress()\n internal\n view\n returns (address)\n {\n return address(link);\n }\n\n /**\n * @notice Retrieves the stored address of the oracle contract\n * @return The address of the oracle contract\n */\n function chainlinkOracleAddress()\n internal\n view\n returns (address)\n {\n return address(oracle);\n }\n\n /**\n * @notice Allows for a request which was created on another contract to be fulfilled\n * on this contract\n * @param _oracle The address of the oracle contract that will fulfill the request\n * @param _requestId The request ID used for the response\n */\n function addChainlinkExternalRequest(address _oracle, bytes32 _requestId)\n internal\n notPendingRequest(_requestId)\n {\n pendingRequests[_requestId] = _oracle;\n }\n\n /**\n * @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS\n * @dev Accounts for subnodes having different resolvers\n * @param _ens The address of the ENS contract\n * @param _node The ENS node hash\n */\n function useChainlinkWithENS(address _ens, bytes32 _node)\n internal\n {\n ens = ENSInterface(_ens);\n ensNode = _node;\n bytes32 linkSubnode = keccak256(abi.encodePacked(ensNode, ENS_TOKEN_SUBNAME));\n ENSResolver_Chainlink resolver = ENSResolver_Chainlink(ens.resolver(linkSubnode));\n setChainlinkToken(resolver.addr(linkSubnode));\n updateChainlinkOracleWithENS();\n }\n\n /**\n * @notice Sets the stored oracle contract with the address resolved by ENS\n * @dev This may be called on its own as long as `useChainlinkWithENS` has been called previously\n */\n function updateChainlinkOracleWithENS()\n internal\n {\n bytes32 oracleSubnode = keccak256(abi.encodePacked(ensNode, ENS_ORACLE_SUBNAME));\n ENSResolver_Chainlink resolver = ENSResolver_Chainlink(ens.resolver(oracleSubnode));\n setChainlinkOracle(resolver.addr(oracleSubnode));\n }\n\n /**\n * @notice Encodes the request to be sent to the oracle contract\n * @dev The Chainlink node expects values to be in order for the request to be picked up. Order of types\n * will be validated in the oracle contract.\n * @param _req The initialized Chainlink Request\n * @return The bytes payload for the `transferAndCall` method\n */\n function encodeRequest(Chainlink.Request memory _req)\n private\n view\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n oracle.oracleRequest.selector,\n SENDER_OVERRIDE, // Sender value - overridden by onTokenTransfer by the requesting contract's address\n AMOUNT_OVERRIDE, // Amount value - overridden by onTokenTransfer by the actual amount of LINK sent\n _req.id,\n _req.callbackAddress,\n _req.callbackFunctionId,\n _req.nonce,\n ARGS_VERSION,\n _req.buf.buf);\n }\n\n /**\n * @notice Ensures that the fulfillment is valid for this contract\n * @dev Use if the contract developer prefers methods instead of modifiers for validation\n * @param _requestId The request ID for fulfillment\n */\n function validateChainlinkCallback(bytes32 _requestId)\n internal\n recordChainlinkFulfillment(_requestId)\n // solhint-disable-next-line no-empty-blocks\n {}\n\n /**\n * @dev Reverts if the sender is not the oracle of the request.\n * Emits ChainlinkFulfilled event.\n * @param _requestId The request ID for fulfillment\n */\n modifier recordChainlinkFulfillment(bytes32 _requestId) {\n require(msg.sender == pendingRequests[_requestId], \"Source must be the oracle of the request\");\n delete pendingRequests[_requestId];\n emit ChainlinkFulfilled(_requestId);\n _;\n }\n\n /**\n * @dev Reverts if the request is already pending\n * @param _requestId The request ID for fulfillment\n */\n modifier notPendingRequest(bytes32 _requestId) {\n require(pendingRequests[_requestId] == address(0), \"Request is already pending\");\n _;\n }\n}\n",
106
+ "Chainlink.sol": "pragma solidity ^0.4.24;\n\nimport { CBOR as CBOR_Chainlink, Buffer as Buffer_Chainlink } from \"./vendor/CBOR.sol\";\n\n/**\n * @title Library for common Chainlink functions\n * @dev Uses imported CBOR library for encoding to buffer\n */\nlibrary Chainlink {\n uint256 internal constant defaultBufferSize = 256; // solhint-disable-line const-name-snakecase\n\n using CBOR_Chainlink for Buffer_Chainlink.buffer;\n\n struct Request {\n bytes32 id;\n address callbackAddress;\n bytes4 callbackFunctionId;\n uint256 nonce;\n Buffer_Chainlink.buffer buf;\n }\n\n /**\n * @notice Initializes a Chainlink request\n * @dev Sets the ID, callback address, and callback function signature on the request\n * @param self The uninitialized request\n * @param _id The Job Specification ID\n * @param _callbackAddress The callback address\n * @param _callbackFunction The callback function signature\n * @return The initialized request\n */\n function initialize(\n Request memory self,\n bytes32 _id,\n address _callbackAddress,\n bytes4 _callbackFunction\n ) internal pure returns (Chainlink.Request memory) {\n Buffer_Chainlink.init(self.buf, defaultBufferSize);\n self.id = _id;\n self.callbackAddress = _callbackAddress;\n self.callbackFunctionId = _callbackFunction;\n return self;\n }\n\n /**\n * @notice Sets the data for the buffer without encoding CBOR on-chain\n * @dev CBOR can be closed with curly-brackets {} or they can be left off\n * @param self The initialized request\n * @param _data The CBOR data\n */\n function setBuffer(Request memory self, bytes _data)\n internal pure\n {\n Buffer_Chainlink.init(self.buf, _data.length);\n Buffer_Chainlink.append(self.buf, _data);\n }\n\n /**\n * @notice Adds a string value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The string value to add\n */\n function add(Request memory self, string _key, string _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeString(_value);\n }\n\n /**\n * @notice Adds a bytes value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The bytes value to add\n */\n function addBytes(Request memory self, string _key, bytes _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeBytes(_value);\n }\n\n /**\n * @notice Adds a int256 value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The int256 value to add\n */\n function addInt(Request memory self, string _key, int256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeInt(_value);\n }\n\n /**\n * @notice Adds a uint256 value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The uint256 value to add\n */\n function addUint(Request memory self, string _key, uint256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeUInt(_value);\n }\n\n /**\n * @notice Adds an array of strings to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _values The array of string values to add\n */\n function addStringArray(Request memory self, string _key, string[] memory _values)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.startArray();\n for (uint256 i = 0; i < _values.length; i++) {\n self.buf.encodeString(_values[i]);\n }\n self.buf.endSequence();\n }\n}\n",
107
+ "interfaces/ENSInterface.sol": "pragma solidity ^0.4.24;\n\ninterface ENSInterface {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;\n function setResolver(bytes32 node, address resolver) external;\n function setOwner(bytes32 node, address owner) external;\n function setTTL(bytes32 node, uint64 ttl) external;\n function owner(bytes32 node) external view returns (address);\n function resolver(bytes32 node) external view returns (address);\n function ttl(bytes32 node) external view returns (uint64);\n\n}\n",
108
+ "interfaces/LinkTokenInterface.sol": "pragma solidity ^0.4.24;\n\ninterface LinkTokenInterface {\n function allowance(address owner, address spender) external returns (uint256 remaining);\n function approve(address spender, uint256 value) external returns (bool success);\n function balanceOf(address owner) external returns (uint256 balance);\n function decimals() external returns (uint8 decimalPlaces);\n function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);\n function increaseApproval(address spender, uint256 subtractedValue) external;\n function name() external returns (string tokenName);\n function symbol() external returns (string tokenSymbol);\n function totalSupply() external returns (uint256 totalTokensIssued);\n function transfer(address to, uint256 value) external returns (bool success);\n function transferAndCall(address to, uint256 value, bytes data) external returns (bool success);\n function transferFrom(address from, address to, uint256 value) external returns (bool success);\n}\n",
109
+ "interfaces/ChainlinkRequestInterface.sol": "pragma solidity ^0.4.24;\n\ninterface ChainlinkRequestInterface {\n function oracleRequest(\n address sender,\n uint256 payment,\n bytes32 id,\n address callbackAddress,\n bytes4 callbackFunctionId,\n uint256 nonce,\n uint256 version,\n bytes data\n ) external;\n\n function cancelOracleRequest(\n bytes32 requestId,\n uint256 payment,\n bytes4 callbackFunctionId,\n uint256 expiration\n ) external;\n}\n",
110
+ "interfaces/PointerInterface.sol": "pragma solidity ^0.4.24;\n\ninterface PointerInterface {\n function getAddress() external view returns (address);\n}\n",
111
+ "vendor/ENSResolver.sol": "pragma solidity 0.4.24;\n\ncontract ENSResolver {\n function addr(bytes32 node) public view returns (address);\n}\n",
112
+ "vendor/SafeMath.sol": "pragma solidity ^0.4.24;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMath {\n\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n // Gas optimization: this is cheaper than asserting 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (_a == 0) {\n return 0;\n }\n\n c = _a * _b;\n assert(c / _a == _b);\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 _a, uint256 _b) internal pure returns (uint256) {\n // assert(_b > 0); // Solidity automatically throws when dividing by 0\n // uint256 c = _a / _b;\n // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold\n return _a / _b;\n }\n\n /**\n * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {\n assert(_b <= _a);\n return _a - _b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n c = _a + _b;\n assert(c >= _a);\n return c;\n }\n}\n"
113
+ },
114
+ "sourceTreeHashHex": "0x95191012d5798b250767c7a57faf41a8e9a1c969618fc51a85649b4dcf70e67c",
115
+ "compiler": {
116
+ "name": "solc",
117
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
118
+ "settings": {
119
+ "optimizer": {
120
+ "enabled": false
121
+ },
122
+ "outputSelection": {
123
+ "*": {
124
+ "*": [
125
+ "abi",
126
+ "evm.bytecode.object",
127
+ "evm.bytecode.sourceMap",
128
+ "evm.deployedBytecode.object",
129
+ "evm.deployedBytecode.sourceMap"
130
+ ]
131
+ }
132
+ },
133
+ "remappings": []
134
+ }
135
+ },
136
+ "chains": {}
137
+ }