Skip to content

Commit

Permalink
Merge pull request #42 from push-protocol/showrunners-update
Browse files Browse the repository at this point in the history
  • Loading branch information
pranshurastogi authored Aug 28, 2024
2 parents 9050594 + 1cad246 commit faedf2b
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 63 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@
},
"homepage": "https://github.com/ethereum-push-notification-system/epns-push-register-service#readme",
"dependencies": {
"@lens-protocol/client": "^2.2.0",
"@apollo/client": "^3.6.9",
"@aragon/sdk-client": "^1.19.0",
"@aragon/sdk-client-common": "^1.5.0-rc0",
"@arbitrum/sdk": "^1.1.0",
"@covalenthq/client-sdk": "^1.0.1",
"@gnosis.pm/safe-service-client": "^1.4.0",
"@google-cloud/bigquery": "^6.2.0",
"@improbable-eng/grpc-web": "^0.15.0",
Expand All @@ -49,9 +51,10 @@
"@injectivelabs/ts-types": "^0.5.0",
"@makerdao/dai": "^0.42.4",
"@makerdao/dai-plugin-mcd": "^1.8.5",
"@pushprotocol/restapi": "^1.6.10",
"@pushprotocol/restapi": "^1.7.25",
"@rodrigogs/mysql-events": "0.6.0",
"@safe-global/safe-ethers-lib": "^1.8.0",
"@safe-global/protocol-kit": "1.3.0",
"@uniswap/v3-sdk": "^3.3.2",
"agenda": "^2.0.2",
"agendash": "^1.0.0",
Expand Down Expand Up @@ -96,6 +99,7 @@
"mysql": "2.18.1",
"nano-ipfs-store": "0.1.3",
"node-schedule": "1.3.2",
"numeral": "^2.0.6",
"p-limit": "^4.0.0",
"p-queue": "^6.5.0",
"parse-url": "^6.0.5",
Expand Down
14 changes: 6 additions & 8 deletions src/config/channelsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import LoggerInstance from '../loaders/logger';
const utils = require('../helpers/utilsHelper');

// Loads wallets using the private keys present in each folder
// Scans for channelNameKeys.json file in the channel directory
// Scans for channelNameKeys.ts file in the channel directory
// Loads the private key and add the keys to channlKeys
const channelWallets = function loadShowrunnersWallets() {
LoggerInstance.info(` -- Checking and Loading Dynamic Channel Keys...`);
Expand All @@ -22,16 +22,14 @@ const channelWallets = function loadShowrunnersWallets() {
}

for (const channel of directories) {
const absPath = `${channelFolderPath}${channel}/${channel}Keys.json`;
const relativePath = `../showrunners/${channel}/${channel}Keys.json`;

const absPath = `${channelFolderPath}${channel}/${channel}Keys.ts`;
if (fs.existsSync(absPath)) {
const object = require(absPath);
let count = 1;

channelKeys[`${channel}`] = {};

for (const [key, value] of Object.entries(object)) {
for (const [key, value] of Object.entries(object.keys)) {
// check and decide old standard or not
const isOldStandard = typeof value === 'string' || value instanceof String ? true : false;
const newValue: any = value;
Expand All @@ -51,13 +49,13 @@ const channelWallets = function loadShowrunnersWallets() {
LoggerInstance.info(` ✔️ ${channel} Loaded ${Object.keys(channelKeys[`${channel}`]).length} Wallet(s)!`);
} else {
LoggerInstance.info(
` ❌ ${channel} has no wallets attached to them... aborting! Check ${channel}Keys.json!!!`,
` ❌ ${channel} has no wallets attached to them... aborting! Check ${channel}Keys.ts!!!`,
);
process.exit(1);
}
} else {
LoggerInstance.info(
` ❌ ${channel}Keys.json does not exists. aborting! Create ${channel}Keys.json and add one wallet to it!!!`,
` ❌ ${channel}Keys.ts does not exists. aborting! Create ${channel}Keys.ts and add one wallet to it!!!`,
);
process.exit(1);
}
Expand All @@ -66,4 +64,4 @@ const channelWallets = function loadShowrunnersWallets() {
return channelKeys;
};

export default channelWallets;
export default channelWallets;
3 changes: 2 additions & 1 deletion src/sample_showrunners/aave/aaveChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import { Service, Inject } from 'typedi';
import config, { defaultSdkSettings, settings } from '../../config';
import { ethers } from 'ethers';
import aaveSettings from './aaveSettings.json';
import {aaveSettings} from './aaveSettings';
import {keys} from './aaveKeys';
import aaveLendingPoolDeployedContractABI from './aave_LendingPool.json';
import { EPNSChannel } from '../../helpers/epnschannel';
import { Logger } from 'winston';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const keys = {
"PRIVATE_KEY_NEW_STANDARD": {
"PK": "YOUR_CHANNEL_PRIVATE_KEY_HERE",
"CHAIN_ID": "CHAIN_ID_HERE | SUPPORTED VALUES = eip155:1 or eip155:42 for Ethereum | eip155:137 or eip155:80001 for Polygon"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const aaveSettings = {
"aaveLendingPoolDeployedContractPolygonMainnet": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf",
"aaveLendingPoolDeployedContractPolygonMumbai": "0x9198F13B08E299d85E096929fA9781A1E3d5d827",
"aaveLendingPoolDeployedContractMainnet": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
Expand Down
32 changes: 1 addition & 31 deletions src/sample_showrunners/bank/bankChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { PushAPI } from "@pushprotocol/restapi";

import { ethers } from "ethers";
import bank from "./bank.json";
import {keys} from "./bankKeys";

import 'dotenv/config'
require('dotenv').config()
Expand All @@ -30,30 +31,11 @@ export default class BankChannel extends EPNSChannel {
});
}

/*
event Apy(uint256 apy);
event Investments(uint256 investment);
event HolidayStatus(bool holiday);
Category 1 --> Boolean
This notification use-case considers a scenario where the users get notification about Bank holidays.
Category 2, 3 --> Slider
This notification use-case send notification to users who are interested in investments and APY.
*/

async startEventListener(simulate) {
this.logInfo("EventListener function started!")

const { contract, userAlice } = await this.initializeUser();

// contract.on("Apy", async (apy, event) => {
// // call functions in channel
// this.logInfo("Calling ---> apyNotif()");

// this.apyNotif(userAlice, apy, simulate);
// })

contract.on("Investments", async (investment, event) => {
// call functions in channel
this.logInfo("Calling ---> investmentNotif()");
Expand All @@ -69,18 +51,6 @@ export default class BankChannel extends EPNSChannel {
})

}

// async apyNotif(userAlice, apy, simulate) {
// try {
// this.logInfo("Getting events ---> apyNotif");

//

// }catch (error) {
// this.logInfo("Error caused in the getInitiated function", error);
// }
// }


// This function is triggered with slider settings
async investmentNotif(userAlice, investment, simulate) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const keys = {
"PRIVATE_KEY_NEW_STANDARD": {
"PK": "YOUR_CHANNEL_PRIVATE_KEY_HERE",
"CHAIN_ID": "CHAIN_ID_HERE | SUPPORTED VALUES = eip155:1 or eip155:42 for Ethereum | eip155:137 or eip155:80001 for Polygon"
Expand Down
4 changes: 2 additions & 2 deletions src/sample_showrunners/btcTicker/btcTickerChannel.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

import { Service, Inject } from 'typedi';
import config from '../../config';
import settings from './btcTickerSettings.json';
import {settings} from './btcTickerSettings';
import { EPNSChannel } from '../../helpers/epnschannel';
import { Logger } from 'winston';
import keys from './btcTickerKeys.json';
import {keys} from './btcTickerKeys';
import { PushAPI, CONSTANTS } from '@pushprotocol/restapi';
import { ethers } from 'ethers';
import { btcTickerUserModel, btcTickerGlobalModel } from './btcTickerModel';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const keys = {
"PRIVATE_KEY_NEW_STANDARD": {
"PK": "0xyour channel's PK goes here",
"CHAIN_ID": "eip115:chainId (11155111 for sepolia)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const settings = {
"cmcEndpoint": "https://pro-api.coinmarketcap.com/",
"providerUrl":"https://sepolia.gateway.tenderly.co",
"route":"v1/cryptocurrency/quotes/latest",
Expand Down
2 changes: 1 addition & 1 deletion src/sample_showrunners/digible/digibleChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { EPNSChannel, ISendNotificationParams } from '../../helpers/epnschannel'
import { ethers } from 'ethers';
import digiTradeABI from './digiTradeAbi.json';
import digiTrackABI from './digiTrackabi.json';
import digibleSettings from './digibleSettings.json';
import {digibleSettings} from './digibleSettings';
import { digibleModel } from './digibleModel';
import ERC20ABI from './ERC20.json';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const keys = {
"PRIVATE_KEY_NEW_STANDARD": {
"PK": "YOUR_CHANNEL_PRIVATE_KEY_HERE",
"CHAIN_ID": "CHAIN_ID_HERE | SUPPORTED VALUES = eip155:1 or eip155:42 for Ethereum | eip155:137 or eip155:80001 for Polygon"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const digibleSettings = {
"digiTrackContractAddressMainnet": "0x4168a4D108b24A347F19617BB95C25c8Eb9618de",
"digiTrackContractAddressTestnet": "0x4168a4D108b24A347F19617BB95C25c8Eb9618de",
"digiTradeContractAddressMainnet": "0x915338948fBF10583DD15C6FcCCF55565FF5b60f",
Expand Down
2 changes: 1 addition & 1 deletion src/sample_showrunners/ens/ensChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import config, { defaultSdkSettings, settings } from '../../config';
import { EPNSChannel } from '../../helpers/epnschannel';
import { Logger } from 'winston';
import { request, gql } from 'graphql-request';
import ensSettings from './ensSettings.json';
import {ensSettings} from './ensSettings';
const NETWORK_TO_MONITOR = config.web3MainnetNetwork;
const TRIGGER_THRESHOLD_SECS = 60 * 60 * 24 * 7; // 7 Days

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const keys = {
"PRIVATE_KEY_NEW_STANDARD": {
"PK": "YOUR_CHANNEL_PRIVATE_KEY_HERE",
"CHAIN_ID": "CHAIN_ID_HERE | SUPPORTED VALUES = eip155:1 or eip155:42 for Ethereum | eip155:137 or eip155:80001 for Polygon"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const ensSettings = {
"ensDeployedContract": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
"ensEndpoint": "https://api.thegraph.com/subgraphs/name/ensdomains/ens"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const keys = {
"PRIVATE_KEY_NEW_STANDARD": {
"PK": "YOUR_CHANNEL_PRIVATE_KEY_HERE",
"CHAIN_ID": "CHAIN_ID_HERE | SUPPORTED VALUES = eip155:1 or eip155:42 for Ethereum | eip155:137 or eip155:80001 for Polygon"
Expand Down
4 changes: 2 additions & 2 deletions src/sample_showrunners/priceTracker/priceTrackerChannel.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Inject, Service } from 'typedi';
import { Logger } from 'winston';
import config from '../../config';
import settings from './priceTrackerSettings.json';
import {settings} from './priceTrackerSettings';
import { EPNSChannel } from '../../helpers/epnschannel';
import keys from './priceTrackerKeys.json';
import {keys} from './priceTrackerKeys';
import { PushAPI, CONSTANTS } from '@pushprotocol/restapi';
import { ethers } from 'ethers';
import axios from 'axios';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export const keys = {
"PRIVATE_KEY_NEW_STANDARD": {
"PK": "0x{Privatekey}",
"CHAIN_ID": "eip115:11155111 (for sepolia)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
export const settings = {
"cmcEndpoint": "https://pro-api.coinmarketcap.com/",
"providerUrl":"https://ethereum-sepolia.publicnode.com",
"route":"v2/cryptocurrency/quotes/latest",
"cmcKey":"4fd478f1-5d64-4666-bd4d-c9d1489a6c5e",
"cmcKey":"CMC_API_KEY",
"id":"1,1027,1839,5426,2010,5805,1975,6636,3890,9111",
"tokenNames":["BTC","ETH","BNB","SOL","ADA","AVAX","LINK","DOT","MATIC","PUSH"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Inject, Service } from 'typedi';
import config, { defaultSdkSettings } from '../../config';

import { request, gql } from 'graphql-request';
import proofOfHumanitySettings from './proofOfHumanitySettings.json';
import {proofOfHumanitySettings} from './proofOfHumanitySettings';
import proofOfHumanityABI from './proofOfHumanity.json';

import { Contract } from '@ethersproject/contracts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
export const keys = {
"PRIVATE_KEY": "YOUR_CHANNEL_PRIVATE_KEY_HERE"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
export const proofOfHumanitySettings = {
"proofOfHumanityDeployedContract":"0xc5e9ddebb09cd64dfacab4011a0d5cedaf7c9bdb"
}

0 comments on commit faedf2b

Please sign in to comment.