Skip to content

Commit

Permalink
added new channels
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham committed Mar 6, 2024
1 parent 24500a6 commit e5302df
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 480 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"homepage": "https://github.com/ethereum-push-notification-system/epns-push-register-service#readme",
"dependencies": {
"@apollo/client": "^3.6.9",
"@arbitrum/sdk": "^1.1.0",
"@aragon/sdk-client": "^1.19.0",
"@aragon/sdk-client-common": "^1.5.0-rc0",
"@arbitrum/sdk": "^1.1.0",
"@gnosis.pm/safe-service-client": "^1.4.0",
"@google-cloud/bigquery": "^6.2.0",
"@improbable-eng/grpc-web": "^0.15.0",
Expand All @@ -49,7 +49,7 @@
"@injectivelabs/ts-types": "^0.5.0",
"@makerdao/dai": "^0.42.4",
"@makerdao/dai-plugin-mcd": "^1.8.5",
"@pushprotocol/restapi": "^1.4.36",
"@pushprotocol/restapi": "^1.6.10",
"@rodrigogs/mysql-events": "0.6.0",
"@safe-global/safe-ethers-lib": "^1.8.0",
"@uniswap/v3-sdk": "^3.3.2",
Expand Down
3 changes: 3 additions & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ let config = {
web3MainnetNetwork: process.env.MAINNET_RPC_OVERRIDE || staticConfig.MAINNET_WEB3_NETWORK,
web3MainnetSocket: staticConfig.MAINNET_WEB3_SOCKET,

web3TestnetSepoliaProvider:process.env.SEPOLIA_QUICKNODE_RPC,
web3TestnetSepoliaNetwork: 'SEPOLIA',

web3PolygonMainnetProvider: `https://polygon-mainnet.infura.io/v3/${process.env.INFURA_PROJECT_ID}`,
web3PolygonMainnetRPC: staticConfig.POLYGON_MAINNET_RPC,

Expand Down
11 changes: 5 additions & 6 deletions src/sample_showrunners/btcTicker/btcTickerChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ethers } from 'ethers';
import { btcTickerUserModel, btcTickerGlobalModel } from './btcTickerModel';
import axios from 'axios';

const NETWORK_TO_MONITOR = config.web3MainnetNetwork;
const NETWORK_TO_MONITOR = config.web3TestnetSepoliaNetwork;

@Service()
export default class BtcTickerChannel extends EPNSChannel {
Expand Down Expand Up @@ -106,10 +106,10 @@ export default class BtcTickerChannel extends EPNSChannel {
// --------------------------------------------------------------------------------------------- */

// Initializing userAlice
const provider = new ethers.providers.JsonRpcProvider( config.web3MainnetProvider || settings.providerUrl);
const provider = new ethers.providers.JsonRpcProvider( config.web3TestnetSepoliaProvider || settings.providerUrl);

const signer = new ethers.Wallet(keys.PRIVATE_KEY_NEW_STANDARD.PK, provider);
const userAlice = await PushAPI.initialize(signer, { env: CONSTANTS.ENV.PROD });
const userAlice = await PushAPI.initialize(signer, { env: CONSTANTS.ENV.STAGING });

let i = 1;

Expand Down Expand Up @@ -148,8 +148,7 @@ export default class BtcTickerChannel extends EPNSChannel {
// this.logInfo(`⚡⚡⚡Setting ${JSON.stringify(userSettings)} (${subscriberObj.subscriber})`);

// Fetch users last btc price & last cycle values
const userDBValue =
(await btcTickerUserModel.findOne({ _id: subscriberObj.subscriber })) ||
const userDBValue = (await btcTickerUserModel.findOne({ _id: subscriberObj.subscriber })) ||
(await btcTickerUserModel.create({
_id: subscriberObj.subscriber,
lastCycle: btcTrackerGlobalData.cycles,
Expand All @@ -164,7 +163,7 @@ export default class BtcTickerChannel extends EPNSChannel {


// this.logInfo(`🔽Previous BTC price of ${subscriberObj.subscriber}: ` + Number(userDBValue.lastBtcPrice));
// this.logInfo(`Change Price ${subscriberObj.subscriber} :` + changePercentage);
this.logInfo(`Change Price ${subscriberObj.subscriber} :` + changePercentage);

// ----------------------------------------------------

Expand Down
7 changes: 0 additions & 7 deletions src/sample_showrunners/btcTicker/btcTickerJobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@
// Execute a cron job every 5 Minutes = */5 * * * *
// Starts from seconds = * * * * * *

import config from '../../config';
import logger from '../../loaders/logger';

// Import the Push SDK
import { PushAPI } from "@pushprotocol/restapi";

import { ethers } from "ethers";

import { Container } from 'typedi';
import schedule from 'node-schedule';

Expand Down
7 changes: 7 additions & 0 deletions src/sample_showrunners/btcTicker/btcTickerKeys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"PRIVATE_KEY_NEW_STANDARD": {
"PK": "0xyour channel's PK goes here",
"CHAIN_ID": "eip115:chainId (11155111 for sepolia)"
},
"PRIVATE_KEY_OLD_STANDARD": "0xyour channel's PK goes here"
}
4 changes: 2 additions & 2 deletions src/sample_showrunners/btcTicker/btcTickerSettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"cmcEndpoint": "https://pro-api.coinmarketcap.com/",
"providerUrl":"https://rpc.ankr.com/eth",
"providerUrl":"https://sepolia.gateway.tenderly.co",
"route":"v1/cryptocurrency/quotes/latest",
"cmcKey":"Key"
"cmcKey":"coin marketcap api key"
}

Loading

0 comments on commit e5302df

Please sign in to comment.