-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(oracle-proto): add proto files for oracle module and some ignite scalffold dependencies * feat(oracle-proto): add oracle types, mainly proto generated files * feat(oracle-keeper): implement keeper for state access, msgserver for price update * test(oracle-keeper): add test * feat(oracle-keeper): add cache as memory storage for prices collection across blocks * feat(oracle-keeper): add aggregator used to implement the mainly function to calculate fianl price from sources provided by validators * feat(oracle): integrate oracle module into app * fix(oracle-message): udpate CreatePrice signer with validatorAddress and responding GetSigners * test(oracle): add test cases, events, logs * fix(oracle): fix workflow check, linters, typo * refactor(oracle): use internal interface for external keeper reference * fix(oracle): fix test network params compatible with ignite * test(oracle): remove client test and simulation temporary * test(oracle-keeper): reset caches between testsuite * test(oracle): change monkey to gomonkey for arch compatible, add test flag for monkey * refactor(oracle): update the file name of aggregator, and fix typo * feat(oracle): set tokenFeeder in default params to a future block
- Loading branch information
Showing
124 changed files
with
21,166 additions
and
12 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
syntax = "proto3"; | ||
|
||
package exocore.oracle; | ||
|
||
import "exocore/oracle/index_recent_msg.proto"; | ||
import "exocore/oracle/index_recent_params.proto"; | ||
import "exocore/oracle/params.proto"; | ||
import "exocore/oracle/prices.proto"; | ||
import "exocore/oracle/recent_msg.proto"; | ||
import "exocore/oracle/recent_params.proto"; | ||
import "exocore/oracle/validator_update_block.proto"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/ExocoreNetwork/exocore/x/oracle/types"; | ||
|
||
// GenesisState defines the oracle module's genesis state. | ||
message GenesisState { | ||
// module params | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
// prices of all tokens | ||
repeated Prices prices_list = 2 [(gogoproto.nullable) = false]; | ||
|
||
//TODO: userDefinedTokenFeeder | ||
// latest block on which the validator set be updated | ||
ValidatorUpdateBlock validator_update_block = 3; | ||
// index for the cached recent params | ||
IndexRecentParams index_recent_params = 4; | ||
// index for the cached recent messages | ||
IndexRecentMsg index_recent_msg = 5; | ||
// cached recent messages | ||
repeated RecentMsg recent_msg_list = 6 [(gogoproto.nullable) = false]; | ||
// cached recent params | ||
repeated RecentParams recent_params_list = 7 [(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,10 @@ | ||
syntax = "proto3"; | ||
package exocore.oracle; | ||
|
||
option go_package = "github.com/ExocoreNetwork/exocore/x/oracle/types"; | ||
|
||
// index for the cached recent messages | ||
message IndexRecentMsg { | ||
// index list | ||
repeated uint64 index = 1; | ||
} |
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,10 @@ | ||
syntax = "proto3"; | ||
package exocore.oracle; | ||
|
||
option go_package = "github.com/ExocoreNetwork/exocore/x/oracle/types"; | ||
|
||
// index for the cached recent params | ||
message IndexRecentParams { | ||
// index list | ||
repeated uint64 index = 1; | ||
} |
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,50 @@ | ||
syntax = "proto3"; | ||
package exocore.oracle; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/ExocoreNetwork/exocore/x/oracle/types"; | ||
|
||
// Chain represents for the Chain on which token contracts deployed | ||
message Chain{ | ||
//eg."bitcoin" | ||
string name = 1; | ||
//TODO: metadata | ||
string desc = 2; | ||
} | ||
|
||
// Token represents the token info | ||
message Token{ | ||
// token name | ||
string name = 1; | ||
//id refer to chainList's index | ||
uint64 chain_id = 2 [(gogoproto.customname) = "ChainID"]; | ||
//if any, like erc20 tokens | ||
string contract_address = 3; | ||
// decimal of token price | ||
int32 decimal = 4; | ||
//set false when we stop official price oracle service for a specified token | ||
bool active = 5; | ||
} | ||
|
||
// Endpoint tells where to fetch the price info | ||
message Endpoint{ | ||
//url int refer to TokenList.ID, 0 reprents default for all (as fall back) | ||
//key refer to tokenID, 1->"https://chainlink.../eth" | ||
map<uint64,string> offchain = 1; | ||
//url int refer to TokenList.ID, 0 reprents default for all (as fall back) | ||
//key refer to tokenID, 1->"eth://0xabc...def" | ||
map<uint64,string> onchain = 2; | ||
} | ||
|
||
// Source represents price data source | ||
message Source { | ||
// name of price source, like 'chainlink' | ||
string name = 1; | ||
// endpoint of corresponding source to fetch price data from | ||
Endpoint entry = 2; | ||
//set false when the source is out of service or reject to accept this source for official service | ||
bool valid = 3; | ||
// if this source is deteministic or not | ||
bool deterministic = 4; | ||
} |
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,23 @@ | ||
syntax = "proto3"; | ||
package exocore.oracle; | ||
|
||
import "exocore/oracle/info.proto"; | ||
import "exocore/oracle/token_feeder.proto"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/ExocoreNetwork/exocore/x/oracle/types"; | ||
|
||
// Params defines the parameters for the module. | ||
message Params { | ||
option (gogoproto.goproto_stringer) = false; | ||
// chains represents the blockchains info | ||
repeated Chain chains = 1; | ||
// tokens info | ||
repeated Token tokens = 2; | ||
// sources info from where the price data would be fetched | ||
repeated Source sources = 3; | ||
// rules specified on how to decide the provided price source to be accept | ||
repeated RuleSource rules = 4; | ||
// each tokenFeeder represents an active token whose price being updated | ||
repeated TokenFeeder token_feeders = 5; | ||
} |
Oops, something went wrong.