Skip to content

Commit

Permalink
add a new network property for autocompound interval
Browse files Browse the repository at this point in the history
  • Loading branch information
kiragpg committed Oct 6, 2023
1 parent ebd9bad commit ccdb3cf
Show file tree
Hide file tree
Showing 10 changed files with 312 additions and 215 deletions.
4 changes: 3 additions & 1 deletion proto/kira/gov/network_properties.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ enum NetworkProperty {
DAPP_POOL_SLIPPAGE_DEFAULT = 56 [(gogoproto.enumvalue_customname) = "DappPoolSlippageDefault"];
MINTING_FT_FEE = 57 [ (gogoproto.enumvalue_customname) = "MintingFtFee" ];
MINTING_NFT_FEE = 58 [ (gogoproto.enumvalue_customname) = "MintingNftFee" ];
VETO_THRESHOLD = 59 [ (gogoproto.enumvalue_customname) = "VetoThreshold" ];
VETO_THRESHOLD = 59 [ (gogoproto.enumvalue_customname) = "VetoThreshold" ];
AUTOCOMPOUND_INTERVAL_NUM_BLOCKS = 60 [ (gogoproto.enumvalue_customname) = "AutocompoundIntervalNumBlocks" ];
}

message NetworkPropertyValue {
Expand Down Expand Up @@ -172,4 +173,5 @@ message NetworkProperties {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
uint64 autocompound_interval_num_blocks = 61; // default 17280 - once per day
}
3 changes: 2 additions & 1 deletion proto/kira/multistaking/multistaking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ message CompoundInfo {
string delegator = 1;
bool all_denom = 2;
repeated string compound_denoms = 3;
}
uint64 last_exec_block = 4;
}
1 change: 1 addition & 0 deletions x/genutil/client/cli/upgrade_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ $ %s new-genesis-from-exported exported-genesis.json new-genesis.json
MintingFtFee: 100_000_000_000_000,
MintingNftFee: 100_000_000_000_000,
VetoThreshold: sdk.NewDecWithPrec(3340, 2), //33.40%
AutocompoundIntervalNumBlocks: 17280,
},
ExecutionFees: govGenesisV01228.ExecutionFees,
PoorNetworkMessages: govGenesisV01228.PoorNetworkMessages,
Expand Down
1 change: 1 addition & 0 deletions x/gov/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ func TestExportInitGenesis(t *testing.T) {
MintingFtFee: 100_000_000_000_000,
MintingNftFee: 100_000_000_000_000,
VetoThreshold: sdk.NewDecWithPrec(3340, 2), // 33.40%
AutocompoundIntervalNumBlocks: 17280,
},
ExecutionFees: []types.ExecutionFee{
{
Expand Down
6 changes: 5 additions & 1 deletion x/gov/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"errors"
"fmt"

"github.com/KiraCore/sekai/x/gov/types"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
Expand Down Expand Up @@ -248,7 +249,8 @@ func (k Keeper) GetNetworkProperty(ctx sdk.Context, property types.NetworkProper
return types.NetworkPropertyValue{Value: properties.MintingNftFee}, nil
case types.VetoThreshold:
return types.NetworkPropertyValue{StrValue: properties.VetoThreshold.String()}, nil

case types.AutocompoundIntervalNumBlocks:
return types.NetworkPropertyValue{Value: properties.AutocompoundIntervalNumBlocks}, nil
default:
return types.NetworkPropertyValue{}, errors.New("trying to fetch network property that does not exist")
}
Expand Down Expand Up @@ -402,6 +404,8 @@ func (k Keeper) SetNetworkProperty(ctx sdk.Context, property types.NetworkProper
}
properties.VetoThreshold = decValue

case types.AutocompoundIntervalNumBlocks:
properties.AutocompoundIntervalNumBlocks = value.Value
default:
return errors.New("trying to set network property that does not exist")
}
Expand Down
1 change: 1 addition & 0 deletions x/gov/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func DefaultGenesis() *GenesisState {
MintingFtFee: 100_000_000_000_000,
MintingNftFee: 100_000_000_000_000,
VetoThreshold: sdk.NewDecWithPrec(3340, 2), // 33.40%
AutocompoundIntervalNumBlocks: 17280,
},
ExecutionFees: []ExecutionFee{
{
Expand Down
392 changes: 218 additions & 174 deletions x/gov/types/network_properties.pb.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions x/gov/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion x/gov/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 75 additions & 35 deletions x/multistaking/types/multistaking.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ccdb3cf

Please sign in to comment.