{"id":36573144,"url":"https://github.com/ostdotcom/ost-price-oracle","last_synced_at":"2026-01-12T07:20:20.590Z","repository":{"id":57134384,"uuid":"117841108","full_name":"ostdotcom/ost-price-oracle","owner":"ostdotcom","description":"Price Oracle Contracts and Service Layer to deploy contract and interact with service methods","archived":false,"fork":false,"pushed_at":"2019-11-08T08:00:27.000Z","size":811,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":20,"default_branch":"develop","last_synced_at":"2025-08-15T11:02:34.959Z","etag":null,"topics":["blockchain-platform","ethereum","openst","price-oracle","simpletoken"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ostdotcom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-17T13:38:04.000Z","updated_at":"2023-02-10T08:03:52.000Z","dependencies_parsed_at":"2022-09-04T09:11:37.705Z","dependency_job_id":null,"html_url":"https://github.com/ostdotcom/ost-price-oracle","commit_stats":null,"previous_names":["openstfoundation/ost-price-oracle"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ostdotcom/ost-price-oracle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ostdotcom%2Fost-price-oracle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ostdotcom%2Fost-price-oracle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ostdotcom%2Fost-price-oracle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ostdotcom%2Fost-price-oracle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ostdotcom","download_url":"https://codeload.github.com/ostdotcom/ost-price-oracle/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ostdotcom%2Fost-price-oracle/sbom","scorecard":{"id":114307,"data":{"date":"2025-08-04","repo":{"name":"github.com/ostdotcom/ost-price-oracle","commit":"ca53fd4f4c126bde9bbb4161ac7cf20e55241d06"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":5,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU Lesser General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T23:53:55.184Z","repository_id":57134384,"created_at":"2025-08-15T23:53:55.184Z","updated_at":"2025-08-15T23:53:55.184Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28336499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain-platform","ethereum","openst","price-oracle","simpletoken"],"created_at":"2026-01-12T07:20:20.534Z","updated_at":"2026-01-12T07:20:20.583Z","avatar_url":"https://github.com/ostdotcom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OST Price Oracle\n\n[![Latest version](https://img.shields.io/npm/v/@ostdotcom/ost-price-oracle.svg?maxAge=3600)](https://www.npmjs.com/package/@ostdotcom/ost-price-oracle)\n[![Build Status](https://travis-ci.org/ostdotcom/ost-price-oracle.svg?branch=develop)](https://travis-ci.org/ostdotcom/ost-price-oracle)\n[![Downloads per month](https://img.shields.io/npm/dm/@ostdotcom/ost-price-oracle.svg?maxAge=3600)](https://www.npmjs.com/package/@ostdotcom/ost-price-oracle)\n\n##  Setup\nThis library assumes that nodejs and geth are installed and running. To install ost-price-oracle in your project using npm:\n\n```bash\nnpm install @ostdotcom/ost-price-oracle --save\n```\n\n## Deploying contract and setting addresses in contract.\n\n### Constants\n\nBefore deploying contracts, please set some constants to funded addresses that you control.\n\n```js\n\n// Initialize web3 object using the geth endpoint\nconst Web3 = require('web3');\nconst Tx = require('ethereumjs-tx');\nconst Web3Util = require('web3-utils');\nconst web3Provider = new Web3('http://127.0.0.1:8545');\nconst auxChainId = 2001;\nconst baseCurrency = 'OST';\nconst quoteCurrency = 'USD';\n// Owner address.\nconst ownerAddress = '0xAb_______';\n// Owner private key.\nconst ownerPrivateKey = '00_______';\n// Worker address.\nconst workerAddress = '0xAb_______';\n// Admin address.\nconst adminAddress = '0xAb_______';\n\n```\n\n### Deploy Price Oracle contract\n\n```js\nconst DeployAndSetOpsAndAdminHelper = require('./index').DeployAndSetOpsAndAdminHelper;\nconst deployAndSetOpsAndAdminHelper = new DeployAndSetOpsAndAdminHelper();\n// Prepare txOptions.\nconst txOptions = {\n  gasPrice: '0x0', // Set this value according to your chain gas price.\n  gas: Web3Util.toHex(650000),\n  chainId: Number(auxChainId),\n  value: '0x0',\n  nonce: 0\n};\n// Get raw transaction object.\nconst txObject = deployAndSetOpsAndAdminHelper.deployRawTx(\n  web3Provider,\n  ownerAddress,\n  baseCurrency,\n  quoteCurrency,\n  txOptions\n);\ntxOptions.data = txObject.encodeABI();\nconst privateKeyObj = new Buffer.from(ownerPrivateKey, 'hex'); // Prepare transaction object.\nconst tx = new Tx(txOptions);\ntx.sign(privateKeyObj);\nconst serializedTx = tx.serialize();\nconst signedTransaction = '0x' + serializedTx.toString('hex');\nlet priceOracleContractAddress;\n// Submit transaction on geth.\nconst transactionReceipt = web3Provider.eth.sendSignedTransaction(signedTransaction)\n.then(function(transactionReceipt){\n  console.log(\"Price oracle contract deployed successfully.\");\n  priceOracleContractAddress = transactionReceipt.contractAddress;\n})\n.catch(function(err) {\n  console.log(\"Faced an error while deploying contract. Error: \", err);\n});\n\n```\n\n### Set ops address in price oracle contract.\n\n```js\nconst DeployAndSetOpsAndAdminHelper = require('./index').DeployAndSetOpsAndAdminHelper;\nconst deployAndSetOpsAndAdminHelper = new DeployAndSetOpsAndAdminHelper();\n// Prepare txOptions.\nconst txOptions = {\n  gasPrice: '0x0', // Set this value according to your chain gas price.\n  gas: Web3Util.toHex(60000),\n  chainId: Number(auxChainId),\n  value: '0x0',\n  nonce: 1\n};\n// Get raw transaction object.\nconst txObject = deployAndSetOpsAndAdminHelper.setOpsAddressTx(\n  web3Provider,\n  workerAddress,\n  priceOracleContractAddress,\n  txOptions\n);\ntxOptions['data'] = txObject.encodeABI();\nconst privateKeyObj = new Buffer.from(ownerPrivateKey, 'hex'); // Prepare transaction object.\nconst tx = new Tx(txOptions);\ntx.sign(privateKeyObj);\nconst serializedTx = tx.serialize();\nconst signedTransaction = '0x' + serializedTx.toString('hex');\n// Submit transaction on geth.\nconst transactionReceipt = web3Provider.eth.sendSignedTransaction(signedTransaction)\n.then(console.log(\"Ops address set successfully in the contract.\"))\n.catch(function(err) {\n  console.log(\"Faced an error while setting ops address in contract. Error: \", err);\n});\n\n```\n\n### Set admin address in price oracle contract.\n\n```js\nconst DeployAndSetOpsAndAdminHelper = require('./index').DeployAndSetOpsAndAdminHelper;\nconst deployAndSetOpsAndAdminHelper = new DeployAndSetOpsAndAdminHelper();\n// Prepare txOptions.\nconst txOptions = {\n  gasPrice: '0x0', // Set this value according to your chain gas price.\n  gas: Web3Util.toHex(60000),\n  chainId: Number(auxChainId),\n  value: '0x0',\n  nonce: 2\n};\n// Get raw transaction object.\nconst txObject = deployAndSetOpsAndAdminHelper.setAdminAddressTx(\n  web3Provider,\n  adminAddress,\n  priceOracleContractAddress,\n  txOptions\n);\ntxOptions['data'] = txObject.encodeABI();\nconst privateKeyObj = new Buffer.from(ownerPrivateKey, 'hex'); // Prepare transaction object.\nconst tx = new Tx(txOptions);\ntx.sign(privateKeyObj);\nconst serializedTx = tx.serialize();\nconst signedTransaction = '0x' + serializedTx.toString('hex');\n// Submit transaction on geth.\nconst transactionReceipt = web3Provider.eth.sendSignedTransaction(signedTransaction)\n.then(console.log(\"Ops address set successfully in the contract.\"))\n.catch(function(err) {\n  console.log(\"Faced an error while setting ops address in contract. Error: \", err);\n});\n\n```\n\n## Calling contract methods.\n\n### Constants\n\nBefore calling contract methods, please set some constants.\n\n```js\n\n// Initialize web3 object using the geth endpoint\nconst Web3 = require('web3');\nconst Tx = require('ethereumjs-tx');\nconst Web3Util = require('web3-utils');\nconst web3Provider = new Web3('http://127.0.0.1:8545');\nconst auxChainId = 2001;\nconst baseCurrency = 'OST';\nconst quoteCurrency = 'USD';\n// Worker address.\nconst workerAddress = '0xAb61FEa23744DA08A711B5B53c272ef19_______';\n// Worker private key.\nconst workerPrivateKey = '008d022f7980d780d8b07a251a4ec580db77ec8f44878a8ebacb0d8f9_______';\n// Price oracle contract address.\nconst priceOracleContractAddress = '0xAb61FEa23744DA08A711B5B53c272ef19_______';\n\n```\n\n### Set price in contract.\n\n```js\nconst PriceOracleHelper = require('./index').PriceOracleHelper;\nconst priceInWei = '27596633800000000';\nconst gasPrice = '0x0'; // Set this value according to your chain gas price.\n// Get transaction object.\nconst txResponse = new PriceOracleHelper(web3Provider).setPriceTx(\n  web3Provider,\n  baseCurrency,\n  quoteCurrency,\n  priceOracleContractAddress,\n  priceInWei,\n  gasPrice\n);\n// Prepare params for transaction.\nconst encodedABI = txResponse.encodedABI;\nconst txParams = {\n    from: workerAddress,\n    to: priceOracleContractAddress,\n    value: '0x0',\n    data: encodedABI,\n    gas: Web3Util.toHex(80000),\n    gasPrice: gasPrice,\n    chainId: Number(auxChainId),\n    nonce: 0\n  };\n// Prepare transaction object.\nconst privateKeyObj = new Buffer.from(workerPrivateKey, 'hex');\nconst tx = new Tx(txParams);\ntx.sign(privateKeyObj);\nconst serializedTx = tx.serialize();\nconst signedTransaction = '0x' + serializedTx.toString('hex');\n// Submit transaction on geth.\nweb3Provider.eth.sendSignedTransaction(signedTransaction)\n.then(console.log(\"Price set successfully in contract.\"))\n.catch(function(err) {\n  console.log(\"Price was not set in contract. Error: \", err);\n})\n```\n\n### Get price from contract.\n\n```js\nnew PriceOracleHelper(web3Provider).getPrice(web3Provider, priceOracleContractAddress)\n.then(function(price) {\n  console.log(\"Price fetched from contract is: \", price);\n})\n.catch(function(err) {\n  console.log(\"Could not fetch price from contract. Error: \", err);\n})\n```\n\n### Get quote currency from contract.\n\n```js\nnew PriceOracleHelper(web3Provider).getQuoteCurrency(web3Provider, priceOracleContractAddress)\n.then(function(quoteCurrency) {\n  console.log(\"Quote currency fetched from contract is: \", quoteCurrency);\n})\n.catch(function(err) {\n  console.log(\"Could not fetch quote currency from contract. Error: \", err);\n})\n```\n\n### Get base currency from contract.\n\n```js\nnew PriceOracleHelper(web3Provider).getBaseCurrency(web3Provider, priceOracleContractAddress)\n.then(function(baseCurrency) {\n  console.log(\"Base currency fetched from contract is: \", baseCurrency);\n})\n.catch(function(err) {\n  console.log(\"Could not fetch base currency from contract. Error: \", err);\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fostdotcom%2Fost-price-oracle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fostdotcom%2Fost-price-oracle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fostdotcom%2Fost-price-oracle/lists"}