-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add Gas Price Data Source #28
Changes from 12 commits
2266e55
1fd1df8
d2ec49f
12abd16
22f9f1b
85f768e
c4feb65
00ed863
6420bd5
0dab6e3
43edb6c
84b3f84
d5fc2d3
6815f5f
0f2b6cd
217297c
ebeeed5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ type aggregatedAttributedObservation struct { | |
Observers [32]commontypes.OracleID | ||
Observations []*big.Int | ||
JuelsPerFeeCoin *big.Int | ||
GasPriceSubunit *big.Int | ||
} | ||
|
||
func aggregate(observations []median.ParsedAttributedObservation) *aggregatedAttributedObservation { | ||
|
@@ -33,6 +34,11 @@ func aggregate(observations []median.ParsedAttributedObservation) *aggregatedAtt | |
}) | ||
aggregated.JuelsPerFeeCoin = observations[n/2].JuelsPerFeeCoin | ||
|
||
slices.SortFunc(observations, func(a, b median.ParsedAttributedObservation) int { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extracts the GasPriceSubunits to the aggregated observation. If it uses the default codec or codecs that do not know about this field, then field is ignored (see https://chainlink-core.slack.com/archives/C03EZMT3XPX/p1715627908908079?thread_ts=1711719895.085089&cid=C03EZMT3XPX). If it's on Starknet, the Starknet codec will utilize it |
||
return a.GasPriceSubunits.Cmp(b.GasPriceSubunits) | ||
}) | ||
aggregated.GasPriceSubunit = observations[n/2].GasPriceSubunits | ||
|
||
slices.SortFunc(observations, func(a, b median.ParsedAttributedObservation) int { | ||
return a.Value.Cmp(b.Value) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will point to master once smartcontractkit/chainlink-common#509 is merged