From 164e4fd33d5fc6909ab6438cd0094f1ffcfc5079 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Fri, 27 Sep 2024 19:12:15 +0530 Subject: [PATCH 01/14] feat: update params proto to add inflation change percentage --- proto/arkeo/arkeo/params.proto | 7 +-- x/arkeo/types/params.go | 7 +-- x/arkeo/types/params.pb.go | 96 ++++++++++++++++++++++++++-------- 3 files changed, 81 insertions(+), 29 deletions(-) diff --git a/proto/arkeo/arkeo/params.proto b/proto/arkeo/arkeo/params.proto index b7a7de5f..d32d5a75 100644 --- a/proto/arkeo/arkeo/params.proto +++ b/proto/arkeo/arkeo/params.proto @@ -10,7 +10,8 @@ option go_package = "github.com/arkeonetwork/arkeo/x/arkeo/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; - string CommunityPoolPercentage= 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - string DevFundPercentage= 2 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - string GrantFundPercentage= 3 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; + string community_pool_percentage= 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; + string dev_fund_percentage= 2 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; + string grant_fund_percentage= 3 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; + string inflation_change_percentage = 4 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; } diff --git a/x/arkeo/types/params.go b/x/arkeo/types/params.go index ebfb1a91..cefc91c1 100644 --- a/x/arkeo/types/params.go +++ b/x/arkeo/types/params.go @@ -16,9 +16,10 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams() Params { return Params{ - CommunityPoolPercentage: math.NewInt(10), - DevFundPercentage: math.NewInt(20), - GrantFundPercentage: math.NewInt(20), + CommunityPoolPercentage: math.NewInt(10), + DevFundPercentage: math.NewInt(20), + GrantFundPercentage: math.NewInt(20), + InflationChangePercentage: math.NewInt(13), } } diff --git a/x/arkeo/types/params.pb.go b/x/arkeo/types/params.pb.go index 7bff56db..86facb70 100644 --- a/x/arkeo/types/params.pb.go +++ b/x/arkeo/types/params.pb.go @@ -29,9 +29,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - CommunityPoolPercentage cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=CommunityPoolPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"CommunityPoolPercentage"` - DevFundPercentage cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=DevFundPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"DevFundPercentage"` - GrantFundPercentage cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=GrantFundPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"GrantFundPercentage"` + CommunityPoolPercentage cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=community_pool_percentage,json=communityPoolPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"community_pool_percentage"` + DevFundPercentage cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=dev_fund_percentage,json=devFundPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"dev_fund_percentage"` + GrantFundPercentage cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=grant_fund_percentage,json=grantFundPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"grant_fund_percentage"` + InflationChangePercentage cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=inflation_change_percentage,json=inflationChangePercentage,proto3,customtype=cosmossdk.io/math.Int" json:"inflation_change_percentage"` } func (m *Params) Reset() { *m = Params{} } @@ -73,26 +74,29 @@ func init() { func init() { proto.RegisterFile("arkeo/arkeo/params.proto", fileDescriptor_47c871f4fc73dfc5) } var fileDescriptor_47c871f4fc73dfc5 = []byte{ - // 290 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0x2c, 0xca, 0x4e, - 0xcd, 0xd7, 0x87, 0x90, 0x05, 0x89, 0x45, 0x89, 0xb9, 0xc5, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, - 0x42, 0xdc, 0x60, 0x31, 0x3d, 0x30, 0x29, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x16, 0xd7, 0x07, - 0xb1, 0x20, 0x4a, 0xa4, 0xe4, 0x92, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x93, 0x12, 0x8b, 0x53, - 0xf5, 0xcb, 0x0c, 0x93, 0x52, 0x4b, 0x12, 0x0d, 0xf5, 0x93, 0xf3, 0x33, 0xf3, 0xa0, 0xf2, 0x92, - 0x10, 0xf9, 0x78, 0x88, 0x46, 0x08, 0x07, 0x22, 0xa5, 0xb4, 0x9e, 0x89, 0x8b, 0x2d, 0x00, 0x6c, - 0x9d, 0x50, 0x2a, 0x97, 0xb8, 0x73, 0x7e, 0x6e, 0x6e, 0x69, 0x5e, 0x66, 0x49, 0x65, 0x40, 0x7e, - 0x7e, 0x4e, 0x40, 0x6a, 0x51, 0x72, 0x6a, 0x5e, 0x49, 0x62, 0x7a, 0xaa, 0x04, 0xa3, 0x02, 0xa3, - 0x06, 0xa7, 0x93, 0xf6, 0x89, 0x7b, 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0x8b, 0x42, 0x4c, 0x28, 0x4e, - 0xc9, 0xd6, 0xcb, 0xcc, 0xd7, 0xcf, 0x4d, 0x2c, 0xc9, 0xd0, 0xf3, 0xcc, 0x2b, 0xb9, 0xb4, 0x45, - 0x97, 0x0b, 0x6a, 0xb4, 0x67, 0x5e, 0x49, 0x10, 0x2e, 0xb3, 0x84, 0x22, 0xb9, 0x04, 0x5d, 0x52, - 0xcb, 0xdc, 0x4a, 0xf3, 0x52, 0x90, 0x2c, 0x60, 0x22, 0xdd, 0x02, 0x4c, 0x53, 0x84, 0x62, 0xb9, - 0x84, 0xdd, 0x8b, 0x12, 0xf3, 0x4a, 0xd0, 0x0c, 0x67, 0x26, 0xdd, 0x70, 0x6c, 0xe6, 0x58, 0xb1, - 0xcc, 0x58, 0x20, 0xcf, 0xe0, 0xe4, 0x7a, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, - 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, - 0x51, 0xda, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0x90, 0x88, 0xcc, 0x4b, - 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0x86, 0xc6, 0x6a, 0x05, 0x94, 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, - 0x62, 0x03, 0x87, 0xbf, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xf8, 0x23, 0xd7, 0xf9, 0x01, - 0x00, 0x00, + // 340 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xb1, 0x4e, 0xf3, 0x30, + 0x10, 0xc7, 0x93, 0xaf, 0x55, 0xa5, 0xcf, 0x4c, 0xb4, 0x54, 0xb4, 0x45, 0x72, 0x11, 0x13, 0x52, + 0x45, 0xa2, 0x8a, 0x8d, 0xb1, 0x08, 0xa4, 0x6e, 0x15, 0x23, 0x0c, 0x91, 0x93, 0xb8, 0x6e, 0x94, + 0xc6, 0x17, 0xc5, 0x97, 0x42, 0xdf, 0x82, 0x91, 0x11, 0xf1, 0x0c, 0x3c, 0x44, 0xc7, 0x8a, 0x09, + 0x31, 0x54, 0xa8, 0x7d, 0x11, 0x84, 0x1d, 0x95, 0x0a, 0xa6, 0x2c, 0x67, 0xfb, 0xfe, 0xf6, 0xef, + 0x37, 0xf8, 0x48, 0x8b, 0x65, 0x31, 0x07, 0xd7, 0xd4, 0x94, 0x65, 0x2c, 0x51, 0x4e, 0x9a, 0x01, + 0x42, 0x7d, 0x4f, 0xf7, 0x1c, 0x5d, 0x3b, 0x07, 0x02, 0x04, 0xe8, 0xbe, 0xfb, 0xbd, 0x33, 0x57, + 0x3a, 0x34, 0x00, 0x95, 0x80, 0x72, 0x7d, 0xa6, 0xb8, 0x3b, 0xeb, 0xfb, 0x1c, 0x59, 0xdf, 0x0d, + 0x20, 0x92, 0x45, 0xde, 0x36, 0xb9, 0x67, 0x1e, 0x9a, 0x83, 0x89, 0x4e, 0x5e, 0x2a, 0xa4, 0x36, + 0xd2, 0xba, 0xba, 0x20, 0xed, 0x00, 0x92, 0x24, 0x97, 0x11, 0xce, 0xbd, 0x14, 0x60, 0xea, 0xa5, + 0x3c, 0x0b, 0xb8, 0x44, 0x26, 0x78, 0xcb, 0x3e, 0xb6, 0x4f, 0xff, 0x0f, 0x7a, 0x8b, 0x55, 0xd7, + 0xfa, 0x58, 0x75, 0x9b, 0x86, 0xa1, 0xc2, 0xd8, 0x89, 0xc0, 0x4d, 0x18, 0x4e, 0x9c, 0xa1, 0xc4, + 0xb7, 0xd7, 0x33, 0x52, 0xc0, 0x87, 0x12, 0x6f, 0x0e, 0xb7, 0xb4, 0x11, 0xc0, 0x74, 0xb4, 0x65, + 0xd5, 0xef, 0x48, 0x23, 0xe4, 0x33, 0x6f, 0x9c, 0xcb, 0x70, 0x57, 0xf1, 0xaf, 0xbc, 0x62, 0x3f, + 0xe4, 0xb3, 0xeb, 0x5c, 0x86, 0x3b, 0x70, 0x8f, 0x34, 0x45, 0xc6, 0x24, 0xfe, 0xc1, 0x57, 0xca, + 0xe3, 0x1b, 0x9a, 0xf4, 0x4b, 0x10, 0x93, 0xa3, 0x48, 0x8e, 0xa7, 0x0c, 0x23, 0x90, 0x5e, 0x30, + 0x61, 0x52, 0xf0, 0x5d, 0x4d, 0xb5, 0xbc, 0xa6, 0xbd, 0xe5, 0x5d, 0x6a, 0xdc, 0x8f, 0xec, 0xa2, + 0xfa, 0xf4, 0xdc, 0xb5, 0x06, 0x57, 0x8b, 0x35, 0xb5, 0x97, 0x6b, 0x6a, 0x7f, 0xae, 0xa9, 0xfd, + 0xb8, 0xa1, 0xd6, 0x72, 0x43, 0xad, 0xf7, 0x0d, 0xb5, 0x6e, 0x7b, 0x22, 0xc2, 0x49, 0xee, 0x3b, + 0x01, 0x24, 0x66, 0x76, 0x24, 0xc7, 0x7b, 0xc8, 0xe2, 0x62, 0x90, 0x1e, 0x8a, 0x15, 0xe7, 0x29, + 0x57, 0x7e, 0x4d, 0x7f, 0xf9, 0xf9, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x6d, 0xf0, 0xe5, + 0x6c, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -115,6 +119,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.InflationChangePercentage.Size() + i -= size + if _, err := m.InflationChangePercentage.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 { size := m.GrantFundPercentage.Size() i -= size @@ -171,6 +185,8 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) l = m.GrantFundPercentage.Size() n += 1 + l + sovParams(uint64(l)) + l = m.InflationChangePercentage.Size() + n += 1 + l + sovParams(uint64(l)) return n } @@ -311,6 +327,40 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationChangePercentage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InflationChangePercentage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From 9a15947d797cfb8ac2fda46bb4389515ebb2614e Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Fri, 27 Sep 2024 19:21:34 +0530 Subject: [PATCH 02/14] feat: update validator token allocation --- app/app.go | 20 ++++++- app/genesis.go | 22 ++++++- x/arkeo/keeper/keeper.go | 105 ++++++++++++++++++++------------- x/arkeo/keeper/manager.go | 69 ++++++++++++---------- x/arkeo/keeper/manager_test.go | 32 +++++----- 5 files changed, 156 insertions(+), 92 deletions(-) diff --git a/app/app.go b/app/app.go index 26a74819..65c61b64 100644 --- a/app/app.go +++ b/app/app.go @@ -12,6 +12,7 @@ import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" clienthelpers "cosmossdk.io/client/v2/helpers" + "cosmossdk.io/math" runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/gogoproto/proto" @@ -620,7 +621,7 @@ func NewArkeoApp( groupmodule.NewAppModule(appCodec, app.Keepers.GroupKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.interfaceRegistry), crisis.NewAppModule(&app.Keepers.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), gov.NewAppModule(appCodec, app.Keepers.GovKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.GetSubspace(govtypes.ModuleName)), - mint.NewAppModule(appCodec, app.Keepers.MintKeeper, app.Keepers.AccountKeeper, minttypes.DefaultInflationCalculationFn, app.GetSubspace(minttypes.ModuleName)), + mint.NewAppModule(appCodec, app.Keepers.MintKeeper, app.Keepers.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.Keepers.SlashingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.Keepers.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), distr.NewAppModule(appCodec, app.Keepers.DistrKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.Keepers.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), staking.NewAppModule(appCodec, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), @@ -760,7 +761,7 @@ func NewArkeoApp( capability.NewAppModule(appCodec, *app.Keepers.CapabilityKeeper, false), feegrantmodule.NewAppModule(appCodec, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.Keepers.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, app.Keepers.GovKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.GetSubspace(govtypes.ModuleName)), - mint.NewAppModule(appCodec, app.Keepers.MintKeeper, app.Keepers.AccountKeeper, minttypes.DefaultInflationCalculationFn, app.GetSubspace(minttypes.ModuleName)), + mint.NewAppModule(appCodec, app.Keepers.MintKeeper, app.Keepers.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), staking.NewAppModule(appCodec, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), distr.NewAppModule(appCodec, app.Keepers.DistrKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.Keepers.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), slashing.NewAppModule(appCodec, app.Keepers.SlashingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.Keepers.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), @@ -852,6 +853,21 @@ func (app *ArkeoApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (* if err != nil { panic(err) } + mintGen := minttypes.GenesisState{ + Minter: minttypes.Minter{ + Inflation: math.LegacyMustNewDecFromStr("0.000000000000000000"), + AnnualProvisions: math.LegacyMustNewDecFromStr("0.000000000000000000"), + }, + Params: minttypes.Params{ + MintDenom: "uarkeo", + InflationRateChange: math.LegacyMustNewDecFromStr("0.000000000000000000"), + InflationMax: math.LegacyMustNewDecFromStr("0.000000000000000000"), + InflationMin: math.LegacyMustNewDecFromStr("0.000000000000000000"), + GoalBonded: math.LegacyNewDec(670000000000000000), + BlocksPerYear: 5256666, + }, + } + genesisState[minttypes.ModuleName] = app.cdc.MustMarshalJSON(&mintGen) return app.mm.InitGenesis(ctx, app.appCodec, genesisState) } diff --git a/app/genesis.go b/app/genesis.go index 5bf0c1da..399e3f17 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -3,7 +3,9 @@ package app import ( "encoding/json" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) // The genesis state of the blockchain is represented here as a map of raw json @@ -17,5 +19,23 @@ type GenesisState map[string]json.RawMessage // NewDefaultGenesisState generates the default state for the application. func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState { - return ModuleBasics.DefaultGenesis(cdc) + defaultGenesis := ModuleBasics.DefaultGenesis(cdc) + // set mint module params for genesis state + mintGen := minttypes.GenesisState{ + Minter: minttypes.Minter{ + Inflation: math.LegacyMustNewDecFromStr("0.000000000000000000"), + AnnualProvisions: math.LegacyMustNewDecFromStr("0.000000000000000000"), + }, + Params: minttypes.Params{ + MintDenom: "uarkeo", + InflationRateChange: math.LegacyMustNewDecFromStr("0.000000000000000000"), + InflationMax: math.LegacyMustNewDecFromStr("0.000000000000000000"), + InflationMin: math.LegacyMustNewDecFromStr("0.000000000000000000"), + GoalBonded: math.LegacyNewDec(670000000000000000), + BlocksPerYear: 5256666, + }, + } + defaultGenesis[minttypes.ModuleName] = cdc.MustMarshalJSON(&mintGen) + + return defaultGenesis } diff --git a/x/arkeo/keeper/keeper.go b/x/arkeo/keeper/keeper.go index b5d1eaa5..f3335d17 100644 --- a/x/arkeo/keeper/keeper.go +++ b/x/arkeo/keeper/keeper.go @@ -63,10 +63,12 @@ type Keeper interface { GetActiveValidators(ctx cosmos.Context) ([]stakingtypes.Validator, error) GetAccount(ctx cosmos.Context, addr cosmos.AccAddress) cosmos.Account StakingSetParams(ctx cosmos.Context, params stakingtypes.Params) error - MintAndDistributeTokens(ctx cosmos.Context, newlyMinted cosmos.Coin) (cosmos.Coin, error) - GetCirculatingSupply(ctx cosmos.Context, denom string) (cosmos.Coin, error) - GetInflationRate(ctx cosmos.Context) (math.LegacyDec, error) + MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.DecCoin) (sdk.DecCoin, error) + GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.DecCoin, error) + GetInflationRate(ctx cosmos.Context) math.LegacyDec MoveTokensFromDistributionToFoundationPoolAccount(ctx cosmos.Context) error + AllocateTokensToValidator(ctx context.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins) error + BurnCoins(ctx context.Context, moduleName string, coins sdk.Coins) error // Query Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) @@ -382,114 +384,125 @@ func (k KVStore) GetAuthority() string { return k.authority } -func (k KVStore) GetCirculatingSupply(ctx cosmos.Context, denom string) (cosmos.Coin, error) { +func (k KVStore) GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.DecCoin, error) { sdkContext := sdk.UnwrapSDKContext(ctx) // Get Total Supply - fullTokenSupply, err := k.coinKeeper.TotalSupply(ctx, &banktypes.QueryTotalSupplyRequest{}) + fullTokenSupply, err := k.coinKeeper.SupplyOf(ctx, &banktypes.QuerySupplyOfRequest{Denom: configs.Denom}) if err != nil { sdkContext.Logger().Error("Failed to get full token supply data", err) - return cosmos.NewCoin(denom, sdkmath.NewInt(0)), err + return sdk.NewDecCoin(denom, sdkmath.NewInt(0)), err } - totalSupply := fullTokenSupply.Supply.AmountOf(configs.Denom) + totalSupply := fullTokenSupply.GetAmount().Amount + + sdkContext.Logger().Info(fmt.Sprintf("TotalSupply %v", totalSupply)) // Get the account addresses whose balances need to be exempted devAccountAddress, err := k.getFoundationDevAccountAddress() if err != nil { - return cosmos.NewCoin(denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) + return sdk.NewDecCoin(denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } communityAccountAddress, err := k.getFoundationCommunityAccountAddress() if err != nil { - return cosmos.NewCoin(denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) + return sdk.NewDecCoin(denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } grantAccountAddress, err := k.getFoundationGrantsAccountAddress() if err != nil { - return cosmos.NewCoin(denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) + return sdk.NewDecCoin(denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } - // Module Address for which the circulating supply should be exempted - moduleAddressToExempt := []sdk.AccAddress{ + // Account Address for which the circulating supply should be exempted + addressToExempt := []sdk.AccAddress{ devAccountAddress, communityAccountAddress, grantAccountAddress, + k.stakingKeeper.GetBondedPool(ctx).GetAddress(), + k.GetModuleAccAddress(types.ModuleName), + k.GetModuleAccAddress("claimarkeo"), } exemptBalance := cosmos.NewInt(0) - // range over the module and create exempt balances - for _, moduleAddress := range moduleAddressToExempt { - moduleBalance := k.coinKeeper.GetBalance(ctx, moduleAddress, denom) - exemptBalance = exemptBalance.Add(moduleBalance.Amount) + sdkContext.Logger().Info("Starting to calculate exempt balances") + + // Range over the module accounts to create exempt balances + for _, address := range addressToExempt { + moduleBalance := k.coinKeeper.GetBalance(ctx, address, denom) + sdkContext.Logger().Info(fmt.Sprintf("Module address: %v, Balance: %v %v", address.String(), moduleBalance.Amount, denom)) + + if !moduleBalance.IsZero() { + exemptBalance = exemptBalance.Add(moduleBalance.Amount) + } else { + sdkContext.Logger().Info(fmt.Sprintf("Module address: %v has zero balance for denom: %v", address.String(), denom)) + } } - // total supply without balances of exempted module circulatingSupply := totalSupply.Sub(exemptBalance) + sdkContext.Logger().Info(fmt.Sprintf("Total supply %v exempted balance %v, final balance %v", totalSupply, exemptBalance, circulatingSupply)) - return cosmos.NewCoin(denom, circulatingSupply), nil + return sdk.NewDecCoin(denom, circulatingSupply), nil } -func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted cosmos.Coin) (sdk.Coin, error) { +func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.DecCoin) (sdk.DecCoin, error) { sdkContext := sdk.UnwrapSDKContext(ctx) params := k.GetParams(ctx) newlyMintedAmount := newlyMinted.Amount // mint newly added tokens to reserve - if err := k.MintToModule(ctx, types.ModuleName, newlyMinted); err != nil { + if err := k.MintToModule(ctx, types.ModuleName, sdk.NewCoin(newlyMinted.Denom, newlyMinted.Amount.RoundInt())); err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to mint %s", err)) - return cosmos.NewCoin(newlyMinted.Denom, sdkmath.NewInt(0)), err + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), err } - devFundAmount := newlyMintedAmount.Mul(params.DevFundPercentage).Quo(sdkmath.NewInt(100)) - communityPoolAmount := newlyMintedAmount.Mul(params.CommunityPoolPercentage).Quo(sdkmath.NewInt(100)) - grantFundAmount := newlyMintedAmount.Mul(params.GrantFundPercentage).Quo(sdkmath.NewInt(100)) + devFundAmount := newlyMintedAmount.Mul(params.DevFundPercentage.ToLegacyDec()).Quo(sdkmath.NewInt(100).ToLegacyDec()) + communityPoolAmount := newlyMintedAmount.Mul(params.CommunityPoolPercentage.ToLegacyDec()).Quo(sdkmath.NewInt(100).ToLegacyDec()) + grantFundAmount := newlyMintedAmount.Mul(params.GrantFundPercentage.ToLegacyDec()).Quo(sdkmath.NewInt(100).ToLegacyDec()) devAccountAddress, err := k.getFoundationDevAccountAddress() if err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to fetch foundational account %s", err)) - return cosmos.NewCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } communityAccountAddress, err := k.getFoundationCommunityAccountAddress() if err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to fetch foundational account %s", err)) - return cosmos.NewCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } grantAccountAddress, err := k.getFoundationGrantsAccountAddress() if err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to fetch foundational account %s", err)) - return cosmos.NewCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } - if err := k.SendFromModuleToAccount(ctx, types.ModuleName, devAccountAddress, cosmos.NewCoins(cosmos.NewCoin(newlyMinted.Denom, devFundAmount))); err != nil { + if err := k.SendFromModuleToAccount(ctx, types.ModuleName, devAccountAddress, cosmos.NewCoins(cosmos.NewCoin(newlyMinted.Denom, devFundAmount.RoundInt()))); err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to send amount to Dev foundational account %s", err)) - return cosmos.NewCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) } - if err := k.SendFromModuleToAccount(ctx, types.ModuleName, communityAccountAddress, cosmos.NewCoins(cosmos.NewCoin(newlyMinted.Denom, communityPoolAmount))); err != nil { + if err := k.SendFromModuleToAccount(ctx, types.ModuleName, communityAccountAddress, cosmos.NewCoins(cosmos.NewCoin(newlyMinted.Denom, communityPoolAmount.RoundInt()))); err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to send amount to Community foundational account %s", err)) - return cosmos.NewCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) } - if err := k.SendFromModuleToAccount(ctx, types.ModuleName, grantAccountAddress, cosmos.NewCoins(cosmos.NewCoin(newlyMinted.Denom, grantFundAmount))); err != nil { + if err := k.SendFromModuleToAccount(ctx, types.ModuleName, grantAccountAddress, cosmos.NewCoins(cosmos.NewCoin(newlyMinted.Denom, grantFundAmount.RoundInt()))); err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to send amount to Grant foundational account %s", err)) - return cosmos.NewCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) } balance := newlyMintedAmount.Sub(devFundAmount).Sub(communityPoolAmount).Sub(grantFundAmount) - return cosmos.NewCoin(newlyMinted.Denom, balance), nil + return sdk.NewDecCoin(newlyMinted.Denom, balance.RoundInt()), nil } -func (k KVStore) GetInflationRate(ctx cosmos.Context) (math.LegacyDec, error) { - minter, err := k.mintKeeper.Minter.Get(ctx) - if err != nil { - return math.LegacyNewDec(0), err - } +func (k KVStore) GetInflationRate(ctx cosmos.Context) math.LegacyDec { + + params := k.GetParams(ctx) - return minter.Inflation, nil + return params.InflationChangePercentage.ToLegacyDec() } // transfer tokens form the Distribution to Foundation Community Pool @@ -506,7 +519,7 @@ func (k KVStore) MoveTokensFromDistributionToFoundationPoolAccount(ctx cosmos.Co return fmt.Errorf("failed to fetch foundational account %s", err) } - if amount.RoundInt64() > 0 { + if !amount.IsZero() { if err := k.distributionKeeper.DistributeFromFeePool(ctx, cosmos.NewCoins(cosmos.NewCoin(configs.Denom, amount.RoundInt())), communityAccountAddress); err != nil { if err.Error() == "community pool does not have sufficient coins to distribute" { ctx.Logger().Info(fmt.Sprintf("%s", err)) @@ -516,7 +529,9 @@ func (k KVStore) MoveTokensFromDistributionToFoundationPoolAccount(ctx cosmos.Co return err } } + } + return nil } @@ -531,3 +546,11 @@ func (k KVStore) getFoundationCommunityAccountAddress() (cosmos.AccAddress, erro func (k KVStore) getFoundationGrantsAccountAddress() (cosmos.AccAddress, error) { return sdk.AccAddressFromBech32(types.FoundationGrantsAccount) } + +func (k KVStore) AllocateTokensToValidator(ctx context.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins) error { + return k.distributionKeeper.AllocateTokensToValidator(ctx, val, tokens) +} + +func (k KVStore) BurnCoins(ctx context.Context, moduleName string, coins sdk.Coins) error { + return k.coinKeeper.BurnCoins(ctx, moduleName, coins) +} diff --git a/x/arkeo/keeper/manager.go b/x/arkeo/keeper/manager.go index d12d4bb5..d2eacf2d 100644 --- a/x/arkeo/keeper/manager.go +++ b/x/arkeo/keeper/manager.go @@ -36,7 +36,6 @@ func (mgr *Manager) BeginBlock(ctx cosmos.Context) error { if err != nil { return err } - ctx.Logger().Info(fmt.Sprintf("current version :%s", swVersion)) if ver > swVersion { panic( fmt.Sprintf("Unsupported Version: update your binary (your version: %d, network consensus version: %d)", @@ -72,13 +71,13 @@ func (mgr *Manager) BeginBlock(ctx cosmos.Context) error { ctx.Logger().Error("unable to send tokens from distribution to pool account", "error", err) } - validatorPayoutCycle := mgr.FetchConfig(ctx, configs.ValidatorPayoutCycle) + validatorPayoutCycle := sdkmath.LegacyNewDec(mgr.FetchConfig(ctx, configs.ValidatorPayoutCycle)) - emissionCurve := mgr.FetchConfig(ctx, configs.EmissionCurve) // Emission curve factor - blocksPerYear := mgr.FetchConfig(ctx, configs.BlocksPerYear) + emissionCurve := sdkmath.LegacyNewDec(mgr.FetchConfig(ctx, configs.EmissionCurve)) // Emission curve factor + blocksPerYear := sdkmath.LegacyNewDec(mgr.FetchConfig(ctx, configs.BlocksPerYear)) // Calculate Block Rewards - blockReward := mgr.calcBlockReward(ctx, circSupply.Amount.ToLegacyDec().RoundInt64(), emissionCurve, blocksPerYear, validatorPayoutCycle) + blockReward := mgr.calcBlockReward(ctx, circSupply.Amount, emissionCurve, blocksPerYear, validatorPayoutCycle) ctx.Logger().Info(fmt.Sprintf("Block Reward %v", blockReward)) // Distribute Minted To Pools @@ -221,7 +220,7 @@ func (mgr Manager) ContractEndBlock(ctx cosmos.Context) error { // units = U / (T / t) // Since the development goal at the moment is to get this chain up and // running, we can save this optimization for another day. -func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, blockReward cosmos.Coin) error { +func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, blockReward sdk.DecCoin) error { if blockReward.IsZero() { return nil } @@ -242,6 +241,7 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl if total.IsZero() { return nil } + totalAllocated := cosmos.ZeroInt() for _, vote := range votes { if vote.BlockIdFlag.String() == "BLOCK_ID_FLAG_ABSENT" || vote.BlockIdFlag.String() == "BLOCK_ID_FLAG_UNKNOWN" { @@ -271,7 +271,7 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl } acc := cosmos.AccAddress(val.GetOperator()) - totalReward := common.GetSafeShare(val.GetDelegatorShares().RoundInt(), total, blockReward.Amount) + totalReward := common.GetSafeShare(val.GetDelegatorShares().RoundInt(), total, blockReward.Amount.RoundInt()) validatorReward := cosmos.ZeroInt() rateBasisPts := val.GetCommission().MulInt64(100).RoundInt() @@ -292,51 +292,62 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl delegateReward = delegateReward.Sub(valFee) validatorReward = validatorReward.Add(valFee) } + if err := mgr.keeper.SendFromModuleToAccount(ctx, types.ModuleName, delegateAcc, cosmos.NewCoins(cosmos.NewCoin(blockReward.Denom, delegateReward))); err != nil { ctx.Logger().Error("unable to pay rewards to delegate", "delegate", delegate.DelegatorAddress, "error", err) continue } ctx.Logger().Info("delegate rewarded", "delegate", delegateAcc.String(), "amount", delegateReward) + + totalAllocated = totalAllocated.Add(delegateReward) } if !validatorReward.IsZero() { - if err := mgr.keeper.SendFromModuleToAccount(ctx, types.ModuleName, acc, cosmos.NewCoins(cosmos.NewCoin(blockReward.Denom, validatorReward))); err != nil { + if err := mgr.keeper.AllocateTokensToValidator(ctx, val, sdk.NewDecCoins(sdk.NewDecCoin(blockReward.Denom, validatorReward))); err != nil { ctx.Logger().Error("unable to pay rewards to validator", "validator", val.GetOperator(), "error", err) continue } ctx.Logger().Info("validator additional rewards", "validator", acc.String(), "amount", validatorReward) + } if err := mgr.EmitValidatorPayoutEvent(ctx, acc, validatorReward); err != nil { ctx.Logger().Error("unable to emit validator payout event", "validator", acc.String(), "error", err) } + totalAllocated = totalAllocated.Add(validatorReward) + } + + if !totalAllocated.IsZero() { + if err := mgr.keeper.BurnCoins(ctx, types.ModuleName, cosmos.NewCoins(cosmos.NewCoin(blockReward.Denom, totalAllocated))); err != nil { + ctx.Logger().Error("unable to burn allocated rewards from module account", "amount", totalAllocated, "error", err) + return err + } + ctx.Logger().Info("total rewards deducted from module account", "amount", totalAllocated) } return nil } -func (mgr Manager) calcBlockReward(ctx cosmos.Context, totalReserve, emissionCurve, blocksPerYear, validatorPayoutCycle int64) cosmos.Coin { +func (mgr Manager) calcBlockReward(ctx cosmos.Context, totalReserve, emissionCurve, blocksPerYear, validatorPayoutCycle sdkmath.LegacyDec) sdk.DecCoin { sdkContext := sdk.UnwrapSDKContext(ctx) // Block Rewards will take the latest reserve, divide it by the emission // curve factor, then divide by blocks per year - if emissionCurve == 0 || blocksPerYear == 0 { + if emissionCurve.IsZero() || blocksPerYear.IsZero() { sdkContext.Logger().Info("block and emission-curve cannot be zero") - return cosmos.NewCoin(configs.Denom, sdkmath.NewInt(0)) + return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)) } - if validatorPayoutCycle == 0 || sdkContext.BlockHeight()%validatorPayoutCycle != 0 { + if validatorPayoutCycle.IsZero() || sdkContext.BlockHeight()%validatorPayoutCycle.RoundInt64() != 0 { sdkContext.Logger().Info("validator payout cycle cannot be zero") - return cosmos.NewCoin(configs.Denom, sdkmath.NewInt(0)) + return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)) } - trD := cosmos.NewDec(totalReserve) - ecD := cosmos.NewDec(emissionCurve) - bpyD := cosmos.NewDec((blocksPerYear / validatorPayoutCycle)) + bpyD := blocksPerYear.Quo(validatorPayoutCycle) - blockReward := trD.Quo(ecD).Quo(bpyD).RoundInt() + blockReward := totalReserve.Quo(emissionCurve).Quo(bpyD).RoundInt() - return cosmos.NewCoin(configs.Denom, blockReward) + return sdk.NewDecCoin(configs.Denom, blockReward) } func (mgr Manager) FetchConfig(ctx cosmos.Context, name configs.ConfigName) int64 { @@ -433,31 +444,25 @@ func (mgr Manager) contractDebt(ctx cosmos.Context, contract types.Contract) (co return debt, nil } -func (mgr Manager) circulatingSupplyAfterInflationCalc(ctx cosmos.Context) (cosmos.Coin, error) { +func (mgr Manager) circulatingSupplyAfterInflationCalc(ctx cosmos.Context) (sdk.DecCoin, error) { sdkContext := sdk.UnwrapSDKContext(ctx) // Get the circulating supply circulatingSupply, err := mgr.keeper.GetCirculatingSupply(ctx, configs.Denom) + sdkContext.Logger().Info(fmt.Sprintf("circulating supply: %d", circulatingSupply.Amount)) if err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to get circulating supply %s", err)) - return cosmos.NewCoin(configs.Denom, sdkmath.NewInt(0)), err + return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)), err } // Get the inflation rate - inflationRate, err := mgr.keeper.GetInflationRate(ctx) - if err != nil { - sdkContext.Logger().Error(fmt.Sprintf("failed to get inflation rate: %s", err)) - return cosmos.NewCoin(configs.Denom, sdkmath.NewInt(0)), err - } - - // Convert circulating supply to decimal for precise calculation - circulatingSupplyDec := sdkmath.LegacyNewDec(circulatingSupply.Amount.Int64()) + inflationRate := mgr.keeper.GetInflationRate(ctx) + sdkContext.Logger().Info(fmt.Sprintf("inflation rate: %d", inflationRate)) // Multiply circulating supply by inflation rate to get the newly minted token amount - newTokenAmountMintedDec := circulatingSupplyDec.Mul(inflationRate) + newTokenAmountMintedDec := circulatingSupply.Amount.Mul(inflationRate).QuoInt64(100) - // Convert the result back to integer and truncate any decimals - newTokenAmountMinted := newTokenAmountMintedDec.TruncateInt() + sdkContext.Logger().Info(fmt.Sprintf("minted token value: %v", newTokenAmountMintedDec)) - return cosmos.NewCoin(configs.Denom, newTokenAmountMinted), nil + return sdk.NewDecCoin(configs.Denom, newTokenAmountMintedDec.RoundInt()), nil } diff --git a/x/arkeo/keeper/manager_test.go b/x/arkeo/keeper/manager_test.go index a1da1d70..813ad769 100644 --- a/x/arkeo/keeper/manager_test.go +++ b/x/arkeo/keeper/manager_test.go @@ -315,37 +315,37 @@ func TestBlockRewardCalculation(t *testing.T) { // Total Reserve -> 100000000 // validator cycle -> 100 // reward = (totalReserve / emissionCurve) / (blocksPerYear / valCycle)) -> 2000 - valCycle := int64(100) - emissionCurve := int64(10) - blocksPerYear := int64(5000) - totalReserve := int64(1000000) + valCycle := sdkmath.LegacyNewDec(100) + emissionCurve := sdkmath.LegacyNewDec(10) + blocksPerYear := sdkmath.LegacyNewDec(5000) + totalReserve := sdkmath.LegacyNewDec(1000000) reward := mgr.calcBlockReward(ctx, totalReserve, emissionCurve, blocksPerYear, valCycle) - require.Equal(t, reward.Amount.Int64(), int64(2000)) + require.Equal(t, reward.Amount.RoundInt64(), int64(2000)) - valCycle = int64(10) - emissionCurve = int64(5) - blocksPerYear = int64(200) - totalReserve = int64(999999) + valCycle = sdkmath.LegacyNewDec(10) + emissionCurve = sdkmath.LegacyNewDec(5) + blocksPerYear = sdkmath.LegacyNewDec(200) + totalReserve = sdkmath.LegacyNewDec(999999) reward = mgr.calcBlockReward(ctx, totalReserve, emissionCurve, blocksPerYear, valCycle) - require.Equal(t, reward.Amount.Int64(), int64(10000)) // its 9999.99 rounded to 10000 + require.Equal(t, reward.Amount.RoundInt64(), int64(10000)) // its 9999.99 rounded to 10000 } func TestValidatorPayouts(t *testing.T) { ctx, k, sk := SetupKeeperWithStaking(t) mgr := NewManager(k, sk) - valCycle := int64(100) - emissionCurve := int64(10) - blocksPerYear := int64(5000) - totalReserve := int64(1000000000) + valCycle := sdkmath.NewInt(100).ToLegacyDec() + emissionCurve := sdkmath.NewInt(10).ToLegacyDec() + blocksPerYear := sdkmath.NewInt(5000).ToLegacyDec() + totalReserve := sdkmath.NewInt(1000000000).ToLegacyDec() blockReward := mgr.calcBlockReward(ctx, totalReserve, emissionCurve, blocksPerYear, valCycle) - require.Equal(t, blockReward.Amount.Int64(), int64(2000000)) + require.Equal(t, blockReward.Amount.RoundInt64(), int64(2000000)) pks := simtestutil.CreateTestPubKeys(3) pk1, err := common.NewPubKeyFromCrypto(pks[0]) @@ -466,7 +466,7 @@ func TestValidatorPayouts(t *testing.T) { require.Equal(t, totalBal.ToLegacyDec(), sdkmath.LegacyNewDec(996293)) moduleBalance = k.GetBalanceOfModule(ctx, types.ModuleName, configs.Denom) - require.Equal(t, moduleBalance.Int64(), int64(20000000000000)) + require.Equal(t, moduleBalance.ToLegacyDec().RoundInt64(), int64(20000000000000-996293)) } func checkBalance(ctx cosmos.Context, t *testing.T, k Keeper, acc cosmos.AccAddress, denom string, expectedAmt int64, total *sdkmath.Int) { bal := k.GetBalance(ctx, acc) From 0272067825f9db61c43957fb3e7d87be45a9d372 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Fri, 27 Sep 2024 19:22:00 +0530 Subject: [PATCH 03/14] chore: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6de552ef..a5f85759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,8 @@ Contains all the PRs that improved the code without changing the behaviors. ## Changed - Removed unused module account +- Disabled System Validator Rewards +- Default Mint params set to zero ## Fixed - Testnet binary generation using go build From 3df37a7d40b37e94fca6bc3c0a2d074ae7551b3a Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Fri, 27 Sep 2024 19:37:25 +0530 Subject: [PATCH 04/14] fix: rewards distribution --- app/app.go | 2 +- app/app_regtest.go | 2 +- x/arkeo/keeper/manager.go | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/app.go b/app/app.go index 65c61b64..37990486 100644 --- a/app/app.go +++ b/app/app.go @@ -210,7 +210,7 @@ var ( govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, claimmoduletypes.ModuleName: {authtypes.Minter}, - arkeomoduletypes.ModuleName: {authtypes.Minter}, + arkeomoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, arkeomoduletypes.ProviderName: {}, arkeomoduletypes.ContractName: {}, } diff --git a/app/app_regtest.go b/app/app_regtest.go index 80066423..6c15ea47 100644 --- a/app/app_regtest.go +++ b/app/app_regtest.go @@ -222,7 +222,7 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - arkeomoduletypes.ModuleName: {authtypes.Minter}, + arkeomoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, arkeomoduletypes.ProviderName: {}, arkeomoduletypes.ContractName: {}, claimmoduletypes.ModuleName: {authtypes.Minter}, diff --git a/x/arkeo/keeper/manager.go b/x/arkeo/keeper/manager.go index d2eacf2d..84f4c3c3 100644 --- a/x/arkeo/keeper/manager.go +++ b/x/arkeo/keeper/manager.go @@ -298,8 +298,6 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl continue } ctx.Logger().Info("delegate rewarded", "delegate", delegateAcc.String(), "amount", delegateReward) - - totalAllocated = totalAllocated.Add(delegateReward) } if !validatorReward.IsZero() { From 09bbea7cd6c5584655c909c2b88d6c8f2160ced6 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Fri, 27 Sep 2024 19:46:48 +0530 Subject: [PATCH 05/14] fix: unit tests --- x/arkeo/keeper/manager_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/arkeo/keeper/manager_test.go b/x/arkeo/keeper/manager_test.go index 813ad769..f5d33c16 100644 --- a/x/arkeo/keeper/manager_test.go +++ b/x/arkeo/keeper/manager_test.go @@ -466,7 +466,7 @@ func TestValidatorPayouts(t *testing.T) { require.Equal(t, totalBal.ToLegacyDec(), sdkmath.LegacyNewDec(996293)) moduleBalance = k.GetBalanceOfModule(ctx, types.ModuleName, configs.Denom) - require.Equal(t, moduleBalance.ToLegacyDec().RoundInt64(), int64(20000000000000-996293)) + require.Equal(t, moduleBalance.ToLegacyDec().RoundInt64(), int64(20000000000000)) } func checkBalance(ctx cosmos.Context, t *testing.T, k Keeper, acc cosmos.AccAddress, denom string, expectedAmt int64, total *sdkmath.Int) { bal := k.GetBalance(ctx, acc) From 4bd73a7431e601932079c55cbc4a217509b29e74 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Fri, 27 Sep 2024 19:49:01 +0530 Subject: [PATCH 06/14] chore: fix lint code --- x/arkeo/configs/config.go | 1 - x/arkeo/keeper/keeper.go | 4 ---- x/arkeo/keeper/manager.go | 1 - 3 files changed, 6 deletions(-) diff --git a/x/arkeo/configs/config.go b/x/arkeo/configs/config.go index bc0edc46..d3fd35a4 100644 --- a/x/arkeo/configs/config.go +++ b/x/arkeo/configs/config.go @@ -142,7 +142,6 @@ func GetSWVersion() (int64, error) { version = majorVersion } else { version = 1 - } return version, nil } diff --git a/x/arkeo/keeper/keeper.go b/x/arkeo/keeper/keeper.go index f3335d17..c0f77a0f 100644 --- a/x/arkeo/keeper/keeper.go +++ b/x/arkeo/keeper/keeper.go @@ -193,12 +193,10 @@ func (k KVStore) SetParams(ctx sdk.Context, params types.Params) { // TODO: Check Thi Again func (k KVStore) GetComputedVersion(ctx cosmos.Context) int64 { - versions := make(map[int64]int64) // maps are safe in blockchains, but should be okay in this case validators, err := k.stakingKeeper.GetBondedValidatorsByPower(ctx) if err != nil { ctx.Logger().Error(fmt.Sprintf("get Bonded Validator error :%s ", err.Error())) - } // if there is only one validator, no need for consensus. Just return the @@ -499,7 +497,6 @@ func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.Dec } func (k KVStore) GetInflationRate(ctx cosmos.Context) math.LegacyDec { - params := k.GetParams(ctx) return params.InflationChangePercentage.ToLegacyDec() @@ -529,7 +526,6 @@ func (k KVStore) MoveTokensFromDistributionToFoundationPoolAccount(ctx cosmos.Co return err } } - } return nil diff --git a/x/arkeo/keeper/manager.go b/x/arkeo/keeper/manager.go index 84f4c3c3..a79de012 100644 --- a/x/arkeo/keeper/manager.go +++ b/x/arkeo/keeper/manager.go @@ -306,7 +306,6 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl continue } ctx.Logger().Info("validator additional rewards", "validator", acc.String(), "amount", validatorReward) - } if err := mgr.EmitValidatorPayoutEvent(ctx, acc, validatorReward); err != nil { From 9f6f118c2ed759fd3dd8e0f4f1b55b56f31d4ba8 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Mon, 30 Sep 2024 17:19:29 +0530 Subject: [PATCH 07/14] chore: update calculations --- app/app.go | 10 +++--- x/arkeo/configs/config_v1.go | 2 +- x/arkeo/keeper/keeper.go | 15 +++------ x/arkeo/keeper/manager.go | 65 ++++++++++++++++-------------------- x/arkeo/types/params.go | 2 +- 5 files changed, 40 insertions(+), 54 deletions(-) diff --git a/app/app.go b/app/app.go index 37990486..e72c3832 100644 --- a/app/app.go +++ b/app/app.go @@ -855,16 +855,16 @@ func (app *ArkeoApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (* } mintGen := minttypes.GenesisState{ Minter: minttypes.Minter{ - Inflation: math.LegacyMustNewDecFromStr("0.000000000000000000"), + Inflation: math.LegacyMustNewDecFromStr("0.030000000000000000"), AnnualProvisions: math.LegacyMustNewDecFromStr("0.000000000000000000"), }, Params: minttypes.Params{ MintDenom: "uarkeo", - InflationRateChange: math.LegacyMustNewDecFromStr("0.000000000000000000"), - InflationMax: math.LegacyMustNewDecFromStr("0.000000000000000000"), - InflationMin: math.LegacyMustNewDecFromStr("0.000000000000000000"), + InflationRateChange: math.LegacyMustNewDecFromStr("0.030000000000000000"), + InflationMax: math.LegacyMustNewDecFromStr("0.050000000000000000"), + InflationMin: math.LegacyMustNewDecFromStr("0.020000000000000000"), GoalBonded: math.LegacyNewDec(670000000000000000), - BlocksPerYear: 5256666, + BlocksPerYear: 6311520, }, } genesisState[minttypes.ModuleName] = app.cdc.MustMarshalJSON(&mintGen) diff --git a/x/arkeo/configs/config_v1.go b/x/arkeo/configs/config_v1.go index 6dea1e34..6254e6bd 100644 --- a/x/arkeo/configs/config_v1.go +++ b/x/arkeo/configs/config_v1.go @@ -17,7 +17,7 @@ func NewConfigValue010() *ConfigVals { OpenContractCost: common.Tokens(1), // cost to open a contract MinProviderBond: common.Tokens(1), // min bond for a data provider to be able to open contracts with ReserveTax: 1000, // reserve income off provider income, in basis points - BlocksPerYear: 5256666, // blocks per year + BlocksPerYear: 6311520, // blocks per year EmissionCurve: 6, // rate in which the reserve is depleted to pay validators ValidatorPayoutCycle: 1, // how often validators are paid out rewards VersionConsensus: 90, // out of 100, percentage of nodes on a specific version before it is accepted diff --git a/x/arkeo/keeper/keeper.go b/x/arkeo/keeper/keeper.go index c0f77a0f..a37525f8 100644 --- a/x/arkeo/keeper/keeper.go +++ b/x/arkeo/keeper/keeper.go @@ -417,7 +417,6 @@ func (k KVStore) GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.Dec communityAccountAddress, grantAccountAddress, k.stakingKeeper.GetBondedPool(ctx).GetAddress(), - k.GetModuleAccAddress(types.ModuleName), k.GetModuleAccAddress("claimarkeo"), } @@ -438,7 +437,7 @@ func (k KVStore) GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.Dec } circulatingSupply := totalSupply.Sub(exemptBalance) - sdkContext.Logger().Info(fmt.Sprintf("Total supply %v exempted balance %v, final balance %v", totalSupply, exemptBalance, circulatingSupply)) + sdkContext.Logger().Info(fmt.Sprintf("TotalSupply=%v Foundation Accounts Exempted Balance=%v, Circulating Supply=%v", totalSupply, exemptBalance, circulatingSupply)) return sdk.NewDecCoin(denom, circulatingSupply), nil } @@ -449,12 +448,6 @@ func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.Dec params := k.GetParams(ctx) newlyMintedAmount := newlyMinted.Amount - // mint newly added tokens to reserve - if err := k.MintToModule(ctx, types.ModuleName, sdk.NewCoin(newlyMinted.Denom, newlyMinted.Amount.RoundInt())); err != nil { - sdkContext.Logger().Error(fmt.Sprintf("failed to mint %s", err)) - return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), err - } - devFundAmount := newlyMintedAmount.Mul(params.DevFundPercentage.ToLegacyDec()).Quo(sdkmath.NewInt(100).ToLegacyDec()) communityPoolAmount := newlyMintedAmount.Mul(params.CommunityPoolPercentage.ToLegacyDec()).Quo(sdkmath.NewInt(100).ToLegacyDec()) grantFundAmount := newlyMintedAmount.Mul(params.GrantFundPercentage.ToLegacyDec()).Quo(sdkmath.NewInt(100).ToLegacyDec()) @@ -477,17 +470,17 @@ func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.Dec return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } - if err := k.SendFromModuleToAccount(ctx, types.ModuleName, devAccountAddress, cosmos.NewCoins(cosmos.NewCoin(newlyMinted.Denom, devFundAmount.RoundInt()))); err != nil { + if err := k.MintAndSendToAccount(ctx, devAccountAddress, cosmos.NewCoin(newlyMinted.Denom, devFundAmount.RoundInt())); err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to send amount to Dev foundational account %s", err)) return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) } - if err := k.SendFromModuleToAccount(ctx, types.ModuleName, communityAccountAddress, cosmos.NewCoins(cosmos.NewCoin(newlyMinted.Denom, communityPoolAmount.RoundInt()))); err != nil { + if err := k.MintAndSendToAccount(ctx, communityAccountAddress, cosmos.NewCoin(newlyMinted.Denom, communityPoolAmount.RoundInt())); err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to send amount to Community foundational account %s", err)) return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) } - if err := k.SendFromModuleToAccount(ctx, types.ModuleName, grantAccountAddress, cosmos.NewCoins(cosmos.NewCoin(newlyMinted.Denom, grantFundAmount.RoundInt()))); err != nil { + if err := k.MintAndSendToAccount(ctx, grantAccountAddress, cosmos.NewCoin(newlyMinted.Denom, grantFundAmount.RoundInt())); err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to send amount to Grant foundational account %s", err)) return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) } diff --git a/x/arkeo/keeper/manager.go b/x/arkeo/keeper/manager.go index a79de012..8df7d3de 100644 --- a/x/arkeo/keeper/manager.go +++ b/x/arkeo/keeper/manager.go @@ -46,19 +46,6 @@ func (mgr *Manager) BeginBlock(ctx cosmos.Context) error { } mgr.keeper.SetVersion(ctx, ver) // update stored version - var votes = []abci.VoteInfo{} - for i := 0; i < ctx.CometInfo().GetLastCommit().Votes().Len(); i++ { - vote := ctx.CometInfo().GetLastCommit().Votes().Get(i) - abciVote := abci.VoteInfo{ - Validator: abci.Validator{ - Address: vote.Validator().Address(), - Power: vote.Validator().Power(), - }, - BlockIdFlag: cmptm.BlockIDFlag(vote.GetBlockIDFlag()), - } - votes = append(votes, abciVote) - } - // Get the circulating supply after calculating inflation circSupply, err := mgr.circulatingSupplyAfterInflationCalc(ctx) if err != nil { @@ -76,17 +63,32 @@ func (mgr *Manager) BeginBlock(ctx cosmos.Context) error { emissionCurve := sdkmath.LegacyNewDec(mgr.FetchConfig(ctx, configs.EmissionCurve)) // Emission curve factor blocksPerYear := sdkmath.LegacyNewDec(mgr.FetchConfig(ctx, configs.BlocksPerYear)) - // Calculate Block Rewards - blockReward := mgr.calcBlockReward(ctx, circSupply.Amount, emissionCurve, blocksPerYear, validatorPayoutCycle) - ctx.Logger().Info(fmt.Sprintf("Block Reward %v", blockReward)) - // Distribute Minted To Pools - balanceDistribution, err := mgr.keeper.MintAndDistributeTokens(ctx, blockReward) + balanceDistribution, err := mgr.keeper.MintAndDistributeTokens(ctx, circSupply) if err != nil { ctx.Logger().Error("unable to mint and distribute tokens", "error", err) } - if err := mgr.ValidatorPayout(ctx, votes, balanceDistribution); err != nil { + ctx.Logger().Info(fmt.Sprintf("Circulating Supply After Funding Foundational Account %s", balanceDistribution)) + + // Calculate Block Rewards + blockReward := mgr.calcBlockReward(ctx, balanceDistribution.Amount, emissionCurve, blocksPerYear, validatorPayoutCycle) + ctx.Logger().Info(fmt.Sprintf("Block Reward for block number %d, %v", ctx.BlockHeight(), blockReward)) + + var votes = []abci.VoteInfo{} + for i := 0; i < ctx.CometInfo().GetLastCommit().Votes().Len(); i++ { + vote := ctx.CometInfo().GetLastCommit().Votes().Get(i) + abciVote := abci.VoteInfo{ + Validator: abci.Validator{ + Address: vote.Validator().Address(), + Power: vote.Validator().Power(), + }, + BlockIdFlag: cmptm.BlockIDFlag(vote.GetBlockIDFlag()), + } + votes = append(votes, abciVote) + } + + if err := mgr.ValidatorPayout(ctx, votes, blockReward); err != nil { ctx.Logger().Error("unable to settle contracts", "error", err) } return nil @@ -241,7 +243,6 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl if total.IsZero() { return nil } - totalAllocated := cosmos.ZeroInt() for _, vote := range votes { if vote.BlockIdFlag.String() == "BLOCK_ID_FLAG_ABSENT" || vote.BlockIdFlag.String() == "BLOCK_ID_FLAG_UNKNOWN" { @@ -293,7 +294,7 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl validatorReward = validatorReward.Add(valFee) } - if err := mgr.keeper.SendFromModuleToAccount(ctx, types.ModuleName, delegateAcc, cosmos.NewCoins(cosmos.NewCoin(blockReward.Denom, delegateReward))); err != nil { + if err := mgr.keeper.MintAndSendToAccount(ctx, delegateAcc, cosmos.NewCoin(blockReward.Denom, delegateReward)); err != nil { ctx.Logger().Error("unable to pay rewards to delegate", "delegate", delegate.DelegatorAddress, "error", err) continue } @@ -311,15 +312,7 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl if err := mgr.EmitValidatorPayoutEvent(ctx, acc, validatorReward); err != nil { ctx.Logger().Error("unable to emit validator payout event", "validator", acc.String(), "error", err) } - totalAllocated = totalAllocated.Add(validatorReward) - } - if !totalAllocated.IsZero() { - if err := mgr.keeper.BurnCoins(ctx, types.ModuleName, cosmos.NewCoins(cosmos.NewCoin(blockReward.Denom, totalAllocated))); err != nil { - ctx.Logger().Error("unable to burn allocated rewards from module account", "amount", totalAllocated, "error", err) - return err - } - ctx.Logger().Info("total rewards deducted from module account", "amount", totalAllocated) } return nil @@ -452,14 +445,14 @@ func (mgr Manager) circulatingSupplyAfterInflationCalc(ctx cosmos.Context) (sdk. return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)), err } - // Get the inflation rate - inflationRate := mgr.keeper.GetInflationRate(ctx) - sdkContext.Logger().Info(fmt.Sprintf("inflation rate: %d", inflationRate)) + // // Get the inflation rate + // inflationRate := mgr.keeper.GetInflationRate(ctx) + // sdkContext.Logger().Info(fmt.Sprintf("inflation rate: %d", inflationRate)) - // Multiply circulating supply by inflation rate to get the newly minted token amount - newTokenAmountMintedDec := circulatingSupply.Amount.Mul(inflationRate).QuoInt64(100) + // // Multiply circulating supply by inflation rate to get the newly minted token amount + // newTokenAmountMintedDec := circulatingSupply.Amount.Mul(inflationRate).QuoInt64(100) - sdkContext.Logger().Info(fmt.Sprintf("minted token value: %v", newTokenAmountMintedDec)) + // sdkContext.Logger().Info(fmt.Sprintf("minted token value: %v", sdkmath.Int(circulatingSupply.Amount))) - return sdk.NewDecCoin(configs.Denom, newTokenAmountMintedDec.RoundInt()), nil + return sdk.NewDecCoin(configs.Denom, circulatingSupply.Amount.RoundInt()), nil } diff --git a/x/arkeo/types/params.go b/x/arkeo/types/params.go index cefc91c1..480a26d0 100644 --- a/x/arkeo/types/params.go +++ b/x/arkeo/types/params.go @@ -19,7 +19,7 @@ func NewParams() Params { CommunityPoolPercentage: math.NewInt(10), DevFundPercentage: math.NewInt(20), GrantFundPercentage: math.NewInt(20), - InflationChangePercentage: math.NewInt(13), + InflationChangePercentage: math.NewInt(3), } } From 0d08a3616412c847bd1f897119cc01dd38a35459 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Mon, 30 Sep 2024 17:27:36 +0530 Subject: [PATCH 08/14] chore: add inflation calc --- x/arkeo/keeper/manager.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/x/arkeo/keeper/manager.go b/x/arkeo/keeper/manager.go index 8df7d3de..ebeef321 100644 --- a/x/arkeo/keeper/manager.go +++ b/x/arkeo/keeper/manager.go @@ -445,14 +445,14 @@ func (mgr Manager) circulatingSupplyAfterInflationCalc(ctx cosmos.Context) (sdk. return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)), err } - // // Get the inflation rate - // inflationRate := mgr.keeper.GetInflationRate(ctx) - // sdkContext.Logger().Info(fmt.Sprintf("inflation rate: %d", inflationRate)) + // Get the inflation rate + inflationRate := mgr.keeper.GetInflationRate(ctx) + sdkContext.Logger().Info(fmt.Sprintf("inflation rate: %d", inflationRate)) - // // Multiply circulating supply by inflation rate to get the newly minted token amount - // newTokenAmountMintedDec := circulatingSupply.Amount.Mul(inflationRate).QuoInt64(100) + // Multiply circulating supply by inflation rate to get the newly minted token amount + newTokenAmountMintedDec := circulatingSupply.Amount.Mul(inflationRate).QuoInt64(100) - // sdkContext.Logger().Info(fmt.Sprintf("minted token value: %v", sdkmath.Int(circulatingSupply.Amount))) + sdkContext.Logger().Info(fmt.Sprintf("minted token value: %v", sdkmath.Int(circulatingSupply.Amount))) - return sdk.NewDecCoin(configs.Denom, circulatingSupply.Amount.RoundInt()), nil + return sdk.NewDecCoin(configs.Denom, newTokenAmountMintedDec.RoundInt()), nil } From bfbe8900bce1e91a792fe62f38a4ddf36b89545a Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Mon, 30 Sep 2024 19:11:45 +0530 Subject: [PATCH 09/14] feat: update proto params --- app/app.go | 8 ++--- proto/arkeo/arkeo/params.proto | 24 ++++++++++++--- x/arkeo/keeper/keeper.go | 8 ++--- x/arkeo/keeper/manager.go | 9 +++--- x/arkeo/keeper/manager_test.go | 2 +- x/arkeo/types/params.go | 8 ++--- x/arkeo/types/params.pb.go | 54 +++++++++++++++++----------------- 7 files changed, 64 insertions(+), 49 deletions(-) diff --git a/app/app.go b/app/app.go index e72c3832..5e6d31b1 100644 --- a/app/app.go +++ b/app/app.go @@ -855,14 +855,14 @@ func (app *ArkeoApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (* } mintGen := minttypes.GenesisState{ Minter: minttypes.Minter{ - Inflation: math.LegacyMustNewDecFromStr("0.030000000000000000"), + Inflation: math.LegacyMustNewDecFromStr("0.000000000000000000"), AnnualProvisions: math.LegacyMustNewDecFromStr("0.000000000000000000"), }, Params: minttypes.Params{ MintDenom: "uarkeo", - InflationRateChange: math.LegacyMustNewDecFromStr("0.030000000000000000"), - InflationMax: math.LegacyMustNewDecFromStr("0.050000000000000000"), - InflationMin: math.LegacyMustNewDecFromStr("0.020000000000000000"), + InflationRateChange: math.LegacyMustNewDecFromStr("0.000000000000000000"), + InflationMax: math.LegacyMustNewDecFromStr("0.000000000000000000"), + InflationMin: math.LegacyMustNewDecFromStr("0.000000000000000000"), GoalBonded: math.LegacyNewDec(670000000000000000), BlocksPerYear: 6311520, }, diff --git a/proto/arkeo/arkeo/params.proto b/proto/arkeo/arkeo/params.proto index d32d5a75..2a4622dd 100644 --- a/proto/arkeo/arkeo/params.proto +++ b/proto/arkeo/arkeo/params.proto @@ -10,8 +10,24 @@ option go_package = "github.com/arkeonetwork/arkeo/x/arkeo/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; - string community_pool_percentage= 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - string dev_fund_percentage= 2 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - string grant_fund_percentage= 3 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - string inflation_change_percentage = 4 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; + string community_pool_percentage= 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + string dev_fund_percentage= 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + string grant_fund_percentage= 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + string inflation_change_percentage = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } diff --git a/x/arkeo/keeper/keeper.go b/x/arkeo/keeper/keeper.go index a37525f8..a347dd15 100644 --- a/x/arkeo/keeper/keeper.go +++ b/x/arkeo/keeper/keeper.go @@ -448,9 +448,9 @@ func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.Dec params := k.GetParams(ctx) newlyMintedAmount := newlyMinted.Amount - devFundAmount := newlyMintedAmount.Mul(params.DevFundPercentage.ToLegacyDec()).Quo(sdkmath.NewInt(100).ToLegacyDec()) - communityPoolAmount := newlyMintedAmount.Mul(params.CommunityPoolPercentage.ToLegacyDec()).Quo(sdkmath.NewInt(100).ToLegacyDec()) - grantFundAmount := newlyMintedAmount.Mul(params.GrantFundPercentage.ToLegacyDec()).Quo(sdkmath.NewInt(100).ToLegacyDec()) + devFundAmount := newlyMintedAmount.Mul(params.DevFundPercentage) + communityPoolAmount := newlyMintedAmount.Mul(params.CommunityPoolPercentage) + grantFundAmount := newlyMintedAmount.Mul(params.GrantFundPercentage) devAccountAddress, err := k.getFoundationDevAccountAddress() if err != nil { @@ -492,7 +492,7 @@ func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.Dec func (k KVStore) GetInflationRate(ctx cosmos.Context) math.LegacyDec { params := k.GetParams(ctx) - return params.InflationChangePercentage.ToLegacyDec() + return params.InflationChangePercentage } // transfer tokens form the Distribution to Foundation Community Pool diff --git a/x/arkeo/keeper/manager.go b/x/arkeo/keeper/manager.go index ebeef321..e5cbaca8 100644 --- a/x/arkeo/keeper/manager.go +++ b/x/arkeo/keeper/manager.go @@ -106,9 +106,9 @@ func (mgr Manager) EndBlock(ctx cosmos.Context) error { if err := mgr.invariantContractModule(ctx); err != nil { panic(err) } - if err := mgr.invariantMaxSupply(ctx); err != nil { - panic(err) - } + // if err := mgr.invariantMaxSupply(ctx); err != nil { + // panic(err) + // } return nil } @@ -439,7 +439,6 @@ func (mgr Manager) circulatingSupplyAfterInflationCalc(ctx cosmos.Context) (sdk. // Get the circulating supply circulatingSupply, err := mgr.keeper.GetCirculatingSupply(ctx, configs.Denom) - sdkContext.Logger().Info(fmt.Sprintf("circulating supply: %d", circulatingSupply.Amount)) if err != nil { sdkContext.Logger().Error(fmt.Sprintf("failed to get circulating supply %s", err)) return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)), err @@ -452,7 +451,7 @@ func (mgr Manager) circulatingSupplyAfterInflationCalc(ctx cosmos.Context) (sdk. // Multiply circulating supply by inflation rate to get the newly minted token amount newTokenAmountMintedDec := circulatingSupply.Amount.Mul(inflationRate).QuoInt64(100) - sdkContext.Logger().Info(fmt.Sprintf("minted token value: %v", sdkmath.Int(circulatingSupply.Amount))) + sdkContext.Logger().Info(fmt.Sprintf("After Inflation Calculation: %v", newTokenAmountMintedDec)) return sdk.NewDecCoin(configs.Denom, newTokenAmountMintedDec.RoundInt()), nil } diff --git a/x/arkeo/keeper/manager_test.go b/x/arkeo/keeper/manager_test.go index f5d33c16..6a10fd35 100644 --- a/x/arkeo/keeper/manager_test.go +++ b/x/arkeo/keeper/manager_test.go @@ -287,7 +287,7 @@ func TestParamsRewardsPercentage(t *testing.T) { params := k.GetParams(ctx) - require.Equal(t, params.CommunityPoolPercentage.Int64(), int64(10)) + require.Equal(t, params.CommunityPoolPercentage.RoundInt(), int64(10)) } func TestCommunityPoolDistributionToFoundationCommunityPool(t *testing.T) { ctx, k, sk := SetupKeeperWithStaking(t) diff --git a/x/arkeo/types/params.go b/x/arkeo/types/params.go index 480a26d0..f19457a9 100644 --- a/x/arkeo/types/params.go +++ b/x/arkeo/types/params.go @@ -16,10 +16,10 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams() Params { return Params{ - CommunityPoolPercentage: math.NewInt(10), - DevFundPercentage: math.NewInt(20), - GrantFundPercentage: math.NewInt(20), - InflationChangePercentage: math.NewInt(3), + CommunityPoolPercentage: math.LegacyMustNewDecFromStr("0.100000000000000000"), + DevFundPercentage: math.LegacyMustNewDecFromStr("0.200000000000000000"), + GrantFundPercentage: math.LegacyMustNewDecFromStr("0.200000000000000000"), + InflationChangePercentage: math.LegacyMustNewDecFromStr("0.030000000000000000"), } } diff --git a/x/arkeo/types/params.pb.go b/x/arkeo/types/params.pb.go index 86facb70..c1acfbca 100644 --- a/x/arkeo/types/params.pb.go +++ b/x/arkeo/types/params.pb.go @@ -29,10 +29,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - CommunityPoolPercentage cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=community_pool_percentage,json=communityPoolPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"community_pool_percentage"` - DevFundPercentage cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=dev_fund_percentage,json=devFundPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"dev_fund_percentage"` - GrantFundPercentage cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=grant_fund_percentage,json=grantFundPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"grant_fund_percentage"` - InflationChangePercentage cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=inflation_change_percentage,json=inflationChangePercentage,proto3,customtype=cosmossdk.io/math.Int" json:"inflation_change_percentage"` + CommunityPoolPercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=community_pool_percentage,json=communityPoolPercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"community_pool_percentage"` + DevFundPercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=dev_fund_percentage,json=devFundPercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"dev_fund_percentage"` + GrantFundPercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=grant_fund_percentage,json=grantFundPercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"grant_fund_percentage"` + InflationChangePercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=inflation_change_percentage,json=inflationChangePercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_change_percentage"` } func (m *Params) Reset() { *m = Params{} } @@ -74,29 +74,29 @@ func init() { func init() { proto.RegisterFile("arkeo/arkeo/params.proto", fileDescriptor_47c871f4fc73dfc5) } var fileDescriptor_47c871f4fc73dfc5 = []byte{ - // 340 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xb1, 0x4e, 0xf3, 0x30, - 0x10, 0xc7, 0x93, 0xaf, 0x55, 0xa5, 0xcf, 0x4c, 0xb4, 0x54, 0xb4, 0x45, 0x72, 0x11, 0x13, 0x52, - 0x45, 0xa2, 0x8a, 0x8d, 0xb1, 0x08, 0xa4, 0x6e, 0x15, 0x23, 0x0c, 0x91, 0x93, 0xb8, 0x6e, 0x94, - 0xc6, 0x17, 0xc5, 0x97, 0x42, 0xdf, 0x82, 0x91, 0x11, 0xf1, 0x0c, 0x3c, 0x44, 0xc7, 0x8a, 0x09, - 0x31, 0x54, 0xa8, 0x7d, 0x11, 0x84, 0x1d, 0x95, 0x0a, 0xa6, 0x2c, 0x67, 0xfb, 0xfe, 0xf6, 0xef, - 0x37, 0xf8, 0x48, 0x8b, 0x65, 0x31, 0x07, 0xd7, 0xd4, 0x94, 0x65, 0x2c, 0x51, 0x4e, 0x9a, 0x01, - 0x42, 0x7d, 0x4f, 0xf7, 0x1c, 0x5d, 0x3b, 0x07, 0x02, 0x04, 0xe8, 0xbe, 0xfb, 0xbd, 0x33, 0x57, - 0x3a, 0x34, 0x00, 0x95, 0x80, 0x72, 0x7d, 0xa6, 0xb8, 0x3b, 0xeb, 0xfb, 0x1c, 0x59, 0xdf, 0x0d, - 0x20, 0x92, 0x45, 0xde, 0x36, 0xb9, 0x67, 0x1e, 0x9a, 0x83, 0x89, 0x4e, 0x5e, 0x2a, 0xa4, 0x36, - 0xd2, 0xba, 0xba, 0x20, 0xed, 0x00, 0x92, 0x24, 0x97, 0x11, 0xce, 0xbd, 0x14, 0x60, 0xea, 0xa5, - 0x3c, 0x0b, 0xb8, 0x44, 0x26, 0x78, 0xcb, 0x3e, 0xb6, 0x4f, 0xff, 0x0f, 0x7a, 0x8b, 0x55, 0xd7, - 0xfa, 0x58, 0x75, 0x9b, 0x86, 0xa1, 0xc2, 0xd8, 0x89, 0xc0, 0x4d, 0x18, 0x4e, 0x9c, 0xa1, 0xc4, - 0xb7, 0xd7, 0x33, 0x52, 0xc0, 0x87, 0x12, 0x6f, 0x0e, 0xb7, 0xb4, 0x11, 0xc0, 0x74, 0xb4, 0x65, - 0xd5, 0xef, 0x48, 0x23, 0xe4, 0x33, 0x6f, 0x9c, 0xcb, 0x70, 0x57, 0xf1, 0xaf, 0xbc, 0x62, 0x3f, - 0xe4, 0xb3, 0xeb, 0x5c, 0x86, 0x3b, 0x70, 0x8f, 0x34, 0x45, 0xc6, 0x24, 0xfe, 0xc1, 0x57, 0xca, - 0xe3, 0x1b, 0x9a, 0xf4, 0x4b, 0x10, 0x93, 0xa3, 0x48, 0x8e, 0xa7, 0x0c, 0x23, 0x90, 0x5e, 0x30, - 0x61, 0x52, 0xf0, 0x5d, 0x4d, 0xb5, 0xbc, 0xa6, 0xbd, 0xe5, 0x5d, 0x6a, 0xdc, 0x8f, 0xec, 0xa2, - 0xfa, 0xf4, 0xdc, 0xb5, 0x06, 0x57, 0x8b, 0x35, 0xb5, 0x97, 0x6b, 0x6a, 0x7f, 0xae, 0xa9, 0xfd, - 0xb8, 0xa1, 0xd6, 0x72, 0x43, 0xad, 0xf7, 0x0d, 0xb5, 0x6e, 0x7b, 0x22, 0xc2, 0x49, 0xee, 0x3b, - 0x01, 0x24, 0x66, 0x76, 0x24, 0xc7, 0x7b, 0xc8, 0xe2, 0x62, 0x90, 0x1e, 0x8a, 0x15, 0xe7, 0x29, - 0x57, 0x7e, 0x4d, 0x7f, 0xf9, 0xf9, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x6d, 0xf0, 0xe5, - 0x6c, 0x02, 0x00, 0x00, + // 343 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xbd, 0x4e, 0xf3, 0x30, + 0x14, 0x86, 0x93, 0xaf, 0x55, 0xa5, 0xcf, 0x4c, 0xb4, 0x20, 0xfa, 0x23, 0xb9, 0x88, 0x09, 0x09, + 0x91, 0xa8, 0x62, 0x63, 0x2c, 0x85, 0x89, 0xa1, 0x62, 0x64, 0x89, 0x1c, 0xe7, 0xd4, 0x8d, 0x5a, + 0xfb, 0x84, 0xc4, 0x29, 0xf4, 0x2e, 0x18, 0x19, 0xb9, 0x08, 0x26, 0xae, 0xa0, 0x63, 0xc5, 0x84, + 0x18, 0x2a, 0xd4, 0xde, 0x08, 0xc2, 0x8e, 0x4a, 0x05, 0x5b, 0x97, 0x93, 0xf8, 0xbc, 0xf6, 0xf3, + 0x2c, 0x2f, 0xa9, 0xb3, 0x74, 0x04, 0xe8, 0xdb, 0x99, 0xb0, 0x94, 0xc9, 0xcc, 0x4b, 0x52, 0xd4, + 0x58, 0xdd, 0x31, 0x3b, 0xcf, 0xcc, 0xe6, 0x9e, 0x40, 0x81, 0x66, 0xef, 0x7f, 0xff, 0xd9, 0x2b, + 0x4d, 0xca, 0x31, 0x93, 0x98, 0xf9, 0x21, 0xcb, 0xc0, 0x9f, 0x74, 0x42, 0xd0, 0xac, 0xe3, 0x73, + 0x8c, 0x55, 0x91, 0x37, 0x6c, 0x1e, 0xd8, 0x87, 0xf6, 0x60, 0xa3, 0xa3, 0xd7, 0x12, 0xa9, 0xf4, + 0x8d, 0xae, 0x2a, 0x49, 0x83, 0xa3, 0x94, 0xb9, 0x8a, 0xf5, 0x34, 0x48, 0x10, 0xc7, 0x41, 0x02, + 0x29, 0x07, 0xa5, 0x99, 0x80, 0xba, 0x7b, 0xe8, 0x1e, 0xff, 0xef, 0x76, 0x66, 0x8b, 0xb6, 0xf3, + 0xb1, 0x68, 0xb7, 0x2c, 0x23, 0x8b, 0x46, 0x5e, 0x8c, 0xbe, 0x64, 0x7a, 0xe8, 0x5d, 0x83, 0x60, + 0x7c, 0xda, 0x03, 0xfe, 0xf6, 0x72, 0x4a, 0x0a, 0x45, 0x0f, 0xf8, 0xcd, 0xc1, 0x9a, 0xd9, 0x47, + 0x1c, 0xf7, 0xd7, 0xc4, 0x2a, 0x23, 0xb5, 0x08, 0x26, 0xc1, 0x20, 0x57, 0xd1, 0xa6, 0xe8, 0xdf, + 0xb6, 0xa2, 0xdd, 0x08, 0x26, 0x57, 0xb9, 0x8a, 0x36, 0x14, 0x40, 0xf6, 0x45, 0xca, 0x94, 0xfe, + 0x23, 0x29, 0x6d, 0x2b, 0xa9, 0x19, 0xde, 0x2f, 0xcd, 0x1d, 0x69, 0xc5, 0x6a, 0x30, 0x66, 0x3a, + 0x46, 0x15, 0xf0, 0x21, 0x53, 0x02, 0x36, 0x65, 0xe5, 0x6d, 0x65, 0x8d, 0x35, 0xf5, 0xc2, 0x40, + 0x7f, 0x94, 0xe7, 0xe5, 0xa7, 0xe7, 0xb6, 0xd3, 0xbd, 0x9c, 0x2d, 0xa9, 0x3b, 0x5f, 0x52, 0xf7, + 0x73, 0x49, 0xdd, 0xc7, 0x15, 0x75, 0xe6, 0x2b, 0xea, 0xbc, 0xaf, 0xa8, 0x73, 0x7b, 0x22, 0x62, + 0x3d, 0xcc, 0x43, 0x8f, 0xa3, 0xb4, 0x9d, 0x52, 0xa0, 0xef, 0x31, 0x1d, 0x15, 0x05, 0x7b, 0x28, + 0xbe, 0x7a, 0x9a, 0x40, 0x16, 0x56, 0x4c, 0x15, 0xce, 0xbe, 0x02, 0x00, 0x00, 0xff, 0xff, 0x36, + 0xa2, 0x81, 0xbc, 0x84, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { From 69189c659bf0676bd39aadcbaba56cddeae3014f Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Mon, 30 Sep 2024 19:28:10 +0530 Subject: [PATCH 10/14] fix: test case update --- x/arkeo/keeper/manager_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/arkeo/keeper/manager_test.go b/x/arkeo/keeper/manager_test.go index 6a10fd35..e269240b 100644 --- a/x/arkeo/keeper/manager_test.go +++ b/x/arkeo/keeper/manager_test.go @@ -287,7 +287,7 @@ func TestParamsRewardsPercentage(t *testing.T) { params := k.GetParams(ctx) - require.Equal(t, params.CommunityPoolPercentage.RoundInt(), int64(10)) + require.Equal(t, params.CommunityPoolPercentage, sdkmath.LegacyMustNewDecFromStr("0.100000000000000000")) } func TestCommunityPoolDistributionToFoundationCommunityPool(t *testing.T) { ctx, k, sk := SetupKeeperWithStaking(t) @@ -447,7 +447,7 @@ func TestValidatorPayouts(t *testing.T) { require.Equal(t, communityAccountBal, sdkmath.NewInt(200000)) moduleBalance := k.GetBalanceOfModule(ctx, types.ModuleName, configs.Denom) - require.Equal(t, moduleBalance.Int64(), int64(20000001000000)) + require.Equal(t, moduleBalance.Int64(), int64(20000000000000)) require.NoError(t, mgr.ValidatorPayout(ctx, votes, balanceDistribution)) From 836cc13af53984b2988fd7f4f0c1be39bae92db4 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Tue, 1 Oct 2024 11:27:49 +0530 Subject: [PATCH 11/14] feat: update inflation calculation --- api/arkeo/arkeo/params.pulsar.go | 585 ++++++++++++++++++++++++++----- proto/arkeo/arkeo/params.proto | 21 ++ scripts/genesis.sh | 34 +- x/arkeo/keeper/keeper.go | 63 +++- x/arkeo/keeper/manager.go | 46 +-- x/arkeo/keeper/manager_test.go | 16 +- x/arkeo/types/keys.go | 6 +- x/arkeo/types/params.go | 7 +- x/arkeo/types/params.pb.go | 263 ++++++++++++-- 9 files changed, 870 insertions(+), 171 deletions(-) diff --git a/api/arkeo/arkeo/params.pulsar.go b/api/arkeo/arkeo/params.pulsar.go index 1a3b1573..0a331135 100644 --- a/api/arkeo/arkeo/params.pulsar.go +++ b/api/arkeo/arkeo/params.pulsar.go @@ -16,18 +16,30 @@ import ( ) var ( - md_Params protoreflect.MessageDescriptor - fd_Params_CommunityPoolPercentage protoreflect.FieldDescriptor - fd_Params_DevFundPercentage protoreflect.FieldDescriptor - fd_Params_ValidatorRewardsPercentage protoreflect.FieldDescriptor + md_Params protoreflect.MessageDescriptor + fd_Params_community_pool_percentage protoreflect.FieldDescriptor + fd_Params_dev_fund_percentage protoreflect.FieldDescriptor + fd_Params_grant_fund_percentage protoreflect.FieldDescriptor + fd_Params_inflation_change_percentage protoreflect.FieldDescriptor + fd_Params_inflation_min protoreflect.FieldDescriptor + fd_Params_inflation_max protoreflect.FieldDescriptor + fd_Params_goal_bonded protoreflect.FieldDescriptor + fd_Params_block_per_year protoreflect.FieldDescriptor + fd_Params_emission_curve protoreflect.FieldDescriptor ) func init() { file_arkeo_arkeo_params_proto_init() md_Params = File_arkeo_arkeo_params_proto.Messages().ByName("Params") - fd_Params_CommunityPoolPercentage = md_Params.Fields().ByName("CommunityPoolPercentage") - fd_Params_DevFundPercentage = md_Params.Fields().ByName("DevFundPercentage") - fd_Params_ValidatorRewardsPercentage = md_Params.Fields().ByName("ValidatorRewardsPercentage") + fd_Params_community_pool_percentage = md_Params.Fields().ByName("community_pool_percentage") + fd_Params_dev_fund_percentage = md_Params.Fields().ByName("dev_fund_percentage") + fd_Params_grant_fund_percentage = md_Params.Fields().ByName("grant_fund_percentage") + fd_Params_inflation_change_percentage = md_Params.Fields().ByName("inflation_change_percentage") + fd_Params_inflation_min = md_Params.Fields().ByName("inflation_min") + fd_Params_inflation_max = md_Params.Fields().ByName("inflation_max") + fd_Params_goal_bonded = md_Params.Fields().ByName("goal_bonded") + fd_Params_block_per_year = md_Params.Fields().ByName("block_per_year") + fd_Params_emission_curve = md_Params.Fields().ByName("emission_curve") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -97,19 +109,55 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.CommunityPoolPercentage != "" { value := protoreflect.ValueOfString(x.CommunityPoolPercentage) - if !f(fd_Params_CommunityPoolPercentage, value) { + if !f(fd_Params_community_pool_percentage, value) { return } } if x.DevFundPercentage != "" { value := protoreflect.ValueOfString(x.DevFundPercentage) - if !f(fd_Params_DevFundPercentage, value) { + if !f(fd_Params_dev_fund_percentage, value) { return } } - if x.ValidatorRewardsPercentage != "" { - value := protoreflect.ValueOfString(x.ValidatorRewardsPercentage) - if !f(fd_Params_ValidatorRewardsPercentage, value) { + if x.GrantFundPercentage != "" { + value := protoreflect.ValueOfString(x.GrantFundPercentage) + if !f(fd_Params_grant_fund_percentage, value) { + return + } + } + if x.InflationChangePercentage != "" { + value := protoreflect.ValueOfString(x.InflationChangePercentage) + if !f(fd_Params_inflation_change_percentage, value) { + return + } + } + if x.InflationMin != "" { + value := protoreflect.ValueOfString(x.InflationMin) + if !f(fd_Params_inflation_min, value) { + return + } + } + if x.InflationMax != "" { + value := protoreflect.ValueOfString(x.InflationMax) + if !f(fd_Params_inflation_max, value) { + return + } + } + if x.GoalBonded != "" { + value := protoreflect.ValueOfString(x.GoalBonded) + if !f(fd_Params_goal_bonded, value) { + return + } + } + if x.BlockPerYear != uint64(0) { + value := protoreflect.ValueOfUint64(x.BlockPerYear) + if !f(fd_Params_block_per_year, value) { + return + } + } + if x.EmissionCurve != uint64(0) { + value := protoreflect.ValueOfUint64(x.EmissionCurve) + if !f(fd_Params_emission_curve, value) { return } } @@ -128,12 +176,24 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto // a repeated field is populated if it is non-empty. func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "arkeo.arkeo.Params.CommunityPoolPercentage": + case "arkeo.arkeo.Params.community_pool_percentage": return x.CommunityPoolPercentage != "" - case "arkeo.arkeo.Params.DevFundPercentage": + case "arkeo.arkeo.Params.dev_fund_percentage": return x.DevFundPercentage != "" - case "arkeo.arkeo.Params.ValidatorRewardsPercentage": - return x.ValidatorRewardsPercentage != "" + case "arkeo.arkeo.Params.grant_fund_percentage": + return x.GrantFundPercentage != "" + case "arkeo.arkeo.Params.inflation_change_percentage": + return x.InflationChangePercentage != "" + case "arkeo.arkeo.Params.inflation_min": + return x.InflationMin != "" + case "arkeo.arkeo.Params.inflation_max": + return x.InflationMax != "" + case "arkeo.arkeo.Params.goal_bonded": + return x.GoalBonded != "" + case "arkeo.arkeo.Params.block_per_year": + return x.BlockPerYear != uint64(0) + case "arkeo.arkeo.Params.emission_curve": + return x.EmissionCurve != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: arkeo.arkeo.Params")) @@ -150,12 +210,24 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "arkeo.arkeo.Params.CommunityPoolPercentage": + case "arkeo.arkeo.Params.community_pool_percentage": x.CommunityPoolPercentage = "" - case "arkeo.arkeo.Params.DevFundPercentage": + case "arkeo.arkeo.Params.dev_fund_percentage": x.DevFundPercentage = "" - case "arkeo.arkeo.Params.ValidatorRewardsPercentage": - x.ValidatorRewardsPercentage = "" + case "arkeo.arkeo.Params.grant_fund_percentage": + x.GrantFundPercentage = "" + case "arkeo.arkeo.Params.inflation_change_percentage": + x.InflationChangePercentage = "" + case "arkeo.arkeo.Params.inflation_min": + x.InflationMin = "" + case "arkeo.arkeo.Params.inflation_max": + x.InflationMax = "" + case "arkeo.arkeo.Params.goal_bonded": + x.GoalBonded = "" + case "arkeo.arkeo.Params.block_per_year": + x.BlockPerYear = uint64(0) + case "arkeo.arkeo.Params.emission_curve": + x.EmissionCurve = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: arkeo.arkeo.Params")) @@ -172,15 +244,33 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "arkeo.arkeo.Params.CommunityPoolPercentage": + case "arkeo.arkeo.Params.community_pool_percentage": value := x.CommunityPoolPercentage return protoreflect.ValueOfString(value) - case "arkeo.arkeo.Params.DevFundPercentage": + case "arkeo.arkeo.Params.dev_fund_percentage": value := x.DevFundPercentage return protoreflect.ValueOfString(value) - case "arkeo.arkeo.Params.ValidatorRewardsPercentage": - value := x.ValidatorRewardsPercentage + case "arkeo.arkeo.Params.grant_fund_percentage": + value := x.GrantFundPercentage + return protoreflect.ValueOfString(value) + case "arkeo.arkeo.Params.inflation_change_percentage": + value := x.InflationChangePercentage + return protoreflect.ValueOfString(value) + case "arkeo.arkeo.Params.inflation_min": + value := x.InflationMin + return protoreflect.ValueOfString(value) + case "arkeo.arkeo.Params.inflation_max": + value := x.InflationMax + return protoreflect.ValueOfString(value) + case "arkeo.arkeo.Params.goal_bonded": + value := x.GoalBonded return protoreflect.ValueOfString(value) + case "arkeo.arkeo.Params.block_per_year": + value := x.BlockPerYear + return protoreflect.ValueOfUint64(value) + case "arkeo.arkeo.Params.emission_curve": + value := x.EmissionCurve + return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: arkeo.arkeo.Params")) @@ -201,12 +291,24 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "arkeo.arkeo.Params.CommunityPoolPercentage": + case "arkeo.arkeo.Params.community_pool_percentage": x.CommunityPoolPercentage = value.Interface().(string) - case "arkeo.arkeo.Params.DevFundPercentage": + case "arkeo.arkeo.Params.dev_fund_percentage": x.DevFundPercentage = value.Interface().(string) - case "arkeo.arkeo.Params.ValidatorRewardsPercentage": - x.ValidatorRewardsPercentage = value.Interface().(string) + case "arkeo.arkeo.Params.grant_fund_percentage": + x.GrantFundPercentage = value.Interface().(string) + case "arkeo.arkeo.Params.inflation_change_percentage": + x.InflationChangePercentage = value.Interface().(string) + case "arkeo.arkeo.Params.inflation_min": + x.InflationMin = value.Interface().(string) + case "arkeo.arkeo.Params.inflation_max": + x.InflationMax = value.Interface().(string) + case "arkeo.arkeo.Params.goal_bonded": + x.GoalBonded = value.Interface().(string) + case "arkeo.arkeo.Params.block_per_year": + x.BlockPerYear = value.Uint() + case "arkeo.arkeo.Params.emission_curve": + x.EmissionCurve = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: arkeo.arkeo.Params")) @@ -227,12 +329,24 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "arkeo.arkeo.Params.CommunityPoolPercentage": - panic(fmt.Errorf("field CommunityPoolPercentage of message arkeo.arkeo.Params is not mutable")) - case "arkeo.arkeo.Params.DevFundPercentage": - panic(fmt.Errorf("field DevFundPercentage of message arkeo.arkeo.Params is not mutable")) - case "arkeo.arkeo.Params.ValidatorRewardsPercentage": - panic(fmt.Errorf("field ValidatorRewardsPercentage of message arkeo.arkeo.Params is not mutable")) + case "arkeo.arkeo.Params.community_pool_percentage": + panic(fmt.Errorf("field community_pool_percentage of message arkeo.arkeo.Params is not mutable")) + case "arkeo.arkeo.Params.dev_fund_percentage": + panic(fmt.Errorf("field dev_fund_percentage of message arkeo.arkeo.Params is not mutable")) + case "arkeo.arkeo.Params.grant_fund_percentage": + panic(fmt.Errorf("field grant_fund_percentage of message arkeo.arkeo.Params is not mutable")) + case "arkeo.arkeo.Params.inflation_change_percentage": + panic(fmt.Errorf("field inflation_change_percentage of message arkeo.arkeo.Params is not mutable")) + case "arkeo.arkeo.Params.inflation_min": + panic(fmt.Errorf("field inflation_min of message arkeo.arkeo.Params is not mutable")) + case "arkeo.arkeo.Params.inflation_max": + panic(fmt.Errorf("field inflation_max of message arkeo.arkeo.Params is not mutable")) + case "arkeo.arkeo.Params.goal_bonded": + panic(fmt.Errorf("field goal_bonded of message arkeo.arkeo.Params is not mutable")) + case "arkeo.arkeo.Params.block_per_year": + panic(fmt.Errorf("field block_per_year of message arkeo.arkeo.Params is not mutable")) + case "arkeo.arkeo.Params.emission_curve": + panic(fmt.Errorf("field emission_curve of message arkeo.arkeo.Params is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: arkeo.arkeo.Params")) @@ -246,12 +360,24 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "arkeo.arkeo.Params.CommunityPoolPercentage": + case "arkeo.arkeo.Params.community_pool_percentage": return protoreflect.ValueOfString("") - case "arkeo.arkeo.Params.DevFundPercentage": + case "arkeo.arkeo.Params.dev_fund_percentage": return protoreflect.ValueOfString("") - case "arkeo.arkeo.Params.ValidatorRewardsPercentage": + case "arkeo.arkeo.Params.grant_fund_percentage": return protoreflect.ValueOfString("") + case "arkeo.arkeo.Params.inflation_change_percentage": + return protoreflect.ValueOfString("") + case "arkeo.arkeo.Params.inflation_min": + return protoreflect.ValueOfString("") + case "arkeo.arkeo.Params.inflation_max": + return protoreflect.ValueOfString("") + case "arkeo.arkeo.Params.goal_bonded": + return protoreflect.ValueOfString("") + case "arkeo.arkeo.Params.block_per_year": + return protoreflect.ValueOfUint64(uint64(0)) + case "arkeo.arkeo.Params.emission_curve": + return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: arkeo.arkeo.Params")) @@ -329,10 +455,32 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.ValidatorRewardsPercentage) + l = len(x.GrantFundPercentage) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.InflationChangePercentage) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.InflationMin) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.InflationMax) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.GoalBonded) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.BlockPerYear != 0 { + n += 1 + runtime.Sov(uint64(x.BlockPerYear)) + } + if x.EmissionCurve != 0 { + n += 1 + runtime.Sov(uint64(x.EmissionCurve)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -362,10 +510,48 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.ValidatorRewardsPercentage) > 0 { - i -= len(x.ValidatorRewardsPercentage) - copy(dAtA[i:], x.ValidatorRewardsPercentage) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ValidatorRewardsPercentage))) + if x.EmissionCurve != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.EmissionCurve)) + i-- + dAtA[i] = 0x48 + } + if x.BlockPerYear != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockPerYear)) + i-- + dAtA[i] = 0x40 + } + if len(x.GoalBonded) > 0 { + i -= len(x.GoalBonded) + copy(dAtA[i:], x.GoalBonded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.GoalBonded))) + i-- + dAtA[i] = 0x3a + } + if len(x.InflationMax) > 0 { + i -= len(x.InflationMax) + copy(dAtA[i:], x.InflationMax) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.InflationMax))) + i-- + dAtA[i] = 0x32 + } + if len(x.InflationMin) > 0 { + i -= len(x.InflationMin) + copy(dAtA[i:], x.InflationMin) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.InflationMin))) + i-- + dAtA[i] = 0x2a + } + if len(x.InflationChangePercentage) > 0 { + i -= len(x.InflationChangePercentage) + copy(dAtA[i:], x.InflationChangePercentage) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.InflationChangePercentage))) + i-- + dAtA[i] = 0x22 + } + if len(x.GrantFundPercentage) > 0 { + i -= len(x.GrantFundPercentage) + copy(dAtA[i:], x.GrantFundPercentage) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.GrantFundPercentage))) i-- dAtA[i] = 0x1a } @@ -498,7 +684,103 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 3: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ValidatorRewardsPercentage", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field GrantFundPercentage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.GrantFundPercentage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field InflationChangePercentage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.InflationChangePercentage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field InflationMin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.InflationMin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field InflationMax", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -526,8 +808,78 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.ValidatorRewardsPercentage = string(dAtA[iNdEx:postIndex]) + x.InflationMax = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field GoalBonded", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.GoalBonded = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockPerYear", wireType) + } + x.BlockPerYear = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.BlockPerYear |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EmissionCurve", wireType) + } + x.EmissionCurve = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.EmissionCurve |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -582,9 +934,15 @@ type Params struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CommunityPoolPercentage string `protobuf:"bytes,1,opt,name=CommunityPoolPercentage,proto3" json:"CommunityPoolPercentage,omitempty"` - DevFundPercentage string `protobuf:"bytes,2,opt,name=DevFundPercentage,proto3" json:"DevFundPercentage,omitempty"` - ValidatorRewardsPercentage string `protobuf:"bytes,3,opt,name=ValidatorRewardsPercentage,proto3" json:"ValidatorRewardsPercentage,omitempty"` + CommunityPoolPercentage string `protobuf:"bytes,1,opt,name=community_pool_percentage,json=communityPoolPercentage,proto3" json:"community_pool_percentage,omitempty"` + DevFundPercentage string `protobuf:"bytes,2,opt,name=dev_fund_percentage,json=devFundPercentage,proto3" json:"dev_fund_percentage,omitempty"` + GrantFundPercentage string `protobuf:"bytes,3,opt,name=grant_fund_percentage,json=grantFundPercentage,proto3" json:"grant_fund_percentage,omitempty"` + InflationChangePercentage string `protobuf:"bytes,4,opt,name=inflation_change_percentage,json=inflationChangePercentage,proto3" json:"inflation_change_percentage,omitempty"` + InflationMin string `protobuf:"bytes,5,opt,name=inflation_min,json=inflationMin,proto3" json:"inflation_min,omitempty"` + InflationMax string `protobuf:"bytes,6,opt,name=inflation_max,json=inflationMax,proto3" json:"inflation_max,omitempty"` + GoalBonded string `protobuf:"bytes,7,opt,name=goal_bonded,json=goalBonded,proto3" json:"goal_bonded,omitempty"` + BlockPerYear uint64 `protobuf:"varint,8,opt,name=block_per_year,json=blockPerYear,proto3" json:"block_per_year,omitempty"` + EmissionCurve uint64 `protobuf:"varint,9,opt,name=emission_curve,json=emissionCurve,proto3" json:"emission_curve,omitempty"` } func (x *Params) Reset() { @@ -621,13 +979,55 @@ func (x *Params) GetDevFundPercentage() string { return "" } -func (x *Params) GetValidatorRewardsPercentage() string { +func (x *Params) GetGrantFundPercentage() string { + if x != nil { + return x.GrantFundPercentage + } + return "" +} + +func (x *Params) GetInflationChangePercentage() string { + if x != nil { + return x.InflationChangePercentage + } + return "" +} + +func (x *Params) GetInflationMin() string { + if x != nil { + return x.InflationMin + } + return "" +} + +func (x *Params) GetInflationMax() string { + if x != nil { + return x.InflationMax + } + return "" +} + +func (x *Params) GetGoalBonded() string { if x != nil { - return x.ValidatorRewardsPercentage + return x.GoalBonded } return "" } +func (x *Params) GetBlockPerYear() uint64 { + if x != nil { + return x.BlockPerYear + } + return 0 +} + +func (x *Params) GetEmissionCurve() uint64 { + if x != nil { + return x.EmissionCurve + } + return 0 +} + var File_arkeo_arkeo_params_proto protoreflect.FileDescriptor var file_arkeo_arkeo_params_proto_rawDesc = []byte{ @@ -638,38 +1038,65 @@ var file_arkeo_arkeo_params_proto_rawDesc = []byte{ 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe1, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x71, 0x0a, 0x17, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, - 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x37, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, + 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8b, 0x06, 0x0a, 0x06, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0x6d, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, + 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, + 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x75, + 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, + 0x67, 0x65, 0x12, 0x61, 0x0a, 0x13, 0x64, 0x65, 0x76, 0x5f, 0x66, 0x75, 0x6e, 0x64, 0x5f, 0x70, + 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, + 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, + 0x65, 0x63, 0x52, 0x11, 0x64, 0x65, 0x76, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x63, 0x65, + 0x6e, 0x74, 0x61, 0x67, 0x65, 0x12, 0x65, 0x0a, 0x15, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x5f, 0x66, + 0x75, 0x6e, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, - 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x10, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0x52, 0x17, 0x43, - 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x65, 0x72, 0x63, - 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x12, 0x65, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x46, 0x75, 0x6e, - 0x64, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x37, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, - 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x10, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0x52, 0x11, 0x44, 0x65, 0x76, 0x46, - 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x12, 0x77, 0x0a, - 0x1a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x73, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x37, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x13, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x46, 0x75, + 0x6e, 0x64, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x12, 0x71, 0x0a, 0x1b, + 0x69, 0x6e, 0x66, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, - 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x10, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0x52, 0x1a, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x50, 0x65, 0x72, 0x63, - 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0x89, 0x01, 0x0a, - 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x72, 0x6b, 0x65, 0x6f, 0x2e, 0x61, 0x72, 0x6b, 0x65, 0x6f, - 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x1c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x61, 0x72, 0x6b, 0x65, 0x6f, 0x2f, 0x61, 0x72, 0x6b, 0x65, 0x6f, 0xa2, 0x02, 0x03, - 0x41, 0x41, 0x58, 0xaa, 0x02, 0x0b, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0x2e, 0x41, 0x72, 0x6b, 0x65, - 0x6f, 0xca, 0x02, 0x0b, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0x5c, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0xe2, - 0x02, 0x17, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0x5c, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x41, 0x72, 0x6b, 0x65, - 0x6f, 0x3a, 0x3a, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x44, 0x65, 0x63, 0x52, 0x19, 0x69, 0x6e, 0x66, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x12, + 0x56, 0x0a, 0x0d, 0x69, 0x6e, 0x66, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x69, 0x6e, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, + 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0c, 0x69, 0x6e, 0x66, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x69, 0x6e, 0x12, 0x56, 0x0a, 0x0d, 0x69, 0x6e, 0x66, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, + 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, + 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, + 0x63, 0x52, 0x0c, 0x69, 0x6e, 0x66, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x12, + 0x52, 0x0a, 0x0b, 0x67, 0x6f, 0x61, 0x6c, 0x5f, 0x62, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, + 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0a, 0x67, 0x6f, 0x61, 0x6c, 0x42, 0x6f, 0x6e, + 0x64, 0x65, 0x64, 0x12, 0x24, 0x0a, 0x0e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x70, 0x65, 0x72, + 0x5f, 0x79, 0x65, 0x61, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x50, 0x65, 0x72, 0x59, 0x65, 0x61, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x75, 0x72, 0x76, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0d, 0x65, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x75, 0x72, 0x76, 0x65, + 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0x89, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x61, + 0x72, 0x6b, 0x65, 0x6f, 0x2e, 0x61, 0x72, 0x6b, 0x65, 0x6f, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x72, 0x6b, 0x65, + 0x6f, 0x2f, 0x61, 0x72, 0x6b, 0x65, 0x6f, 0xa2, 0x02, 0x03, 0x41, 0x41, 0x58, 0xaa, 0x02, 0x0b, + 0x41, 0x72, 0x6b, 0x65, 0x6f, 0x2e, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0xca, 0x02, 0x0b, 0x41, 0x72, + 0x6b, 0x65, 0x6f, 0x5c, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0xe2, 0x02, 0x17, 0x41, 0x72, 0x6b, 0x65, + 0x6f, 0x5c, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x41, 0x72, 0x6b, 0x65, 0x6f, 0x3a, 0x3a, 0x41, 0x72, 0x6b, + 0x65, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/arkeo/arkeo/params.proto b/proto/arkeo/arkeo/params.proto index 2a4622dd..7b4358c0 100644 --- a/proto/arkeo/arkeo/params.proto +++ b/proto/arkeo/arkeo/params.proto @@ -30,4 +30,25 @@ message Params { (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; + string inflation_min = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + string inflation_max = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + string goal_bonded = 7 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + uint64 block_per_year = 8; + + uint64 emission_curve = 9; } diff --git a/scripts/genesis.sh b/scripts/genesis.sh index 0fd001ca..7bee7ff0 100755 --- a/scripts/genesis.sh +++ b/scripts/genesis.sh @@ -4,10 +4,10 @@ set -o pipefail set -ex CHAIN_ID="arkeo-testnet-v2" -STAKE="50000000000000000uarkeo" +STAKE="1000000000uarkeo" TOKEN="uarkeo" USER="ark" -TOTAL_SUPPLY=50000000000000000 # Initial supply corresponding to the stake +TOTAL_SUPPLY=1000000000 # Initial supply corresponding to the stake add_module() { jq --arg ADDRESS "$1" --arg ASSET "$2" --arg AMOUNT "$3" --arg NAME "$4" '.app_state.auth.accounts += [{ @@ -82,8 +82,7 @@ if [ ! -f ~/.arkeo/config/genesis.json ]; then add_account "$FAUCET" $TOKEN 10000000000000000 # faucet, 10m if [ "$NET" = "mocknet" ] || [ "$NET" = "testnet" ]; then - add_module tarkeo1d0m97ywk2y4vq58ud6q5e0r3q9khj9e3unfe4t $TOKEN 10000000000000000 'arkeo-reserve' # reserve, 10m - add_module tarkeo14tmx70mvve3u7hfmd45vle49kvylk6s2wllxny $TOKEN 10000000000000000 'claimarkeo' + add_module tarkeo14tmx70mvve3u7hfmd45vle49kvylk6s2wllxny $TOKEN 30250000000000 'claimarkeo' echo "shoulder heavy loyal save patient deposit crew bag pull club escape eyebrow hip verify border into wire start pact faint fame festival solve shop" | arkeod keys add alice --keyring-backend test --recover ALICE=$(arkeod keys show alice -a --keyring-backend test) @@ -94,13 +93,14 @@ if [ ! -f ~/.arkeo/config/genesis.json ]; then add_account "$BOB" $TOKEN 1000000000000000 # bob, 1m add_claim_records "ARKEO" "$BOB" 1000 1000 1000 true + # Add Foundational Accounts - # FoundationCommunityAccount = "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx" - add_account "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx" $TOKEN 10000 - # FoundationDevAccount = "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r" - add_account "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r" $TOKEN 10000 - # FoundationGrantsAccount = "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup" - add_account "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup" $TOKEN 10000 + # FoundationCommunityAccount = "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc" + add_account "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc" $TOKEN 1048400000000000000 + # FoundationDevAccount = "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q" + add_account "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q" $TOKEN 12100000000000 + # FoundationGrantsAccount = "tarkeo1a307z4a82mcyv9njdj9ajnd9xpp90kmeqwntxj" + add_account "tarkeo1a307z4a82mcyv9njdj9ajnd9xpp90kmeqwntxj" $TOKEN 6050000000000 # Thorchain derived test addresses @@ -116,15 +116,15 @@ if [ ! -f ~/.arkeo/config/genesis.json ]; then add_claim_records "ETHEREUM" "0x92E14917A0508Eb56C90C90619f5F9Adbf49f47d" 500000 600000 700000 true # enable CORs on testnet/localnet - sed -i 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' ~/.arkeo/config/app.toml - sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["*"\]/g' ~/.arkeo/config/config.toml + sed -i '' 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' ~/.arkeo/config/app.toml + sed -i '' 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["*"\]/g' ~/.arkeo/config/config.toml fi - sed -i 's/"stake"/"uarkeo"/g' ~/.arkeo/config/genesis.json - sed -i '/"duration_until_decay"\|"duration_of_decay"/s/"3600s"/"7884000s"/' ~/.arkeo/config/genesis.json - sed -i 's/enable = false/enable = true/g' ~/.arkeo/config/app.toml - sed -i 's/127.0.0.1:26657/0.0.0.0:26657/g' ~/.arkeo/config/config.toml - sed -i 's/address = "tcp:\/\/localhost:1317"/address = "tcp:\/\/0.0.0.0:1317"/g' ~/.arkeo/config/app.toml + sed -i '' 's/"stake"/"uarkeo"/g' ~/.arkeo/config/genesis.json + sed -i '' '/"duration_until_decay"\|"duration_of_decay"/s/"3600s"/"7884000s"/' ~/.arkeo/config/genesis.json + sed -i '' 's/enable = false/enable = true/g' ~/.arkeo/config/app.toml + sed -i '' 's/127.0.0.1:26657/0.0.0.0:26657/g' ~/.arkeo/config/config.toml + sed -i '' 's/address = "tcp:\/\/localhost:1317"/address = "tcp:\/\/0.0.0.0:1317"/g' ~/.arkeo/config/app.toml # Update the supply field in genesis.json using jq jq --arg DENOM "$TOKEN" --arg AMOUNT "$TOTAL_SUPPLY" '.app_state.bank.supply = [{"denom": $DENOM, "amount": $AMOUNT}]' <~/.arkeo/config/genesis.json >/tmp/genesis.json diff --git a/x/arkeo/keeper/keeper.go b/x/arkeo/keeper/keeper.go index a347dd15..fe8f7fa1 100644 --- a/x/arkeo/keeper/keeper.go +++ b/x/arkeo/keeper/keeper.go @@ -28,6 +28,8 @@ import ( "github.com/arkeonetwork/arkeo/x/arkeo/types" ) +var inflation math.LegacyDec = math.LegacyNewDec(0) + type dbPrefix string func (p dbPrefix) String() string { @@ -35,7 +37,7 @@ func (p dbPrefix) String() string { } type Keeper interface { - Logger(ctx sdk.Context) log.Logger + Logger() log.Logger GetParams(ctx sdk.Context) types.Params SetParams(ctx sdk.Context, params types.Params) Cdc() codec.BinaryCodec @@ -65,7 +67,7 @@ type Keeper interface { StakingSetParams(ctx cosmos.Context, params stakingtypes.Params) error MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.DecCoin) (sdk.DecCoin, error) GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.DecCoin, error) - GetInflationRate(ctx cosmos.Context) math.LegacyDec + GetInflationRate(ctx cosmos.Context) (math.LegacyDec, error) MoveTokensFromDistributionToFoundationPoolAccount(ctx cosmos.Context) error AllocateTokensToValidator(ctx context.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins) error BurnCoins(ctx context.Context, moduleName string, coins sdk.Coins) error @@ -167,7 +169,7 @@ func NewKVStore( } } -func (k KVStore) Logger(ctx sdk.Context) log.Logger { +func (k KVStore) Logger() log.Logger { return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) } @@ -418,6 +420,7 @@ func (k KVStore) GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.Dec grantAccountAddress, k.stakingKeeper.GetBondedPool(ctx).GetAddress(), k.GetModuleAccAddress("claimarkeo"), + k.GetModuleAccAddress(types.ModuleName), } exemptBalance := cosmos.NewInt(0) @@ -443,7 +446,6 @@ func (k KVStore) GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.Dec } func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.DecCoin) (sdk.DecCoin, error) { - sdkContext := sdk.UnwrapSDKContext(ctx) params := k.GetParams(ctx) newlyMintedAmount := newlyMinted.Amount @@ -454,45 +456,70 @@ func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.Dec devAccountAddress, err := k.getFoundationDevAccountAddress() if err != nil { - sdkContext.Logger().Error(fmt.Sprintf("failed to fetch foundational account %s", err)) + k.Logger().Error(fmt.Sprintf("failed to fetch foundational account %s", err)) return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } communityAccountAddress, err := k.getFoundationCommunityAccountAddress() if err != nil { - sdkContext.Logger().Error(fmt.Sprintf("failed to fetch foundational account %s", err)) + k.Logger().Error(fmt.Sprintf("failed to fetch foundational account %s", err)) return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } grantAccountAddress, err := k.getFoundationGrantsAccountAddress() if err != nil { - sdkContext.Logger().Error(fmt.Sprintf("failed to fetch foundational account %s", err)) + k.Logger().Error(fmt.Sprintf("failed to fetch foundational account %s", err)) return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("failed to fetch foundational account %s", err) } - if err := k.MintAndSendToAccount(ctx, devAccountAddress, cosmos.NewCoin(newlyMinted.Denom, devFundAmount.RoundInt())); err != nil { - sdkContext.Logger().Error(fmt.Sprintf("failed to send amount to Dev foundational account %s", err)) - return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) + if !devFundAmount.IsZero() { + if err := k.MintAndSendToAccount(ctx, devAccountAddress, cosmos.NewCoin(newlyMinted.Denom, devFundAmount.RoundInt())); err != nil { + k.Logger().Error(fmt.Sprintf("failed to send amount to Dev foundational account %s", err)) + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) + } } - if err := k.MintAndSendToAccount(ctx, communityAccountAddress, cosmos.NewCoin(newlyMinted.Denom, communityPoolAmount.RoundInt())); err != nil { - sdkContext.Logger().Error(fmt.Sprintf("failed to send amount to Community foundational account %s", err)) - return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) + if !communityPoolAmount.IsZero() { + if err := k.MintAndSendToAccount(ctx, communityAccountAddress, cosmos.NewCoin(newlyMinted.Denom, communityPoolAmount.RoundInt())); err != nil { + k.Logger().Error(fmt.Sprintf("failed to send amount to Community foundational account %s", err)) + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) + } } - if err := k.MintAndSendToAccount(ctx, grantAccountAddress, cosmos.NewCoin(newlyMinted.Denom, grantFundAmount.RoundInt())); err != nil { - sdkContext.Logger().Error(fmt.Sprintf("failed to send amount to Grant foundational account %s", err)) - return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) + if !grantFundAmount.IsZero() { + if err := k.MintAndSendToAccount(ctx, grantAccountAddress, cosmos.NewCoin(newlyMinted.Denom, grantFundAmount.RoundInt())); err != nil { + k.Logger().Error(fmt.Sprintf("failed to send amount to Grant foundational account %s", err)) + return sdk.NewDecCoin(newlyMinted.Denom, sdkmath.NewInt(0)), fmt.Errorf("error sending amount to module %s", err) + } } balance := newlyMintedAmount.Sub(devFundAmount).Sub(communityPoolAmount).Sub(grantFundAmount) return sdk.NewDecCoin(newlyMinted.Denom, balance.RoundInt()), nil } -func (k KVStore) GetInflationRate(ctx cosmos.Context) math.LegacyDec { +func (k KVStore) GetInflationRate(ctx cosmos.Context) (math.LegacyDec, error) { params := k.GetParams(ctx) - return params.InflationChangePercentage + bondedRatio, err := k.stakingKeeper.BondedRatio(ctx) + if err != nil { + ctx.Logger().Error(fmt.Sprintf("failed to get bonded ration %s", err.Error())) + return math.LegacyNewDec(0), err + } + + inflationRateChangePerYear := math.LegacyOneDec().Sub(bondedRatio.Quo(params.GoalBonded)).Mul(params.InflationChangePercentage) + + inflationRateChange := inflationRateChangePerYear.Quo(sdkmath.LegacyNewDec(int64(params.BlockPerYear))) + + inflationRate := inflation.Add(inflationRateChange) + + if inflationRate.GT(params.InflationMax) { + inflationRate = params.InflationMax + } + if inflation.LT(params.InflationMin) { + inflationRate = params.InflationMin + } + + return inflationRate, nil } // transfer tokens form the Distribution to Foundation Community Pool diff --git a/x/arkeo/keeper/manager.go b/x/arkeo/keeper/manager.go index e5cbaca8..6c9dfa1e 100644 --- a/x/arkeo/keeper/manager.go +++ b/x/arkeo/keeper/manager.go @@ -31,6 +31,8 @@ func NewManager(k Keeper, sk stakingkeeper.Keeper) Manager { func (mgr *Manager) BeginBlock(ctx cosmos.Context) error { // if local version is behind the consensus version, panic and don't try to // create a new block + + params := mgr.keeper.GetParams(ctx) ver := mgr.keeper.GetComputedVersion(ctx) swVersion, err := configs.GetSWVersion() if err != nil { @@ -60,8 +62,8 @@ func (mgr *Manager) BeginBlock(ctx cosmos.Context) error { validatorPayoutCycle := sdkmath.LegacyNewDec(mgr.FetchConfig(ctx, configs.ValidatorPayoutCycle)) - emissionCurve := sdkmath.LegacyNewDec(mgr.FetchConfig(ctx, configs.EmissionCurve)) // Emission curve factor - blocksPerYear := sdkmath.LegacyNewDec(mgr.FetchConfig(ctx, configs.BlocksPerYear)) + emissionCurve := sdkmath.LegacyNewDec(int64(params.EmissionCurve)) // Emission curve factor + blocksPerYear := sdkmath.LegacyNewDec(int64(params.BlockPerYear)) // Distribute Minted To Pools balanceDistribution, err := mgr.keeper.MintAndDistributeTokens(ctx, circSupply) @@ -232,7 +234,7 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl for _, vote := range votes { val, err := mgr.sk.ValidatorByConsAddr(ctx, vote.Validator.Address) if err != nil { - ctx.Logger().Info("unable to find validator", "validator", string(vote.Validator.Address)) + mgr.keeper.Logger().Info("unable to find validator", "validator", string(vote.Validator.Address)) continue } if !val.IsBonded() || val.IsJailed() { @@ -246,17 +248,17 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl for _, vote := range votes { if vote.BlockIdFlag.String() == "BLOCK_ID_FLAG_ABSENT" || vote.BlockIdFlag.String() == "BLOCK_ID_FLAG_UNKNOWN" { - ctx.Logger().Info(fmt.Sprintf("validator rewards skipped due to lack of signature: %s, validator : %s ", vote.BlockIdFlag.String(), string(vote.Validator.GetAddress()))) + mgr.keeper.Logger().Info(fmt.Sprintf("validator rewards skipped due to lack of signature: %s, validator : %s ", vote.BlockIdFlag.String(), string(vote.Validator.GetAddress()))) continue } val, err := mgr.sk.ValidatorByConsAddr(ctx, vote.Validator.Address) if err != nil { - ctx.Logger().Info("unable to find validator", "validator", string(vote.Validator.Address)) + mgr.keeper.Logger().Info("unable to find validator", "validator", string(vote.Validator.Address)) continue } if !val.IsBonded() || val.IsJailed() { - ctx.Logger().Info("validator rewards skipped due to status or jailed", "validator", val.GetOperator()) + mgr.keeper.Logger().Info("validator rewards skipped due to status or jailed", "validator", val.GetOperator()) continue } @@ -284,7 +286,7 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl for _, delegate := range delegates { delegateAcc, err := cosmos.AccAddressFromBech32(delegate.DelegatorAddress) if err != nil { - ctx.Logger().Error("unable to fetch delegate address", "delegate", delegate.DelegatorAddress, "error", err) + mgr.keeper.Logger().Error("unable to fetch delegate address", "delegate", delegate.DelegatorAddress, "error", err) continue } delegateReward := common.GetSafeShare(delegate.GetShares().RoundInt(), val.GetDelegatorShares().RoundInt(), totalReward) @@ -295,22 +297,22 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl } if err := mgr.keeper.MintAndSendToAccount(ctx, delegateAcc, cosmos.NewCoin(blockReward.Denom, delegateReward)); err != nil { - ctx.Logger().Error("unable to pay rewards to delegate", "delegate", delegate.DelegatorAddress, "error", err) + mgr.keeper.Logger().Error("unable to pay rewards to delegate", "delegate", delegate.DelegatorAddress, "error", err) continue } - ctx.Logger().Info("delegate rewarded", "delegate", delegateAcc.String(), "amount", delegateReward) + mgr.keeper.Logger().Info("delegate rewarded", "delegate", delegateAcc.String(), "amount", delegateReward) } if !validatorReward.IsZero() { if err := mgr.keeper.AllocateTokensToValidator(ctx, val, sdk.NewDecCoins(sdk.NewDecCoin(blockReward.Denom, validatorReward))); err != nil { - ctx.Logger().Error("unable to pay rewards to validator", "validator", val.GetOperator(), "error", err) + mgr.keeper.Logger().Error("unable to pay rewards to validator", "validator", val.GetOperator(), "error", err) continue } - ctx.Logger().Info("validator additional rewards", "validator", acc.String(), "amount", validatorReward) + mgr.keeper.Logger().Info("validator additional rewards", "validator", acc.String(), "amount", validatorReward) } if err := mgr.EmitValidatorPayoutEvent(ctx, acc, validatorReward); err != nil { - ctx.Logger().Error("unable to emit validator payout event", "validator", acc.String(), "error", err) + mgr.keeper.Logger().Error("unable to emit validator payout event", "validator", acc.String(), "error", err) } } @@ -319,17 +321,15 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl } func (mgr Manager) calcBlockReward(ctx cosmos.Context, totalReserve, emissionCurve, blocksPerYear, validatorPayoutCycle sdkmath.LegacyDec) sdk.DecCoin { - sdkContext := sdk.UnwrapSDKContext(ctx) - // Block Rewards will take the latest reserve, divide it by the emission // curve factor, then divide by blocks per year if emissionCurve.IsZero() || blocksPerYear.IsZero() { - sdkContext.Logger().Info("block and emission-curve cannot be zero") + mgr.keeper.Logger().Info("block and emission-curve cannot be zero") return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)) } - if validatorPayoutCycle.IsZero() || sdkContext.BlockHeight()%validatorPayoutCycle.RoundInt64() != 0 { - sdkContext.Logger().Info("validator payout cycle cannot be zero") + if validatorPayoutCycle.IsZero() || ctx.BlockHeight()%validatorPayoutCycle.RoundInt64() != 0 { + mgr.keeper.Logger().Info("validator payout cycle cannot be zero") return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)) } @@ -435,23 +435,25 @@ func (mgr Manager) contractDebt(ctx cosmos.Context, contract types.Contract) (co } func (mgr Manager) circulatingSupplyAfterInflationCalc(ctx cosmos.Context) (sdk.DecCoin, error) { - sdkContext := sdk.UnwrapSDKContext(ctx) // Get the circulating supply circulatingSupply, err := mgr.keeper.GetCirculatingSupply(ctx, configs.Denom) if err != nil { - sdkContext.Logger().Error(fmt.Sprintf("failed to get circulating supply %s", err)) + mgr.keeper.Logger().Error(fmt.Sprintf("failed to get circulating supply %s", err)) return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)), err } // Get the inflation rate - inflationRate := mgr.keeper.GetInflationRate(ctx) - sdkContext.Logger().Info(fmt.Sprintf("inflation rate: %d", inflationRate)) + inflationRate, err := mgr.keeper.GetInflationRate(ctx) + if err != nil { + return sdk.NewDecCoin(configs.Denom, sdkmath.NewInt(0)), err + } + mgr.keeper.Logger().Info(fmt.Sprintf("inflation rate: %d", inflationRate)) // Multiply circulating supply by inflation rate to get the newly minted token amount newTokenAmountMintedDec := circulatingSupply.Amount.Mul(inflationRate).QuoInt64(100) - sdkContext.Logger().Info(fmt.Sprintf("After Inflation Calculation: %v", newTokenAmountMintedDec)) + mgr.keeper.Logger().Info(fmt.Sprintf("After Inflation Calculation: %v", newTokenAmountMintedDec)) return sdk.NewDecCoin(configs.Denom, newTokenAmountMintedDec.RoundInt()), nil } diff --git a/x/arkeo/keeper/manager_test.go b/x/arkeo/keeper/manager_test.go index e269240b..06c1adbe 100644 --- a/x/arkeo/keeper/manager_test.go +++ b/x/arkeo/keeper/manager_test.go @@ -441,7 +441,7 @@ func TestValidatorPayouts(t *testing.T) { require.Equal(t, devAccountBal, sdkmath.NewInt(400000)) grantAccountBal := k.GetBalance(ctx, grantAccountAddress).AmountOf(configs.Denom) - require.Equal(t, grantAccountBal, sdkmath.NewInt(400000)) + require.Equal(t, grantAccountBal, sdkmath.NewInt(0)) communityAccountBal := k.GetBalance(ctx, communityAccountAddress).AmountOf(configs.Denom) require.Equal(t, communityAccountBal, sdkmath.NewInt(200000)) @@ -454,16 +454,16 @@ func TestValidatorPayouts(t *testing.T) { totalBal := cosmos.ZeroInt() // Check balances of validators 7 - checkBalance(ctx, t, k, acc1, configs.Denom, 117529, &totalBal) - checkBalance(ctx, t, k, acc2, configs.Denom, 234824, &totalBal) - checkBalance(ctx, t, k, acc3, configs.Denom, 585294, &totalBal) + checkBalance(ctx, t, k, acc1, configs.Denom, 164541, &totalBal) + checkBalance(ctx, t, k, acc2, configs.Denom, 328753, &totalBal) + checkBalance(ctx, t, k, acc3, configs.Denom, 819411, &totalBal) // Check balances of delegates - checkBalance(ctx, t, k, delAcc1, configs.Denom, 11753, &totalBal) - checkBalance(ctx, t, k, delAcc2, configs.Denom, 23482, &totalBal) - checkBalance(ctx, t, k, delAcc3, configs.Denom, 23411, &totalBal) + checkBalance(ctx, t, k, delAcc1, configs.Denom, 16455, &totalBal) + checkBalance(ctx, t, k, delAcc2, configs.Denom, 32875, &totalBal) + checkBalance(ctx, t, k, delAcc3, configs.Denom, 32776, &totalBal) - require.Equal(t, totalBal.ToLegacyDec(), sdkmath.LegacyNewDec(996293)) + require.Equal(t, totalBal.ToLegacyDec(), sdkmath.LegacyNewDec(1394811)) moduleBalance = k.GetBalanceOfModule(ctx, types.ModuleName, configs.Denom) require.Equal(t, moduleBalance.ToLegacyDec().RoundInt64(), int64(20000000000000)) diff --git a/x/arkeo/types/keys.go b/x/arkeo/types/keys.go index 019d4064..b8214eb8 100644 --- a/x/arkeo/types/keys.go +++ b/x/arkeo/types/keys.go @@ -23,7 +23,7 @@ func KeyPrefix(p string) []byte { // Foundational Accounts const ( - FoundationDevAccount = "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r" - FoundationCommunityAccount = "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx" - FoundationGrantsAccount = "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup" + FoundationDevAccount = "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q" + FoundationCommunityAccount = "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc" + FoundationGrantsAccount = "tarkeo1a307z4a82mcyv9njdj9ajnd9xpp90kmeqwntxj" ) diff --git a/x/arkeo/types/params.go b/x/arkeo/types/params.go index f19457a9..7f26761e 100644 --- a/x/arkeo/types/params.go +++ b/x/arkeo/types/params.go @@ -18,8 +18,13 @@ func NewParams() Params { return Params{ CommunityPoolPercentage: math.LegacyMustNewDecFromStr("0.100000000000000000"), DevFundPercentage: math.LegacyMustNewDecFromStr("0.200000000000000000"), - GrantFundPercentage: math.LegacyMustNewDecFromStr("0.200000000000000000"), + GrantFundPercentage: math.LegacyMustNewDecFromStr("0.000000000000000000"), InflationChangePercentage: math.LegacyMustNewDecFromStr("0.030000000000000000"), + InflationMin: math.LegacyMustNewDecFromStr("0.020000000000000000"), + InflationMax: math.LegacyMustNewDecFromStr("0.050000000000000000"), + GoalBonded: math.LegacyMustNewDecFromStr("0.670000000000000000"), + BlockPerYear: 6311520, + EmissionCurve: 6, } } diff --git a/x/arkeo/types/params.pb.go b/x/arkeo/types/params.pb.go index c1acfbca..d7602f97 100644 --- a/x/arkeo/types/params.pb.go +++ b/x/arkeo/types/params.pb.go @@ -33,6 +33,11 @@ type Params struct { DevFundPercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=dev_fund_percentage,json=devFundPercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"dev_fund_percentage"` GrantFundPercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=grant_fund_percentage,json=grantFundPercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"grant_fund_percentage"` InflationChangePercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=inflation_change_percentage,json=inflationChangePercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_change_percentage"` + InflationMin cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=inflation_min,json=inflationMin,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_min"` + InflationMax cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=inflation_max,json=inflationMax,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_max"` + GoalBonded cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=goal_bonded,json=goalBonded,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"goal_bonded"` + BlockPerYear uint64 `protobuf:"varint,8,opt,name=block_per_year,json=blockPerYear,proto3" json:"block_per_year,omitempty"` + EmissionCurve uint64 `protobuf:"varint,9,opt,name=emission_curve,json=emissionCurve,proto3" json:"emission_curve,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -67,6 +72,20 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +func (m *Params) GetBlockPerYear() uint64 { + if m != nil { + return m.BlockPerYear + } + return 0 +} + +func (m *Params) GetEmissionCurve() uint64 { + if m != nil { + return m.EmissionCurve + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "arkeo.arkeo.Params") } @@ -74,29 +93,35 @@ func init() { func init() { proto.RegisterFile("arkeo/arkeo/params.proto", fileDescriptor_47c871f4fc73dfc5) } var fileDescriptor_47c871f4fc73dfc5 = []byte{ - // 343 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xbd, 0x4e, 0xf3, 0x30, - 0x14, 0x86, 0x93, 0xaf, 0x55, 0xa5, 0xcf, 0x4c, 0xb4, 0x20, 0xfa, 0x23, 0xb9, 0x88, 0x09, 0x09, - 0x91, 0xa8, 0x62, 0x63, 0x2c, 0x85, 0x89, 0xa1, 0x62, 0x64, 0x89, 0x1c, 0xe7, 0xd4, 0x8d, 0x5a, - 0xfb, 0x84, 0xc4, 0x29, 0xf4, 0x2e, 0x18, 0x19, 0xb9, 0x08, 0x26, 0xae, 0xa0, 0x63, 0xc5, 0x84, - 0x18, 0x2a, 0xd4, 0xde, 0x08, 0xc2, 0x8e, 0x4a, 0x05, 0x5b, 0x97, 0x93, 0xf8, 0xbc, 0xf6, 0xf3, - 0x2c, 0x2f, 0xa9, 0xb3, 0x74, 0x04, 0xe8, 0xdb, 0x99, 0xb0, 0x94, 0xc9, 0xcc, 0x4b, 0x52, 0xd4, - 0x58, 0xdd, 0x31, 0x3b, 0xcf, 0xcc, 0xe6, 0x9e, 0x40, 0x81, 0x66, 0xef, 0x7f, 0xff, 0xd9, 0x2b, - 0x4d, 0xca, 0x31, 0x93, 0x98, 0xf9, 0x21, 0xcb, 0xc0, 0x9f, 0x74, 0x42, 0xd0, 0xac, 0xe3, 0x73, - 0x8c, 0x55, 0x91, 0x37, 0x6c, 0x1e, 0xd8, 0x87, 0xf6, 0x60, 0xa3, 0xa3, 0xd7, 0x12, 0xa9, 0xf4, - 0x8d, 0xae, 0x2a, 0x49, 0x83, 0xa3, 0x94, 0xb9, 0x8a, 0xf5, 0x34, 0x48, 0x10, 0xc7, 0x41, 0x02, - 0x29, 0x07, 0xa5, 0x99, 0x80, 0xba, 0x7b, 0xe8, 0x1e, 0xff, 0xef, 0x76, 0x66, 0x8b, 0xb6, 0xf3, - 0xb1, 0x68, 0xb7, 0x2c, 0x23, 0x8b, 0x46, 0x5e, 0x8c, 0xbe, 0x64, 0x7a, 0xe8, 0x5d, 0x83, 0x60, - 0x7c, 0xda, 0x03, 0xfe, 0xf6, 0x72, 0x4a, 0x0a, 0x45, 0x0f, 0xf8, 0xcd, 0xc1, 0x9a, 0xd9, 0x47, - 0x1c, 0xf7, 0xd7, 0xc4, 0x2a, 0x23, 0xb5, 0x08, 0x26, 0xc1, 0x20, 0x57, 0xd1, 0xa6, 0xe8, 0xdf, - 0xb6, 0xa2, 0xdd, 0x08, 0x26, 0x57, 0xb9, 0x8a, 0x36, 0x14, 0x40, 0xf6, 0x45, 0xca, 0x94, 0xfe, - 0x23, 0x29, 0x6d, 0x2b, 0xa9, 0x19, 0xde, 0x2f, 0xcd, 0x1d, 0x69, 0xc5, 0x6a, 0x30, 0x66, 0x3a, - 0x46, 0x15, 0xf0, 0x21, 0x53, 0x02, 0x36, 0x65, 0xe5, 0x6d, 0x65, 0x8d, 0x35, 0xf5, 0xc2, 0x40, - 0x7f, 0x94, 0xe7, 0xe5, 0xa7, 0xe7, 0xb6, 0xd3, 0xbd, 0x9c, 0x2d, 0xa9, 0x3b, 0x5f, 0x52, 0xf7, - 0x73, 0x49, 0xdd, 0xc7, 0x15, 0x75, 0xe6, 0x2b, 0xea, 0xbc, 0xaf, 0xa8, 0x73, 0x7b, 0x22, 0x62, - 0x3d, 0xcc, 0x43, 0x8f, 0xa3, 0xb4, 0x9d, 0x52, 0xa0, 0xef, 0x31, 0x1d, 0x15, 0x05, 0x7b, 0x28, - 0xbe, 0x7a, 0x9a, 0x40, 0x16, 0x56, 0x4c, 0x15, 0xce, 0xbe, 0x02, 0x00, 0x00, 0xff, 0xff, 0x36, - 0xa2, 0x81, 0xbc, 0x84, 0x02, 0x00, 0x00, + // 445 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xcf, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x13, 0xad, 0xd5, 0x9d, 0xfd, 0x01, 0x66, 0x15, 0xd3, 0x5d, 0x48, 0x17, 0x51, 0x58, + 0x10, 0x13, 0x8a, 0x37, 0x8f, 0xdd, 0xd5, 0x93, 0x42, 0xe9, 0x41, 0xd0, 0x4b, 0x78, 0x99, 0xbc, + 0x4d, 0x87, 0x66, 0xe6, 0xc5, 0xc9, 0xa4, 0xb6, 0x7f, 0x83, 0x17, 0x8f, 0x1e, 0xfd, 0x23, 0xfc, + 0x23, 0xf6, 0xb8, 0x78, 0x12, 0x0f, 0x8b, 0xb4, 0xff, 0x88, 0x74, 0x52, 0x6b, 0xa9, 0xb7, 0xb0, + 0x97, 0x97, 0xe4, 0xfb, 0x5e, 0x3e, 0x1f, 0x98, 0xe1, 0x31, 0x1f, 0xf4, 0x18, 0x29, 0xaa, 0x6b, + 0x01, 0x1a, 0x64, 0x19, 0x16, 0x9a, 0x0c, 0x79, 0xbb, 0x36, 0x0b, 0x6d, 0x3d, 0x7a, 0x90, 0x51, + 0x46, 0x36, 0x8f, 0x96, 0x6f, 0xf5, 0xc8, 0x51, 0xc0, 0xa9, 0x94, 0x54, 0x46, 0x09, 0x94, 0x18, + 0x4d, 0x7a, 0x09, 0x1a, 0xe8, 0x45, 0x9c, 0x84, 0x5a, 0xf5, 0x3b, 0x75, 0x3f, 0xae, 0x7f, 0xac, + 0x3f, 0xea, 0xd6, 0xe3, 0xcf, 0x6d, 0xd6, 0x1e, 0x58, 0x9d, 0x27, 0x59, 0x87, 0x93, 0x94, 0x95, + 0x12, 0x66, 0x16, 0x17, 0x44, 0x79, 0x5c, 0xa0, 0xe6, 0xa8, 0x0c, 0x64, 0xe8, 0xbb, 0x27, 0xee, + 0xe9, 0x4e, 0xbf, 0x77, 0x79, 0xdd, 0x75, 0x7e, 0x5d, 0x77, 0x8f, 0x6b, 0x46, 0x99, 0x8e, 0x43, + 0x41, 0x91, 0x04, 0x33, 0x0a, 0xdf, 0x60, 0x06, 0x7c, 0x76, 0x8e, 0xfc, 0xc7, 0xf7, 0xe7, 0x6c, + 0xa5, 0x38, 0x47, 0x3e, 0x7c, 0xb4, 0x66, 0x0e, 0x88, 0xf2, 0xc1, 0x9a, 0xe8, 0x01, 0x3b, 0x4c, + 0x71, 0x12, 0x5f, 0x54, 0x2a, 0xdd, 0x14, 0xdd, 0x6a, 0x2a, 0xba, 0x9f, 0xe2, 0xe4, 0x75, 0xa5, + 0xd2, 0x0d, 0x05, 0xb2, 0x87, 0x99, 0x06, 0x65, 0xfe, 0x93, 0xdc, 0x6e, 0x2a, 0x39, 0xb4, 0xbc, + 0x2d, 0xcd, 0x47, 0x76, 0x2c, 0xd4, 0x45, 0x0e, 0x46, 0x90, 0x8a, 0xf9, 0x08, 0x54, 0x86, 0x9b, + 0xb2, 0x56, 0x53, 0x59, 0x67, 0x4d, 0x3d, 0xb3, 0xd0, 0x0d, 0xe5, 0x3b, 0xb6, 0xff, 0x4f, 0x29, + 0x85, 0xf2, 0xef, 0x34, 0x95, 0xec, 0xad, 0x39, 0x6f, 0x85, 0xda, 0xe2, 0xc2, 0xd4, 0x6f, 0xdf, + 0x00, 0x17, 0xa6, 0xde, 0x90, 0xed, 0x66, 0x04, 0x79, 0x9c, 0x90, 0x4a, 0x31, 0xf5, 0xef, 0x36, + 0xa5, 0xb2, 0x25, 0xa5, 0x6f, 0x21, 0xde, 0x13, 0x76, 0x90, 0xe4, 0xc4, 0xc7, 0xcb, 0xb3, 0x8e, + 0x67, 0x08, 0xda, 0xbf, 0x77, 0xe2, 0x9e, 0xb6, 0x86, 0x7b, 0x36, 0x1d, 0xa0, 0x7e, 0x8f, 0xa0, + 0xbd, 0xa7, 0xec, 0x00, 0xa5, 0x28, 0x4b, 0x7b, 0x37, 0x95, 0x9e, 0xa0, 0xbf, 0x63, 0xa7, 0xf6, + 0xff, 0xa6, 0x67, 0xcb, 0xf0, 0x65, 0xeb, 0xeb, 0xb7, 0xae, 0xd3, 0x7f, 0x75, 0x39, 0x0f, 0xdc, + 0xab, 0x79, 0xe0, 0xfe, 0x9e, 0x07, 0xee, 0x97, 0x45, 0xe0, 0x5c, 0x2d, 0x02, 0xe7, 0xe7, 0x22, + 0x70, 0x3e, 0x3c, 0xcb, 0x84, 0x19, 0x55, 0x49, 0xc8, 0x49, 0xd6, 0x4b, 0xaa, 0xd0, 0x7c, 0x22, + 0x3d, 0x5e, 0x6d, 0xec, 0x74, 0xf5, 0x34, 0xb3, 0x02, 0xcb, 0xa4, 0x6d, 0x77, 0xeb, 0xc5, 0x9f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x94, 0x80, 0x25, 0xba, 0xd5, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -119,6 +144,46 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.EmissionCurve != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.EmissionCurve)) + i-- + dAtA[i] = 0x48 + } + if m.BlockPerYear != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.BlockPerYear)) + i-- + dAtA[i] = 0x40 + } + { + size := m.GoalBonded.Size() + i -= size + if _, err := m.GoalBonded.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.InflationMax.Size() + i -= size + if _, err := m.InflationMax.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.InflationMin.Size() + i -= size + if _, err := m.InflationMin.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a { size := m.InflationChangePercentage.Size() i -= size @@ -187,6 +252,18 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) l = m.InflationChangePercentage.Size() n += 1 + l + sovParams(uint64(l)) + l = m.InflationMin.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.InflationMax.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.GoalBonded.Size() + n += 1 + l + sovParams(uint64(l)) + if m.BlockPerYear != 0 { + n += 1 + sovParams(uint64(m.BlockPerYear)) + } + if m.EmissionCurve != 0 { + n += 1 + sovParams(uint64(m.EmissionCurve)) + } return n } @@ -361,6 +438,146 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationMin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InflationMin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationMax", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InflationMax.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GoalBonded", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GoalBonded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockPerYear", wireType) + } + m.BlockPerYear = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockPerYear |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EmissionCurve", wireType) + } + m.EmissionCurve = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EmissionCurve |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From dd615038a56ea67d7395ca02ea509c79fda299ae Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Tue, 1 Oct 2024 11:36:28 +0530 Subject: [PATCH 12/14] chore: update regression tests --- .../suites_contracts_pay-as-you-go.json | 115 +++++++---------- .../suites_contracts_subscription.json | 115 +++++++---------- .../mnt/exports/suites_core_send.json | 120 ++++++----------- .../mnt/exports/suites_initialize.json | 120 ++++++----------- .../exports/suites_providers_providers.json | 122 +++++++----------- .../suites_sentinel_contract_config.json | 88 +++++-------- .../mnt/exports/suites_sentinel_sentinel.json | 88 +++++-------- 7 files changed, 290 insertions(+), 478 deletions(-) diff --git a/test/regression/mnt/exports/suites_contracts_pay-as-you-go.json b/test/regression/mnt/exports/suites_contracts_pay-as-you-go.json index e30999a4..6a7155e8 100644 --- a/test/regression/mnt/exports/suites_contracts_pay-as-you-go.json +++ b/test/regression/mnt/exports/suites_contracts_pay-as-you-go.json @@ -46,9 +46,15 @@ ], "next_contract_id": "2", "params": { - "CommunityPoolPercentage": "10", - "DevFundPercentage": "20", - "GrantFundPercentage": "20" + "block_per_year": "6311520", + "community_pool_percentage": "0.100000000000000000", + "dev_fund_percentage": "0.200000000000000000", + "emission_curve": "6", + "goal_bonded": "0.670000000000000000", + "grant_fund_percentage": "0.000000000000000000", + "inflation_change_percentage": "0.030000000000000000", + "inflation_max": "0.050000000000000000", + "inflation_min": "0.020000000000000000" }, "providers": [ { @@ -77,10 +83,17 @@ } ], "user_contract_sets": [], - "version": "0" + "version": "1" }, "auth": { "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "10", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -95,6 +108,13 @@ "staking" ] }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "11", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -119,20 +139,6 @@ }, "sequence": "2" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "11", - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", - "pub_key": null, - "sequence": "0" - }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "13", - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -146,13 +152,6 @@ "burner" ] }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "10", - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -169,7 +168,7 @@ { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { - "account_number": "14", + "account_number": "12", "address": "tarkeo1kz2dkl8zlxwte008astc5e65htrxdcse6x3h3h", "pub_key": null, "sequence": "0" @@ -187,7 +186,8 @@ }, "name": "arkeo", "permissions": [ - "minter" + "minter", + "burner" ] }, { @@ -200,13 +200,6 @@ }, "sequence": "1" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "12", - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -265,37 +258,37 @@ ] }, { - "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", "coins": [ { - "amount": "50000000000000000", + "amount": "1200605009566", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", + "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", "coins": [ { - "amount": "1000000000000003", + "amount": "50000000000000000", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", "coins": [ { - "amount": "621404328", + "amount": "600538144583", "denom": "uarkeo" } ] }, { - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", + "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", "coins": [ { - "amount": "643005225", + "amount": "1000000000000003", "denom": "uarkeo" } ] @@ -304,7 +297,7 @@ "address": "tarkeo1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8t6gr9e", "coins": [ { - "amount": "15766261669", + "amount": "15830782786", "denom": "uarkeo" } ] @@ -313,7 +306,7 @@ "address": "tarkeo1k8925g52vwe5jgfp4nqr7ljuhs7nzu2f8g0za5", "coins": [ { - "amount": "207167575", + "amount": "100000000", "denom": "uarkeo" } ] @@ -322,16 +315,7 @@ "address": "tarkeo1hnyy4gp5tgarpg3xu6w5cw4zsyphx2lyvls9rz", "coins": [ { - "amount": "1498845173", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "coins": [ - { - "amount": "643005225", + "amount": "103474", "denom": "uarkeo" } ] @@ -344,15 +328,6 @@ "denom": "uarkeo" } ] - }, - { - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "coins": [ - { - "amount": "1500352", - "denom": "uarkeo" - } - ] } ], "denom_metadata": [], @@ -363,7 +338,7 @@ "send_enabled": [], "supply": [ { - "amount": "52001019281189547", + "amount": "52002816974040409", "denom": "uarkeo" } ] @@ -438,7 +413,7 @@ "fee_pool": { "community_pool": [ { - "amount": "21421544.840000000000000000", + "amount": "85688652.700000000000000000", "denom": "uarkeo" } ] @@ -447,7 +422,7 @@ { "outstanding_rewards": [ { - "amount": "15744840124.160000000000000000", + "amount": "15745094231.300000000000000000", "denom": "uarkeo" } ], @@ -466,7 +441,7 @@ "accumulated": { "commission": [ { - "amount": "1574484012.416000000000000000", + "amount": "1574509423.130000000000000000", "denom": "uarkeo" } ] @@ -480,7 +455,7 @@ "period": "2", "rewards": [ { - "amount": "14170356111.744000000000000000", + "amount": "14170584808.170000000000000000", "denom": "uarkeo" } ] @@ -655,8 +630,8 @@ }, "mint": { "minter": { - "annual_provisions": "6760125348991042.808880506171119200", - "inflation": "0.129999865570708475" + "annual_provisions": "6760343469143471.564097458997205602", + "inflation": "0.129999865577861409" }, "params": { "blocks_per_year": "6311520", diff --git a/test/regression/mnt/exports/suites_contracts_subscription.json b/test/regression/mnt/exports/suites_contracts_subscription.json index 593ebc6c..16d96cc5 100644 --- a/test/regression/mnt/exports/suites_contracts_subscription.json +++ b/test/regression/mnt/exports/suites_contracts_subscription.json @@ -67,9 +67,15 @@ ], "next_contract_id": "3", "params": { - "CommunityPoolPercentage": "10", - "DevFundPercentage": "20", - "GrantFundPercentage": "20" + "block_per_year": "6311520", + "community_pool_percentage": "0.100000000000000000", + "dev_fund_percentage": "0.200000000000000000", + "emission_curve": "6", + "goal_bonded": "0.670000000000000000", + "grant_fund_percentage": "0.000000000000000000", + "inflation_change_percentage": "0.030000000000000000", + "inflation_max": "0.050000000000000000", + "inflation_min": "0.020000000000000000" }, "providers": [ { @@ -98,10 +104,17 @@ } ], "user_contract_sets": [], - "version": "0" + "version": "1" }, "auth": { "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "10", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -116,6 +129,13 @@ "staking" ] }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "11", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -137,20 +157,6 @@ "pub_key": null, "sequence": "0" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "11", - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", - "pub_key": null, - "sequence": "0" - }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "13", - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -164,13 +170,6 @@ "burner" ] }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "10", - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -187,7 +186,7 @@ { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { - "account_number": "14", + "account_number": "12", "address": "tarkeo1kz2dkl8zlxwte008astc5e65htrxdcse6x3h3h", "pub_key": null, "sequence": "0" @@ -205,7 +204,8 @@ }, "name": "arkeo", "permissions": [ - "minter" + "minter", + "burner" ] }, { @@ -218,13 +218,6 @@ }, "sequence": "2" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "12", - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -283,37 +276,37 @@ ] }, { - "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", "coins": [ { - "amount": "50000000000000000", + "amount": "1440727141200", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", + "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", "coins": [ { - "amount": "1000000000000108", + "amount": "50000000000000000", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", "coins": [ { - "amount": "749969453", + "amount": "720749166049", "denom": "uarkeo" } ] }, { - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", + "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", "coins": [ { - "amount": "771606216", + "amount": "1000000000000108", "denom": "uarkeo" } ] @@ -322,7 +315,7 @@ "address": "tarkeo1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8t6gr9e", "coins": [ { - "amount": "18915228438", + "amount": "18894177023", "denom": "uarkeo" } ] @@ -331,7 +324,7 @@ "address": "tarkeo1k8925g52vwe5jgfp4nqr7ljuhs7nzu2f8g0za5", "coins": [ { - "amount": "307167587", + "amount": "200000012", "denom": "uarkeo" } ] @@ -340,16 +333,7 @@ "address": "tarkeo1hnyy4gp5tgarpg3xu6w5cw4zsyphx2lyvls9rz", "coins": [ { - "amount": "1820026156", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "coins": [ - { - "amount": "771606216", + "amount": "125647", "denom": "uarkeo" } ] @@ -362,15 +346,6 @@ "denom": "uarkeo" } ] - }, - { - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "coins": [ - { - "amount": "1821854", - "denom": "uarkeo" - } - ] } ], "denom_metadata": [], @@ -381,7 +356,7 @@ "send_enabled": [], "supply": [ { - "amount": "52001023137425908", + "amount": "52003180370609919", "denom": "uarkeo" } ] @@ -456,7 +431,7 @@ "fee_pool": { "community_pool": [ { - "amount": "21421541.840000000000000000", + "amount": "0.440000000000000000", "denom": "uarkeo" } ] @@ -465,7 +440,7 @@ { "outstanding_rewards": [ { - "amount": "18893806896.160000000000000000", + "amount": "18894177141.560000000000000000", "denom": "uarkeo" } ], @@ -484,7 +459,7 @@ "accumulated": { "commission": [ { - "amount": "1889380689.616000000000000000", + "amount": "1889417714.156000000000000000", "denom": "uarkeo" } ] @@ -498,7 +473,7 @@ "period": "2", "rewards": [ { - "amount": "17004426206.544000000000000000", + "amount": "17004759427.404000000000000000", "denom": "uarkeo" } ] @@ -673,8 +648,8 @@ }, "mint": { "minter": { - "annual_provisions": "6760124452210194.355441603119737810", - "inflation": "0.129999838684869898" + "annual_provisions": "6760389312648620.453696029191955035", + "inflation": "0.129999838695292701" }, "params": { "blocks_per_year": "6311520", diff --git a/test/regression/mnt/exports/suites_core_send.json b/test/regression/mnt/exports/suites_core_send.json index 39ae93ec..53fb2bfc 100644 --- a/test/regression/mnt/exports/suites_core_send.json +++ b/test/regression/mnt/exports/suites_core_send.json @@ -7,16 +7,29 @@ "contracts": [], "next_contract_id": "1", "params": { - "CommunityPoolPercentage": "10", - "DevFundPercentage": "20", - "GrantFundPercentage": "20" + "block_per_year": "6311520", + "community_pool_percentage": "0.100000000000000000", + "dev_fund_percentage": "0.200000000000000000", + "emission_curve": "6", + "goal_bonded": "0.670000000000000000", + "grant_fund_percentage": "0.000000000000000000", + "inflation_change_percentage": "0.030000000000000000", + "inflation_max": "0.050000000000000000", + "inflation_min": "0.020000000000000000" }, "providers": [], "user_contract_sets": [], - "version": "0" + "version": "1" }, "auth": { "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "10", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -31,6 +44,13 @@ "staking" ] }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "11", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -52,20 +72,6 @@ "pub_key": null, "sequence": "0" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "11", - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", - "pub_key": null, - "sequence": "0" - }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "13", - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -79,13 +85,6 @@ "burner" ] }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "10", - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -109,7 +108,8 @@ }, "name": "arkeo", "permissions": [ - "minter" + "minter", + "burner" ] }, { @@ -122,13 +122,6 @@ }, "sequence": "1" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "12", - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -178,37 +171,37 @@ "bank": { "balances": [ { - "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", "coins": [ { - "amount": "50000000000000000", + "amount": "240000255341", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", + "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", "coins": [ { - "amount": "1000000400000000", + "amount": "50000000000000000", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", "coins": [ { - "amount": "64299303", + "amount": "120042970010", "denom": "uarkeo" } ] }, { - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", + "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", "coins": [ { - "amount": "128598609", + "amount": "1000000400000000", "denom": "uarkeo" } ] @@ -217,16 +210,7 @@ "address": "tarkeo1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8t6gr9e", "coins": [ { - "amount": "3213171739", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo1k8925g52vwe5jgfp4nqr7ljuhs7nzu2f8g0za5", - "coins": [ - { - "amount": "107165513", + "amount": "3170336802", "denom": "uarkeo" } ] @@ -235,16 +219,7 @@ "address": "tarkeo1hnyy4gp5tgarpg3xu6w5cw4zsyphx2lyvls9rz", "coins": [ { - "amount": "214116679", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "coins": [ - { - "amount": "128598609", + "amount": "14774", "denom": "uarkeo" } ] @@ -257,15 +232,6 @@ "denom": "uarkeo" } ] - }, - { - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "coins": [ - { - "amount": "214332", - "denom": "uarkeo" - } - ] } ], "denom_metadata": [], @@ -276,7 +242,7 @@ "send_enabled": [], "supply": [ { - "amount": "52000003856164784", + "amount": "52000363213576927", "denom": "uarkeo" } ] @@ -351,7 +317,7 @@ "fee_pool": { "community_pool": [ { - "amount": "64263434.780000000000000000", + "amount": "21421242.840000000000000000", "denom": "uarkeo" } ] @@ -360,7 +326,7 @@ { "outstanding_rewards": [ { - "amount": "3148908304.220000000000000000", + "amount": "3148915573.160000000000000000", "denom": "uarkeo" } ], @@ -379,7 +345,7 @@ "accumulated": { "commission": [ { - "amount": "314890830.422000000000000000", + "amount": "314891557.316000000000000000", "denom": "uarkeo" } ] @@ -393,7 +359,7 @@ "period": "2", "rewards": [ { - "amount": "2834017473.798000000000000000", + "amount": "2834024015.844000000000000000", "denom": "uarkeo" } ] @@ -568,8 +534,8 @@ }, "mint": { "minter": { - "annual_provisions": "6759998936046892.886047279891762320", - "inflation": "0.129999973112423204" + "annual_provisions": "6760030080351352.543315475191878170", + "inflation": "0.129999973112627482" }, "params": { "blocks_per_year": "6311520", diff --git a/test/regression/mnt/exports/suites_initialize.json b/test/regression/mnt/exports/suites_initialize.json index 8faee0d3..b0f4ffe3 100644 --- a/test/regression/mnt/exports/suites_initialize.json +++ b/test/regression/mnt/exports/suites_initialize.json @@ -7,16 +7,29 @@ "contracts": [], "next_contract_id": "1", "params": { - "CommunityPoolPercentage": "10", - "DevFundPercentage": "20", - "GrantFundPercentage": "20" + "block_per_year": "6311520", + "community_pool_percentage": "0.100000000000000000", + "dev_fund_percentage": "0.200000000000000000", + "emission_curve": "6", + "goal_bonded": "0.670000000000000000", + "grant_fund_percentage": "0.000000000000000000", + "inflation_change_percentage": "0.030000000000000000", + "inflation_max": "0.050000000000000000", + "inflation_min": "0.020000000000000000" }, "providers": [], "user_contract_sets": [], - "version": "0" + "version": "1" }, "auth": { "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "10", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -31,6 +44,13 @@ "staking" ] }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "11", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -52,20 +72,6 @@ "pub_key": null, "sequence": "0" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "11", - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", - "pub_key": null, - "sequence": "0" - }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "13", - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -79,13 +85,6 @@ "burner" ] }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "10", - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -109,7 +108,8 @@ }, "name": "arkeo", "permissions": [ - "minter" + "minter", + "burner" ] }, { @@ -122,13 +122,6 @@ }, "sequence": "2" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "12", - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -175,37 +168,37 @@ "bank": { "balances": [ { - "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", "coins": [ { - "amount": "50000000000000000", + "amount": "160000128527", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", + "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", "coins": [ { - "amount": "1000000001000000", + "amount": "50000000000000000", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", "coins": [ { - "amount": "42866203", + "amount": "80042906603", "denom": "uarkeo" } ] }, { - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", + "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", "coins": [ { - "amount": "85732408", + "amount": "1000000000000000", "denom": "uarkeo" } ] @@ -214,16 +207,7 @@ "address": "tarkeo1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8t6gr9e", "coins": [ { - "amount": "2142114540", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo1k8925g52vwe5jgfp4nqr7ljuhs7nzu2f8g0za5", - "coins": [ - { - "amount": "107165513", + "amount": "2099274668", "denom": "uarkeo" } ] @@ -232,16 +216,7 @@ "address": "tarkeo1hnyy4gp5tgarpg3xu6w5cw4zsyphx2lyvls9rz", "coins": [ { - "amount": "106058342", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "coins": [ - { - "amount": "85732408", + "amount": "7387", "denom": "uarkeo" } ] @@ -254,15 +229,6 @@ "denom": "uarkeo" } ] - }, - { - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "coins": [ - { - "amount": "107166", - "denom": "uarkeo" - } - ] } ], "denom_metadata": [], @@ -273,7 +239,7 @@ "send_enabled": [], "supply": [ { - "amount": "52000002570776580", + "amount": "52000242142317185", "denom": "uarkeo" } ] @@ -348,7 +314,7 @@ "fee_pool": { "community_pool": [ { - "amount": "42842290.800000000000000000", + "amount": "0.160000000000000000", "denom": "uarkeo" } ] @@ -357,7 +323,7 @@ { "outstanding_rewards": [ { - "amount": "2099272249.200000000000000000", + "amount": "2099274674.840000000000000000", "denom": "uarkeo" } ], @@ -376,7 +342,7 @@ "accumulated": { "commission": [ { - "amount": "209927224.920000000000000000", + "amount": "209927467.484000000000000000", "denom": "uarkeo" } ] @@ -390,7 +356,7 @@ "period": "2", "rewards": [ { - "amount": "1889345024.280000000000000000", + "amount": "1889347207.356000000000000000", "denom": "uarkeo" } ] @@ -565,8 +531,8 @@ }, "mint": { "minter": { - "annual_provisions": "6759999234997758.173347634280370968", - "inflation": "0.129999982074948072" + "annual_provisions": "6760014807144472.792103205454968905", + "inflation": "0.129999982075016165" }, "params": { "blocks_per_year": "6311520", diff --git a/test/regression/mnt/exports/suites_providers_providers.json b/test/regression/mnt/exports/suites_providers_providers.json index 4b1a06b9..596a5ef5 100644 --- a/test/regression/mnt/exports/suites_providers_providers.json +++ b/test/regression/mnt/exports/suites_providers_providers.json @@ -7,20 +7,26 @@ "contracts": [], "next_contract_id": "1", "params": { - "CommunityPoolPercentage": "10", - "DevFundPercentage": "20", - "GrantFundPercentage": "20" + "block_per_year": "6311520", + "community_pool_percentage": "0.100000000000000000", + "dev_fund_percentage": "0.200000000000000000", + "emission_curve": "6", + "goal_bonded": "0.670000000000000000", + "grant_fund_percentage": "0.000000000000000000", + "inflation_change_percentage": "0.030000000000000000", + "inflation_max": "0.050000000000000000", + "inflation_min": "0.020000000000000000" }, "providers": [], "user_contract_sets": [], - "version": "0" + "version": "1" }, "auth": { "accounts": [ { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { - "account_number": "14", + "account_number": "12", "address": "tarkeo1rcvm4v5mcepj53fh2526uve0tly4grdsx5yw7k", "pub_key": null, "sequence": "0" @@ -28,6 +34,13 @@ "name": "providers", "permissions": [] }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "10", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -42,6 +55,13 @@ "staking" ] }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "11", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -66,20 +86,6 @@ }, "sequence": "5" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "11", - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", - "pub_key": null, - "sequence": "0" - }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "13", - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -93,13 +99,6 @@ "burner" ] }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "10", - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -123,7 +122,8 @@ }, "name": "arkeo", "permissions": [ - "minter" + "minter", + "burner" ] }, { @@ -136,13 +136,6 @@ }, "sequence": "1" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "12", - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -189,37 +182,37 @@ "bank": { "balances": [ { - "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", "coins": [ { - "amount": "50000000000000000", + "amount": "480000890270", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", + "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", "coins": [ { - "amount": "1000000000000000", + "amount": "50000000000000000", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", "coins": [ { - "amount": "257125458", + "amount": "240128972735", "denom": "uarkeo" } ] }, { - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", + "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", "coins": [ { - "amount": "257197200", + "amount": "1000000000000000", "denom": "uarkeo" } ] @@ -228,16 +221,7 @@ "address": "tarkeo1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8t6gr9e", "coins": [ { - "amount": "6297816191", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo1k8925g52vwe5jgfp4nqr7ljuhs7nzu2f8g0za5", - "coins": [ - { - "amount": "107165513", + "amount": "6297852460", "denom": "uarkeo" } ] @@ -246,16 +230,7 @@ "address": "tarkeo1hnyy4gp5tgarpg3xu6w5cw4zsyphx2lyvls9rz", "coins": [ { - "amount": "535291663", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "coins": [ - { - "amount": "257197200", + "amount": "36935", "denom": "uarkeo" } ] @@ -268,15 +243,6 @@ "denom": "uarkeo" } ] - }, - { - "address": "tarkeo1w3shy6m9damxzmr0wpjhyvtgdeuhjdr8wq6hgempwfcxwvmcw5m8wdtrwu685umewp58svnv09nxudf5wd5qsks9jp", - "coins": [ - { - "amount": "535827", - "denom": "uarkeo" - } - ] } ], "denom_metadata": [], @@ -287,7 +253,7 @@ "send_enabled": [], "supply": [ { - "amount": "52000007712329052", + "amount": "52000726427752400", "denom": "uarkeo" } ] @@ -362,7 +328,7 @@ "fee_pool": { "community_pool": [ { - "amount": "0.040000000000000000", + "amount": "0.220000000000000000", "denom": "uarkeo" } ] @@ -371,7 +337,7 @@ { "outstanding_rewards": [ { - "amount": "6297816190.960000000000000000", + "amount": "6297852494.780000000000000000", "denom": "uarkeo" } ], @@ -390,7 +356,7 @@ "accumulated": { "commission": [ { - "amount": "629781619.096000000000000000", + "amount": "629785249.478000000000000000", "denom": "uarkeo" } ] @@ -404,7 +370,7 @@ "period": "2", "rewards": [ { - "amount": "5668034571.864000000000000000", + "amount": "5668067245.302000000000000000", "denom": "uarkeo" } ] @@ -579,8 +545,8 @@ }, "mint": { "minter": { - "annual_provisions": "6759998039194342.158301786339003680", - "inflation": "0.129999946224852984" + "annual_provisions": "6760075900031454.898464351600071864", + "inflation": "0.129999946225874372" }, "params": { "blocks_per_year": "6311520", diff --git a/test/regression/mnt/exports/suites_sentinel_contract_config.json b/test/regression/mnt/exports/suites_sentinel_contract_config.json index b3e3034f..dfb45920 100644 --- a/test/regression/mnt/exports/suites_sentinel_contract_config.json +++ b/test/regression/mnt/exports/suites_sentinel_contract_config.json @@ -71,9 +71,15 @@ ], "next_contract_id": "1", "params": { - "CommunityPoolPercentage": "10", - "DevFundPercentage": "20", - "GrantFundPercentage": "20" + "block_per_year": "6311520", + "community_pool_percentage": "0.100000000000000000", + "dev_fund_percentage": "0.200000000000000000", + "emission_curve": "6", + "goal_bonded": "0.670000000000000000", + "grant_fund_percentage": "0.000000000000000000", + "inflation_change_percentage": "0.030000000000000000", + "inflation_max": "0.050000000000000000", + "inflation_min": "0.020000000000000000" }, "providers": [ { @@ -102,10 +108,17 @@ } ], "user_contract_sets": [], - "version": "0" + "version": "1" }, "auth": { "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "10", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -120,6 +133,13 @@ "staking" ] }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "11", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -141,13 +161,6 @@ "pub_key": null, "sequence": "0" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "11", - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -161,13 +174,6 @@ "burner" ] }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "10", - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -191,7 +197,8 @@ }, "name": "arkeo", "permissions": [ - "minter" + "minter", + "burner" ] }, { @@ -204,13 +211,6 @@ }, "sequence": "1" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "12", - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -266,37 +266,37 @@ ] }, { - "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", "coins": [ { - "amount": "50000000000000000", + "amount": "80040042843", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", + "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", "coins": [ { - "amount": "1000000000000000", + "amount": "50000000000000000", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", "coins": [ { - "amount": "21433514", + "amount": "40020021422", "denom": "uarkeo" } ] }, { - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", + "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", "coins": [ { - "amount": "42867029", + "amount": "1000000000000000", "denom": "uarkeo" } ] @@ -310,24 +310,6 @@ } ] }, - { - "address": "tarkeo1k8925g52vwe5jgfp4nqr7ljuhs7nzu2f8g0za5", - "coins": [ - { - "amount": "107167575", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "coins": [ - { - "amount": "42867029", - "denom": "uarkeo" - } - ] - }, { "address": "tarkeo1uhapc6jjq6ns0ydnk7zld5x7f5kl2ukemjw5fg", "coins": [ @@ -355,7 +337,7 @@ "send_enabled": [], "supply": [ { - "amount": "52001001285413338", + "amount": "52001121131142456", "denom": "uarkeo" } ] diff --git a/test/regression/mnt/exports/suites_sentinel_sentinel.json b/test/regression/mnt/exports/suites_sentinel_sentinel.json index 4ce43644..761167df 100644 --- a/test/regression/mnt/exports/suites_sentinel_sentinel.json +++ b/test/regression/mnt/exports/suites_sentinel_sentinel.json @@ -7,16 +7,29 @@ "contracts": [], "next_contract_id": "1", "params": { - "CommunityPoolPercentage": "10", - "DevFundPercentage": "20", - "GrantFundPercentage": "20" + "block_per_year": "6311520", + "community_pool_percentage": "0.100000000000000000", + "dev_fund_percentage": "0.200000000000000000", + "emission_curve": "6", + "goal_bonded": "0.670000000000000000", + "grant_fund_percentage": "0.000000000000000000", + "inflation_change_percentage": "0.030000000000000000", + "inflation_max": "0.050000000000000000", + "inflation_min": "0.020000000000000000" }, "providers": [], "user_contract_sets": [], - "version": "0" + "version": "1" }, "auth": { "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "10", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -31,6 +44,13 @@ "staking" ] }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "11", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", + "pub_key": null, + "sequence": "0" + }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -52,13 +72,6 @@ "pub_key": null, "sequence": "0" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "11", - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -72,13 +85,6 @@ "burner" ] }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "10", - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -102,7 +108,8 @@ }, "name": "arkeo", "permissions": [ - "minter" + "minter", + "burner" ] }, { @@ -115,13 +122,6 @@ }, "sequence": "1" }, - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "account_number": "12", - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", - "pub_key": null, - "sequence": "0" - }, { "@type": "/cosmos.auth.v1beta1.ModuleAccount", "base_account": { @@ -168,55 +168,37 @@ "bank": { "balances": [ { - "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", + "address": "tarkeo1x978nttd8vgcgnv9wxut4dh7809lr0n2fhuh0q", "coins": [ { - "amount": "50000000000000000", + "amount": "80000042842", "denom": "uarkeo" } ] }, { - "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", - "coins": [ - { - "amount": "1000000000000000", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo1v50hrsxx0mxar4653aujcnqyjft07w0npcxrjx", - "coins": [ - { - "amount": "21433102", - "denom": "uarkeo" - } - ] - }, - { - "address": "tarkeo10sav33v67743s6cl2cvjmmua7c5arysw3txz9r", + "address": "tarkeo1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3e79s43", "coins": [ { - "amount": "42866205", + "amount": "50000000000000000", "denom": "uarkeo" } ] }, { - "address": "tarkeo1k8925g52vwe5jgfp4nqr7ljuhs7nzu2f8g0za5", + "address": "tarkeo124qmjmg55v6q5c5vy0vcpefrywxnxhkm7426pc", "coins": [ { - "amount": "107165513", + "amount": "40000021421", "denom": "uarkeo" } ] }, { - "address": "tarkeo16k3k0erkwaanqnup20dxxenpd6wh058nh4pgup", + "address": "tarkeo1v0n7wer498vqq6yddkr4clg3lck7kaw9lstp4k", "coins": [ { - "amount": "42866205", + "amount": "1000000000000000", "denom": "uarkeo" } ] @@ -248,7 +230,7 @@ "send_enabled": [], "supply": [ { - "amount": "52000001285388319", + "amount": "52000121071121557", "denom": "uarkeo" } ] From c960318516c288c35637e9d98dafda1645b24bab Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Tue, 1 Oct 2024 11:37:49 +0530 Subject: [PATCH 13/14] chore: lint code --- x/arkeo/keeper/keeper.go | 1 - x/arkeo/keeper/manager.go | 2 -- 2 files changed, 3 deletions(-) diff --git a/x/arkeo/keeper/keeper.go b/x/arkeo/keeper/keeper.go index fe8f7fa1..ef8f65ee 100644 --- a/x/arkeo/keeper/keeper.go +++ b/x/arkeo/keeper/keeper.go @@ -446,7 +446,6 @@ func (k KVStore) GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.Dec } func (k KVStore) MintAndDistributeTokens(ctx cosmos.Context, newlyMinted sdk.DecCoin) (sdk.DecCoin, error) { - params := k.GetParams(ctx) newlyMintedAmount := newlyMinted.Amount diff --git a/x/arkeo/keeper/manager.go b/x/arkeo/keeper/manager.go index 6c9dfa1e..ca5eb625 100644 --- a/x/arkeo/keeper/manager.go +++ b/x/arkeo/keeper/manager.go @@ -314,7 +314,6 @@ func (mgr Manager) ValidatorPayout(ctx cosmos.Context, votes []abci.VoteInfo, bl if err := mgr.EmitValidatorPayoutEvent(ctx, acc, validatorReward); err != nil { mgr.keeper.Logger().Error("unable to emit validator payout event", "validator", acc.String(), "error", err) } - } return nil @@ -435,7 +434,6 @@ func (mgr Manager) contractDebt(ctx cosmos.Context, contract types.Contract) (co } func (mgr Manager) circulatingSupplyAfterInflationCalc(ctx cosmos.Context) (sdk.DecCoin, error) { - // Get the circulating supply circulatingSupply, err := mgr.keeper.GetCirculatingSupply(ctx, configs.Denom) if err != nil { From 2e9987471204a8537c01b1595ef97546fed3095c Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Tue, 1 Oct 2024 15:45:09 +0530 Subject: [PATCH 14/14] chore: update logger --- x/arkeo/keeper/keeper.go | 14 ++++++-------- x/arkeo/keeper/manager.go | 16 ++++++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/x/arkeo/keeper/keeper.go b/x/arkeo/keeper/keeper.go index ef8f65ee..4b364486 100644 --- a/x/arkeo/keeper/keeper.go +++ b/x/arkeo/keeper/keeper.go @@ -385,17 +385,15 @@ func (k KVStore) GetAuthority() string { } func (k KVStore) GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.DecCoin, error) { - sdkContext := sdk.UnwrapSDKContext(ctx) - // Get Total Supply fullTokenSupply, err := k.coinKeeper.SupplyOf(ctx, &banktypes.QuerySupplyOfRequest{Denom: configs.Denom}) if err != nil { - sdkContext.Logger().Error("Failed to get full token supply data", err) + k.Logger().Error("Failed to get full token supply data", err) return sdk.NewDecCoin(denom, sdkmath.NewInt(0)), err } totalSupply := fullTokenSupply.GetAmount().Amount - sdkContext.Logger().Info(fmt.Sprintf("TotalSupply %v", totalSupply)) + k.Logger().Info(fmt.Sprintf("TotalSupply %v", totalSupply)) // Get the account addresses whose balances need to be exempted devAccountAddress, err := k.getFoundationDevAccountAddress() @@ -425,22 +423,22 @@ func (k KVStore) GetCirculatingSupply(ctx cosmos.Context, denom string) (sdk.Dec exemptBalance := cosmos.NewInt(0) - sdkContext.Logger().Info("Starting to calculate exempt balances") + k.Logger().Info("Starting to calculate exempt balances") // Range over the module accounts to create exempt balances for _, address := range addressToExempt { moduleBalance := k.coinKeeper.GetBalance(ctx, address, denom) - sdkContext.Logger().Info(fmt.Sprintf("Module address: %v, Balance: %v %v", address.String(), moduleBalance.Amount, denom)) + k.Logger().Info(fmt.Sprintf("Module address: %v, Balance: %v %v", address.String(), moduleBalance.Amount, denom)) if !moduleBalance.IsZero() { exemptBalance = exemptBalance.Add(moduleBalance.Amount) } else { - sdkContext.Logger().Info(fmt.Sprintf("Module address: %v has zero balance for denom: %v", address.String(), denom)) + k.Logger().Info(fmt.Sprintf("Module address: %v has zero balance for denom: %v", address.String(), denom)) } } circulatingSupply := totalSupply.Sub(exemptBalance) - sdkContext.Logger().Info(fmt.Sprintf("TotalSupply=%v Foundation Accounts Exempted Balance=%v, Circulating Supply=%v", totalSupply, exemptBalance, circulatingSupply)) + k.Logger().Info(fmt.Sprintf("TotalSupply=%v Foundation Accounts Exempted Balance=%v, Circulating Supply=%v", totalSupply, exemptBalance, circulatingSupply)) return sdk.NewDecCoin(denom, circulatingSupply), nil } diff --git a/x/arkeo/keeper/manager.go b/x/arkeo/keeper/manager.go index ca5eb625..607e9db0 100644 --- a/x/arkeo/keeper/manager.go +++ b/x/arkeo/keeper/manager.go @@ -51,13 +51,13 @@ func (mgr *Manager) BeginBlock(ctx cosmos.Context) error { // Get the circulating supply after calculating inflation circSupply, err := mgr.circulatingSupplyAfterInflationCalc(ctx) if err != nil { - ctx.Logger().Error("unable to get supply with inflation calculation", "error", err) + mgr.keeper.Logger().Error("unable to get supply with inflation calculation", "error", err) return err } err = mgr.keeper.MoveTokensFromDistributionToFoundationPoolAccount(ctx) if err != nil { - ctx.Logger().Error("unable to send tokens from distribution to pool account", "error", err) + mgr.keeper.Logger().Error("unable to send tokens from distribution to pool account", "error", err) } validatorPayoutCycle := sdkmath.LegacyNewDec(mgr.FetchConfig(ctx, configs.ValidatorPayoutCycle)) @@ -68,14 +68,14 @@ func (mgr *Manager) BeginBlock(ctx cosmos.Context) error { // Distribute Minted To Pools balanceDistribution, err := mgr.keeper.MintAndDistributeTokens(ctx, circSupply) if err != nil { - ctx.Logger().Error("unable to mint and distribute tokens", "error", err) + mgr.keeper.Logger().Error("unable to mint and distribute tokens", "error", err) } - ctx.Logger().Info(fmt.Sprintf("Circulating Supply After Funding Foundational Account %s", balanceDistribution)) + mgr.keeper.Logger().Info(fmt.Sprintf("Circulating Supply After Funding Foundational Account %s", balanceDistribution)) // Calculate Block Rewards blockReward := mgr.calcBlockReward(ctx, balanceDistribution.Amount, emissionCurve, blocksPerYear, validatorPayoutCycle) - ctx.Logger().Info(fmt.Sprintf("Block Reward for block number %d, %v", ctx.BlockHeight(), blockReward)) + mgr.keeper.Logger().Info(fmt.Sprintf("Block Reward for block number %d, %v", ctx.BlockHeight(), blockReward)) var votes = []abci.VoteInfo{} for i := 0; i < ctx.CometInfo().GetLastCommit().Votes().Len(); i++ { @@ -91,14 +91,14 @@ func (mgr *Manager) BeginBlock(ctx cosmos.Context) error { } if err := mgr.ValidatorPayout(ctx, votes, blockReward); err != nil { - ctx.Logger().Error("unable to settle contracts", "error", err) + mgr.keeper.Logger().Error("unable to settle contracts", "error", err) } return nil } func (mgr Manager) EndBlock(ctx cosmos.Context) error { if err := mgr.ContractEndBlock(ctx); err != nil { - ctx.Logger().Error("unable to settle contracts", "error", err) + mgr.keeper.Logger().Error("unable to settle contracts", "error", err) } // invariant checks @@ -128,7 +128,7 @@ func (mgr Manager) invariantBondModule(ctx cosmos.Context) error { for ; iter.Valid(); iter.Next() { var provider types.Provider if err := mgr.keeper.Cdc().Unmarshal(iter.Value(), &provider); err != nil { - ctx.Logger().Error("fail to unmarshal provider", "error", err) + mgr.keeper.Logger().Error("fail to unmarshal provider", "error", err) continue } sum = sum.Add(provider.Bond)