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

refactor: Update median tracking for historacle pricing #1632

Merged
merged 32 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a48bb43
Refactor historacle median tracking
rbajollari Dec 1, 2022
1501fb1
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 1, 2022
a90346e
lint
rbajollari Dec 1, 2022
7fc2c74
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 1, 2022
a545a28
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 2, 2022
c9356a3
Update historacle keeper methods
rbajollari Dec 2, 2022
803e219
Add pricestats unit test
rbajollari Dec 2, 2022
e91f75b
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 2, 2022
97627a0
Add Get to getter keeper methods
rbajollari Dec 3, 2022
c6a5f60
PR comments
rbajollari Dec 5, 2022
dd9f000
Update x/oracle/types/keys.go
rbajollari Dec 5, 2022
eb0f1b0
Add ParseBlockFromKey comment
rbajollari Dec 5, 2022
a0630a0
lint
rbajollari Dec 5, 2022
85c2ffc
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 5, 2022
ced6379
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 5, 2022
f9b761c
Add decmath util package
rbajollari Dec 6, 2022
2fff271
Update keeper methods in historacle design doc
rbajollari Dec 6, 2022
d8fd83f
Update WithinMedianDeviation
rbajollari Dec 6, 2022
fcfcf60
revert file picked up by gofmt
rbajollari Dec 6, 2022
ff0ed4c
switch umee version from v3.2.0 -> ../ (again)
adamewozniak Dec 6, 2022
ffeda21
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 8, 2022
8d6ee4f
Fix keeper method names
rbajollari Dec 8, 2022
e3d3154
Update util/decmath/decmath.go
rbajollari Dec 8, 2022
1813826
Update util/decmath/decmath.go
rbajollari Dec 8, 2022
78fca1b
Update util/decmath/decmath.go
rbajollari Dec 8, 2022
4d1160f
Update x/oracle/abci.go
rbajollari Dec 8, 2022
2b3896a
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 8, 2022
43db6cb
PR comments
rbajollari Dec 8, 2022
0c0e5eb
lint
rbajollari Dec 8, 2022
8e41f41
update method names in design doc
rbajollari Dec 8, 2022
aad1422
Use KVStoreReversePrefixIteratorPaginated
rbajollari Dec 8, 2022
694d5d3
Update iterator method names and comments
rbajollari Dec 8, 2022
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
4 changes: 2 additions & 2 deletions app/upgradev3x3/gov_legacy.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions docs/design_docs/011-historacle-pricing.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ We define two Maximum values, which correspond to the most we will store of a me

Modules will have access to the following `keeper` functions from the `x/oracle` module:

- `HistoricMedian(denom) ([]sdk.Dec, error)` returns list median prices of an asset in the last `Pruning Period`
- `WithinHistoricDeviation(denom) (bool, error)` returns whether or not the current price of an asset is within the Standard Deviation around the Median.
- `MedianOfMedians(denom string, blockNum int) sdk.Dec` returns the Median of the all the Medians recorded within the past `blockNum`. TODO: what does it mean "within the past blockNum"?
- `AverageOfMedians(denom string, blockNum int) sdk.Dec` returns the Average of all the Medians recorded within the past `blockNum`.
- `MaxMedian(denom string, blockNum int) sdk.Dec` returns the Maximum of all the Medians recorded within the past `blockNum`.
- `MinMedian(denom string, blockNum int) sdk.Dec` returns the Minimum of all the Medians recorded within the past `blockNum`.
- `HistoricMedians(denom string, numStamps uint64) []sdk.Dec` returns list of last `numStamps` amount of median prices of an asset
- `WithinHistoricDeviation(denom string) (bool, error)` returns whether or not the current price of an asset is within the Standard Deviation around the Median.
- `MedianOfHistoricMedians(denom string, numStamps uint64) (sdk.Dec, error)` returns the Median of the all the Medians recorded within the past `numStamps` of medians.
- `AverageOfHistoricMedians(denom string, numStamps uint64) (sdk.Dec, error)` returns the Average of all the Medians recorded within the past `numStamps` of medians.
- `MaxOfHistoricMedians(denom string, numStamps uint64) (sdk.Dec, error)` returns the Maximum of all the Medians recorded within the past `numStamps` of medians.
- `MinOfHistoricMedians(denom string, numStamps uint64) (sdk.Dec, error)` returns the Minimum of all the Medians recorded within the past `numStamps` of medians.

### Outcomes

Expand Down
22 changes: 11 additions & 11 deletions price-feeder/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ require (

require (
4d63.com/gochecknoglobals v0.1.0 // indirect
cloud.google.com/go v0.104.0 // indirect
cloud.google.com/go v0.105.0 // indirect
cloud.google.com/go/compute v1.12.1 // indirect
cloud.google.com/go/compute/metadata v0.2.1 // indirect
cloud.google.com/go/iam v0.4.0 // indirect
cloud.google.com/go/storage v1.23.0 // indirect
cloud.google.com/go/iam v0.7.0 // indirect
cloud.google.com/go/storage v1.27.0 // indirect
cosmossdk.io/errors v1.0.0-beta.7 // indirect
cosmossdk.io/math v1.0.0-beta.3 // indirect
cosmossdk.io/math v1.0.0-beta.4 // indirect
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
Expand Down Expand Up @@ -74,7 +74,7 @@ require (
github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect
github.com/confio/ics23/go v0.7.0 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/cosmos-proto v1.0.0-alpha8 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.1 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogoproto v1.4.2 // indirect
github.com/cosmos/gorocksdb v1.2.0 // indirect
Expand Down Expand Up @@ -143,7 +143,6 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
github.com/googleapis/go-type-adapters v1.0.0 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
Expand Down Expand Up @@ -282,16 +281,16 @@ require (
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/oauth2 v0.2.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/term v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/tools v0.2.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.102.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect
google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1 // indirect
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand All @@ -313,4 +312,5 @@ replace (
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/osmosis-labs/bech32-ibc => github.com/umee-network/bech32-ibc v0.3.1
github.com/umee-network/umee/v3 => ../
)
Loading