Skip to content
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

chore(api): remove routed information from configuration file #409

Merged
merged 4 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
56 changes: 0 additions & 56 deletions packages/api/src/dataFeedsRouter.json
Original file line number Diff line number Diff line change
Expand Up @@ -1351,21 +1351,12 @@
"maxSecsBetweenUpdates": 86400,
"minSecsBetweenUpdates": 900
},
"Price-BAT/USD-6": {
"isRouted": true
},
"Price-BCH/USD-6": {
"deviationPercentage": 1.0
},
"Price-BNB/USD-6": {
"isRouted": true
},
"Price-BORING/USDT-6": {
"deviationPercentage": 0.5
},
"Price-BUSD/USD-6": {
"isRouted": true
},
"Price-CELO/EUR-6": {
"deviationPercentage": 1.0
},
Expand All @@ -1383,9 +1374,6 @@
"Price-CRO/USDT-6": {
"deviationPercentage": 3.5
},
"Price-CUBE/USD-6": {
"isRouted": true
},
"Price-CUBE/USDT-6": {
"deviationPercentage": 3.5
},
Expand All @@ -1398,38 +1386,18 @@
"Price-DOT/USD-6": {
"deviationPercentage": 3.5
},
"Price-ELA/USD-6": {
"isRouted": true
},
"Price-ELA/USDT-6": {
"deviationPercentage": 3.5
},
"Price-ELON/USD-9": {
"isRouted": true
},
"Price-FRAX/USDT-6": {
"deviationPercentage": 0.25
},
"Price-GLINT/USD-6": {
"isRouted": true,
"maxSecsBetweenUpdates": 86400,
"minSecsBetweenUpdates": 900
},
"Price-GLINT/USDC-6": {
"deviationPercentage": 1.0
},
"Price-GLMR/USD-6": {
"isRouted": true
},
"Price-GLMR/USDT-6": {
"deviationPercentage": 1.0
},
"Price-HT/USD-6": {
"isRouted": true
},
"Price-KAVA/USD-6": {
"isRouted": true
},
"Price-KAVA/USDT-6": {
"deviationPercentage": 0.5
},
Expand All @@ -1438,51 +1406,27 @@
"maxSecsBetweenUpdates": 3600,
"minSecsBetweenUpdates": 3600
},
"Price-KLAY/USD-6": {
"isRouted": true
},
"Price-KSP/USD-6": {
"isRouted": true
},
"Price-METIS/USD-6": {
"isRouted": true
},
"Price-MJT/KCS-9": {
"deviationPercentage": 0.5
},
"Price-MOVR/USDT-6": {
"deviationPercentage": 1.0
},
"Price-MTRG/USD-6": {
"isRouted": true
},
"Price-NCT/USD-6": {
"isRouted": true
},
"Price-OKT/USDT-6": {
"deviationPercentage": 0.5
},
"Price-OP/USDT-6": {
"deviationPercentage": 1.0
},
"Price-QUICK/USD-6": {
"isRouted": true
},
"Price-SAX/USDT-6": {
"deviationPercentage": 0.5
},
"Price-STELLA/USD-6": {
"isRouted": true
},
"Price-STELLA/USDT-6": {
"deviationPercentage": 1.0
},
"Price-SYS/USDT-6": {
"deviationPercentage": 1.0
},
"Price-TUSD/USD-6": {
"isRouted": true
},
"Price-TUSD/USDT-6": {
"deviationPercentage": 0.25
},
Expand Down
4 changes: 1 addition & 3 deletions packages/api/src/web3Middleware/NetworkRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ export class NetworkRouter {
setInterval(async () => {
const snapshot = await this.getSnapshot()
const insertPromises = snapshot.feeds
.filter((feed) => {
return feed.status === ResultStatus.Ready
})
.filter((feed) => feed.timestamp !== '0')
.map((feed) => ({
feedFullName: createFeedFullName(
this.network,
Expand Down
8 changes: 6 additions & 2 deletions packages/api/src/web3Middleware/PriceFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ export class PriceFeed {
if (!feedConfiguration || Object.keys(feedConfiguration).length === 0) {
throw new Error(`${feed.caption} not found in configuration file`)
}

const isRouted: boolean = feed.solver.endsWith('000000000000000000000000')
const isRouted: boolean = this.isRouted(feed.solver)

if (isRouted) {
feedConfiguration.maxSecsBetweenUpdates = 0
Expand Down Expand Up @@ -123,4 +122,9 @@ export class PriceFeed {
chain,
})
}

static isRouted(solver: string): boolean {
// ends in 24 0s
return solver.endsWith('000000000000000000000000')
}
}
1 change: 1 addition & 0 deletions packages/ui/api/queries/feeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default gql`
query feeds($network: String!) {
feeds(network: $network) {
feeds {
isRouted
feedFullName
name
address
Expand Down
5 changes: 4 additions & 1 deletion packages/ui/components/DataFeedDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
/>
<client-only>
<FieldsetCard
v-if="maxTimeToResolve || normalizedFeed.deviation"
v-if="
!normalizedFeed.isRouted &&
(maxTimeToResolve || normalizedFeed.deviation)
"
:title="$t('data_feed_details.trigger_parameters')"
>
<DataFeedTriggerParams
Expand Down
8 changes: 5 additions & 3 deletions packages/ui/components/DataFeeds.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const allFeeds = computed(() => {
return feed.lastResult && Number(feed.lastResultTimestamp) > 0
})
.map((feed: any) => {
const heartbeat = Number(feed.heartbeat || '0')
const timeToUpdate =
heartbeat && !feed.isRouted ? heartbeat + Number(feed.finality) : null

return {
detailsPath: {
name: 'network-id',
Expand All @@ -54,9 +58,7 @@ const allFeeds = computed(() => {
value: feed.lastResult,
lastResultTimestamp: feed.lastResultTimestamp || '0',
label: feed.label,
timeToUpdate: feed.heartbeat
? Number(feed.heartbeat) + Number(feed.finality)
: null,
timeToUpdate,
img: {
name: formatSvgName(feed.name),
alt: feed.name,
Expand Down
Loading