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(x/protocolpool,x/distribution)!: remove dependency + fix continuous fund bug #20790

Merged
merged 46 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
75df477
improvements on protocolpool, remove unnecessary code, add tests
facundomedica Jun 26, 2024
683c2ef
reduce math complexity and less iterations
facundomedica Jun 26, 2024
69987d3
more simplifying
facundomedica Jun 26, 2024
e0089c2
skip test, more simplification
facundomedica Jun 26, 2024
dad3c91
lint fix
facundomedica Jun 26, 2024
e432de0
rollback some lint fixes
facundomedica Jun 26, 2024
c2f16e9
rollback some lint fixes
facundomedica Jun 26, 2024
88e1ac7
remove protocolpool dependency
facundomedica Jun 26, 2024
c4eb064
fix tests
facundomedica Jun 26, 2024
8128913
modify protocolpool
facundomedica Jun 26, 2024
a416037
add beginblockers
facundomedica Jun 26, 2024
16f8858
forgot to add the function hehe
facundomedica Jun 26, 2024
89c33b3
the 4th is the charm
facundomedica Jun 26, 2024
7efb7b9
fix test
facundomedica Jun 27, 2024
9fe6cfa
fix, send percentage of distributed funds instead of all funds in com…
facundomedica Jun 27, 2024
c60a84e
fix
facundomedica Jun 27, 2024
a47f15d
merge
facundomedica Jun 27, 2024
4ea9404
merge
facundomedica Jun 27, 2024
05a0e90
Merge branch 'main' of https://github.com/cosmos/cosmos-sdk into facu…
facundomedica Jun 27, 2024
a46fe68
Merge branch 'facu/protopool-imp' of https://github.com/cosmos/cosmos…
facundomedica Jun 27, 2024
42f3141
improvement, we have an intermediary account
facundomedica Jun 27, 2024
50b913d
fix commment
facundomedica Jun 27, 2024
a66c41f
fix tests
facundomedica Jun 27, 2024
2a682a9
add replace
facundomedica Jun 28, 2024
ce384c6
fix
facundomedica Jun 28, 2024
a80b754
fix tests
facundomedica Jun 28, 2024
a2a71d0
merge
facundomedica Jun 28, 2024
3cfa09b
fix unit tests
facundomedica Jun 28, 2024
047be60
small fixes
facundomedica Jun 28, 2024
86e3d07
go mod tidy
facundomedica Jun 28, 2024
32f45a1
cl++
facundomedica Jun 28, 2024
e313a3e
fix tests
facundomedica Jul 9, 2024
b96398f
fix all tests
facundomedica Jul 9, 2024
b85069d
remove
facundomedica Jul 9, 2024
c3588ff
merge main
facundomedica Jul 9, 2024
62f3703
fix
facundomedica Jul 10, 2024
bf31209
lint fix
facundomedica Jul 10, 2024
a8187da
Merge branch 'main' of https://github.com/cosmos/cosmos-sdk into facu…
facundomedica Jul 10, 2024
c9e24ce
fixes
facundomedica Jul 10, 2024
5738ab0
fixes and add tests
facundomedica Jul 10, 2024
fdedde6
lint
facundomedica Jul 10, 2024
f7b265c
rebuild mocks
facundomedica Jul 10, 2024
c1deb95
fix mocks
facundomedica Jul 10, 2024
4dc77b1
added genesis stuff
facundomedica Jul 16, 2024
d34617a
merge main
facundomedica Jul 24, 2024
57d33eb
Merge branch 'main' into facu/removepooldep-distr
facundomedica Jul 24, 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
1,013 changes: 869 additions & 144 deletions api/cosmos/protocolpool/v1/genesis.pulsar.go

Large diffs are not rendered by default.

67 changes: 34 additions & 33 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
"cosmossdk.io/client/v2/autocli"
clienthelpers "cosmossdk.io/client/v2/helpers"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/log"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/accounts"
Expand Down Expand Up @@ -124,15 +123,16 @@ var (

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
pooltypes.ModuleName: nil,
pooltypes.StreamAccount: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
nft.ModuleName: nil,
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
pooltypes.ModuleName: nil,
pooltypes.StreamAccount: nil,
pooltypes.ProtocolPoolDistrAccount: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
nft.ModuleName: nil,
}
)

Expand Down Expand Up @@ -354,7 +354,7 @@ func NewSimApp(

app.PoolKeeper = poolkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[pooltypes.StoreKey]), logger.With(log.ModuleKey, "x/protocolpool")), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String())

app.DistrKeeper = distrkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger.With(log.ModuleKey, "x/distribution")), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, app.PoolKeeper, cometService, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String())
app.DistrKeeper = distrkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger.With(log.ModuleKey, "x/distribution")), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, cometService, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String())

app.SlashingKeeper = slashingkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), logger.With(log.ModuleKey, "x/slashing")),
appCodec, legacyAmino, app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(),
Expand Down Expand Up @@ -437,28 +437,28 @@ func NewSimApp(

// NOTE: Any module instantiated in the module manager that is later modified
// must be passed by reference here.
app.ModuleManager = module.NewManagerFromMap(map[string]appmodule.AppModule{
genutiltypes.ModuleName: genutil.NewAppModule(appCodec, app.AuthKeeper, app.StakingKeeper, app, txConfig, genutiltypes.DefaultMessageValidator),
accounts.ModuleName: accounts.NewAppModule(appCodec, app.AccountsKeeper),
authtypes.ModuleName: auth.NewAppModule(appCodec, app.AuthKeeper, app.AccountsKeeper, authsims.RandomGenesisAccounts),
vestingtypes.ModuleName: vesting.NewAppModule(app.AuthKeeper, app.BankKeeper),
banktypes.ModuleName: bank.NewAppModule(appCodec, app.BankKeeper, app.AuthKeeper),
feegrant.ModuleName: feegrantmodule.NewAppModule(appCodec, app.AuthKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
govtypes.ModuleName: gov.NewAppModule(appCodec, &app.GovKeeper, app.AuthKeeper, app.BankKeeper, app.PoolKeeper),
minttypes.ModuleName: mint.NewAppModule(appCodec, app.MintKeeper, app.AuthKeeper, nil),
slashingtypes.ModuleName: slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AuthKeeper, app.BankKeeper, app.StakingKeeper, app.interfaceRegistry, cometService),
distrtypes.ModuleName: distr.NewAppModule(appCodec, app.DistrKeeper, app.AuthKeeper, app.BankKeeper, app.StakingKeeper, app.PoolKeeper),
stakingtypes.ModuleName: staking.NewAppModule(appCodec, app.StakingKeeper, app.AuthKeeper, app.BankKeeper),
upgradetypes.ModuleName: upgrade.NewAppModule(app.UpgradeKeeper),
evidencetypes.ModuleName: evidence.NewAppModule(appCodec, app.EvidenceKeeper, cometService),
authz.ModuleName: authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry),
group.ModuleName: groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry),
nft.ModuleName: nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry),
consensusparamtypes.ModuleName: consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
circuittypes.ModuleName: circuit.NewAppModule(appCodec, app.CircuitKeeper),
pooltypes.ModuleName: protocolpool.NewAppModule(appCodec, app.PoolKeeper, app.AuthKeeper, app.BankKeeper),
epochstypes.ModuleName: epochs.NewAppModule(appCodec, app.EpochsKeeper),
})
app.ModuleManager = module.NewManager(
genutil.NewAppModule(appCodec, app.AuthKeeper, app.StakingKeeper, app, txConfig, genutiltypes.DefaultMessageValidator),
accounts.NewAppModule(appCodec, app.AccountsKeeper),
auth.NewAppModule(appCodec, app.AuthKeeper, app.AccountsKeeper, authsims.RandomGenesisAccounts),
vesting.NewAppModule(app.AuthKeeper, app.BankKeeper),
bank.NewAppModule(appCodec, app.BankKeeper, app.AuthKeeper),
feegrantmodule.NewAppModule(appCodec, app.AuthKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
gov.NewAppModule(appCodec, &app.GovKeeper, app.AuthKeeper, app.BankKeeper, app.PoolKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AuthKeeper, nil),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AuthKeeper, app.BankKeeper, app.StakingKeeper, app.interfaceRegistry, cometService),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AuthKeeper, app.BankKeeper, app.StakingKeeper),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AuthKeeper, app.BankKeeper),
upgrade.NewAppModule(app.UpgradeKeeper),
evidence.NewAppModule(appCodec, app.EvidenceKeeper, cometService),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry),
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry),
nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
circuit.NewAppModule(appCodec, app.CircuitKeeper),
protocolpool.NewAppModule(appCodec, app.PoolKeeper, app.AuthKeeper, app.BankKeeper),
epochs.NewAppModule(appCodec, app.EpochsKeeper),
)

app.ModuleManager.RegisterLegacyAminoCodec(legacyAmino)
app.ModuleManager.RegisterInterfaces(interfaceRegistry)
Expand All @@ -474,6 +474,7 @@ func NewSimApp(
app.ModuleManager.SetOrderBeginBlockers(
minttypes.ModuleName,
distrtypes.ModuleName,
pooltypes.ModuleName,
slashingtypes.ModuleName,
evidencetypes.ModuleName,
stakingtypes.ModuleName,
Expand Down
2 changes: 2 additions & 0 deletions simapp/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ var (
{Account: distrtypes.ModuleName},
{Account: pooltypes.ModuleName},
{Account: pooltypes.StreamAccount},
{Account: pooltypes.ProtocolPoolDistrAccount},
{Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}},
{Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
{Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
Expand Down Expand Up @@ -119,6 +120,7 @@ var (
BeginBlockers: []string{
minttypes.ModuleName,
distrtypes.ModuleName,
pooltypes.ModuleName,
slashingtypes.ModuleName,
evidencetypes.ModuleName,
stakingtypes.ModuleName,
Expand Down
2 changes: 2 additions & 0 deletions simapp/v2/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ var (
{Account: distrtypes.ModuleName},
{Account: pooltypes.ModuleName},
{Account: pooltypes.StreamAccount},
{Account: pooltypes.ProtocolPoolDistrAccount},
{Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}},
{Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
{Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
Expand Down Expand Up @@ -115,6 +116,7 @@ var (
BeginBlockers: []string{
minttypes.ModuleName,
distrtypes.ModuleName,
pooltypes.ModuleName,
slashingtypes.ModuleName,
evidencetypes.ModuleName,
stakingtypes.ModuleName,
Expand Down
15 changes: 8 additions & 7 deletions tests/integration/distribution/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ func initFixture(t *testing.T) *fixture {
authority := authtypes.NewModuleAddress("gov")

maccPerms := map[string][]string{
pooltypes.ModuleName: {},
pooltypes.StreamAccount: {},
distrtypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
pooltypes.ModuleName: {},
pooltypes.StreamAccount: {},
pooltypes.ProtocolPoolDistrAccount: {},
distrtypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
}

// gomock initializations
Expand Down Expand Up @@ -137,13 +138,13 @@ func initFixture(t *testing.T) *fixture {
poolKeeper := poolkeeper.NewKeeper(cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[pooltypes.StoreKey]), log.NewNopLogger()), accountKeeper, bankKeeper, stakingKeeper, authority.String())

distrKeeper := distrkeeper.NewKeeper(
cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger), accountKeeper, bankKeeper, stakingKeeper, poolKeeper, cometService, distrtypes.ModuleName, authority.String(),
cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger), accountKeeper, bankKeeper, stakingKeeper, cometService, distrtypes.ModuleName, authority.String(),
)

authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts)
bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper)
stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper)
distrModule := distribution.NewAppModule(cdc, distrKeeper, accountKeeper, bankKeeper, stakingKeeper, poolKeeper)
distrModule := distribution.NewAppModule(cdc, distrKeeper, accountKeeper, bankKeeper, stakingKeeper)
poolModule := protocolpool.NewAppModule(cdc, poolKeeper, accountKeeper, bankKeeper)

addr := sdk.AccAddress(PKS[0].Address())
Expand Down
13 changes: 7 additions & 6 deletions tests/integration/gov/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ func initFixture(tb testing.TB) *fixture {
authority := authtypes.NewModuleAddress(types.ModuleName)

maccPerms := map[string][]string{
pooltypes.ModuleName: {},
pooltypes.StreamAccount: {},
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
types.ModuleName: {authtypes.Burner},
pooltypes.ModuleName: {},
pooltypes.StreamAccount: {},
pooltypes.ProtocolPoolDistrAccount: {},
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
types.ModuleName: {authtypes.Burner},
}

// gomock initializations
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/protocolpool/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func TestWithdrawAnytime(t *testing.T) {
// TestExpireInTheMiddle tests if a continuous fund that expires without anyone
// calling the withdraw function, the funds are still distributed correctly.
func TestExpireInTheMiddle(t *testing.T) {
t.Skip("This is a bug @facu found, will fix in another PR")
var accountKeeper authkeeper.AccountKeeper
var protocolpoolKeeper protocolpoolkeeper.Keeper
var bankKeeper bankkeeper.Keeper
Expand Down Expand Up @@ -131,8 +130,8 @@ func TestExpireInTheMiddle(t *testing.T) {
_, err = msgServer.WithdrawContinuousFund(ctx, &protocolpooltypes.MsgWithdrawContinuousFund{
RecipientAddress: testAddr0Str,
})
require.Error(t, err)
require.NoError(t, err)

endBalance := bankKeeper.GetBalance(ctx, testAddrs[0], sdk.DefaultBondDenom)
require.Equal(t, "158441stake", endBalance.String())
require.Equal(t, "237661stake", endBalance.String())
}
2 changes: 2 additions & 0 deletions testutil/configurator/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func defaultConfig() *Config {
BeginBlockersOrder: []string{
testutil.MintModuleName,
testutil.DistributionModuleName,
testutil.ProtocolPoolModuleName,
testutil.SlashingModuleName,
testutil.EvidenceModuleName,
testutil.StakingModuleName,
Expand Down Expand Up @@ -164,6 +165,7 @@ func AuthModule() ModuleOption {
{Account: testutil.NFTModuleName},
{Account: testutil.ProtocolPoolModuleName},
{Account: "stream_acc"},
{Account: "protocolpool_distr"},
},
}),
}
Expand Down
8 changes: 6 additions & 2 deletions x/distribution/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ Ref: https://keepachangelog.com/en/1.0.0/

*

### API Breaking Changes
### Improvements

* [#20790](https://github.com/cosmos/cosmos-sdk/pull/20790) `x/distribution` does not depend on `x/protocolpool` anymore, now `x/distribution` only does token transfers and `x/protocolpool` does the rest.

### API Breaking Changes

* [#20790](https://github.com/cosmos/cosmos-sdk/pull/20790) `x/distribution` does not depend on `x/protocolpool` anymore, meaning NewAppModule and NewKeeper do not take it as an argument.
* [#20588](https://github.com/cosmos/cosmos-sdk/pull/20588) `x/distribution` now takes cometService in order to get consensus related information.
* [#19868](https://github.com/cosmos/cosmos-sdk/pull/19868) Removes Accounts String method
* `NewMsgSetWithdrawAddress` now takes strings as argument instead of `sdk.AccAddress`.
Expand All @@ -52,7 +56,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* remove `Keeper`: `SetDelegatorWithdrawAddr`, `DeleteDelegatorWithdrawAddr`, `IterateDelegatorWithdrawAddrs`.
* [#16459](https://github.com/cosmos/cosmos-sdk/pull/16459) use collections for `ValidatorCurrentRewards` state management:
* remove `Keeper`: `IterateValidatorCurrentRewards`, `GetValidatorCurrentRewards`, `SetValidatorCurrentRewards`, `DeleteValidatorCurrentRewards`
* [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) The distribution module keeper now takes a new argument `PoolKeeper` in addition.
* [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) ~The distribution module keeper now takes a new argument `PoolKeeper` in addition.~ Reverted on #20790
* [#17670](https://github.com/cosmos/cosmos-sdk/pull/17670) `AllocateTokens` takes `comet.VoteInfos` instead of `[]abci.VoteInfo`
* [#19740](https://github.com/cosmos/cosmos-sdk/pull/19740) `InitGenesis` and `ExportGenesis` module code and keeper code do not panic but return errors.

Expand Down
4 changes: 1 addition & 3 deletions x/distribution/depinject.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ type ModuleInputs struct {
AccountKeeper types.AccountKeeper
BankKeeper types.BankKeeper
StakingKeeper types.StakingKeeper
PoolKeeper types.PoolKeeper
}

type ModuleOutputs struct {
Expand Down Expand Up @@ -70,13 +69,12 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
in.AccountKeeper,
in.BankKeeper,
in.StakingKeeper,
in.PoolKeeper,
in.CometService,
feeCollectorName,
authorityAddr,
)

m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.StakingKeeper, in.PoolKeeper)
m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.StakingKeeper)

return ModuleOutputs{
DistrKeeper: k,
Expand Down
1 change: 1 addition & 0 deletions x/distribution/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ replace (
cosmossdk.io/x/auth => ../auth
cosmossdk.io/x/bank => ../bank
cosmossdk.io/x/consensus => ../consensus
cosmossdk.io/x/protocolpool => ../protocolpool
cosmossdk.io/x/staking => ../staking
cosmossdk.io/x/tx => ../tx
)
2 changes: 0 additions & 2 deletions x/distribution/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA=
cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg=
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU=
cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o=
cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
Expand Down
9 changes: 2 additions & 7 deletions x/distribution/keeper/allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo
}
// send to community pool and set remainder in fee pool
amt, re := remaining.TruncateDecimal()
if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ProtocolPoolModuleName, amt); err != nil {
return err
}

// set ToDistribute in protocolpool to keep track of continuous funds distribution
if err := k.poolKeeper.SetToDistribute(ctx, amt, k.GetAuthority()); err != nil { // TODO: this should be distribution module account
if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ProtocolPoolDistrAccount, amt); err != nil {
return err
}

Expand Down Expand Up @@ -170,7 +165,7 @@ func (k Keeper) sendDecimalPoolToCommunityPool(ctx context.Context) error {
}

amt, re := feePool.DecimalPool.TruncateDecimal()
if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ProtocolPoolModuleName, amt); err != nil {
if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ProtocolPoolDistrAccount, amt); err != nil {
return err
}

Expand Down
Loading
Loading