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) #24

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fc501d1
chore: add ignite dep
leonz789 Feb 23, 2024
7e0cb8e
feat(oracle): scaffold oracle module
leonz789 Feb 23, 2024
f5cf831
feat(oracle-proto): add empty create-price message
leonz789 Feb 23, 2024
8d2d2ac
feat(oracle-proto): add create-price definition
leonz789 Feb 23, 2024
42f0f6c
feat(oracle-proto): add params definition
leonz789 Feb 24, 2024
30f2d25
feat(oracle-proto): add price storage for oracle price store
leonz789 Feb 24, 2024
4a3cd7d
feat(oracle-proto):update create price message field
leonz789 Feb 24, 2024
1ae5769
feat(oracle-proto): update prices field
leonz789 Feb 24, 2024
28bd930
feat(oracle-keeper):add prices curd for embeded field
leonz789 Feb 24, 2024
cba6cb1
feat(oracle-proto):add roundInfo state for aggregator
leonz789 Feb 26, 2024
58cc010
feat(oracle-proto): add round-data state for aggregator
leonz789 Feb 26, 2024
6787b14
feat(oracle-proto):add validators state for aggregation
leonz789 Feb 26, 2024
7695c4f
feat(oracle-keeper): add aggregator, implement calculator, filter, ag…
leonz789 Feb 28, 2024
2e65519
refactor(oracle-proto): remove round related state definition
leonz789 Feb 28, 2024
cc373c9
feat(oracle-keeper):update aggregator implementation, remove round re…
leonz789 Mar 5, 2024
c0e19aa
feat(oracle-keeper):aggregator, reache, commit to update validator state
leonz789 Mar 7, 2024
81b69ff
feat(oracle-proto): update validators in state
leonz789 Mar 7, 2024
1b1e17f
feat(oracle-keeper): add recache logic
leonz789 Mar 11, 2024
3fbf0a9
feat(oracle-proto): udpate state for recache to keep recent history data
leonz789 Mar 12, 2024
5df805d
feat(oracle-proto):udpate recentMsg
leonz789 Mar 12, 2024
4208917
feat(oracle-keeper): update recache
leonz789 Mar 13, 2024
c006454
feat(oracle-keeper):refactor keeper structure: aggregator, cache, common
leonz789 Mar 13, 2024
a2aabfe
feat(oracle-keeper): interface check
leonz789 Mar 13, 2024
4a19ace
feat(oracle-keeper): update proto, remove validtors for genesis state
leonz789 Mar 13, 2024
161f081
feat(oracle-proto):update caches with recache for aggregatorContext, …
leonz789 Mar 18, 2024
6cb3677
test(oracle-keeper): add test for keeper
leonz789 Mar 25, 2024
f15339c
test(oracle-keeper):tmp
leonz789 Apr 2, 2024
5d08798
test(oracle-keeper):add keeper test
leonz789 Apr 2, 2024
7557592
feat(oracle-proto): add proto files for oracle module and some ignite…
leonz789 Apr 2, 2024
a945c0b
feat(oracle-proto): add oracle types, mainly proto generated files
leonz789 Apr 2, 2024
1a1d063
feat(oracle-keeper):implement keeper for state access, msgserver for …
leonz789 Apr 2, 2024
9800fb8
test(oracle-keeper):add test
leonz789 Apr 2, 2024
07bb9e5
feat(oracle-keeper):add cache as memory storage for prices collection…
leonz789 Apr 2, 2024
8aa9a1b
feat(oracle-keeper):add aggregator used to implement the mainly funct…
leonz789 Apr 2, 2024
9acca96
feat(oracle):integrate oracle module into app
leonz789 Apr 2, 2024
5ada640
fix(oracle-message): udpate CreatePrice signer with validatorAddress …
leonz789 Apr 7, 2024
86d7212
test(oracle):add test cases, events, logs
leonz789 Apr 8, 2024
e988fc0
Merge branch 'develop-leon-oracle' into develop-oracle
leonz789 Apr 8, 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
18 changes: 16 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ import (
depositKeeper "github.com/ExocoreNetwork/exocore/x/deposit/keeper"
depositTypes "github.com/ExocoreNetwork/exocore/x/deposit/types"
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 @@ -267,6 +272,7 @@ var (
withdraw.AppModuleBasic{},
reward.AppModuleBasic{},
exoslash.AppModuleBasic{},
oracle.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -358,6 +364,7 @@ type ExocoreApp struct {
WithdrawKeeper withdrawKeeper.Keeper
RewardKeeper rewardKeeper.Keeper
OperatorKeeper operatorKeeper.Keeper
OracleKeeper oracleKeeper.Keeper

ExoSlashKeeper slashKeeper.Keeper
// the module manager
Expand Down Expand Up @@ -441,11 +448,12 @@ func NewExocoreApp(
rewardTypes.StoreKey,
exoslashTypes.StoreKey,
operatorTypes.StoreKey,
oracleTypes.StoreKey,
)

// Add the EVM transient store key
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
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 @@ -630,6 +638,7 @@ func NewExocoreApp(
app.WithdrawKeeper = *withdrawKeeper.NewKeeper(appCodec, keys[withdrawTypes.StoreKey], app.AssetsKeeper, app.DepositKeeper)
app.RewardKeeper = *rewardKeeper.NewKeeper(appCodec, keys[rewardTypes.StoreKey], app.AssetsKeeper)
app.ExoSlashKeeper = slashKeeper.NewKeeper(appCodec, keys[exoslashTypes.StoreKey], app.AssetsKeeper)
app.OracleKeeper = oracleKeeper.NewKeeper(appCodec, keys[oracleTypes.StoreKey], memKeys[oracleTypes.MemStoreKey], app.GetSubspace(oracleTypes.ModuleName), app.StakingKeeper)
// 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 @@ -804,6 +813,7 @@ func NewExocoreApp(
withdraw.NewAppModule(appCodec, app.WithdrawKeeper),
reward.NewAppModule(appCodec, app.RewardKeeper),
exoslash.NewAppModule(appCodec, app.ExoSlashKeeper),
oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper),
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -851,6 +861,7 @@ func NewExocoreApp(
withdrawTypes.ModuleName,
rewardTypes.ModuleName,
exoslashTypes.ModuleName,
oracleTypes.ModuleName,
)

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

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -935,6 +947,7 @@ func NewExocoreApp(
withdrawTypes.ModuleName,
rewardTypes.ModuleName,
exoslashTypes.ModuleName,
oracleTypes.ModuleName,
// Evmos modules
vestingtypes.ModuleName,
inflationtypes.ModuleName,
Expand Down Expand Up @@ -1269,7 +1282,8 @@ func initParamsKeeper(
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
// ethermint subspaces
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable()) //nolint: staticcheck
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(oracleTypes.ModuleName).WithKeyTable(oracleTypes.ParamKeyTable()) //nolint:staticcheck
return paramsKeeper
}

Expand Down
21 changes: 21 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 1
accounts:
- name: alice
coins:
- 20000token
- 200000000stake
- name: bob
coins:
- 10000token
- 100000000stake
client:
openapi:
path: docs/static/openapi.yml
faucet:
name: bob
coins:
- 5token
- 100000stake
validators:
- name: alice
bonded: 100000000stake
Loading
Loading