Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7ee29bc
add distribution module
Pantani Jun 23, 2025
2310be2
fix proto paths
Pantani Jun 24, 2025
d00f411
regenerate pulsar files
Pantani Jun 25, 2025
5266df2
remove unused and legacy code
Pantani Jun 25, 2025
32e45b7
export mint query server
Pantani Jun 25, 2025
0b02f80
Merge branch 'julien/050' into feat/dstr-module
Pantani Jun 25, 2025
0c12be8
rollback unecessary changes
Pantani Jun 25, 2025
69bf280
remove unecessary keeper interface
Pantani Jun 25, 2025
88058af
fix duplicated error register and makefile check version
Pantani Jun 25, 2025
88881d0
fix distribute reward
Pantani Jun 27, 2025
cbdf45c
fix linter
Pantani Jul 1, 2025
6c5996d
fix allocation tests
Pantani Jul 1, 2025
229a74f
remove mint query server
Pantani Jul 1, 2025
ea05f4a
get bound denom from staking module
Pantani Jul 1, 2025
6211eec
improve allocate bonus logic
Pantani Jul 1, 2025
e829cd8
allocation test
Pantani Jul 1, 2025
7067fb7
fix makefile
Pantani Jul 3, 2025
3388b61
fix validate params
Pantani Jul 3, 2025
4f3c853
reollback some cli methods
Pantani Jul 3, 2025
ee009d0
remove mocks from lint
Pantani Jul 3, 2025
1b4154a
fix wrong msg paths
Pantani Jul 3, 2025
11cca60
Merge branch 'julien/050' into feat/dstr-module
Pantani Jul 3, 2025
10d31ec
fix wrong path
Pantani Jul 3, 2025
bda5450
clone distribution module
Pantani Jul 10, 2025
db6d58f
rollback `check_go_version` from Makefile
Pantani Jul 10, 2025
eb46bca
rollback some generetaed files
Pantani Jul 10, 2025
f19fd5b
rollback gov changes
Pantani Jul 10, 2025
1968023
rollback makefile
Pantani Jul 11, 2025
553168a
add dynamically change for nakamoto coefficient
Pantani Jul 11, 2025
a29f4a6
adjust the nakamoto bonus first
Pantani Jul 12, 2025
9d46d8b
fix bounded tokens status
Pantani Jul 13, 2025
d0b403c
add full tests and events
Pantani Jul 13, 2025
bf0bc66
add NakamotoBonusEnabled logic
Pantani Jul 13, 2025
1aba26b
Merge branch 'julien/050' into Pantani/feat/dstr-module
Pantani Jul 16, 2025
fd9d499
Merge branch 'Pantani/feat/dstr-module' into Pantani/feat/nakamoto-bonus
Pantani Jul 16, 2025
3332833
fix lint
Pantani Jul 16, 2025
ea6d970
get latest improvements
Pantani Jul 16, 2025
cca07d1
Merge branch 'Pantani/feat/dstr-module' into Pantani/feat/nakamoto-bonus
Pantani Jul 16, 2025
7542b5c
fix lint
Pantani Jul 16, 2025
327d7fb
add test params for nakamoto bonus
Pantani Jul 16, 2025
ced2d37
move constants to types pkg
Pantani Jul 16, 2025
7bc8745
Merge branch 'julien/050' into Pantani/feat/nakamoto-bonus
Pantani Aug 4, 2025
f02f0e3
Merge branch 'julien/050' into Pantani/feat/dstr-module
Pantani Aug 4, 2025
794ab3e
remove pulsar files
Pantani Aug 4, 2025
173a223
remove pulsar files
Pantani Aug 4, 2025
f7dd803
remove dreprecated skip files
Pantani Aug 4, 2025
c858fa6
remove deprecated lint rules
Pantani Aug 4, 2025
46ccfa7
fix lint
Pantani Aug 4, 2025
8c5f5aa
fix cosmos grpc paths
Pantani Aug 11, 2025
e092e68
Merge branch 'julien/050' into Pantani/feat/dstr-module
Pantani Aug 11, 2025
ce96707
format proto files
Pantani Aug 11, 2025
48b97ba
format query.proto
Pantani Aug 11, 2025
133ad46
Merge branch 'Pantani/feat/dstr-module' into Pantani/feat/nakamoto-bonus
Pantani Aug 11, 2025
a5c734c
fix proto path
Pantani Aug 11, 2025
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
12 changes: 6 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ run:
tests: false
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m
skip-dirs:
- tests/
skip-files:
- ".*\\.pb\\.go$"
- ".*\\.pb\\.gw\\.go$"

linters:
disable-all: true
enable:
Expand All @@ -33,6 +27,11 @@ linters:
- unused

issues:
exclude-dirs:
- tests/
exclude-files:
- ".*\\.pb\\.go$"
- ".*\\.pb\\.gw\\.go$"
exclude-rules:
- text: "Use of weak random number generator"
linters:
Expand All @@ -59,6 +58,7 @@ issues:
- gosec
text: "G115: integer overflow conversion"


max-issues-per-linter: 10000
max-same-issues: 10000

Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ docker-build-all: docker-build-debug docker-build-hermes
mockgen_cmd=$(rundep) github.com/golang/mock/mockgen

mocks-gen:
$(mockgen_cmd) -source=x/distribution/types/expected_keepers.go -package testutil -destination x/distribution/testutil/expected_keepers_mocks.go
$(mockgen_cmd) -source=x/gov/testutil/expected_keepers.go -package testutil -destination x/gov/testutil/expected_keepers_mocks.go
$(mockgen_cmd) -source=x/photon/types/expected_keepers.go -package testutil -destination x/photon/testutil/expected_keepers_mocks.go
$(mockgen_cmd) -source=x/photon/ante/expected_keepers.go -package ante_test -destination x/photon/ante/expected_keepers_mocks_test.go
Expand Down Expand Up @@ -249,6 +250,7 @@ format: lint-fix
-not -path "*.git*" \
-not -name "*.pb.go" \
-not -name "*.pb.gw.go" \
-not -name "*_mocks.go" \
| xargs $(rundep) mvdan.cc/gofumpt -w -l

.PHONY: format lint lint-fix
Expand Down
4 changes: 2 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
Expand All @@ -51,6 +49,8 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

distrkeeper "github.com/atomone-hub/atomone/x/distribution/keeper"
distrtypes "github.com/atomone-hub/atomone/x/distribution/types"
dynamicfeekeeper "github.com/atomone-hub/atomone/x/dynamicfee/keeper"
dynamicfeetypes "github.com/atomone-hub/atomone/x/dynamicfee/types"
govkeeper "github.com/atomone-hub/atomone/x/gov/keeper"
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

distrtypes "github.com/atomone-hub/atomone/x/distribution/types"
dynamicfeetypes "github.com/atomone-hub/atomone/x/dynamicfee/types"
govtypes "github.com/atomone-hub/atomone/x/gov/types"
photontypes "github.com/atomone-hub/atomone/x/photon/types"
Expand Down
6 changes: 3 additions & 3 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/mint"
Expand All @@ -39,6 +37,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

distr "github.com/atomone-hub/atomone/x/distribution"
distrtypes "github.com/atomone-hub/atomone/x/distribution/types"
"github.com/atomone-hub/atomone/x/dynamicfee"
dynamicfeetypes "github.com/atomone-hub/atomone/x/dynamicfee/types"
"github.com/atomone-hub/atomone/x/gov"
Expand Down Expand Up @@ -85,7 +85,7 @@ func appModules(
),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
photon.NewAppModule(appCodec, *app.PhotonKeeper, app.BankKeeper, app.AccountKeeper, app.StakingKeeper),
upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()),
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v3/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"

"github.com/atomone-hub/atomone/app/keepers"
distrkeeper "github.com/atomone-hub/atomone/x/distribution/keeper"
distrtypes "github.com/atomone-hub/atomone/x/distribution/types"
govkeeper "github.com/atomone-hub/atomone/x/gov/keeper"
v1 "github.com/atomone-hub/atomone/x/gov/types/v1"
photontypes "github.com/atomone-hub/atomone/x/photon/types"
Expand Down
16 changes: 16 additions & 0 deletions proto/atomone/distribution/module/v1/module.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";

package atomone.distribution.module.v1;

import "cosmos/app/v1alpha1/module.proto";

// Module is the config object of the distribution module.
message Module {
option (cosmos.app.v1alpha1.module) = {go_import: "github.com/atomone-hub/atomone/x/distribution"};

string fee_collector_name = 1;

// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
}
164 changes: 164 additions & 0 deletions proto/atomone/distribution/v1beta1/distribution.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
syntax = "proto3";
package atomone.distribution.v1beta1;

import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/atomone-hub/atomone/x/distribution/types";
option (gogoproto.equal_all) = true;

// Params defines the set of params for the distribution module.
message Params {
option (amino.name) = "cosmos-sdk/x/distribution/Params";

string community_tax = 1 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(amino.dont_omitempty) = true,
(gogoproto.nullable) = false
];

bool withdraw_addr_enabled = 4;

string nakamoto_bonus_coefficient = 5 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(amino.dont_omitempty) = true,
(gogoproto.nullable) = false
];

bool nakamoto_bonus_enabled = 6;
}

// ValidatorHistoricalRewards represents historical rewards for a validator.
// Height is implicit within the store key.
// Cumulative reward ratio is the sum from the zeroeth period
// until this period of rewards / tokens, per the spec.
// The reference count indicates the number of objects
// which might need to reference this historical entry at any point.
// ReferenceCount =
// number of outstanding delegations which ended the associated period (and
// might need to read that record)
// + number of slashes which ended the associated period (and might need to
// read that record)
// + one per validator for the zeroeth period, set on initialization
message ValidatorHistoricalRewards {
repeated cosmos.base.v1beta1.DecCoin cumulative_reward_ratio = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
uint32 reference_count = 2;
}

// ValidatorCurrentRewards represents current rewards and current
// period for a validator kept as a running counter and incremented
// each block as long as the validator's tokens remain constant.
message ValidatorCurrentRewards {
repeated cosmos.base.v1beta1.DecCoin rewards = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
uint64 period = 2;
}

// ValidatorAccumulatedCommission represents accumulated commission
// for a validator kept as a running counter, can be withdrawn at any time.
message ValidatorAccumulatedCommission {
repeated cosmos.base.v1beta1.DecCoin commission = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards
// for a validator inexpensive to track, allows simple sanity checks.
message ValidatorOutstandingRewards {
repeated cosmos.base.v1beta1.DecCoin rewards = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// ValidatorSlashEvent represents a validator slash event.
// Height is implicit within the store key.
// This is needed to calculate appropriate amount of staking tokens
// for delegations which are withdrawn after a slash has occurred.
message ValidatorSlashEvent {
uint64 validator_period = 1;
string fraction = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];
}

// ValidatorSlashEvents is a collection of ValidatorSlashEvent messages.
message ValidatorSlashEvents {
repeated ValidatorSlashEvent validator_slash_events = 1 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// FeePool is the global fee pool for distribution.
message FeePool {
repeated cosmos.base.v1beta1.DecCoin community_pool = 1 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"
];
}

// DelegatorStartingInfo represents the starting info for a delegator reward
// period. It tracks the previous validator period, the delegation's amount of
// staking token, and the creation height (to check later on if any slashes have
// occurred). NOTE: Even though validators are slashed to whole staking tokens,
// the delegators within the validator may be left with less than a full token,
// thus sdk.Dec is used.
message DelegatorStartingInfo {
uint64 previous_period = 1;
string stake = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
uint64 height = 3 [
(gogoproto.jsontag) = "creation_height",
(amino.field_name) = "creation_height",
(amino.dont_omitempty) = true
];
}

// DelegationDelegatorReward represents the properties
// of a delegator's delegation reward.
message DelegationDelegatorReward {
option (gogoproto.goproto_getters) = false;

string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"];

repeated cosmos.base.v1beta1.DecCoin reward = 2 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal
// with a deposit
message CommunityPoolSpendProposalWithDeposit {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

string title = 1;
string description = 2;
string recipient = 3;
string amount = 4;
string deposit = 5;
}
Loading
Loading