Skip to content

fixes #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open

fixes #156

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e8d47fa
Add .deepsource.toml
deepsourcebot Mar 24, 2022
2fa56e7
Create SECURITY.md
philipjonsen Mar 24, 2022
9020dc1
Bump tmpl from 1.0.4 to 1.0.5 in /sdk/javascript
dependabot[bot] Mar 24, 2022
12817d3
Bump simple-get from 2.8.1 to 2.8.2 in /sdk/javascript
dependabot[bot] Mar 24, 2022
91931cb
Bump node-fetch from 2.6.0 to 2.6.7 in /sdk/javascript
dependabot[bot] Mar 24, 2022
19c9256
Bump lodash from 4.17.15 to 4.17.21 in /sdk/javascript
dependabot[bot] Mar 24, 2022
a386b3d
Bump tar from 4.4.13 to 4.4.19 in /sdk/javascript
dependabot[bot] Mar 24, 2022
f9ff131
Merge pull request #4 from cryptosweden/dependabot/npm_and_yarn/sdk/j…
philipjonsen Mar 24, 2022
6dc892a
Bump path-parse from 1.0.6 to 1.0.7 in /sdk/javascript
dependabot[bot] Mar 24, 2022
052d7f4
Merge pull request #3 from cryptosweden/dependabot/npm_and_yarn/sdk/j…
philipjonsen Mar 24, 2022
0fb5f39
Merge pull request #6 from cryptosweden/dependabot/npm_and_yarn/sdk/j…
philipjonsen Mar 24, 2022
6b09ad5
Bump normalize-url from 4.5.0 to 4.5.1 in /sdk/javascript
dependabot[bot] Mar 24, 2022
2cab7eb
Bump hosted-git-info from 2.8.5 to 2.8.9 in /sdk/javascript
dependabot[bot] Mar 24, 2022
8225c9f
Bump handlebars from 4.5.3 to 4.7.7 in /sdk/javascript
dependabot[bot] Mar 24, 2022
ad72576
Bump ajv from 6.10.2 to 6.12.6 in /sdk/javascript
dependabot[bot] Mar 24, 2022
ee5f8fe
Create codeql-analysis.yml
philipjonsen Mar 24, 2022
7ba2b11
Merge pull request #11 from cryptosweden/dependabot/npm_and_yarn/sdk/…
philipjonsen Mar 24, 2022
49ec73d
Merge pull request #10 from cryptosweden/dependabot/npm_and_yarn/sdk/…
philipjonsen Mar 24, 2022
e74e539
Merge pull request #9 from cryptosweden/dependabot/npm_and_yarn/sdk/j…
philipjonsen Mar 24, 2022
786a0cf
Merge pull request #8 from cryptosweden/dependabot/npm_and_yarn/sdk/j…
philipjonsen Mar 24, 2022
866428d
Merge pull request #2 from cryptosweden/dependabot/npm_and_yarn/sdk/j…
philipjonsen Mar 24, 2022
8e52061
Merge pull request #7 from cryptosweden/dependabot/npm_and_yarn/sdk/j…
philipjonsen Mar 24, 2022
49f169a
Fix explicit type declarations
deepsource-autofix[bot] Mar 24, 2022
c08e7df
Merge pull request #12 from cryptosweden/deepsource-fix-b843e89a
philipjonsen Mar 24, 2022
794d669
Merge pull request #5 from cryptosweden/dependabot/npm_and_yarn/sdk/j…
philipjonsen Mar 24, 2022
61e0547
Bump y18n from 4.0.0 to 4.0.3 in /sdk/javascript
dependabot[bot] Mar 24, 2022
c4960a0
Bump ini from 1.3.5 to 1.3.8 in /sdk/javascript
dependabot[bot] Mar 24, 2022
1497aaf
Merge pull request #15 from cryptosweden/dependabot/npm_and_yarn/sdk/…
philipjonsen Mar 24, 2022
3438fa7
Bump decompress from 4.2.0 to 4.2.1 in /sdk/javascript
dependabot[bot] Mar 24, 2022
821ccb5
Merge pull request #16 from cryptosweden/dependabot/npm_and_yarn/sdk/…
philipjonsen Mar 24, 2022
99a02f2
Merge pull request #14 from cryptosweden/dependabot/npm_and_yarn/sdk/…
philipjonsen Mar 24, 2022
253a1f2
Replace `if-else` with ternary operator
deepsource-autofix[bot] Mar 25, 2022
1432764
Removes the console expressions
deepsource-autofix[bot] Mar 25, 2022
56a748c
Merge pull request #18 from cryptosweden/deepsource-fix-95b86e23
philipjonsen Mar 25, 2022
44bfbee
Replace `if-else` with ternary operator
deepsource-autofix[bot] Mar 25, 2022
860e08d
Merge pull request #19 from cryptosweden/deepsource-fix-9ecc701e
philipjonsen Mar 25, 2022
6c7bb96
Bump tar from 4.4.13 to 4.4.19 in /poster
dependabot[bot] Mar 25, 2022
c080920
Bump minimist from 1.2.5 to 1.2.6 in /poster
dependabot[bot] Mar 27, 2022
85ec42a
Merge pull request #21 from cryptosweden/dependabot/npm_and_yarn/post…
philipjonsen Mar 27, 2022
69fc6d9
Merge pull request #20 from cryptosweden/dependabot/npm_and_yarn/post…
philipjonsen Mar 27, 2022
7b5fa71
Merge pull request #17 from cryptosweden/deepsource-fix-08ebbea0
philipjonsen Mar 27, 2022
53e959e
Bump minimist from 1.2.5 to 1.2.6
dependabot[bot] Apr 19, 2022
04df838
Merge pull request #22 from cryptosweden/dependabot/npm_and_yarn/mini…
philipjonsen Jun 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version = 1

[[analyzers]]
name = "terraform"
enabled = true

[[analyzers]]
name = "secrets"
enabled = true

[[analyzers]]
name = "ruby"
enabled = true

[[analyzers]]
name = "javascript"
enabled = true

[[analyzers]]
name = "docker"
enabled = true

[[analyzers]]
name = "sql"
enabled = true

[[analyzers]]
name = "scala"
enabled = true

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"

[[analyzers]]
name = "java"
enabled = true

[analyzers.meta]
runtime_version = "11"

[[analyzers]]
name = "csharp"
enabled = true

[[analyzers]]
name = "test-coverage"
enabled = true

[[analyzers]]
name = "shell"
enabled = true

[[analyzers]]
name = "rust"
enabled = true

[analyzers.meta]
msrv = "1.30.0"

[[analyzers]]
name = "php"
enabled = true

[[analyzers]]
name = "go"
enabled = true

[analyzers.meta]
import_root = "github.com/cryptosweden/open-oracle"

[[analyzers]]
name = "ansible"
enabled = true
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '35 16 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
68 changes: 68 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.

package.json
{
"name": "compound-open-oracle",
"version": "1.1.0",
"description": "The Compound Open Oracle",
"main": "index.js",
"repository": "https://github.com/compound-finance/open-oracle",
"author": "Compound Labs, Inc.",
{
"name": "compound-open-oracle",
"version": "1.1.0",
"description": "The Compound Open Oracle",
"main": "index.js",
"repository": "https://github.com/compound-finance/open-oracle",
"author": "Compound Labs, Inc.",
"license": "MIT",
"dependencies": {
"bignumber.js": "^9.0.0",
"eth-saddle": "^0.1.17",
"eth-saddle": "0.1.19",
"web3": "^1.2.4",
"yargs": "^15.0.2"
},
"devDependencies": {
"docker-compose": "^0.23.1",
"istanbul": "^0.4.5",
"jest": "^24.9.0",
"jest-cli": "^24.9.0",
"jest-junit": "^10.0.0"
},
"scripts": {
"test": "npx saddle test",
"test": "script/test",
"coverage": "script/coverage",
"console": "npx -n --experimental-repl-await saddle console",
"compile": "npx saddle compile",
"deploy": "npx saddle deploy"
},
"resolutions": {
"**/ganache-core": "https://github.com/compound-finance/ganache-core.git#compound",
"scrypt.js": "https://registry.npmjs.org/@compound-finance/ethereumjs-wallet/-/ethereumjs-wallet-0.6.3.tgz"
"scrypt.js": "https://registry.npmjs.org/@compound-finance/ethereumjs-wallet/-/ethereumjs-wallet-0.6.3.tgz",
"**/sha3": "^2.1.2"
}
}![package](https://user-images.githubusercontent.com/87861683/159913264-a71e87d2-60a5-41be-977d-62c3244d9be3.jpg)

12 changes: 6 additions & 6 deletions poster/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ async function run() {
}
});

console.log(`Posting with price deltas = `, price_deltas);


// parameters only for testnets that mock uniswap mainnet
const mocked_world = parsed['testnet-world'];
const testnet_pairs = JSON.parse(parsed['testnet-uniswap-pairs'] || '{}');
const mainnet_pairs = JSON.parse(parsed['mainnet-uniswap-pairs'] || '{}');
console.log(`Configuring using testnet and mainnet uniswap pairs:`, testnet_pairs, mainnet_pairs);

const pairs = {testnet: {}, mainnet: {}};
if (mocked_world) {
assets.forEach(asset => {
Expand Down Expand Up @@ -90,10 +90,10 @@ async function run() {
}

run().catch((e) => {
console.error(`Error encountered: ${e}`);
console.error(e);
console.log(e.stack)
console.log





let error_log = {
message: "Price run failed",
Expand Down
2 changes: 1 addition & 1 deletion poster/src/mainnet_uniswap_mocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async function mockUniswapTokenPair(symbol: string, senderKey: string, pairs, ga
const cumulativePrice0 = cumulatives[0];
const cumulativePrice1 = cumulatives[1];

console.log(`Mocking uniswap token pair for ${symbol} with results--> ${reserve0} ${reserve1} ${blockTimestampLast} ${cumulativePrice0} ${cumulativePrice1}`);


const functionSig = "update(uint112,uint112,uint32,uint256,uint256)";
const trxData = buildTrxData(reserve0, reserve1, blockTimestampLast, cumulativePrice0, cumulativePrice1, functionSig);
Expand Down
6 changes: 3 additions & 3 deletions poster/src/post_with_retries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ const RETRIES = 3;
const GAS_PRICE_ADJUSTMENT = 1.2; // Increase gas price by this percentage each retry
const GAS_ADJUSTMENT = 1.5; // Increase gas limit by this percentage each retry

async function postWithRetries(transaction: TransactionConfig, signerKey: string, web3: Web3, retries: number = RETRIES, attempt: number = 0) {
console.log(`Running Open Price Feed Poster${attempt > 0 ? ` [attempt ${attempt}]` : ''}...`);
async function postWithRetries(transaction: TransactionConfig, signerKey: string, web3: Web3, retries: number = RETRIES, attempt = 0) {


signerKey = ensureHex(signerKey, 'private key');

let pubKey = web3.eth.accounts.privateKeyToAccount(signerKey)

console.log(`Posting from account: ${pubKey.address}`);


let nonce = await web3.eth.getTransactionCount(pubKey.address)
transaction.nonce = nonce
Expand Down
6 changes: 3 additions & 3 deletions poster/src/poster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export async function main(
gas: gastEstimateAdjusted
};

console.log(`Posting...`);
console.log(feedItems);



return await postWithRetries(trx, senderKey, web3);
}
Expand Down Expand Up @@ -110,7 +110,7 @@ export async function filterPayloads(

feedItems
.forEach(({source, symbol, price, prev}) => {
console.log(`Setting Price: source=${source}, symbol=${symbol}, price=${price}, prev_price=${prev}`);

});

return feedItems;
Expand Down
Loading