Skip to content

Commit

Permalink
fix(auction): use correct account linking for x/metoken
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed May 6, 2024
1 parent c5caa92 commit e2c0c6e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func New(
app.LeverageKeeper,
app.OracleKeeper,
app.UGovKeeperB.EmergencyGroup,
// rewardsAuctionAccs.RewardsCollect,
rewardsAuctionAccs.RewardsCollect,
)

// register the staking hooks
Expand Down
6 changes: 3 additions & 3 deletions x/metoken/keeper/intest/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@ func initTestSuite(t *testing.T, registry []metoken.Index, balances []metoken.In
AnyTimes()
oracleMock.EXPECT().SetExchangeRate(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()

kb := keeper.NewBuilder(
app.MetokenKeeperB = keeper.NewBuilder(
app.AppCodec(),
app.GetKey(metoken.ModuleName),
app.BankKeeper,
app.LeverageKeeper,
oracleMock,
app.UGovKeeperB.EmergencyGroup,
app.AuctionKeeperB.Accs.RewardsCollect,

Check failure on line 64 in x/metoken/keeper/intest/keeper_test.go

View workflow job for this annotation

GitHub Actions / test-unit-cover

app.AuctionKeeperB.Accs undefined (type "github.com/umee-network/umee/v6/x/auction/keeper".Builder has no field or method Accs)
)
app.MetokenKeeperB = kb

genState := metoken.DefaultGenesisState()
genState.Registry = registry
genState.Balances = balances
kb.Keeper(&ctx).InitGenesis(*genState)
app.MetokenKeeperB.Keeper(&ctx).InitGenesis(*genState)

queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
metoken.RegisterQueryServer(queryHelper, keeper.NewQuerier(app.MetokenKeeperB))
Expand Down
4 changes: 4 additions & 0 deletions x/metoken/keeper/intest/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ func TestMsgServer_Swap_Depegging(t *testing.T) {
app.LeverageKeeper,
oracleMock,
app.UGovKeeperB.EmergencyGroup,
app.AuctionKeeperB.Accs.RewardsCollect,

Check failure on line 619 in x/metoken/keeper/intest/msg_server_test.go

View workflow job for this annotation

GitHub Actions / test-unit-cover

app.AuctionKeeperB.Accs undefined (type "github.com/umee-network/umee/v6/x/auction/keeper".Builder has no field or method Accs)
)
app.MetokenKeeperB = kb
msgServer = keeper.NewMsgServerImpl(app.MetokenKeeperB)
Expand Down Expand Up @@ -714,6 +715,7 @@ func TestMsgServer_Swap_Depegging(t *testing.T) {
app.LeverageKeeper,
oracleMock,
app.UGovKeeperB.EmergencyGroup,
app.AuctionKeeperB.Accs.RewardsCollect,

Check failure on line 718 in x/metoken/keeper/intest/msg_server_test.go

View workflow job for this annotation

GitHub Actions / test-unit-cover

app.AuctionKeeperB.Accs undefined (type "github.com/umee-network/umee/v6/x/auction/keeper".Builder has no field or method Accs)
)
app.MetokenKeeperB = kb
msgServer = keeper.NewMsgServerImpl(app.MetokenKeeperB)
Expand Down Expand Up @@ -1357,6 +1359,7 @@ func TestMsgServer_Redeem_Depegging(t *testing.T) {
app.LeverageKeeper,
oracleMock,
app.UGovKeeperB.EmergencyGroup,
app.AuctionKeeperB.Accs.RewardsCollect,

Check failure on line 1362 in x/metoken/keeper/intest/msg_server_test.go

View workflow job for this annotation

GitHub Actions / test-unit-cover

app.AuctionKeeperB.Accs undefined (type "github.com/umee-network/umee/v6/x/auction/keeper".Builder has no field or method Accs)
)
app.MetokenKeeperB = kb
msgServer = keeper.NewMsgServerImpl(app.MetokenKeeperB)
Expand Down Expand Up @@ -1456,6 +1459,7 @@ func TestMsgServer_Redeem_Depegging(t *testing.T) {
app.LeverageKeeper,
oracleMock,
app.UGovKeeperB.EmergencyGroup,
app.AuctionKeeperB.Accs.RewardsCollect,

Check failure on line 1462 in x/metoken/keeper/intest/msg_server_test.go

View workflow job for this annotation

GitHub Actions / test-unit-cover

app.AuctionKeeperB.Accs undefined (type "github.com/umee-network/umee/v6/x/auction/keeper".Builder has no field or method Accs)
)
app.MetokenKeeperB = kb
msgServer = keeper.NewMsgServerImpl(app.MetokenKeeperB)
Expand Down
5 changes: 5 additions & 0 deletions x/metoken/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Builder struct {
leverageKeeper metoken.LeverageKeeper
oracleKeeper metoken.OracleKeeper
ugov ugov.EmergencyGroupBuilder
rewardsAuction sdk.AccAddress
}

// NewBuilder returns Builder object.
Expand All @@ -28,6 +29,7 @@ func NewBuilder(
leverageKeeper metoken.LeverageKeeper,
oracleKeeper metoken.OracleKeeper,
ugov ugov.EmergencyGroupBuilder,
rewardsAuction sdk.AccAddress,
) Builder {
return Builder{
cdc: cdc,
Expand All @@ -36,6 +38,7 @@ func NewBuilder(
leverageKeeper: leverageKeeper,
oracleKeeper: oracleKeeper,
ugov: ugov,
rewardsAuction: rewardsAuction,
}
}

Expand All @@ -46,6 +49,7 @@ type Keeper struct {
leverageKeeper metoken.LeverageKeeper
oracleKeeper metoken.OracleKeeper
ugov ugov.EmergencyGroupBuilder
rewardsAuction sdk.AccAddress

// TODO: ctx should be removed when we migrate leverageKeeper and oracleKeeper
ctx *sdk.Context
Expand All @@ -60,6 +64,7 @@ func (b Builder) Keeper(ctx *sdk.Context) Keeper {
leverageKeeper: b.leverageKeeper,
oracleKeeper: b.oracleKeeper,
ugov: b.ugov,
rewardsAuction: b.rewardsAuction,
ctx: ctx,
}
}
Expand Down
3 changes: 2 additions & 1 deletion x/metoken/keeper/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/stretchr/testify/require"

"github.com/umee-network/umee/v6/tests/accs"
"github.com/umee-network/umee/v6/tests/tsdk"
"github.com/umee-network/umee/v6/x/metoken"
"github.com/umee-network/umee/v6/x/metoken/mocks"
Expand All @@ -19,7 +20,7 @@ func initSimpleKeeper(t *testing.T) Keeper {
interfaceRegistry := types.NewInterfaceRegistry()
cdc := codec.NewProtoCodec(interfaceRegistry)
storeKey := storetypes.NewMemoryStoreKey("metoken")
kb := NewBuilder(cdc, storeKey, nil, nil, nil, nil)
kb := NewBuilder(cdc, storeKey, nil, nil, nil, nil, accs.GenerateAddr("auction.Rewards"))
ctx, _ := tsdk.NewCtxOneStore(t, storeKey)

k := kb.Keeper(&ctx)
Expand Down

0 comments on commit e2c0c6e

Please sign in to comment.