From 0eef13af84a0ed1543486d3969a8b0d23c9cca83 Mon Sep 17 00:00:00 2001 From: juliopavila Date: Thu, 24 Nov 2022 18:19:41 -0300 Subject: [PATCH 1/2] Improve monitoring scripts --- .../autotasks/on_new_question_from_module.ts | 108 +++++++++++++ monitoring/defender/index.ts | 23 +-- monitoring/util.ts | 29 ++++ package.json | 3 + yarn.lock | 148 +++++++++++++++++- 5 files changed, 292 insertions(+), 19 deletions(-) create mode 100644 monitoring/defender/autotasks/on_new_question_from_module.ts create mode 100644 monitoring/util.ts diff --git a/monitoring/defender/autotasks/on_new_question_from_module.ts b/monitoring/defender/autotasks/on_new_question_from_module.ts new file mode 100644 index 00000000..8db2e86a --- /dev/null +++ b/monitoring/defender/autotasks/on_new_question_from_module.ts @@ -0,0 +1,108 @@ +import { + AutotaskEvent, + BlockTriggerEvent, + EthReceipt, +} from "defender-autotask-utils"; +import { SentinelClient } from "defender-sentinel-client"; +import { ExternalCreateSubscriberRequest } from "defender-sentinel-client/lib/models/subscriber"; + +const PROPOSAL_QUESTION_CREATED_EVENT_TOPIC = + "0xa1f5047031a658827550a2c4be07648493f3ac88a09c857b3961d1336429a31f"; // Keccak-256("ProposalQuestionCreated(bytes32,string)") +export default async function handler(event: AutotaskEvent) { + const match = event.request?.body as BlockTriggerEvent; + // variable from the event + if (match) { + const ethReceipt = match.transaction as EthReceipt; + const evmEvent = ethReceipt.logs.find( + (log) => log.topics[0] === PROPOSAL_QUESTION_CREATED_EVENT_TOPIC + ); + if (evmEvent) { + const questionId = evmEvent.topics[1]; + console.log("QuestionId to monitor for:", questionId); + const txHash = ethReceipt.transactionHash; + const txFrom = ethReceipt.from; + console.log("txHash", txHash); + console.log("txFrom", txFrom); + // variables from autotask creation + const network = "{{network}}"; + const oracleAddress = "{{oracleAddress}}"; + const notificationChannels = "{{notificationChannels}}"; + const apiKey = "{{apiKey}}"; + const apiSecret = "{{apiSecret}}"; + const module = "{{module}}"; + const client = new SentinelClient({ + apiKey, + apiSecret, + }); + + //TODO: Change the module name + const requestParameters = { + type: "BLOCK", + network, + name: `Answer submitted for a proposal question at Reality.eth for the ${module} Module (on ${network})`, + addresses: [oracleAddress], + paused: false, + abi: `[{ + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "answer", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "question_id", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "history_hash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bond", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ts", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "is_commitment", + "type": "bool" + } + ], + "name": "LogNewAnswer", + "type": "event" + }]`, + eventConditions: [ + { + eventSignature: + "LogNewAnswer(bytes32,bytes32,bytes32,address,uint256,uint256,bool)", + expression: `$1 == "${questionId}"`, + }, + ], + notificationChannels: notificationChannels, + }; + return client.create( + requestParameters as unknown as ExternalCreateSubscriberRequest + ); + } + } +} diff --git a/monitoring/defender/index.ts b/monitoring/defender/index.ts index 526cd224..bd78d2c8 100644 --- a/monitoring/defender/index.ts +++ b/monitoring/defender/index.ts @@ -1,14 +1,15 @@ +import { + AutotaskClient, + CreateAutotaskRequest, +} from "defender-autotask-client"; +import { Network } from "defender-base-client"; import { CreateSentinelRequest, NotificationType, SentinelClient, } from "defender-sentinel-client"; -import { AutotaskClient } from "defender-autotask-client"; -import { CreateAutotaskRequest } from "defender-autotask-client"; -import { Network } from "defender-base-client"; -import { packageCode, replaceInString } from "../util"; +import { packageCode, readFileAndReplace } from "../util"; import autotaskJsCode from "./autotasks/on_new_question_from_module"; - export { NotificationType } from "defender-sentinel-client"; export const setupSentinelClient = ({ apiKey, apiSecret }) => @@ -41,7 +42,7 @@ export const setupNewNotificationChannel = async ( * @param client The SentinelClient * @param notificationChannels Where to send notifications * @param network What network to monitor - * @param moduleMastercopyAddress Address of mastercopy of the module + * @param moduleMasterCopyAddress Address of master copy of the module * @param moduleName Name of the module. For nice notification messages * @param autotaskId Optional: ID of autotask to run when the sentinel triggers * @returns @@ -50,15 +51,15 @@ export const createSentinelForModuleFactory = async ( client: SentinelClient, notificationChannels: string[], network: Network, - moduleMastercopyAddress: string, + moduleMasterCopyAddress: string, moduleName: string, autotaskId?: string ) => { const requestParameters: CreateSentinelRequest = { type: "BLOCK", network, - name: `New ${moduleName} Module is set up (${realityModuleAddress} on ${network})`, - addresses: [realityModuleAddress], + name: `New ${moduleName} Module is set up (${moduleMasterCopyAddress} on ${network})`, + addresses: [moduleMasterCopyAddress], paused: false, abi: `[{ "anonymous": false, @@ -102,10 +103,10 @@ export const createAutotask = async ( apiKey: string, apiSecret: string ) => { - const code = replaceInString(autotaskJsCode, { + const code = readFileAndReplace(autotaskJsCode as unknown as string, { "{{network}}": network, "{{oracleAddress}}": oracleAddress, - '"{{notificationChannels}}"': JSON.stringify(notificationChannels), + "{{notificationChannels}}": JSON.stringify(notificationChannels), "{{apiKey}}": apiKey, "{{apiSecret}}": apiSecret, }); diff --git a/monitoring/util.ts b/monitoring/util.ts new file mode 100644 index 00000000..f5ac847e --- /dev/null +++ b/monitoring/util.ts @@ -0,0 +1,29 @@ +import fs from "fs"; +import JSZip from "jszip"; + +export const getEnv = (name: string) => { + const val = process.env[name]; + if (val == null) { + throw new Error("Missing environment variable: " + name); + } + return val; +}; + +export const readFileAndReplace = ( + filePath: string, + replaceMap: { [toReplace: string]: string } +) => { + const buffer = fs.readFileSync(filePath); + let fileContent = buffer.toString(); + Object.keys(replaceMap).forEach((key) => { + fileContent = fileContent.replace(key, replaceMap[key]); + }); + return fileContent; +}; + +export const packageCode = async (code: string) => { + const zip = new JSZip(); + zip.file("index.js", code, { binary: false }); + const zippedCode = await zip.generateAsync({ type: "nodebuffer" }); + return zippedCode.toString("base64"); +}; diff --git a/package.json b/package.json index b7b80ee0..028f269e 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,9 @@ "@openzeppelin/contracts": "^4.3.2", "@openzeppelin/contracts-upgradeable": "^4.2.0", "argv": "^0.0.2", + "defender-autotask-client": "^1.37.0", + "defender-autotask-utils": "^1.37.0", + "defender-sentinel-client": "^1.37.0", "dotenv": "^16.0.3", "ethers": "^5.7.1", "solc": "^0.8.17", diff --git a/yarn.lock b/yarn.lock index b1315a42..97bbcfe4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -129,7 +129,7 @@ "@ethersproject/properties" ">=5.0.0-beta.131" "@ethersproject/strings" ">=5.0.0-beta.130" -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.5.0", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.5.0", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -1430,6 +1430,17 @@ ajv@^8.0.1: require-from-string "^2.0.2" uri-js "^4.2.2" +amazon-cognito-identity-js@^4.3.3: + version "4.6.3" + resolved "https://registry.yarnpkg.com/amazon-cognito-identity-js/-/amazon-cognito-identity-js-4.6.3.tgz#889410379a5fc5e883edc95f4ce233cc628e354c" + integrity sha512-MPVJfirbdmSGo7l4h7Kbn3ms1eJXT5Xq8ly+mCPPi8yAxaxdg7ouMUUNTqtDykoZxIdDLF/P6F3Zbg3dlGKOWg== + dependencies: + buffer "4.9.2" + crypto-js "^4.0.0" + fast-base64-decode "^1.0.0" + isomorphic-unfetch "^3.0.0" + js-cookie "^2.2.1" + amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" @@ -1686,6 +1697,13 @@ async-limiter@~1.0.0: resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== +async-retry@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.3.3.tgz#0e7f36c04d8478e7a58bdbed80cedf977785f280" + integrity sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw== + dependencies: + retry "0.13.1" + async@1.x, async@^1.4.2: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -1730,7 +1748,7 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== -axios@^0.21.1: +axios@^0.21.1, axios@^0.21.2: version "0.21.4" resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== @@ -2275,7 +2293,7 @@ base-x@^3.0.2, base-x@^3.0.8: dependencies: safe-buffer "^5.0.1" -base64-js@^1.3.1: +base64-js@^1.0.2, base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== @@ -2539,6 +2557,15 @@ buffer-xor@^2.0.1: dependencies: safe-buffer "^5.1.1" +buffer@4.9.2: + version "4.9.2" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.2.tgz#230ead344002988644841ab0244af8c44bbe3ef8" + integrity sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg== + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + isarray "^1.0.0" + buffer@^5.0.5, buffer@^5.2.1, buffer@^5.5.0, buffer@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" @@ -3209,6 +3236,11 @@ crypto-browserify@3.12.0: randombytes "^2.0.0" randomfill "^1.0.3" +crypto-js@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf" + integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw== + d@1, d@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" @@ -3315,6 +3347,46 @@ deep-is@^0.1.3, deep-is@~0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== +defender-autotask-client@^1.37.0: + version "1.37.0" + resolved "https://registry.yarnpkg.com/defender-autotask-client/-/defender-autotask-client-1.37.0.tgz#3b59ac826e6d5df4fa3f706f36e09aad07e786d0" + integrity sha512-N66buqg7mgYiEMbN6R+/6tUB4gxp5Q9cu8QDFuDkviR32AxZ2jY7LqV+GkR/9dbRufQtb4ZRf+ihG/b01w5O5Q== + dependencies: + axios "^0.21.2" + defender-base-client "1.37.0" + dotenv "^10.0.0" + glob "^7.1.6" + jszip "^3.5.0" + lodash "^4.17.19" + node-fetch "^2.6.0" + +defender-autotask-utils@^1.37.0: + version "1.37.0" + resolved "https://registry.yarnpkg.com/defender-autotask-utils/-/defender-autotask-utils-1.37.0.tgz#9ed39a6e4384c5a99c727e90b6f917fcdc3f8b38" + integrity sha512-fF8U1MGFVDjvdtBXsmeORJp5r8bOvEBquiKCaBb+dHSiNJZQZ3QleWk5Orr5mTl/jj7p4g69tZC5VTUq+rmzsw== + +defender-base-client@1.37.0: + version "1.37.0" + resolved "https://registry.yarnpkg.com/defender-base-client/-/defender-base-client-1.37.0.tgz#22f63357ac99c2c8f64eab6e52c99ef113c62d3a" + integrity sha512-V6tU0q8/n1/m/edT2FlTvUmZn6u5/A64FqYQfrMgg4PEy1TvYCz9tF+3dnGjk+sJrzICAv0GQWwLw/+8uRq2mg== + dependencies: + amazon-cognito-identity-js "^4.3.3" + async-retry "^1.3.3" + axios "^0.21.2" + lodash "^4.17.19" + node-fetch "^2.6.0" + +defender-sentinel-client@^1.37.0: + version "1.37.0" + resolved "https://registry.yarnpkg.com/defender-sentinel-client/-/defender-sentinel-client-1.37.0.tgz#d5ac68f76ce901e0c8773504ce69412057616a79" + integrity sha512-7OuZXrbnEXgq2EWHRdNOmRdhuKsQRLPOGhFmWSHu5HPBwLYFMkDWnEMJuzU8yBdJ12e1mAkA5ikNPrtGO9VHmw== + dependencies: + "@ethersproject/abi" "^5.6.3" + axios "^0.21.2" + defender-base-client "1.37.0" + lodash "^4.17.19" + node-fetch "^2.6.0" + defer-to-connect@^1.0.1: version "1.1.3" resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591" @@ -3470,6 +3542,11 @@ dom-walk@^0.1.0: resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== +dotenv@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" + integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== + dotenv@^16.0.3: version "16.0.3" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07" @@ -4543,6 +4620,11 @@ fake-merkle-patricia-tree@^1.0.1: dependencies: checkpoint-store "^1.1.0" +fast-base64-decode@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-base64-decode/-/fast-base64-decode-1.0.0.tgz#b434a0dd7d92b12b43f26819300d2dafb83ee418" + integrity sha512-qwaScUgUGBYeDNRnbc/KyllVU88Jk1pRHPStuF/lO7B0/RTRLj7U0lkdTAutlBblY08rwZDff6tNU9cjv6j//Q== + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -5094,7 +5176,7 @@ glob@^5.0.15: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.1.2, glob@^7.1.3, glob@~7.2.3: +glob@^7.0.0, glob@^7.1.2, glob@^7.1.3, glob@^7.1.6, glob@~7.2.3: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -5532,7 +5614,7 @@ idna-uts46-hx@^2.3.1: dependencies: punycode "2.1.0" -ieee754@^1.1.13, ieee754@^1.2.1: +ieee754@^1.1.13, ieee754@^1.1.4, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -5552,6 +5634,11 @@ immediate@^3.2.3: resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.3.0.tgz#1aef225517836bcdf7f2a2de2600c79ff0269266" integrity sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q== +immediate@~3.0.5: + version "3.0.6" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ== + immediate@~3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.2.3.tgz#d140fa8f614659bd6541233097ddaac25cdd991c" @@ -5975,7 +6062,7 @@ isarray@0.0.1: resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== -isarray@1.0.0, isarray@~1.0.0: +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== @@ -5997,11 +6084,24 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== +isomorphic-unfetch@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz#87341d5f4f7b63843d468438128cb087b7c3e98f" + integrity sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q== + dependencies: + node-fetch "^2.6.1" + unfetch "^4.2.0" + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== +js-cookie@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" + integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ== + js-sdsl@^4.1.4: version "4.1.5" resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.1.5.tgz#1ff1645e6b4d1b028cd3f862db88c9d887f26e2a" @@ -6191,6 +6291,16 @@ jsprim@^1.2.2: json-schema "0.4.0" verror "1.10.0" +jszip@^3.5.0: + version "3.10.1" + resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.10.1.tgz#34aee70eb18ea1faec2f589208a157d1feb091c2" + integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g== + dependencies: + lie "~3.3.0" + pako "~1.0.2" + readable-stream "~2.3.6" + setimmediate "^1.0.5" + keccak@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.1.tgz#ae30a0e94dbe43414f741375cff6d64c8bea0bff" @@ -6444,6 +6554,13 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" +lie@~3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a" + integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ== + dependencies: + immediate "~3.0.5" + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -6503,7 +6620,7 @@ lodash@4.17.20: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== -lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4: +lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.4: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -7103,7 +7220,7 @@ node-environment-flags@1.0.6: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -node-fetch@^2.6.1, node-fetch@^2.6.7: +node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== @@ -7419,6 +7536,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +pako@~1.0.2: + version "1.0.11" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" + integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -8180,6 +8302,11 @@ ret@~0.1.10: resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== +retry@0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" + integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg== + reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -9487,6 +9614,11 @@ undici@^5.4.0: dependencies: busboy "^1.6.0" +unfetch@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.2.0.tgz#7e21b0ef7d363d8d9af0fb929a5555f6ef97a3be" + integrity sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA== + union-value@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" From 8fa5d188b7d8ba998bcee3c35f655190ae4dd16f Mon Sep 17 00:00:00 2001 From: Asgeir Date: Fri, 25 Nov 2022 09:55:29 +0100 Subject: [PATCH 2/2] Initial monitoring setup --- .../autotasks/on_new_question_from_module.ts | 108 ------------------ monitoring/defender/index.ts | 92 ++++----------- monitoring/defender/util.ts | 13 +++ monitoring/setup-script.ts | 79 +++++-------- monitoring/util.ts | 29 ----- package.json | 6 +- yarn.lock | 54 +-------- 7 files changed, 69 insertions(+), 312 deletions(-) delete mode 100644 monitoring/defender/autotasks/on_new_question_from_module.ts create mode 100644 monitoring/defender/util.ts delete mode 100644 monitoring/util.ts diff --git a/monitoring/defender/autotasks/on_new_question_from_module.ts b/monitoring/defender/autotasks/on_new_question_from_module.ts deleted file mode 100644 index 8db2e86a..00000000 --- a/monitoring/defender/autotasks/on_new_question_from_module.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { - AutotaskEvent, - BlockTriggerEvent, - EthReceipt, -} from "defender-autotask-utils"; -import { SentinelClient } from "defender-sentinel-client"; -import { ExternalCreateSubscriberRequest } from "defender-sentinel-client/lib/models/subscriber"; - -const PROPOSAL_QUESTION_CREATED_EVENT_TOPIC = - "0xa1f5047031a658827550a2c4be07648493f3ac88a09c857b3961d1336429a31f"; // Keccak-256("ProposalQuestionCreated(bytes32,string)") -export default async function handler(event: AutotaskEvent) { - const match = event.request?.body as BlockTriggerEvent; - // variable from the event - if (match) { - const ethReceipt = match.transaction as EthReceipt; - const evmEvent = ethReceipt.logs.find( - (log) => log.topics[0] === PROPOSAL_QUESTION_CREATED_EVENT_TOPIC - ); - if (evmEvent) { - const questionId = evmEvent.topics[1]; - console.log("QuestionId to monitor for:", questionId); - const txHash = ethReceipt.transactionHash; - const txFrom = ethReceipt.from; - console.log("txHash", txHash); - console.log("txFrom", txFrom); - // variables from autotask creation - const network = "{{network}}"; - const oracleAddress = "{{oracleAddress}}"; - const notificationChannels = "{{notificationChannels}}"; - const apiKey = "{{apiKey}}"; - const apiSecret = "{{apiSecret}}"; - const module = "{{module}}"; - const client = new SentinelClient({ - apiKey, - apiSecret, - }); - - //TODO: Change the module name - const requestParameters = { - type: "BLOCK", - network, - name: `Answer submitted for a proposal question at Reality.eth for the ${module} Module (on ${network})`, - addresses: [oracleAddress], - paused: false, - abi: `[{ - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "answer", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "question_id", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "history_hash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "bond", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ts", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "is_commitment", - "type": "bool" - } - ], - "name": "LogNewAnswer", - "type": "event" - }]`, - eventConditions: [ - { - eventSignature: - "LogNewAnswer(bytes32,bytes32,bytes32,address,uint256,uint256,bool)", - expression: `$1 == "${questionId}"`, - }, - ], - notificationChannels: notificationChannels, - }; - return client.create( - requestParameters as unknown as ExternalCreateSubscriberRequest - ); - } - } -} diff --git a/monitoring/defender/index.ts b/monitoring/defender/index.ts index bd78d2c8..66681f61 100644 --- a/monitoring/defender/index.ts +++ b/monitoring/defender/index.ts @@ -1,22 +1,22 @@ -import { - AutotaskClient, - CreateAutotaskRequest, -} from "defender-autotask-client"; import { Network } from "defender-base-client"; import { CreateSentinelRequest, NotificationType, SentinelClient, } from "defender-sentinel-client"; -import { packageCode, readFileAndReplace } from "../util"; -import autotaskJsCode from "./autotasks/on_new_question_from_module"; -export { NotificationType } from "defender-sentinel-client"; +import { ContractAbis, ContractAddresses } from "../../src/factory/contracts"; +import { KnownContracts } from "../../src/factory/types"; +import { defenderNetworkToSupportedNetwork } from "./util"; -export const setupSentinelClient = ({ apiKey, apiSecret }) => - new SentinelClient({ apiKey, apiSecret }); +export { NotificationType } from "defender-sentinel-client"; -export const setupAutotaskClient = ({ apiKey, apiSecret }) => - new AutotaskClient({ apiKey, apiSecret }); +export const setupSentinelClient = ({ + apiKey, + apiSecret, +}: { + apiKey: string; + apiSecret: string; +}) => new SentinelClient({ apiKey, apiSecret }); export const setupNewNotificationChannel = async ( client: SentinelClient, @@ -42,8 +42,7 @@ export const setupNewNotificationChannel = async ( * @param client The SentinelClient * @param notificationChannels Where to send notifications * @param network What network to monitor - * @param moduleMasterCopyAddress Address of master copy of the module - * @param moduleName Name of the module. For nice notification messages + * @param module The module from the `KnownContracts` * @param autotaskId Optional: ID of autotask to run when the sentinel triggers * @returns */ @@ -51,38 +50,26 @@ export const createSentinelForModuleFactory = async ( client: SentinelClient, notificationChannels: string[], network: Network, - moduleMasterCopyAddress: string, - moduleName: string, + module: KnownContracts, autotaskId?: string ) => { + const moduleMastercopyAddress = + ContractAddresses[defenderNetworkToSupportedNetwork(network)][module]; + const moduleProxyFactoryAddress = + ContractAddresses[defenderNetworkToSupportedNetwork(network)][ + KnownContracts.FACTORY + ]; const requestParameters: CreateSentinelRequest = { type: "BLOCK", network, - name: `New ${moduleName} Module is set up (${moduleMasterCopyAddress} on ${network})`, - addresses: [moduleMasterCopyAddress], + name: `New ${module} Module is set up via the Module Factory on ${network})`, + addresses: [moduleProxyFactoryAddress], paused: false, - abi: `[{ - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "questionId", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "string", - "name": "proposalId", - "type": "string" - } - ], - "name": "ProposalQuestionCreated", - "type": "event" - }]`, + abi: ContractAbis[KnownContracts.FACTORY], eventConditions: [ { - eventSignature: "ProposalQuestionCreated(bytes32,string)", + eventSignature: "ModuleProxyCreation(address,address)", // ModuleProxyCreation(proxy, mastercopy) + expression: '$1 == "' + moduleMastercopyAddress + '"', }, ], autotaskTrigger: autotaskId, @@ -94,34 +81,3 @@ export const createSentinelForModuleFactory = async ( return sentinel.subscriberId; }; - -export const createAutotask = async ( - client: AutotaskClient, - oracleAddress: string, - notificationChannels: string[], - network: string, - apiKey: string, - apiSecret: string -) => { - const code = readFileAndReplace(autotaskJsCode as unknown as string, { - "{{network}}": network, - "{{oracleAddress}}": oracleAddress, - "{{notificationChannels}}": JSON.stringify(notificationChannels), - "{{apiKey}}": apiKey, - "{{apiSecret}}": apiSecret, - }); - - const params: CreateAutotaskRequest = { - name: "Setup Sentinel for new Reality.eth question", - encodedZippedCode: await packageCode(code), - trigger: { - type: "webhook", - }, - paused: false, - }; - - const createdAutotask = await client.create(params); - console.log("Created Autotask with ID: ", createdAutotask.autotaskId); - - return createdAutotask.autotaskId; -}; diff --git a/monitoring/defender/util.ts b/monitoring/defender/util.ts new file mode 100644 index 00000000..bb55fd05 --- /dev/null +++ b/monitoring/defender/util.ts @@ -0,0 +1,13 @@ +import { Network } from "defender-base-client"; +import { SupportedNetworks } from "../../src/factory/contracts"; + +export const defenderNetworkToSupportedNetwork = (networks: Network) => { + switch (networks) { + case "mainnet": + return SupportedNetworks.Mainnet; + case "goerli": + return SupportedNetworks.Goerli; + default: + throw new Error(`Unsupported network ${networks}`); + } +}; diff --git a/monitoring/setup-script.ts b/monitoring/setup-script.ts index 44f5e7ea..0cbe85ab 100644 --- a/monitoring/setup-script.ts +++ b/monitoring/setup-script.ts @@ -1,14 +1,12 @@ +import dotenv from "dotenv"; + +import { KnownContracts } from "../src/factory/types"; import { setupSentinelClient, - NotificationType, setupNewNotificationChannel, - createSentinel, - createAutotask, - setupAutotaskClient, + createSentinelForModuleFactory, } from "./defender"; -import dotenv from "dotenv"; - dotenv.config(); const API_KEY = process.env.OZ_DEFENDER_API_KEY; @@ -25,50 +23,27 @@ if (DISCORD_URL_WITH_KEY == null) { } const setup = async () => { - try { - const sentinelClient = setupSentinelClient({ - apiKey: API_KEY, - apiSecret: API_SECRET, - }); - console.log("Client is ready"); - - const notificationChannel = { - channel: "discord", - config: { - url: DISCORD_URL_WITH_KEY, - }, - }; - - const notificationChannelId = await setupNewNotificationChannel( - sentinelClient, - notificationChannel.channel, - notificationChannel.config - ); - - const sentinelCreationResponds = await createSentinel( - sentinelClient, - [notificationChannelId], - "mainnet", - realityModuleAddress, - autotaskId - ); - console.log("Sentinel creation responds", sentinelCreationResponds); - return response - .status(200) - .setHeader("content-type", "application/json;charset=UTF-8") - .setHeader("Access-Control-Allow-Origin", "*") - .send({ - success: true, - }); - } catch (e) { - console.error(e); - - const { name, message } = e; - // this is safe for we are requesting on behalf of the user (with their API key) - return response.status(500).send({ - name, - message, - success: false, - }); - } + const sentinelClient = setupSentinelClient({ + apiKey: API_KEY, + apiSecret: API_SECRET, + }); + console.log("Client is ready"); + + const notificationChannelId = await setupNewNotificationChannel( + sentinelClient, + "discord", + { + url: DISCORD_URL_WITH_KEY, + } + ); + + const sentinelCreationResponds = await createSentinelForModuleFactory( + sentinelClient, + [notificationChannelId], + "mainnet", + KnownContracts.REALITY_ETH + ); + console.log("Sentinel creation responds", sentinelCreationResponds); }; + +setup(); diff --git a/monitoring/util.ts b/monitoring/util.ts deleted file mode 100644 index f5ac847e..00000000 --- a/monitoring/util.ts +++ /dev/null @@ -1,29 +0,0 @@ -import fs from "fs"; -import JSZip from "jszip"; - -export const getEnv = (name: string) => { - const val = process.env[name]; - if (val == null) { - throw new Error("Missing environment variable: " + name); - } - return val; -}; - -export const readFileAndReplace = ( - filePath: string, - replaceMap: { [toReplace: string]: string } -) => { - const buffer = fs.readFileSync(filePath); - let fileContent = buffer.toString(); - Object.keys(replaceMap).forEach((key) => { - fileContent = fileContent.replace(key, replaceMap[key]); - }); - return fileContent; -}; - -export const packageCode = async (code: string) => { - const zip = new JSZip(); - zip.file("index.js", code, { binary: false }); - const zippedCode = await zip.generateAsync({ type: "nodebuffer" }); - return zippedCode.toString("base64"); -}; diff --git a/package.json b/package.json index 028f269e..ec29fef0 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,9 @@ "@typescript-eslint/parser": "^5.40.0", "chai": "^4.3.6", "debug": "^4.3.4", + "defender-base-client": "^1.37.0", + "defender-sentinel-client": "^1.37.0", + "dotenv": "^16.0.3", "eslint": "^8.25.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", @@ -86,9 +89,6 @@ "@openzeppelin/contracts": "^4.3.2", "@openzeppelin/contracts-upgradeable": "^4.2.0", "argv": "^0.0.2", - "defender-autotask-client": "^1.37.0", - "defender-autotask-utils": "^1.37.0", - "defender-sentinel-client": "^1.37.0", "dotenv": "^16.0.3", "ethers": "^5.7.1", "solc": "^0.8.17", diff --git a/yarn.lock b/yarn.lock index 97bbcfe4..fb7e8488 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3347,25 +3347,7 @@ deep-is@^0.1.3, deep-is@~0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -defender-autotask-client@^1.37.0: - version "1.37.0" - resolved "https://registry.yarnpkg.com/defender-autotask-client/-/defender-autotask-client-1.37.0.tgz#3b59ac826e6d5df4fa3f706f36e09aad07e786d0" - integrity sha512-N66buqg7mgYiEMbN6R+/6tUB4gxp5Q9cu8QDFuDkviR32AxZ2jY7LqV+GkR/9dbRufQtb4ZRf+ihG/b01w5O5Q== - dependencies: - axios "^0.21.2" - defender-base-client "1.37.0" - dotenv "^10.0.0" - glob "^7.1.6" - jszip "^3.5.0" - lodash "^4.17.19" - node-fetch "^2.6.0" - -defender-autotask-utils@^1.37.0: - version "1.37.0" - resolved "https://registry.yarnpkg.com/defender-autotask-utils/-/defender-autotask-utils-1.37.0.tgz#9ed39a6e4384c5a99c727e90b6f917fcdc3f8b38" - integrity sha512-fF8U1MGFVDjvdtBXsmeORJp5r8bOvEBquiKCaBb+dHSiNJZQZ3QleWk5Orr5mTl/jj7p4g69tZC5VTUq+rmzsw== - -defender-base-client@1.37.0: +defender-base-client@1.37.0, defender-base-client@^1.37.0: version "1.37.0" resolved "https://registry.yarnpkg.com/defender-base-client/-/defender-base-client-1.37.0.tgz#22f63357ac99c2c8f64eab6e52c99ef113c62d3a" integrity sha512-V6tU0q8/n1/m/edT2FlTvUmZn6u5/A64FqYQfrMgg4PEy1TvYCz9tF+3dnGjk+sJrzICAv0GQWwLw/+8uRq2mg== @@ -3542,11 +3524,6 @@ dom-walk@^0.1.0: resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== -dotenv@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" - integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== - dotenv@^16.0.3: version "16.0.3" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07" @@ -5176,7 +5153,7 @@ glob@^5.0.15: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.1.2, glob@^7.1.3, glob@^7.1.6, glob@~7.2.3: +glob@^7.0.0, glob@^7.1.2, glob@^7.1.3, glob@~7.2.3: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -5634,11 +5611,6 @@ immediate@^3.2.3: resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.3.0.tgz#1aef225517836bcdf7f2a2de2600c79ff0269266" integrity sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q== -immediate@~3.0.5: - version "3.0.6" - resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" - integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ== - immediate@~3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.2.3.tgz#d140fa8f614659bd6541233097ddaac25cdd991c" @@ -6291,16 +6263,6 @@ jsprim@^1.2.2: json-schema "0.4.0" verror "1.10.0" -jszip@^3.5.0: - version "3.10.1" - resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.10.1.tgz#34aee70eb18ea1faec2f589208a157d1feb091c2" - integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g== - dependencies: - lie "~3.3.0" - pako "~1.0.2" - readable-stream "~2.3.6" - setimmediate "^1.0.5" - keccak@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.1.tgz#ae30a0e94dbe43414f741375cff6d64c8bea0bff" @@ -6554,13 +6516,6 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" -lie@~3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a" - integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ== - dependencies: - immediate "~3.0.5" - load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -7536,11 +7491,6 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== -pako@~1.0.2: - version "1.0.11" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" - integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== - parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"