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

feat: cellarfees v2 changes #289

Merged
merged 28 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5ffb9f1
WIP - cellarfees v2 protos
cbrit Mar 4, 2024
a3611f6
FeeTokenBalance(s) queries and helper functions
cbrit Mar 4, 2024
d8cb5a5
Remove previous upgrade wiring
cbrit Mar 4, 2024
22b5272
Remove gravity keeper and hooks from cellarfees
cbrit Mar 4, 2024
b1b6f13
Fix imports
cbrit Mar 4, 2024
348c5b5
Fix expected keeper
cbrit Mar 4, 2024
14fd4e7
remove empty file
cbrit Mar 4, 2024
6970c70
Initial update to auction handling
cbrit Mar 4, 2024
80fce3e
Wire up new param
cbrit Mar 5, 2024
4ac6cc4
Remove old upgrade files from build
cbrit Mar 5, 2024
f8a6ee1
Refactor cellarfees BeginBlocker
cbrit Mar 5, 2024
4de900c
Update cellarfees keeper unit tests
cbrit Mar 5, 2024
a62b45a
Remove empty file
cbrit Mar 5, 2024
a42def9
Fix broken unit tests and compiler errors
cbrit Mar 5, 2024
2abf19f
gofmt
cbrit Mar 5, 2024
d49043a
WIP - fix integration tests
cbrit Mar 5, 2024
2c5aade
WIP - Integration test updates
cbrit Mar 6, 2024
dc341be
Remove auction requirement that denom be prefixed with gravity
cbrit Mar 7, 2024
53dc56c
WIP - Integration test passing, fee acct usomm balance not going to 0…
cbrit Mar 7, 2024
8f8aeb3
Fix test and skip usomm in auction start logic
cbrit Mar 11, 2024
e92366c
Linting
cbrit Mar 11, 2024
f60fb32
Remove old upgrades from linting rules
cbrit Mar 11, 2024
8ea06d3
Add CLI commands for new queries
cbrit Mar 11, 2024
f9111c8
Fix bugs found in testing
cbrit Mar 11, 2024
f157ed0
Refactor FeeBalance methods/handler to iterate balances instead of to…
cbrit Mar 11, 2024
9f5ab51
Tweak comments and imports
cbrit Mar 12, 2024
a723644
Refactor beginAuction method
cbrit Mar 12, 2024
bff3e20
Comment in proto
cbrit Mar 12, 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
78 changes: 6 additions & 72 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ import (
gravitykeeper "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/keeper"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/types"
appParams "github.com/peggyjv/sommelier/v7/app/params"
v4 "github.com/peggyjv/sommelier/v7/app/upgrades/v4"
v5 "github.com/peggyjv/sommelier/v7/app/upgrades/v5"
v6 "github.com/peggyjv/sommelier/v7/app/upgrades/v6"
v7 "github.com/peggyjv/sommelier/v7/app/upgrades/v7"
"github.com/peggyjv/sommelier/v7/x/auction"
auctionclient "github.com/peggyjv/sommelier/v7/x/auction/client"
auctionkeeper "github.com/peggyjv/sommelier/v7/x/auction/keeper"
Expand Down Expand Up @@ -223,6 +219,7 @@ var (
// incidentally this permission is also required to be able to send tokens from module accounts
allowedReceivingModAcc = map[string]bool{
axelarcorktypes.ModuleName: true,
cellarfeestypes.ModuleName: true,
}

_ simapp.App = (*SommelierApp)(nil)
Expand Down Expand Up @@ -492,7 +489,7 @@ func NewSommelierApp(

app.CellarFeesKeeper = cellarfeeskeeper.NewKeeper(
appCodec, keys[cellarfeestypes.StoreKey], app.GetSubspace(cellarfeestypes.ModuleName),
app.AccountKeeper, app.BankKeeper, app.MintKeeper, app.CorkKeeper, app.GravityKeeper, app.AuctionKeeper,
app.AccountKeeper, app.BankKeeper, app.MintKeeper, app.CorkKeeper, app.AuctionKeeper,
)

app.IncentivesKeeper = incentiveskeeper.NewKeeper(
Expand All @@ -506,7 +503,6 @@ func NewSommelierApp(
app.GravityKeeper = *app.GravityKeeper.SetHooks(
gravitytypes.NewMultiGravityHooks(
app.CorkKeeper.Hooks(),
app.CellarFeesKeeper.Hooks(),
))

// register the proposal types
Expand Down Expand Up @@ -578,7 +574,7 @@ func NewSommelierApp(
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
cork.NewAppModule(app.CorkKeeper, appCodec),
incentives.NewAppModule(app.IncentivesKeeper, app.DistrKeeper, app.BankKeeper, app.MintKeeper, appCodec),
cellarfees.NewAppModule(app.CellarFeesKeeper, appCodec, app.AccountKeeper, app.BankKeeper, app.MintKeeper, app.CorkKeeper, app.GravityKeeper, app.AuctionKeeper),
cellarfees.NewAppModule(app.CellarFeesKeeper, appCodec, app.AccountKeeper, app.BankKeeper, app.MintKeeper, app.CorkKeeper, app.AuctionKeeper),
auction.NewAppModule(app.AuctionKeeper, app.BankKeeper, app.AccountKeeper, appCodec),
pubsub.NewAppModule(appCodec, app.PubsubKeeper, app.StakingKeeper, app.GravityKeeper),
)
Expand Down Expand Up @@ -713,7 +709,7 @@ func NewSommelierApp(
cork.NewAppModule(app.CorkKeeper, appCodec),
axelarcork.NewAppModule(app.AxelarCorkKeeper, appCodec),
incentives.NewAppModule(app.IncentivesKeeper, app.DistrKeeper, app.BankKeeper, app.MintKeeper, appCodec),
cellarfees.NewAppModule(app.CellarFeesKeeper, appCodec, app.AccountKeeper, app.BankKeeper, app.MintKeeper, app.CorkKeeper, app.GravityKeeper, app.AuctionKeeper),
cellarfees.NewAppModule(app.CellarFeesKeeper, appCodec, app.AccountKeeper, app.BankKeeper, app.MintKeeper, app.CorkKeeper, app.AuctionKeeper),
auction.NewAppModule(app.AuctionKeeper, app.BankKeeper, app.AccountKeeper, appCodec),
pubsub.NewAppModule(appCodec, app.PubsubKeeper, app.StakingKeeper, app.GravityKeeper),
)
Expand Down Expand Up @@ -969,75 +965,13 @@ func (app *SommelierApp) setupUpgradeStoreLoaders() {

var storeUpgrades *storetypes.StoreUpgrades = nil

if upgradeInfo.Name == v4.UpgradeName {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{corktypes.ModuleName, cellarfeestypes.ModuleName},
Deleted: []string{"allocation"},
}
}

if upgradeInfo.Name == v5.UpgradeName {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{incentivestypes.ModuleName},
}
}

if upgradeInfo.Name == v6.UpgradeName {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{icahosttypes.SubModuleName},
}
}

if upgradeInfo.Name == v7.UpgradeName {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{auctiontypes.ModuleName, axelarcorktypes.ModuleName, cellarfeestypes.ModuleName, pubsubtypes.ModuleName},
}
}
// TODO: Add v8 store loader when writing upgrade handler

if storeUpgrades != nil {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades))
}
}

func (app *SommelierApp) setupUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(
v4.UpgradeName,
v4.CreateUpgradeHandler(
app.mm,
app.configurator,
app.AccountKeeper,
app.BankKeeper,
),
)

app.UpgradeKeeper.SetUpgradeHandler(
v5.UpgradeName,
v5.CreateUpgradeHandler(
app.mm,
app.configurator,
app.IncentivesKeeper,
),
)

app.UpgradeKeeper.SetUpgradeHandler(
v6.UpgradeName,
v6.CreateUpgradeHandler(
app.mm,
app.configurator,
),
)

app.UpgradeKeeper.SetUpgradeHandler(
v7.UpgradeName,
v7.CreateUpgradeHandler(
app.mm,
app.configurator,
app.AuctionKeeper,
app.AxelarCorkKeeper,
app.CellarFeesKeeper,
app.CorkKeeper,
app.ICAHostKeeper,
app.PubsubKeeper,
),
)
// TODO: Add v8 upgrade handler
}
2 changes: 2 additions & 0 deletions app/upgrades/v4/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build exclude

package v4

import (
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/v5/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build exclude

package v5

import (
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/v6/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build exclude

package v6

import (
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/v7/constants.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build exclude

package v7

// UpgradeName defines the on-chain upgrade name for the Sommelier v7 upgrade
Expand Down
3 changes: 3 additions & 0 deletions app/upgrades/v7/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build exclude
// +build exclude

package v7

import (
Expand Down
Loading
Loading