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

[R4R] feat(oracle) #30

Merged
merged 49 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
24fefab
feat(oracle-proto): add proto files for oracle module and some ignite…
leonz789 Apr 2, 2024
d78044c
feat(oracle-proto): add oracle types, mainly proto generated files
leonz789 Apr 2, 2024
afb4965
feat(oracle-keeper):implement keeper for state access, msgserver for …
leonz789 Apr 2, 2024
d6d244f
test(oracle-keeper):add test
leonz789 Apr 2, 2024
9809ec5
feat(oracle-keeper):add cache as memory storage for prices collection…
leonz789 Apr 2, 2024
c098faa
feat(oracle-keeper):add aggregator used to implement the mainly funct…
leonz789 Apr 2, 2024
39da9c9
feat(oracle):integrate oracle module into app
leonz789 Apr 2, 2024
2773654
fix(oracle-message): udpate CreatePrice signer with validatorAddress …
leonz789 Apr 9, 2024
0ae869a
test(oracle):add test cases, events, logs
leonz789 Apr 9, 2024
c630033
fix(oracle): fix workflow check
leonz789 Apr 12, 2024
b7966ce
typo(oracle): rountId -> roundId
leonz789 Apr 13, 2024
f49d1c5
refactor(oracle): use internal interface for external keeper reference
leonz789 Apr 13, 2024
bf65e5e
feat(oracle):add updateparams service
leonz789 Apr 13, 2024
4d2d032
fix(oracle): fix proto-lint, fix cli-tx
leonz789 Apr 14, 2024
1b3401f
fix(oracle): fix proto grpc-gateway typo tokenId->token_id
leonz789 Apr 14, 2024
9b3383a
fix(oracle):fix monkye method since interface changed
leonz789 Apr 15, 2024
6b06afe
fix(oracle)fix test network params compatible with ignite
leonz789 Apr 15, 2024
b807cd8
fix(oracle-client):fix input params error
leonz789 Apr 16, 2024
6ac82f4
refactor(oracle-keeper):get rid of some int conversion
leonz789 Apr 16, 2024
dbd4d60
refactor(oracle-proto):update index type from int32 to uint64 used to…
leonz789 Apr 16, 2024
ef07cc5
test(oracle):remove client test and simulation temporary
leonz789 Apr 16, 2024
7ea268f
text(oracle):typo
leonz789 Apr 16, 2024
511b012
gofumpt
leonz789 Apr 16, 2024
c1b307a
gofumt, nolint to skip duplicate lines, replace sdkerrors
leonz789 Apr 16, 2024
c1dac1e
remove config.yml used for ignite
leonz789 Apr 16, 2024
60a81f6
fix(oracle-keeper):fix nil return
leonz789 Apr 17, 2024
f7cf7df
remoe openai docs generated by ignite
leonz789 Apr 17, 2024
d7f19db
fix(oracle): lint
leonz789 Apr 17, 2024
6d53266
update proto files Id->ID
leonz789 Apr 17, 2024
e91d320
update Id->ID
leonz789 Apr 17, 2024
473175b
fix(oracle): lint
leonz789 Apr 17, 2024
5d7b769
fix(oracle): lint
leonz789 Apr 17, 2024
397d051
fix(oracle): lint
leonz789 Apr 17, 2024
21e2c5a
text(oracle-proto): proto lint
leonz789 Apr 17, 2024
c288a0a
text(oracle-proto): proto lint
leonz789 Apr 17, 2024
cb6e88c
text(oracle-proto): proto lint, PriceWithSource->PriceSource
leonz789 Apr 17, 2024
ecfda24
text(oracle-proto): proto lint, PriceWithTimeAndRound->PriceTimeRound
leonz789 Apr 17, 2024
dfb42a4
text(oracle-proto): proto lint, RuleWithSource->RuleSource
leonz789 Apr 17, 2024
2ef42cd
get rid of local test replace
leonz789 Apr 17, 2024
a723d1a
get rid of integer conversion
leonz789 Apr 17, 2024
dc84085
add some TODO comments for test
leonz789 Apr 18, 2024
5567367
test(oracle-keeper):reset caches betweent testsuite
leonz789 Apr 18, 2024
e6c3c85
test(oracle)change monkey to gomonkey for arch compatible, add test f…
leonz789 Apr 18, 2024
06f5fd4
refactor: udpate the file name of aggregator, and fix typo
leonz789 Apr 22, 2024
7c3dff1
fix proto index
leonz789 Apr 23, 2024
7588a48
fix typo and comments
leonz789 Apr 25, 2024
8cc8f75
disable oracle module temporary
leonz789 Apr 25, 2024
ecf9145
enable oracle module in app, and set default params to a future block
leonz789 Apr 25, 2024
d892e60
fix lint
leonz789 Apr 25, 2024
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ test-race: ARGS=-race
test-race: TEST_PACKAGES=$(PACKAGES_NOSIMULATION)
$(TEST_TARGETS): run-tests

test-unit-cover: ARGS=-timeout=15m -coverprofile=cover.out -covermode=atomic
test-unit-cover: ARGS=-timeout=15m -coverprofile=cover.out -covermode=atomic -gcflags=all=-l
test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT)

test-e2e:
Expand Down
26 changes: 17 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ import (

operatorTypes "github.com/ExocoreNetwork/exocore/x/operator/types"

"github.com/ExocoreNetwork/exocore/x/oracle"
oracleKeeper "github.com/ExocoreNetwork/exocore/x/oracle/keeper"
oracleTypes "github.com/ExocoreNetwork/exocore/x/oracle/types"

"github.com/ExocoreNetwork/exocore/x/reward"
rewardKeeper "github.com/ExocoreNetwork/exocore/x/reward/keeper"
rewardTypes "github.com/ExocoreNetwork/exocore/x/reward/types"
Expand Down Expand Up @@ -279,6 +283,7 @@ var (
exoslash.AppModuleBasic{},
avs.AppModuleBasic{},
avstask.AppModuleBasic{},
oracle.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -364,6 +369,8 @@ type ExocoreApp struct {
ExoSlashKeeper slashKeeper.Keeper
AVSManagerKeeper avsManagerKeeper.Keeper
TaskKeeper avsTaskKeeper.Keeper
OracleKeeper oracleKeeper.Keeper

// the module manager
mm *module.Manager

Expand Down Expand Up @@ -448,15 +455,12 @@ func NewExocoreApp(
operatorTypes.StoreKey,
avsManagerTypes.StoreKey,
avsTaskTypes.StoreKey,
oracleTypes.StoreKey,
)

// Add the EVM transient store key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update or remove this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

tkeys := sdk.NewTransientStoreKeys(
paramstypes.TStoreKey,
evmtypes.TransientKey,
feemarkettypes.TransientKey,
)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, oracleTypes.MemStoreKey)

// load state streaming if enabled
if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil {
Expand Down Expand Up @@ -666,6 +670,7 @@ func NewExocoreApp(
app.ExoSlashKeeper = slashKeeper.NewKeeper(appCodec, keys[exoslashTypes.StoreKey], app.AssetsKeeper)
app.AVSManagerKeeper = *avsManagerKeeper.NewKeeper(appCodec, keys[avsManagerTypes.StoreKey], &app.OperatorKeeper, app.AssetsKeeper)
app.TaskKeeper = avsTaskKeeper.NewKeeper(appCodec, keys[avsTaskTypes.StoreKey], app.AVSManagerKeeper)
app.OracleKeeper = oracleKeeper.NewKeeper(appCodec, keys[oracleTypes.StoreKey], memKeys[oracleTypes.MemStoreKey], app.GetSubspace(oracleTypes.ModuleName), app.StakingKeeper)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be added to app.go without integration with other modules?

// We call this after setting the hooks to ensure that the hooks are set on the keeper
evmKeeper.WithPrecompiles(
evmkeeper.AvailablePrecompiles(
Expand Down Expand Up @@ -855,6 +860,7 @@ func NewExocoreApp(
exoslash.NewAppModule(appCodec, app.ExoSlashKeeper),
avs.NewAppModule(appCodec, app.AVSManagerKeeper),
avstask.NewAppModule(appCodec, app.TaskKeeper),
oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper),
)

// During begin block slashing happens after reward.BeginBlocker so that
Expand Down Expand Up @@ -900,6 +906,7 @@ func NewExocoreApp(
exoslashTypes.ModuleName,
avsManagerTypes.ModuleName,
avsTaskTypes.ModuleName,
oracleTypes.ModuleName,
)

// NOTE: fee market module must go last in order to retrieve the block gas used.
Expand Down Expand Up @@ -940,6 +947,7 @@ func NewExocoreApp(
exoslashTypes.ModuleName,
avsManagerTypes.ModuleName,
avsTaskTypes.ModuleName,
oracleTypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -977,6 +985,7 @@ func NewExocoreApp(
withdrawTypes.ModuleName,
rewardTypes.ModuleName,
exoslashTypes.ModuleName,
oracleTypes.ModuleName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain the rationale for these orders, if there is any. Or add a comment anyway if there is no particular rationale.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

// Evmos modules
erc20types.ModuleName,
epochstypes.ModuleName,
Expand Down Expand Up @@ -1338,9 +1347,8 @@ func initParamsKeeper(
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
// ethermint subspaces
paramsKeeper.Subspace(evmtypes.ModuleName).
// nolint: staticcheck
WithKeyTable(evmtypes.ParamKeyTable())
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(oracleTypes.ModuleName).WithKeyTable(oracleTypes.ParamKeyTable())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this also have the same nolint line ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

udpated

return paramsKeeper
}

Expand Down
10 changes: 9 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
cosmossdk.io/math v1.0.1
cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d
cosmossdk.io/tools/rosetta v0.2.1
github.com/agiledragon/gomonkey/v2 v2.11.0
github.com/armon/go-metrics v0.4.1
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.8.0
Expand All @@ -21,22 +22,24 @@ require (
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3
github.com/onsi/ginkgo/v2 v2.15.0
github.com/onsi/gomega v1.31.1
github.com/pkg/errors v0.9.1
github.com/prysmaticlabs/prysm/v4 v4.2.1
github.com/rakyll/statik v0.1.7
github.com/smartystreets/goconvey v1.6.4
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
go.opencensus.io v0.24.0
go.uber.org/mock v0.4.0
golang.org/x/crypto v0.21.0
golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e
google.golang.org/grpc v1.57.1
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v2 v2.4.0
sigs.k8s.io/yaml v1.3.0
)
Expand Down Expand Up @@ -105,6 +108,7 @@ require (
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
Expand All @@ -126,6 +130,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
Expand All @@ -147,6 +152,7 @@ require (
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/lib/pq v1.10.9 // indirect
Expand Down Expand Up @@ -184,6 +190,7 @@ require (
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down Expand Up @@ -214,6 +221,7 @@ require (
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I=
github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/agiledragon/gomonkey/v2 v2.11.0 h1:5oxSgA+tC1xuGsrIorR+sYiziYltmJyEZ9qA25b6l5U=
github.com/agiledragon/gomonkey/v2 v2.11.0/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY=
github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
Expand Down Expand Up @@ -843,6 +845,7 @@ github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays=
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
Expand Down Expand Up @@ -1047,6 +1050,7 @@ github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cU
github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI=
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
Expand All @@ -1068,6 +1072,7 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
Expand Down Expand Up @@ -1166,6 +1171,7 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
Expand Down Expand Up @@ -1448,7 +1454,9 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
Expand Down Expand Up @@ -1585,6 +1593,8 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
Expand Down
35 changes: 35 additions & 0 deletions proto/exocore/oracle/genesis.proto
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 = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this start from 3?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

// index for the cached recent params
IndexRecentParams index_recent_params = 5;
// index for the cached recent messages
IndexRecentMsg index_recent_msg = 6;
// cached recent messages
repeated RecentMsg recent_msg_list = 7 [(gogoproto.nullable) = false];
// cached recent params
repeated RecentParams recent_params_list = 8 [(gogoproto.nullable) = false];
}

10 changes: 10 additions & 0 deletions proto/exocore/oracle/index_recent_msg.proto
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;
}
10 changes: 10 additions & 0 deletions proto/exocore/oracle/index_recent_params.proto
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;
}
50 changes: 50 additions & 0 deletions proto/exocore/oracle/info.proto
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{
TimmyExogenous marked this conversation as resolved.
Show resolved Hide resolved
//eg."bitcoin"
string name = 1;
//TODO: metadata
string desc = 2;
}

// Token represents the token info
message Token{
TimmyExogenous marked this conversation as resolved.
Show resolved Hide resolved
// 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;
}
23 changes: 23 additions & 0 deletions proto/exocore/oracle/params.proto
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;
}
Loading
Loading