-
Notifications
You must be signed in to change notification settings - Fork 193
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
feat: add oracle module #791
Merged
Merged
Changes from all commits
Commits
Show all changes
113 commits
Select commit
Hold shift + click to select a range
c5ba451
add: init oracle
b659ae1
chore: adjustments
101324c
more cleanups
b1163d4
remove: sdk.Handler
81629d4
add: tmp fixes
96b1777
add: adjust tests
075d50f
chore: cleanup naming
7b660de
chore: more cleanups
b71ae51
chore: more cleanups 2
8c71c10
chore: finalize denom cleanups
b9b5121
change: rename Denom to Pair
1313700
fix: change DenomList to PairList
b5bae46
change: VoteForTally.Denom=>Pair
6db393e
change: func param rename
bf5e531
chore: docs
c840aa7
chore: more renaming
d05ae91
chore: rename denoms to pairs in query.proto
5b2c688
change: rename denom to pair in oracle.proto
206a36a
change: rename denom to pair in genesis.proto
5c5e595
change: rename denom to pair in hash.go
2709ae5
change: rename SetLunaExchangeRate to SetExchangeRate
e3fcbfc
change: rename SetLunaExchangeRateWithEvent to SetExchangeRateWithEvent
6621aba
change: rename DeleteLunaExchangeRate to DeleteExchangeRate
5196be2
change: rename GetLunaExchangeRate to GetExchangeRate
27ad4f9
change: rename IterateLunaExchangeRates to IterateExchangeRates
215b00e
fix: remove unappliable test
881ae09
fix: keeper_test.go
30403f6
chore: renames and removing unused vars
95e996a
change: remove set denom metadata from whitelist apply
5f48807
change: ballot_test.go shouldn't check for denom registration
0d5879e
change: rename denom.go to pair_list.go
1abd617
add: vote parsing and partial testing
9801f61
add: duplicates logic check
b6f6ce2
change: ParseTuplesStr logic to use pairs instead of denoms
571092d
fix: adjust msgs_test.go
f42e9b1
change: temp disable rewards for oracles
3a6b3f4
fix: adjust abci test part 1
c078081
chore: adjust test oracle drop and oracle tally and test oracle rewar…
bde3552
chore: skip multireward test adjustment
9d946ee
chore: adjust TestOracleExchangeRate test
131d75c
chore: adjust last abci_test.go
91bec8c
fix: last tests
5f32a40
chore: adjust keeper Msgserver FeederDelegation test
9222dd7
chore: adjust final test
8b8a1e9
chore: lint
e10e73b
chore: CHANGELOG.md
c9f7ade
change: Rename ErrUnknownDenom to ErrUnknownPair
6f0f519
fix: null prefix string key to avoid prefix overlaps
1bf0ea3
chore: clear docs denom=>pair
8b627d6
chore: params renaming
5f6d11a
chore: clear docs denom=>pair
a944480
fix: null suffix string for tobin tax keys
693168d
chore: return param rename
1c247ab
remove: pair_list_test.go useless tests
5d11dee
chore: remove deprecated rest handlers
6950adc
chore: rename AttributeKeyDenom=>Pair
d5bcb93
chore: rename OrganizeBallotByDenom=>Pair
9e5ff5e
chore: rename denom to pair in ballot.go
7f3a670
chore: address TODO on pair being wrong on default params
7a04d19
chore: more denom=>pair renames
a2f2272
chore: denom=>pair msg_server.go
9ad2e85
chore: more denom=>pair renames
49272b1
chore: rename denom=>pair params_test.go
432c671
chore: rename denom=>pair ballot.go
0a19920
chore: rename denom=>pair keeper_test.go
03aaf99
chore: rename denom=>pair params.go
9bdeee7
chore: rename denom=>pair params.go
eab9891
chore: cleanup interface expected_keeper.go
51abfb3
chore: renames denom=>pair keys.go
c10eca3
chore: renames denom=>pair tally.go
6c7c26d
chore: lint
f2c859c
chore: rename denom=>pair vote_target.go
c0d2373
chore: rename denom=>pair querier.go
442f518
chore: rename denom=>pair genesis.go
04cbbfd
change: rename references of sdk.DecCoins to ExchangeRateTuples from …
31e72df
chore: refactor confusing tests
55c96dd
chore: refactor confusing tests 2
a1a0152
chore: refactor confusing tests 3
20edfec
remove l mentions
AgentSmithMatrix a054b86
remove messages array
AgentSmithMatrix f8e1257
refactor exchange rate tuple function
AgentSmithMatrix c2b6100
remove dead code
AgentSmithMatrix da208f0
change voter to feeder as in the message
AgentSmithMatrix a822e31
finish review Aggregate Exchange PreVote
AgentSmithMatrix e373579
linter
AgentSmithMatrix 253dbb0
Merge remote-tracking branch 'origin/master' into mercilex/oracle
AgentSmithMatrix 9e5e159
remove mentions to l
AgentSmithMatrix 31222bd
Merge branch 'master' into mercilex/oracle-init
NibiruHeisenberg a2dd7da
Merge branch 'mercilex/oracle-init' into mercilex/oracle
NibiruHeisenberg c58df9c
refactor variable names in oracle abci
NibiruHeisenberg 99e923d
Remove common.MicroUnit
NibiruHeisenberg 1cc04af
Clean up calls to sdk.NewDec
NibiruHeisenberg 70958a1
Remove more usages of common.MicroUnit
NibiruHeisenberg c604315
chore: cleanup TestOracleThreshold test
0082d61
Merge branch 'mercilex/oracle' of jackfan.us.kg-agent:NibiruChain/nibiru…
AgentSmithMatrix 5952364
add exchange rate vote
AgentSmithMatrix a3fa547
change l mention
AgentSmithMatrix 0fb2887
fix comment
AgentSmithMatrix 58a344b
remove mentions to l
AgentSmithMatrix 993be9e
add: more tests
aa7916c
Merge remote-tracking branch 'origin/mercilex/oracle' into mercilex/o…
011f662
chore: todo context
50bc391
chore: more cleanups
c471c13
chore: krw renames
1e642f5
chore: remove references of Terra
5d83fa3
chore: more renamings
3c8ab3f
chore: correct proto docs
e689375
Merge branch 'master' into mercilex/oracle
NibiruHeisenberg c94e56f
Remove references to Terra Luna
NibiruHeisenberg 168cb1f
Remove usages of terra, luna, and denom in docs
NibiruHeisenberg 098a7bd
Update 02_state.md
NibiruHeisenberg e7ed13c
Fix documentation regarding ordering of pair and exchange_rate
NibiruHeisenberg 2cdcba4
Refactor OrganizeBallotByPair and struct name
NibiruHeisenberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
syntax = "proto3"; | ||
package nibiru.oracle.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "oracle/v1beta1/oracle.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/NibiruChain/nibiru/x/oracle/types"; | ||
|
||
// GenesisState defines the oracle module's genesis state. | ||
message GenesisState { | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
repeated FeederDelegation feeder_delegations = 2 [(gogoproto.nullable) = false]; | ||
repeated ExchangeRateTuple exchange_rates = 3 | ||
[(gogoproto.castrepeated) = "ExchangeRateTuples", (gogoproto.nullable) = false]; | ||
repeated MissCounter miss_counters = 4 [(gogoproto.nullable) = false]; | ||
repeated AggregateExchangeRatePrevote aggregate_exchange_rate_prevotes = 5 [(gogoproto.nullable) = false]; | ||
repeated AggregateExchangeRateVote aggregate_exchange_rate_votes = 6 [(gogoproto.nullable) = false]; | ||
repeated TobinTax tobin_taxes = 7 [(gogoproto.nullable) = false]; | ||
} | ||
|
||
// FeederDelegation is the address for where oracle feeder authority are | ||
// delegated to. By default this struct is only used at genesis to feed in | ||
// default feeder addresses. | ||
message FeederDelegation { | ||
string feeder_address = 1; | ||
string validator_address = 2; | ||
} | ||
|
||
// MissCounter defines an miss counter and validator address pair used in | ||
// oracle module's genesis state | ||
message MissCounter { | ||
string validator_address = 1; | ||
uint64 miss_counter = 2; | ||
} | ||
|
||
// TobinTax defines a pair and tobin_tax pair used in | ||
// oracle module's genesis state | ||
message TobinTax { | ||
string pair = 1; | ||
string tobin_tax = 2 | ||
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
syntax = "proto3"; | ||
package nibiru.oracle.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/NibiruChain/nibiru/x/oracle/types"; | ||
|
||
// Params defines the parameters for the oracle module. | ||
message Params { | ||
option (gogoproto.equal) = true; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
uint64 vote_period = 1 [(gogoproto.moretags) = "yaml:\"vote_period\""]; | ||
string vote_threshold = 2 [ | ||
(gogoproto.moretags) = "yaml:\"vote_threshold\"", | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", | ||
(gogoproto.nullable) = false | ||
]; | ||
string reward_band = 3 [ | ||
(gogoproto.moretags) = "yaml:\"reward_band\"", | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", | ||
(gogoproto.nullable) = false | ||
]; | ||
uint64 reward_distribution_window = 4 [(gogoproto.moretags) = "yaml:\"reward_distribution_window\""]; | ||
repeated Pair whitelist = 5 [ | ||
(gogoproto.moretags) = "yaml:\"whitelist\"", | ||
(gogoproto.castrepeated) = "PairList", | ||
(gogoproto.nullable) = false | ||
]; | ||
string slash_fraction = 6 [ | ||
(gogoproto.moretags) = "yaml:\"slash_fraction\"", | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", | ||
(gogoproto.nullable) = false | ||
]; | ||
uint64 slash_window = 7 [(gogoproto.moretags) = "yaml:\"slash_window\""]; | ||
string min_valid_per_window = 8 [ | ||
(gogoproto.moretags) = "yaml:\"min_valid_per_window\"", | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// Pair is the object that holds configuration of each pair. | ||
message Pair { | ||
option (gogoproto.equal) = false; | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
string name = 1 [(gogoproto.moretags) = "yaml:\"name\""]; | ||
string tobin_tax = 2 [ | ||
(gogoproto.moretags) = "yaml:\"tobin_tax\"", | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// struct for aggregate prevoting on the ExchangeRateVote. | ||
// The purpose of aggregate prevote is to hide vote exchange rates with hash | ||
// which is formatted as hex string in SHA256("{salt}:({pair},{exchange_rate})|...,({pair},{exchange_rate}):{voter}") | ||
message AggregateExchangeRatePrevote { | ||
option (gogoproto.equal) = false; | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
string hash = 1 [(gogoproto.moretags) = "yaml:\"hash\""]; | ||
string voter = 2 [(gogoproto.moretags) = "yaml:\"voter\""]; | ||
uint64 submit_block = 3 [(gogoproto.moretags) = "yaml:\"submit_block\""]; | ||
} | ||
|
||
// MsgAggregateExchangeRateVote - struct for voting on | ||
// the exchange rates different assets. | ||
message AggregateExchangeRateVote { | ||
option (gogoproto.equal) = false; | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
repeated ExchangeRateTuple exchange_rate_tuples = 1 [ | ||
(gogoproto.moretags) = "yaml:\"exchange_rate_tuples\"", | ||
(gogoproto.castrepeated) = "ExchangeRateTuples", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
string voter = 2 [(gogoproto.moretags) = "yaml:\"voter\""]; | ||
} | ||
|
||
// ExchangeRateTuple - struct to store interpreted exchange rates data to store | ||
message ExchangeRateTuple { | ||
option (gogoproto.equal) = false; | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
string pair = 1 [(gogoproto.moretags) = "yaml:\"pair\""]; | ||
string exchange_rate = 2 [ | ||
(gogoproto.moretags) = "yaml:\"exchange_rate\"", | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", | ||
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. renaming denom to pair |
||
(gogoproto.nullable) = false | ||
]; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
just renaming denom to pair