chai-link 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -0
- package/contracts/Aggregator.sol +420 -0
- package/contracts/AggregatorProxy.sol +99 -0
- package/contracts/Chainlink.sol +125 -0
- package/contracts/ChainlinkClient.sol +262 -0
- package/contracts/Chainlinked.sol +141 -0
- package/contracts/Migrations.sol +23 -0
- package/contracts/Oracle.sol +320 -0
- package/contracts/Pointer.sol +9 -0
- package/contracts/interfaces/AggregatorInterface.sol +12 -0
- package/contracts/interfaces/ChainlinkRequestInterface.sol +21 -0
- package/contracts/interfaces/ENSInterface.sol +26 -0
- package/contracts/interfaces/LinkTokenInterface.sol +16 -0
- package/contracts/interfaces/OracleInterface.sol +16 -0
- package/contracts/interfaces/PointerInterface.sol +5 -0
- package/contracts/tests/BasicConsumer.sol +13 -0
- package/contracts/tests/ConcreteChainlink.sol +76 -0
- package/contracts/tests/ConcreteChainlinked.sol +100 -0
- package/contracts/tests/ConcreteSignedSafeMath.sol +16 -0
- package/contracts/tests/Consumer.sol +47 -0
- package/contracts/tests/EmptyOracle.sol +19 -0
- package/contracts/tests/GetterSetter.sol +45 -0
- package/contracts/tests/MaliciousChainlink.sol +76 -0
- package/contracts/tests/MaliciousChainlinked.sol +109 -0
- package/contracts/tests/MaliciousConsumer.sol +54 -0
- package/contracts/tests/MaliciousRequester.sol +52 -0
- package/contracts/tests/UpdatableConsumer.sol +24 -0
- package/contracts/vendor/Buffer.sol +301 -0
- package/contracts/vendor/CBOR.sol +71 -0
- package/contracts/vendor/ENS.sol +26 -0
- package/contracts/vendor/ENSRegistry.sol +99 -0
- package/contracts/vendor/ENSResolver.sol +5 -0
- package/contracts/vendor/Ownable.sol +64 -0
- package/contracts/vendor/PublicResolver.sol +238 -0
- package/contracts/vendor/SafeMath.sol +52 -0
- package/contracts/vendor/SignedSafeMath.sol +21 -0
- package/dist/artifacts/Aggregator.json +580 -0
- package/dist/artifacts/AggregatorInterface.json +172 -0
- package/dist/artifacts/AggregatorProxy.json +294 -0
- package/dist/artifacts/BasicConsumer.json +250 -0
- package/dist/artifacts/Buffer.json +52 -0
- package/dist/artifacts/CBOR.json +56 -0
- package/dist/artifacts/Chainlink.json +60 -0
- package/dist/artifacts/ChainlinkClient.json +125 -0
- package/dist/artifacts/ChainlinkRequestInterface.json +121 -0
- package/dist/artifacts/Chainlinked.json +129 -0
- package/dist/artifacts/ConcreteChainlink.json +190 -0
- package/dist/artifacts/ConcreteChainlinked.json +387 -0
- package/dist/artifacts/ConcreteSignedSafeMath.json +80 -0
- package/dist/artifacts/Consumer.json +227 -0
- package/dist/artifacts/ENS.json +259 -0
- package/dist/artifacts/ENSInterface.json +259 -0
- package/dist/artifacts/ENSRegistry.json +269 -0
- package/dist/artifacts/ENSResolver.json +72 -0
- package/dist/artifacts/EmptyOracle.json +259 -0
- package/dist/artifacts/GetterSetter.json +278 -0
- package/dist/artifacts/LinkTokenInterface.json +292 -0
- package/dist/artifacts/MaliciousChainlink.json +60 -0
- package/dist/artifacts/MaliciousChainlinked.json +137 -0
- package/dist/artifacts/MaliciousConsumer.json +288 -0
- package/dist/artifacts/MaliciousRequester.json +266 -0
- package/dist/artifacts/Migrations.json +115 -0
- package/dist/artifacts/Oracle.json +426 -0
- package/dist/artifacts/OracleInterface.json +161 -0
- package/dist/artifacts/Ownable.json +125 -0
- package/dist/artifacts/Pointer.json +78 -0
- package/dist/artifacts/PointerInterface.json +67 -0
- package/dist/artifacts/PublicResolver.json +503 -0
- package/dist/artifacts/SafeMath.json +52 -0
- package/dist/artifacts/SignedSafeMath.json +52 -0
- package/dist/artifacts/UpdatableConsumer.json +287 -0
- package/dist/src/LinkToken.d.ts +40 -0
- package/dist/src/LinkToken.json +164 -0
- package/dist/src/contract.d.ts +13 -0
- package/dist/src/contract.js +3 -0
- package/dist/src/contract.js.map +1 -0
- package/dist/src/debug.d.ts +8 -0
- package/dist/src/debug.js +17 -0
- package/dist/src/debug.js.map +1 -0
- package/dist/src/generated/Aggregator.d.ts +372 -0
- package/dist/src/generated/AggregatorFactory.d.ts +13 -0
- package/dist/src/generated/AggregatorFactory.js +505 -0
- package/dist/src/generated/AggregatorFactory.js.map +1 -0
- package/dist/src/generated/AggregatorInterface.d.ts +110 -0
- package/dist/src/generated/AggregatorInterfaceFactory.d.ts +6 -0
- package/dist/src/generated/AggregatorInterfaceFactory.js +133 -0
- package/dist/src/generated/AggregatorInterfaceFactory.js.map +1 -0
- package/dist/src/generated/AggregatorProxy.d.ts +196 -0
- package/dist/src/generated/AggregatorProxyFactory.d.ts +12 -0
- package/dist/src/generated/AggregatorProxyFactory.js +263 -0
- package/dist/src/generated/AggregatorProxyFactory.js.map +1 -0
- package/dist/src/generated/BasicConsumer.d.ts +154 -0
- package/dist/src/generated/BasicConsumerFactory.d.ts +13 -0
- package/dist/src/generated/BasicConsumerFactory.js +183 -0
- package/dist/src/generated/BasicConsumerFactory.js.map +1 -0
- package/dist/src/generated/ChainlinkClient.d.ts +58 -0
- package/dist/src/generated/ChainlinkClientFactory.d.ts +12 -0
- package/dist/src/generated/ChainlinkClientFactory.js +66 -0
- package/dist/src/generated/ChainlinkClientFactory.js.map +1 -0
- package/dist/src/generated/ChainlinkRequestInterface.d.ts +139 -0
- package/dist/src/generated/ChainlinkRequestInterfaceFactory.d.ts +6 -0
- package/dist/src/generated/ChainlinkRequestInterfaceFactory.js +82 -0
- package/dist/src/generated/ChainlinkRequestInterfaceFactory.js.map +1 -0
- package/dist/src/generated/Chainlinked.d.ts +55 -0
- package/dist/src/generated/ChainlinkedFactory.d.ts +12 -0
- package/dist/src/generated/ChainlinkedFactory.js +66 -0
- package/dist/src/generated/ChainlinkedFactory.js.map +1 -0
- package/dist/src/generated/ConcreteChainlink.d.ts +158 -0
- package/dist/src/generated/ConcreteChainlinkFactory.d.ts +12 -0
- package/dist/src/generated/ConcreteChainlinkFactory.js +155 -0
- package/dist/src/generated/ConcreteChainlinkFactory.js.map +1 -0
- package/dist/src/generated/ConcreteChainlinked.d.ts +300 -0
- package/dist/src/generated/ConcreteChainlinkedFactory.d.ts +12 -0
- package/dist/src/generated/ConcreteChainlinkedFactory.js +320 -0
- package/dist/src/generated/ConcreteChainlinkedFactory.js.map +1 -0
- package/dist/src/generated/ConcreteSignedSafeMath.d.ts +50 -0
- package/dist/src/generated/ConcreteSignedSafeMathFactory.d.ts +12 -0
- package/dist/src/generated/ConcreteSignedSafeMathFactory.js +53 -0
- package/dist/src/generated/ConcreteSignedSafeMathFactory.js.map +1 -0
- package/dist/src/generated/Consumer.d.ts +151 -0
- package/dist/src/generated/ConsumerFactory.d.ts +12 -0
- package/dist/src/generated/ConsumerFactory.js +164 -0
- package/dist/src/generated/ConsumerFactory.js.map +1 -0
- package/dist/src/generated/ENS.d.ts +171 -0
- package/dist/src/generated/ENSFactory.d.ts +6 -0
- package/dist/src/generated/ENSFactory.js +220 -0
- package/dist/src/generated/ENSFactory.js.map +1 -0
- package/dist/src/generated/ENSInterface.d.ts +174 -0
- package/dist/src/generated/ENSInterfaceFactory.d.ts +6 -0
- package/dist/src/generated/ENSInterfaceFactory.js +220 -0
- package/dist/src/generated/ENSInterfaceFactory.js.map +1 -0
- package/dist/src/generated/ENSRegistry.d.ts +171 -0
- package/dist/src/generated/ENSRegistryFactory.d.ts +12 -0
- package/dist/src/generated/ENSRegistryFactory.js +242 -0
- package/dist/src/generated/ENSRegistryFactory.js.map +1 -0
- package/dist/src/generated/ENSResolver.d.ts +45 -0
- package/dist/src/generated/ENSResolverFactory.d.ts +6 -0
- package/dist/src/generated/ENSResolverFactory.js +33 -0
- package/dist/src/generated/ENSResolverFactory.js.map +1 -0
- package/dist/src/generated/EmptyOracle.d.ts +228 -0
- package/dist/src/generated/EmptyOracleFactory.d.ts +12 -0
- package/dist/src/generated/EmptyOracleFactory.js +228 -0
- package/dist/src/generated/EmptyOracleFactory.js.map +1 -0
- package/dist/src/generated/GetterSetter.d.ts +207 -0
- package/dist/src/generated/GetterSetterFactory.d.ts +12 -0
- package/dist/src/generated/GetterSetterFactory.js +255 -0
- package/dist/src/generated/GetterSetterFactory.js.map +1 -0
- package/dist/src/generated/LinkToken.d.ts +243 -0
- package/dist/src/generated/LinkTokenFactory.d.ts +12 -0
- package/dist/src/generated/LinkTokenFactory.js +329 -0
- package/dist/src/generated/LinkTokenFactory.js.map +1 -0
- package/dist/src/generated/LinkTokenInterface.d.ts +230 -0
- package/dist/src/generated/LinkTokenInterfaceFactory.d.ts +6 -0
- package/dist/src/generated/LinkTokenInterfaceFactory.js +253 -0
- package/dist/src/generated/LinkTokenInterfaceFactory.js.map +1 -0
- package/dist/src/generated/MaliciousChainlinked.d.ts +58 -0
- package/dist/src/generated/MaliciousChainlinkedFactory.d.ts +12 -0
- package/dist/src/generated/MaliciousChainlinkedFactory.js +66 -0
- package/dist/src/generated/MaliciousChainlinkedFactory.js.map +1 -0
- package/dist/src/generated/MaliciousConsumer.d.ts +179 -0
- package/dist/src/generated/MaliciousConsumerFactory.d.ts +12 -0
- package/dist/src/generated/MaliciousConsumerFactory.js +221 -0
- package/dist/src/generated/MaliciousConsumerFactory.js.map +1 -0
- package/dist/src/generated/MaliciousRequester.d.ts +161 -0
- package/dist/src/generated/MaliciousRequesterFactory.d.ts +12 -0
- package/dist/src/generated/MaliciousRequesterFactory.js +191 -0
- package/dist/src/generated/MaliciousRequesterFactory.js.map +1 -0
- package/dist/src/generated/Migrations.d.ts +87 -0
- package/dist/src/generated/MigrationsFactory.d.ts +12 -0
- package/dist/src/generated/MigrationsFactory.js +92 -0
- package/dist/src/generated/MigrationsFactory.js.map +1 -0
- package/dist/src/generated/Oracle.d.ts +362 -0
- package/dist/src/generated/OracleFactory.d.ts +12 -0
- package/dist/src/generated/OracleFactory.js +383 -0
- package/dist/src/generated/OracleFactory.js.map +1 -0
- package/dist/src/generated/OracleInterface.d.ts +144 -0
- package/dist/src/generated/OracleInterfaceFactory.d.ts +6 -0
- package/dist/src/generated/OracleInterfaceFactory.js +122 -0
- package/dist/src/generated/OracleInterfaceFactory.js.map +1 -0
- package/dist/src/generated/Ownable.d.ts +91 -0
- package/dist/src/generated/OwnableFactory.d.ts +12 -0
- package/dist/src/generated/OwnableFactory.js +102 -0
- package/dist/src/generated/OwnableFactory.js.map +1 -0
- package/dist/src/generated/Pointer.d.ts +45 -0
- package/dist/src/generated/PointerFactory.d.ts +12 -0
- package/dist/src/generated/PointerFactory.js +55 -0
- package/dist/src/generated/PointerFactory.js.map +1 -0
- package/dist/src/generated/PointerInterface.d.ts +48 -0
- package/dist/src/generated/PointerInterfaceFactory.d.ts +6 -0
- package/dist/src/generated/PointerInterfaceFactory.js +28 -0
- package/dist/src/generated/PointerInterfaceFactory.js.map +1 -0
- package/dist/src/generated/PublicResolver.d.ts +336 -0
- package/dist/src/generated/PublicResolverFactory.d.ts +12 -0
- package/dist/src/generated/PublicResolverFactory.js +476 -0
- package/dist/src/generated/PublicResolverFactory.js.map +1 -0
- package/dist/src/generated/UpdatableConsumer.d.ts +180 -0
- package/dist/src/generated/UpdatableConsumerFactory.d.ts +13 -0
- package/dist/src/generated/UpdatableConsumerFactory.js +220 -0
- package/dist/src/generated/UpdatableConsumerFactory.js.map +1 -0
- package/dist/src/generated/index.d.ts +44 -0
- package/dist/src/generated/index.js +41 -0
- package/dist/src/generated/index.js.map +1 -0
- package/dist/src/helpers.d.ts +144 -0
- package/dist/src/helpers.js +358 -0
- package/dist/src/helpers.js.map +1 -0
- package/dist/src/helpers.test.d.ts +1 -0
- package/dist/src/helpers.test.js +21 -0
- package/dist/src/helpers.test.js.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +27 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/matchers.d.ts +2 -0
- package/dist/src/matchers.js +7 -0
- package/dist/src/matchers.js.map +1 -0
- package/dist/src/provider.d.ts +5 -0
- package/dist/src/provider.js +15 -0
- package/dist/src/provider.js.map +1 -0
- package/dist/src/wallet.d.ts +35 -0
- package/dist/src/wallet.js +64 -0
- package/dist/src/wallet.js.map +1 -0
- package/dist/test/Aggregator.test.d.ts +1 -0
- package/dist/test/Aggregator.test.js +581 -0
- package/dist/test/Aggregator.test.js.map +1 -0
- package/dist/test/AggregatorProxy.test.d.ts +1 -0
- package/dist/test/AggregatorProxy.test.js +179 -0
- package/dist/test/AggregatorProxy.test.js.map +1 -0
- package/dist/test/BasicConsumer.test.d.ts +1 -0
- package/dist/test/BasicConsumer.test.js +180 -0
- package/dist/test/BasicConsumer.test.js.map +1 -0
- package/dist/test/Chainlinked.test.d.ts +1 -0
- package/dist/test/Chainlinked.test.js +11 -0
- package/dist/test/Chainlinked.test.js.map +1 -0
- package/dist/test/ConcreteChainlink.test.d.ts +1 -0
- package/dist/test/ConcreteChainlink.test.js +163 -0
- package/dist/test/ConcreteChainlink.test.js.map +1 -0
- package/dist/test/ConcreteChainlinked.test.d.ts +1 -0
- package/dist/test/ConcreteChainlinked.test.js +182 -0
- package/dist/test/ConcreteChainlinked.test.js.map +1 -0
- package/dist/test/GetterSetter.test.d.ts +1 -0
- package/dist/test/GetterSetter.test.js +76 -0
- package/dist/test/GetterSetter.test.js.map +1 -0
- package/dist/test/Oracle.test.d.ts +1 -0
- package/dist/test/Oracle.test.js +669 -0
- package/dist/test/Oracle.test.js.map +1 -0
- package/dist/test/Pointer.test.d.ts +1 -0
- package/dist/test/Pointer.test.js +35 -0
- package/dist/test/Pointer.test.js.map +1 -0
- package/dist/test/SignedSafeMath.test.d.ts +1 -0
- package/dist/test/SignedSafeMath.test.js +75 -0
- package/dist/test/SignedSafeMath.test.js.map +1 -0
- package/dist/test/UpdatableConsumer.test.d.ts +1 -0
- package/dist/test/UpdatableConsumer.test.js +144 -0
- package/dist/test/UpdatableConsumer.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +7737 -0
- package/package.json +50 -0
- package/r1z9aogk.cjs +1 -0
- package/v0.5/contracts/Chainlink.sol +125 -0
- package/v0.5/contracts/ChainlinkClient.sol +263 -0
- package/v0.5/contracts/LinkTokenReceiver.sol +70 -0
- package/v0.5/contracts/Median.sol +108 -0
- package/v0.5/contracts/Migrations.sol +23 -0
- package/v0.5/contracts/Oracle.sol +273 -0
- package/v0.5/contracts/PreCoordinator.sol +305 -0
- package/v0.5/contracts/dev/AggregatorInterface.sol +12 -0
- package/v0.5/contracts/dev/Coordinator.sol +411 -0
- package/v0.5/contracts/dev/CoordinatorInterface.sol +14 -0
- package/v0.5/contracts/dev/OracleSignaturesDecoder.sol +24 -0
- package/v0.5/contracts/dev/Owned.sol +61 -0
- package/v0.5/contracts/dev/PrepaidAggregator.sol +621 -0
- package/v0.5/contracts/dev/SafeMath128.sol +110 -0
- package/v0.5/contracts/dev/SafeMath32.sol +110 -0
- package/v0.5/contracts/dev/SafeMath64.sol +110 -0
- package/v0.5/contracts/dev/SchnorrSECP256K1.sol +147 -0
- package/v0.5/contracts/dev/ServiceAgreementDecoder.sol +59 -0
- package/v0.5/contracts/dev/VRF.sol +382 -0
- package/v0.5/contracts/dev/Whitelisted.sol +41 -0
- package/v0.5/contracts/dev/WhitelistedAggregator.sol +80 -0
- package/v0.5/contracts/interfaces/ChainlinkRequestInterface.sol +21 -0
- package/v0.5/contracts/interfaces/ENSInterface.sol +26 -0
- package/v0.5/contracts/interfaces/LinkTokenInterface.sol +16 -0
- package/v0.5/contracts/interfaces/OracleInterface.sol +16 -0
- package/v0.5/contracts/interfaces/PointerInterface.sol +5 -0
- package/v0.5/contracts/interfaces/WithdrawalInterface.sol +16 -0
- package/v0.5/contracts/tests/BasicConsumer.sol +13 -0
- package/v0.5/contracts/tests/ChainlinkTestHelper.sol +75 -0
- package/v0.5/contracts/tests/Consumer.sol +55 -0
- package/v0.5/contracts/tests/EmptyAggregator.sol +34 -0
- package/v0.5/contracts/tests/GetterSetter.sol +45 -0
- package/v0.5/contracts/tests/MaliciousChainlink.sol +75 -0
- package/v0.5/contracts/tests/MaliciousChainlinkClient.sol +109 -0
- package/v0.5/contracts/tests/MaliciousConsumer.sol +54 -0
- package/v0.5/contracts/tests/MaliciousRequester.sol +52 -0
- package/v0.5/contracts/tests/MeanAggregator.sol +75 -0
- package/v0.5/contracts/tests/MedianTestHelper.sol +15 -0
- package/v0.5/contracts/tests/OwnedTestHelper.sol +16 -0
- package/v0.5/contracts/tests/ServiceAgreementConsumer.sol +30 -0
- package/v0.5/contracts/vendor/Buffer.sol +301 -0
- package/v0.5/contracts/vendor/CBOR.sol +71 -0
- package/v0.5/contracts/vendor/ENSResolver.sol +5 -0
- package/v0.5/contracts/vendor/Ownable.sol +65 -0
- package/v0.5/contracts/vendor/SafeMath.sol +107 -0
- package/v0.5/contracts/vendor/SignedSafeMath.sol +22 -0
- package/v0.6/contracts/Chainlink.sol +125 -0
- package/v0.6/contracts/ChainlinkClient.sol +263 -0
- package/v0.6/contracts/LinkTokenReceiver.sol +70 -0
- package/v0.6/contracts/Oracle.sol +276 -0
- package/v0.6/contracts/interfaces/ChainlinkRequestInterface.sol +21 -0
- package/v0.6/contracts/interfaces/ENSInterface.sol +26 -0
- package/v0.6/contracts/interfaces/LinkTokenInterface.sol +16 -0
- package/v0.6/contracts/interfaces/OracleInterface.sol +16 -0
- package/v0.6/contracts/interfaces/PointerInterface.sol +5 -0
- package/v0.6/contracts/interfaces/WithdrawalInterface.sol +16 -0
- package/v0.6/contracts/tests/BasicConsumer.sol +13 -0
- package/v0.6/contracts/tests/Consumer.sol +55 -0
- package/v0.6/contracts/vendor/Buffer.sol +301 -0
- package/v0.6/contracts/vendor/CBOR.sol +71 -0
- package/v0.6/contracts/vendor/ENSResolver.sol +5 -0
- package/v0.6/contracts/vendor/Ownable.sol +65 -0
- package/v0.6/contracts/vendor/SafeMath.sol +107 -0
- package/zos.json +8 -0
- package/zos.rinkeby.json +104 -0
- package/zos.ropsten.json +104 -0
@@ -0,0 +1,182 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const test_helpers_1 = require("@chainlink/test-helpers");
|
4
|
+
const chai_1 = require("chai");
|
5
|
+
const ethers_1 = require("ethers");
|
6
|
+
const generated_1 = require("../src/generated");
|
7
|
+
const concreteChainlinkedFactory = new generated_1.ConcreteChainlinkedFactory();
|
8
|
+
const emptyOracleFactory = new generated_1.EmptyOracleFactory();
|
9
|
+
const getterSetterFactory = new generated_1.GetterSetterFactory();
|
10
|
+
const oracleFactory = new generated_1.OracleFactory();
|
11
|
+
const linkTokenFactory = new test_helpers_1.contract.LinkTokenFactory();
|
12
|
+
const provider = test_helpers_1.setup.provider();
|
13
|
+
let roles;
|
14
|
+
beforeAll(async () => {
|
15
|
+
const users = await test_helpers_1.setup.users(provider);
|
16
|
+
roles = users.roles;
|
17
|
+
});
|
18
|
+
describe('ConcreteChainlinked', () => {
|
19
|
+
const specId = '0x4c7b7ffb66b344fbaa64995af81e355a00000000000000000000000000000000';
|
20
|
+
let cc;
|
21
|
+
let gs;
|
22
|
+
let oc;
|
23
|
+
let newoc;
|
24
|
+
let link;
|
25
|
+
const deployment = test_helpers_1.setup.snapshot(provider, async () => {
|
26
|
+
link = await linkTokenFactory.connect(roles.defaultAccount).deploy();
|
27
|
+
oc = await oracleFactory.connect(roles.defaultAccount).deploy(link.address);
|
28
|
+
newoc = await oracleFactory
|
29
|
+
.connect(roles.defaultAccount)
|
30
|
+
.deploy(link.address);
|
31
|
+
gs = await getterSetterFactory.connect(roles.defaultAccount).deploy();
|
32
|
+
cc = await concreteChainlinkedFactory
|
33
|
+
.connect(roles.defaultAccount)
|
34
|
+
.deploy(link.address, oc.address);
|
35
|
+
});
|
36
|
+
beforeEach(async () => {
|
37
|
+
await deployment();
|
38
|
+
});
|
39
|
+
describe('#newRequest', () => {
|
40
|
+
it('forwards the information to the oracle contract through the link token', async () => {
|
41
|
+
var _a;
|
42
|
+
const tx = await cc.publicNewRequest(specId, gs.address, ethers_1.ethers.utils.toUtf8Bytes('requestedBytes32(bytes32,bytes32)'));
|
43
|
+
const receipt = await tx.wait();
|
44
|
+
chai_1.assert.equal(1, (_a = receipt.logs) === null || _a === void 0 ? void 0 : _a.length);
|
45
|
+
const [jId, cbAddr, cbFId, cborData] = receipt.logs
|
46
|
+
? test_helpers_1.oracle.decodeCCRequest(receipt.logs[0])
|
47
|
+
: [];
|
48
|
+
const params = test_helpers_1.helpers.decodeDietCBOR((cborData !== null && cborData !== void 0 ? cborData : ''));
|
49
|
+
chai_1.assert.equal(specId, jId);
|
50
|
+
chai_1.assert.equal(gs.address, cbAddr);
|
51
|
+
chai_1.assert.equal('0xed53e511', cbFId);
|
52
|
+
chai_1.assert.deepEqual({}, params);
|
53
|
+
});
|
54
|
+
});
|
55
|
+
describe('#chainlinkRequest(Request)', () => {
|
56
|
+
it('emits an event from the contract showing the run ID', async () => {
|
57
|
+
var _a, _b, _c;
|
58
|
+
const tx = await cc.publicRequest(specId, cc.address, ethers_1.ethers.utils.toUtf8Bytes('fulfillRequest(bytes32,bytes32)'), 0);
|
59
|
+
const { events, logs } = await tx.wait();
|
60
|
+
chai_1.assert.equal(4, (_a = events) === null || _a === void 0 ? void 0 : _a.length);
|
61
|
+
chai_1.assert.equal((_b = logs) === null || _b === void 0 ? void 0 : _b[0].address, cc.address);
|
62
|
+
chai_1.assert.equal((_c = events) === null || _c === void 0 ? void 0 : _c[0].event, 'ChainlinkRequested');
|
63
|
+
});
|
64
|
+
});
|
65
|
+
describe('#chainlinkRequestTo(Request)', () => {
|
66
|
+
it('emits an event from the contract showing the run ID', async () => {
|
67
|
+
var _a, _b;
|
68
|
+
const tx = await cc.publicRequestRunTo(newoc.address, specId, cc.address, ethers_1.ethers.utils.toUtf8Bytes('fulfillRequest(bytes32,bytes32)'), 0);
|
69
|
+
const { events } = await tx.wait();
|
70
|
+
chai_1.assert.equal(4, (_a = events) === null || _a === void 0 ? void 0 : _a.length);
|
71
|
+
chai_1.assert.equal((_b = events) === null || _b === void 0 ? void 0 : _b[0].event, 'ChainlinkRequested');
|
72
|
+
});
|
73
|
+
it('emits an event on the target oracle contract', async () => {
|
74
|
+
var _a, _b;
|
75
|
+
const tx = await cc.publicRequestRunTo(newoc.address, specId, cc.address, ethers_1.ethers.utils.toUtf8Bytes('fulfillRequest(bytes32,bytes32)'), 0);
|
76
|
+
const { logs } = await tx.wait();
|
77
|
+
const event = logs && newoc.interface.parseLog(logs[3]);
|
78
|
+
chai_1.assert.equal(4, (_a = logs) === null || _a === void 0 ? void 0 : _a.length);
|
79
|
+
chai_1.assert.equal((_b = event) === null || _b === void 0 ? void 0 : _b.name, 'OracleRequest');
|
80
|
+
});
|
81
|
+
it('does not modify the stored oracle address', async () => {
|
82
|
+
await cc.publicRequestRunTo(newoc.address, specId, cc.address, ethers_1.ethers.utils.toUtf8Bytes('fulfillRequest(bytes32,bytes32)'), 0);
|
83
|
+
const actualOracleAddress = await cc.publicOracleAddress();
|
84
|
+
chai_1.assert.equal(oc.address, actualOracleAddress);
|
85
|
+
});
|
86
|
+
});
|
87
|
+
describe('#cancelChainlinkRequest', () => {
|
88
|
+
let requestId;
|
89
|
+
// a concrete chainlink attached to an empty oracle
|
90
|
+
let ecc;
|
91
|
+
beforeEach(async () => {
|
92
|
+
var _a, _b;
|
93
|
+
const emptyOracle = await emptyOracleFactory
|
94
|
+
.connect(roles.defaultAccount)
|
95
|
+
.deploy();
|
96
|
+
ecc = await concreteChainlinkedFactory
|
97
|
+
.connect(roles.defaultAccount)
|
98
|
+
.deploy(link.address, emptyOracle.address);
|
99
|
+
const tx = await ecc.publicRequest(specId, ecc.address, ethers_1.ethers.utils.toUtf8Bytes('fulfillRequest(bytes32,bytes32)'), 0);
|
100
|
+
const { events } = await tx.wait();
|
101
|
+
requestId = ((_b = (_a = events) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.args).id;
|
102
|
+
});
|
103
|
+
it('emits an event from the contract showing the run was cancelled', async () => {
|
104
|
+
var _a, _b, _c;
|
105
|
+
const tx = await ecc.publicCancelRequest(requestId, 0, ethers_1.ethers.utils.hexZeroPad('0x', 4), 0);
|
106
|
+
const { events } = await tx.wait();
|
107
|
+
chai_1.assert.equal(1, (_a = events) === null || _a === void 0 ? void 0 : _a.length);
|
108
|
+
chai_1.assert.equal((_b = events) === null || _b === void 0 ? void 0 : _b[0].event, 'ChainlinkCancelled');
|
109
|
+
chai_1.assert.equal(requestId, ((_c = events) === null || _c === void 0 ? void 0 : _c[0].args).id);
|
110
|
+
});
|
111
|
+
it('throws if given a bogus event ID', async () => {
|
112
|
+
await test_helpers_1.matchers.evmRevert(async () => {
|
113
|
+
await ecc.publicCancelRequest(ethers_1.ethers.utils.formatBytes32String('bogusId'), 0, ethers_1.ethers.utils.hexZeroPad('0x', 4), 0);
|
114
|
+
});
|
115
|
+
});
|
116
|
+
});
|
117
|
+
describe('#recordChainlinkFulfillment(modifier)', () => {
|
118
|
+
let request;
|
119
|
+
beforeEach(async () => {
|
120
|
+
var _a;
|
121
|
+
const tx = await cc.publicRequest(specId, cc.address, ethers_1.ethers.utils.toUtf8Bytes('fulfillRequest(bytes32,bytes32)'), 0);
|
122
|
+
const { logs } = await tx.wait();
|
123
|
+
request = test_helpers_1.oracle.decodeRunRequest((_a = logs) === null || _a === void 0 ? void 0 : _a[3]);
|
124
|
+
});
|
125
|
+
it('emits an event marking the request fulfilled', async () => {
|
126
|
+
var _a, _b, _c;
|
127
|
+
const tx = await oc.fulfillOracleRequest(...test_helpers_1.oracle.convertFufillParams(request, ethers_1.ethers.utils.formatBytes32String('hi mom!')));
|
128
|
+
const { logs } = await tx.wait();
|
129
|
+
const event = logs && cc.interface.parseLog(logs[0]);
|
130
|
+
chai_1.assert.equal(1, (_a = logs) === null || _a === void 0 ? void 0 : _a.length);
|
131
|
+
chai_1.assert.equal((_b = event) === null || _b === void 0 ? void 0 : _b.name, 'ChainlinkFulfilled');
|
132
|
+
chai_1.assert.equal(request.requestId, (_c = event) === null || _c === void 0 ? void 0 : _c.values.id);
|
133
|
+
});
|
134
|
+
});
|
135
|
+
describe('#fulfillChainlinkRequest(function)', () => {
|
136
|
+
let request;
|
137
|
+
beforeEach(async () => {
|
138
|
+
var _a;
|
139
|
+
const tx = await cc.publicRequest(specId, cc.address, ethers_1.ethers.utils.toUtf8Bytes('publicFulfillChainlinkRequest(bytes32,bytes32)'), 0);
|
140
|
+
const { logs } = await tx.wait();
|
141
|
+
request = test_helpers_1.oracle.decodeRunRequest((_a = logs) === null || _a === void 0 ? void 0 : _a[3]);
|
142
|
+
});
|
143
|
+
it('emits an event marking the request fulfilled', async () => {
|
144
|
+
var _a, _b, _c, _d;
|
145
|
+
const tx = await oc.fulfillOracleRequest(...test_helpers_1.oracle.convertFufillParams(request, ethers_1.ethers.utils.formatBytes32String('hi mom!')));
|
146
|
+
const { logs } = await tx.wait();
|
147
|
+
const event = logs && cc.interface.parseLog(logs[0]);
|
148
|
+
chai_1.assert.equal(1, (_a = logs) === null || _a === void 0 ? void 0 : _a.length);
|
149
|
+
chai_1.assert.equal((_b = event) === null || _b === void 0 ? void 0 : _b.name, 'ChainlinkFulfilled');
|
150
|
+
chai_1.assert.equal(request.requestId, (_d = (_c = event) === null || _c === void 0 ? void 0 : _c.values) === null || _d === void 0 ? void 0 : _d.id);
|
151
|
+
});
|
152
|
+
});
|
153
|
+
describe('#chainlinkToken', () => {
|
154
|
+
it('returns the Link Token address', async () => {
|
155
|
+
const addr = await cc.publicChainlinkToken();
|
156
|
+
chai_1.assert.equal(addr, link.address);
|
157
|
+
});
|
158
|
+
});
|
159
|
+
describe('#addExternalRequest', () => {
|
160
|
+
let mock;
|
161
|
+
let request;
|
162
|
+
beforeEach(async () => {
|
163
|
+
var _a;
|
164
|
+
mock = await concreteChainlinkedFactory
|
165
|
+
.connect(roles.defaultAccount)
|
166
|
+
.deploy(link.address, oc.address);
|
167
|
+
const tx = await cc.publicRequest(specId, mock.address, ethers_1.ethers.utils.toUtf8Bytes('fulfillRequest(bytes32,bytes32)'), 0);
|
168
|
+
const receipt = await tx.wait();
|
169
|
+
request = test_helpers_1.oracle.decodeRunRequest((_a = receipt.logs) === null || _a === void 0 ? void 0 : _a[3]);
|
170
|
+
await mock.publicAddExternalRequest(oc.address, request.requestId);
|
171
|
+
});
|
172
|
+
it('allows the external request to be fulfilled', async () => {
|
173
|
+
await oc.fulfillOracleRequest(...test_helpers_1.oracle.convertFufillParams(request, ethers_1.ethers.utils.formatBytes32String('hi mom!')));
|
174
|
+
});
|
175
|
+
it('does not allow the same requestId to be used', async () => {
|
176
|
+
await test_helpers_1.matchers.evmRevert(async () => {
|
177
|
+
await cc.publicAddExternalRequest(newoc.address, request.requestId);
|
178
|
+
});
|
179
|
+
});
|
180
|
+
});
|
181
|
+
});
|
182
|
+
//# sourceMappingURL=ConcreteChainlinked.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ConcreteChainlinked.test.js","sourceRoot":"","sources":["../../test/ConcreteChainlinked.test.ts"],"names":[],"mappings":";;AAAA,0DAMgC;AAChC,+BAA6B;AAC7B,mCAA+B;AAC/B,gDAKyB;AAEzB,MAAM,0BAA0B,GAAG,IAAI,sCAA0B,EAAE,CAAA;AACnE,MAAM,kBAAkB,GAAG,IAAI,8BAAkB,EAAE,CAAA;AACnD,MAAM,mBAAmB,GAAG,IAAI,+BAAmB,EAAE,CAAA;AACrD,MAAM,aAAa,GAAG,IAAI,yBAAa,EAAE,CAAA;AACzC,MAAM,gBAAgB,GAAG,IAAI,uBAAQ,CAAC,gBAAgB,EAAE,CAAA;AAExD,MAAM,QAAQ,GAAG,oBAAK,CAAC,QAAQ,EAAE,CAAA;AAEjC,IAAI,KAAkB,CAAA;AAEtB,SAAS,CAAC,KAAK,IAAI,EAAE;IACnB,MAAM,KAAK,GAAG,MAAM,oBAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAEzC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;AACrB,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,MAAM,GACV,oEAAoE,CAAA;IACtE,IAAI,EAAiD,CAAA;IACrD,IAAI,EAA0C,CAAA;IA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AE,EAAE,CAAC,OAAO,CAAC,CAAA;YAEnC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,aAAa,CAC/B,MAAM,EACN,IAAI,CAAC,OAAO,EACZ,eAAM,CAAC,KAAK,CAAC,WAAW,CAAC,iCAAiC,CAAC,EAC3D,CAAC,CACF,CAAA;YACD,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAA;YAE/B,OAAO,GAAG,qBAAM,CAAC,gBAAgB,OAAC,OAAO,CAAC,IAAI,0CAAG,CAAC,EAAE,CAAA;YACpD,MAAM,IAAI,CAAC,wBAAwB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QACpE,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;YAC3D,MAAM,EAAE,CAAC,oBAAoB,CAC3B,GAAG,qBAAM,CAAC,mBAAmB,CAC3B,OAAO,EACP,eAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAC5C,CACF,CAAA;QACH,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;YAC5D,MAAM,uBAAQ,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;gBAClC,MAAM,EAAE,CAAC,wBAAwB,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;YACrE,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const test_helpers_1 = require("@chainlink/test-helpers");
|
4
|
+
const chai_1 = require("chai");
|
5
|
+
const ethers_1 = require("ethers");
|
6
|
+
const GetterSetterFactory_1 = require("../src/generated/GetterSetterFactory");
|
7
|
+
const GetterSetterContract = new GetterSetterFactory_1.GetterSetterFactory();
|
8
|
+
const provider = test_helpers_1.setup.provider();
|
9
|
+
let roles;
|
10
|
+
beforeAll(async () => {
|
11
|
+
const users = await test_helpers_1.setup.users(provider);
|
12
|
+
roles = users.roles;
|
13
|
+
});
|
14
|
+
describe('GetterSetter', () => {
|
15
|
+
const requestId = '0x3bd198932d9cc01e2950ffc518fd38a303812200000000000000000000000000';
|
16
|
+
const bytes32 = ethers_1.ethers.utils.formatBytes32String('Hi Mom!');
|
17
|
+
const uint256 = ethers_1.ethers.utils.bigNumberify(645746535432);
|
18
|
+
let gs;
|
19
|
+
const deployment = test_helpers_1.setup.snapshot(provider, async () => {
|
20
|
+
gs = await GetterSetterContract.connect(roles.defaultAccount).deploy();
|
21
|
+
});
|
22
|
+
beforeEach(async () => {
|
23
|
+
await deployment();
|
24
|
+
});
|
25
|
+
describe('#setBytes32Val', () => {
|
26
|
+
it('updates the bytes32 value', async () => {
|
27
|
+
await gs.connect(roles.stranger).setBytes32(bytes32);
|
28
|
+
const currentBytes32 = await gs.getBytes32();
|
29
|
+
chai_1.assert.equal(ethers_1.ethers.utils.toUtf8String(currentBytes32), ethers_1.ethers.utils.toUtf8String(bytes32));
|
30
|
+
});
|
31
|
+
it('logs an event', async () => {
|
32
|
+
var _a, _b;
|
33
|
+
const tx = await gs.connect(roles.stranger).setBytes32(bytes32);
|
34
|
+
const receipt = await tx.wait();
|
35
|
+
const args = (_a = receipt.events) === null || _a === void 0 ? void 0 : _a[0].args;
|
36
|
+
chai_1.assert.equal(1, (_b = receipt.events) === null || _b === void 0 ? void 0 : _b.length);
|
37
|
+
chai_1.assert.equal(roles.stranger.address.toLowerCase(), args.from.toLowerCase());
|
38
|
+
chai_1.assert.equal(ethers_1.ethers.utils.toUtf8String(bytes32), ethers_1.ethers.utils.toUtf8String(args.value));
|
39
|
+
});
|
40
|
+
});
|
41
|
+
describe('#requestedBytes32', () => {
|
42
|
+
it('updates the request ID and value', async () => {
|
43
|
+
await gs.connect(roles.stranger).requestedBytes32(requestId, bytes32);
|
44
|
+
const currentRequestId = await gs.requestId();
|
45
|
+
chai_1.assert.equal(currentRequestId, requestId);
|
46
|
+
const currentBytes32 = await gs.getBytes32();
|
47
|
+
chai_1.assert.equal(ethers_1.ethers.utils.toUtf8String(currentBytes32), ethers_1.ethers.utils.toUtf8String(bytes32));
|
48
|
+
});
|
49
|
+
});
|
50
|
+
describe('#setUint256', () => {
|
51
|
+
it('updates uint256 value', async () => {
|
52
|
+
await gs.connect(roles.stranger).setUint256(uint256);
|
53
|
+
const currentUint256 = await gs.getUint256();
|
54
|
+
chai_1.assert.isTrue(currentUint256.eq(uint256));
|
55
|
+
});
|
56
|
+
it('logs an event', async () => {
|
57
|
+
var _a, _b;
|
58
|
+
const tx = await gs.connect(roles.stranger).setUint256(uint256);
|
59
|
+
const receipt = await tx.wait();
|
60
|
+
const args = (_a = receipt.events) === null || _a === void 0 ? void 0 : _a[0].args;
|
61
|
+
chai_1.assert.equal(1, (_b = receipt.events) === null || _b === void 0 ? void 0 : _b.length);
|
62
|
+
chai_1.assert.equal(roles.stranger.address.toLowerCase(), args.from.toLowerCase());
|
63
|
+
chai_1.assert.isTrue(uint256.eq(args.value));
|
64
|
+
});
|
65
|
+
});
|
66
|
+
describe('#requestedUint256', () => {
|
67
|
+
it('updates the request ID and value', async () => {
|
68
|
+
await gs.connect(roles.stranger).requestedUint256(requestId, uint256);
|
69
|
+
const currentRequestId = await gs.requestId();
|
70
|
+
chai_1.assert.equal(currentRequestId, requestId);
|
71
|
+
const currentUint256 = await gs.getUint256();
|
72
|
+
chai_1.assert.isTrue(currentUint256.eq(uint256));
|
73
|
+
});
|
74
|
+
});
|
75
|
+
});
|
76
|
+
//# sourceMappingURL=GetterSetter.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GetterSetter.test.js","sourceRoot":"","sources":["../../test/GetterSetter.test.ts"],"names":[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