diff --git a/proto/multistaking/v1/genesis.proto b/proto/multistaking/v1/genesis.proto index d6b03762..23c33b10 100644 --- a/proto/multistaking/v1/genesis.proto +++ b/proto/multistaking/v1/genesis.proto @@ -23,7 +23,8 @@ message GenesisState { [ (gogoproto.nullable) = false ]; repeated ValidatorMultiStakingCoin validator_multi_staking_coins = 4 [ (gogoproto.nullable) = false ]; - cosmos.staking.v1beta1.GenesisState staking_genesis_state = 5; + cosmos.staking.v1beta1.GenesisState staking_genesis_state = 5 + [ (gogoproto.nullable) = false ]; } message MultiStakingCoinInfo { diff --git a/proto/multistaking/v1/multi_staking.proto b/proto/multistaking/v1/multi_staking.proto index b11f406c..8b952818 100644 --- a/proto/multistaking/v1/multi_staking.proto +++ b/proto/multistaking/v1/multi_staking.proto @@ -31,7 +31,8 @@ message MultiStakingLock { option (gogoproto.goproto_getters) = false; // option (gogoproto.goproto_stringer) = false; - LockID lockID = 1; + LockID lockID = 1 [ (gogoproto.nullable) = false ]; + ; MultiStakingCoin locked_coin = 2 [ (gogoproto.nullable) = false ]; }; @@ -50,7 +51,8 @@ message MultiStakingUnlock { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; - UnlockID unlockID = 1; + UnlockID unlockID = 1 [ (gogoproto.nullable) = false ]; + ; repeated UnlockEntry entries = 2 [ (gogoproto.nullable) = false ]; } diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index e78a7eba..623aec5f 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -9,6 +9,7 @@ import ( "testing" "time" + multistakingtypes "github.com/realio-tech/multi-staking-module/x/multi-staking/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" @@ -68,23 +69,9 @@ func setup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) { // Setup initializes a new SimApp. A Nop logger is set in SimApp. func Setup(isCheckTx bool) *SimApp { - privVal := mock.NewPV() - pubKey, _ := privVal.GetPubKey() - - // create validator set with single validator - validator := tmtypes.NewValidator(pubKey, 1) - valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) - - // generate genesis account - senderPrivKey := secp256k1.GenPrivKey() - acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) - balance := banktypes.Balance{ - Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), - } - - app := SetupWithGenesisValSet(valSet, []authtypes.GenesisAccount{acc}, balance) + valSet := GenValSet() + app := SetupWithGenesisValSet(valSet) return app } @@ -92,9 +79,9 @@ func Setup(isCheckTx bool) *SimApp { // that also act as delegators. For simplicity, each validator is bonded with a delegation // of one consensus engine unit in the default token of the simapp from first genesis // account. A Nop logger is set in SimApp. -func SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { +func SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet) *SimApp { app, genesisState := setup(true, 5) - genesisState = genesisStateWithValSet(app, genesisState, valSet, genAccs, balances...) + genesisState = genesisStateWithValSet(app, genesisState, valSet) stateBytes, _ := json.MarshalIndent(genesisState, "", " ") @@ -119,20 +106,51 @@ func SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.Ge return app } -func genesisStateWithValSet(app *SimApp, genesisState GenesisState, - valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, - balances ...banktypes.Balance, -) GenesisState { +func genesisStateWithValSet(app *SimApp, genesisState GenesisState, valSet *tmtypes.ValidatorSet) GenesisState { + genAcc := GenAcc() + genAccs := []authtypes.GenesisAccount{genAcc} + balances := []banktypes.Balance{} + // set genesis accounts authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) + // set multi staking genesis state + msCoinAInfo := multistakingtypes.MultiStakingCoinInfo{ + Denom: MultiStakingCoinA.Denom, + BondWeight: MultiStakingCoinA.BondWeight, + } + msCoinBInfo := multistakingtypes.MultiStakingCoinInfo{ + Denom: MultiStakingCoinB.Denom, + BondWeight: MultiStakingCoinB.BondWeight, + } + msCoinInfos := []multistakingtypes.MultiStakingCoinInfo{msCoinAInfo, msCoinBInfo} + validatorMsCoins := make([]multistakingtypes.ValidatorMultiStakingCoin, 0, len(valSet.Validators)) + locks := make([]multistakingtypes.MultiStakingLock, 0, len(valSet.Validators)) + lockCoins := sdk.NewCoins() + + // staking genesis state validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) + bondCoins := sdk.NewCoins() - bondAmt := sdk.DefaultPowerReduction + for i, val := range valSet.Validators { + valMsCoin := MultiStakingCoinA + if i%2 == 1 { + valMsCoin = MultiStakingCoinB + } + + validatorMsCoins = append(validatorMsCoins, multistakingtypes.ValidatorMultiStakingCoin{ + ValAddr: sdk.ValAddress(val.Address).String(), + CoinDenom: valMsCoin.Denom, + }) + + lockId := multistakingtypes.MultiStakingLockID(genAcc.GetAddress().String(), sdk.ValAddress(val.Address).String()) + lockRecord := multistakingtypes.NewMultiStakingLock(lockId, valMsCoin) + + locks = append(locks, lockRecord) + lockCoins = lockCoins.Add(valMsCoin.ToCoin()) - for _, val := range valSet.Validators { pk, _ := cryptocodec.FromTmPubKeyInterface(val.PubKey) pkAny, _ := codectypes.NewAnyWithValue(pk) validator := stakingtypes.Validator{ @@ -140,7 +158,7 @@ func genesisStateWithValSet(app *SimApp, genesisState GenesisState, ConsensusPubkey: pkAny, Jailed: false, Status: stakingtypes.Bonded, - Tokens: bondAmt, + Tokens: valMsCoin.BondValue(), DelegatorShares: sdk.OneDec(), Description: stakingtypes.Description{}, UnbondingHeight: int64(0), @@ -148,30 +166,40 @@ func genesisStateWithValSet(app *SimApp, genesisState GenesisState, Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), MinSelfDelegation: sdk.ZeroInt(), } + validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) + delegations = append(delegations, stakingtypes.NewDelegation(genAcc.GetAddress(), val.Address.Bytes(), sdk.OneDec())) + bondCoins = bondCoins.Add(sdk.NewCoin(sdk.DefaultBondDenom, valMsCoin.BondValue())) } + // set validators and delegations stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) - totalSupply := sdk.NewCoins() - for _, b := range balances { - // add genesis acc tokens to total supply - totalSupply = totalSupply.Add(b.Coins...) - } - - for range delegations { - // add delegated tokens to total supply - totalSupply = totalSupply.Add(sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)) + multistakingGenesis := multistakingtypes.GenesisState{ + MultiStakingLocks: locks, + MultiStakingUnlocks: []multistakingtypes.MultiStakingUnlock{}, + MultiStakingCoinInfo: msCoinInfos, + ValidatorMultiStakingCoins: validatorMsCoins, + StakingGenesisState: *stakingGenesis, } + genesisState[multistakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(&multistakingGenesis) - // add bonded amount to bonded pool module account balances = append(balances, banktypes.Balance{ Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)}, + Coins: bondCoins, }) + balances = append(balances, banktypes.Balance{ + Address: authtypes.NewModuleAddress(multistakingtypes.ModuleName).String(), + Coins: lockCoins, + }) + + totalSupply := sdk.NewCoins() + for _, b := range balances { + // add genesis acc tokens to total supply + totalSupply = totalSupply.Add(b.Coins...) + } // update total supply bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) @@ -459,3 +487,25 @@ func FundAccount(app *SimApp, ctx sdk.Context, addr sdk.AccAddress, amounts sdk. } return app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, amounts) } + +func GenValSet() *tmtypes.ValidatorSet { + privVal0 := mock.NewPV() + privVal1 := mock.NewPV() + + pubKey0, _ := privVal0.GetPubKey() + pubKey1, _ := privVal1.GetPubKey() + + // create validator set with single validator + val0 := tmtypes.NewValidator(pubKey0, 1) + val1 := tmtypes.NewValidator(pubKey1, 1) + + valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{val0, val1}) + + return valSet +} + +func GenAcc() authtypes.GenesisAccount { + senderPrivKey := secp256k1.GenPrivKey() + return authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) +} +1 \ No newline at end of file diff --git a/x/multi-staking/keeper/genesis.go b/x/multi-staking/keeper/genesis.go index b9be4f1f..ae7c658d 100644 --- a/x/multi-staking/keeper/genesis.go +++ b/x/multi-staking/keeper/genesis.go @@ -27,7 +27,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) (res []abc k.SetValidatorMultiStakingCoin(ctx, valAddr, valMultiStakingCoin.CoinDenom) } - return k.stakingKeeper.InitGenesis(ctx, data.StakingGenesisState) + return k.stakingKeeper.InitGenesis(ctx, &data.StakingGenesisState) } func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { @@ -69,6 +69,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { MultiStakingUnlocks: multiStakingUnlocks, MultiStakingCoinInfo: multiStakingCoinInfos, ValidatorMultiStakingCoins: ValidatorMultiStakingCoinLists, - StakingGenesisState: k.stakingKeeper.ExportGenesis(ctx), + StakingGenesisState: *k.stakingKeeper.ExportGenesis(ctx), } } diff --git a/x/multi-staking/keeper/lock.go b/x/multi-staking/keeper/lock.go index 2217df18..30ceb51e 100644 --- a/x/multi-staking/keeper/lock.go +++ b/x/multi-staking/keeper/lock.go @@ -12,7 +12,7 @@ import ( func (k Keeper) GetOrCreateMultiStakingLock(ctx sdk.Context, lockID types.LockID) types.MultiStakingLock { multiStakingLock, found := k.GetMultiStakingLock(ctx, lockID) if !found { - multiStakingLock = types.NewMultiStakingLock(&lockID, types.MultiStakingCoin{Amount: sdk.ZeroInt()}) + multiStakingLock = types.NewMultiStakingLock(lockID, types.MultiStakingCoin{Amount: sdk.ZeroInt()}) } return multiStakingLock } diff --git a/x/multi-staking/keeper/store.go b/x/multi-staking/keeper/store.go index 47fd6ce4..88b172d6 100644 --- a/x/multi-staking/keeper/store.go +++ b/x/multi-staking/keeper/store.go @@ -87,7 +87,7 @@ func (k Keeper) GetMultiStakingLock(ctx sdk.Context, multiStakingLockID types.Lo func (k Keeper) SetMultiStakingLock(ctx sdk.Context, multiStakingLock types.MultiStakingLock) { if multiStakingLock.IsEmpty() { - k.RemoveMultiStakingLock(ctx, *multiStakingLock.LockID) + k.RemoveMultiStakingLock(ctx, multiStakingLock.LockID) return } diff --git a/x/multi-staking/types/genesis.go b/x/multi-staking/types/genesis.go index b040475f..7919a8de 100644 --- a/x/multi-staking/types/genesis.go +++ b/x/multi-staking/types/genesis.go @@ -8,7 +8,7 @@ func DefaultGenesis() *GenesisState { stakingGenesis := stakingtypes.DefaultGenesisState() return &GenesisState{ - StakingGenesisState: stakingGenesis, + StakingGenesisState: *stakingGenesis, } } diff --git a/x/multi-staking/types/genesis.pb.go b/x/multi-staking/types/genesis.pb.go index 30ededba..9e472bfd 100644 --- a/x/multi-staking/types/genesis.pb.go +++ b/x/multi-staking/types/genesis.pb.go @@ -35,7 +35,7 @@ type GenesisState struct { MultiStakingUnlocks []MultiStakingUnlock `protobuf:"bytes,2,rep,name=multi_staking_unlocks,json=multiStakingUnlocks,proto3" json:"multi_staking_unlocks"` MultiStakingCoinInfo []MultiStakingCoinInfo `protobuf:"bytes,3,rep,name=multi_staking_coin_info,json=multiStakingCoinInfo,proto3" json:"multi_staking_coin_info"` ValidatorMultiStakingCoins []ValidatorMultiStakingCoin `protobuf:"bytes,4,rep,name=validator_multi_staking_coins,json=validatorMultiStakingCoins,proto3" json:"validator_multi_staking_coins"` - StakingGenesisState *types.GenesisState `protobuf:"bytes,5,opt,name=staking_genesis_state,json=stakingGenesisState,proto3" json:"staking_genesis_state,omitempty"` + StakingGenesisState types.GenesisState `protobuf:"bytes,5,opt,name=staking_genesis_state,json=stakingGenesisState,proto3" json:"staking_genesis_state"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -99,11 +99,11 @@ func (m *GenesisState) GetValidatorMultiStakingCoins() []ValidatorMultiStakingCo return nil } -func (m *GenesisState) GetStakingGenesisState() *types.GenesisState { +func (m *GenesisState) GetStakingGenesisState() types.GenesisState { if m != nil { return m.StakingGenesisState } - return nil + return types.GenesisState{} } type MultiStakingCoinInfo struct { @@ -159,39 +159,39 @@ func init() { func init() { proto.RegisterFile("multistaking/v1/genesis.proto", fileDescriptor_8f95a201ebed173c) } var fileDescriptor_8f95a201ebed173c = []byte{ - // 505 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x41, 0x6b, 0x13, 0x41, - 0x18, 0xcd, 0x36, 0xad, 0xe0, 0x44, 0x10, 0x37, 0x29, 0xdd, 0x06, 0xba, 0x89, 0x6d, 0x95, 0x20, - 0x64, 0x87, 0xd4, 0x93, 0xe0, 0x29, 0x16, 0x44, 0xd0, 0x4b, 0x82, 0x56, 0x84, 0xb2, 0xcc, 0x6e, - 0x26, 0x9b, 0x21, 0x3b, 0xf3, 0x85, 0xcc, 0x64, 0xb5, 0xbf, 0xc1, 0x8b, 0x3f, 0xc6, 0x1f, 0xd1, - 0x63, 0xf1, 0x24, 0x1e, 0x8a, 0x24, 0xbf, 0xc2, 0x9b, 0xec, 0xcc, 0x84, 0x26, 0x9b, 0xb6, 0xa7, - 0x9d, 0x37, 0xef, 0xed, 0x7b, 0x33, 0xdf, 0x3c, 0x74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x9d, 0x1f, 0x0b, 0xbf, 0x74, 0xb5, 0xf0, 0x4b, 0xbf, 0x17, - 0x7e, 0xe9, 0xcb, 0xab, 0x15, 0xef, 0x29, 0x25, 0x29, 0x03, 0x45, 0xe3, 0x91, 0xe9, 0x79, 0x7b, - 0x59, 0xfc, 0x6f, 0x05, 0xac, 0x23, 0xa3, 0x07, 0xba, 0xe5, 0x2f, 0xff, 0x07, 0x00, 0x00, 0xff, - 0xff, 0xeb, 0x76, 0xfb, 0xb1, 0x08, 0x04, 0x00, 0x00, + // 507 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x41, 0x6b, 0xdb, 0x3e, + 0x18, 0xc6, 0xe3, 0xa6, 0xfd, 0xc3, 0x5f, 0x19, 0x8c, 0xb9, 0x29, 0x75, 0x03, 0x75, 0xb2, 0xb6, + 0x1b, 0x61, 0x10, 0x8b, 0x74, 0xa7, 0xc1, 0x4e, 0x59, 0x61, 0x0c, 0xb6, 0x4b, 0xc2, 0x56, 0x18, + 0x74, 0x46, 0x76, 0x14, 0x47, 0xc4, 0xd2, 0x1b, 0x22, 0xc5, 0x5b, 0x3f, 0xc3, 0x2e, 0xfb, 0x30, + 0xfb, 0x10, 0x3d, 0x96, 0x9d, 0xc6, 0x0e, 0x65, 0x24, 0x1f, 0x64, 0xc3, 0x92, 0x4c, 0x13, 0xa7, + 0xeb, 0xc9, 0x7a, 0xf5, 0x3c, 0xfe, 0x3d, 0xd2, 0xab, 0x17, 0x1d, 0xf2, 0x79, 0xaa, 0x98, 0x54, + 0x64, 0xc2, 0x44, 0x82, 0xb3, 0x2e, 0x4e, 0xa8, 0xa0, 0x92, 0xc9, 0x60, 0x3a, 0x03, 0x05, 0xee, + 0xc3, 0x55, 0x39, 0xc8, 0xba, 0x8d, 0x83, 0x04, 0x20, 0x49, 0x29, 0xd6, 0x72, 0x34, 0x1f, 0x61, + 0x22, 0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, 0xf3, 0xbf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x01, 0x7b, 0xa1, 0x83, 0x0e, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -214,18 +214,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.StakingGenesisState != nil { - { - size, err := m.StakingGenesisState.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + { + size, err := m.StakingGenesisState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x2a + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a if len(m.ValidatorMultiStakingCoins) > 0 { for iNdEx := len(m.ValidatorMultiStakingCoins) - 1; iNdEx >= 0; iNdEx-- { { @@ -366,10 +364,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if m.StakingGenesisState != nil { - l = m.StakingGenesisState.Size() - n += 1 + l + sovGenesis(uint64(l)) - } + l = m.StakingGenesisState.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -588,9 +584,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.StakingGenesisState == nil { - m.StakingGenesisState = &types.GenesisState{} - } if err := m.StakingGenesisState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/multi-staking/types/lock.go b/x/multi-staking/types/lock.go index ae534de1..0549f867 100644 --- a/x/multi-staking/types/lock.go +++ b/x/multi-staking/types/lock.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func NewMultiStakingLock(lockID *LockID, lockedCoin MultiStakingCoin) MultiStakingLock { +func NewMultiStakingLock(lockID LockID, lockedCoin MultiStakingCoin) MultiStakingLock { return MultiStakingLock{ LockID: lockID, LockedCoin: lockedCoin, diff --git a/x/multi-staking/types/multi_staking.pb.go b/x/multi-staking/types/multi_staking.pb.go index 7d94bb30..ad5eb4ea 100644 --- a/x/multi-staking/types/multi_staking.pb.go +++ b/x/multi-staking/types/multi_staking.pb.go @@ -126,7 +126,7 @@ func (m *LockID) GetValAddr() string { } type MultiStakingLock struct { - LockID *LockID `protobuf:"bytes,1,opt,name=lockID,proto3" json:"lockID,omitempty"` + LockID LockID `protobuf:"bytes,1,opt,name=lockID,proto3" json:"lockID"` LockedCoin MultiStakingCoin `protobuf:"bytes,2,opt,name=locked_coin,json=lockedCoin,proto3" json:"locked_coin"` } @@ -268,7 +268,7 @@ func (m *UnlockID) GetValAddr() string { } type MultiStakingUnlock struct { - UnlockID *UnlockID `protobuf:"bytes,1,opt,name=unlockID,proto3" json:"unlockID,omitempty"` + UnlockID UnlockID `protobuf:"bytes,1,opt,name=unlockID,proto3" json:"unlockID"` Entries []UnlockEntry `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries"` } @@ -371,44 +371,44 @@ func init() { } var fileDescriptor_c2c118bafa9b671a = []byte{ - // 583 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x6b, 0x13, 0x4f, - 0x18, 0xce, 0xb6, 0xfd, 0xa5, 0xe9, 0xbb, 0xfc, 0x5a, 0x1d, 0x0a, 0x26, 0x45, 0x37, 0x35, 0x82, - 0x16, 0xa1, 0xbb, 0x24, 0xe2, 0xc1, 0xd2, 0x8b, 0x31, 0x42, 0x03, 0xfe, 0xc1, 0x8d, 0x55, 0x10, - 0x64, 0x99, 0xdd, 0x1d, 0x37, 0x43, 0x76, 0x67, 0xc2, 0xee, 0x24, 0xda, 0x6f, 0xe0, 0xc1, 0x83, - 0xe0, 0xc5, 0xa3, 0x1f, 0xc2, 0x0f, 0xd1, 0x63, 0xf1, 0x24, 0x82, 0x45, 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, 0x8a, 0x7b, 0xd6, 0x8a, 0xf6, 0x61, 0x95, 0x30, - 0x91, 0x52, 0x92, 0x55, 0x97, 0xb6, 0x97, 0x77, 0xcc, 0xd6, 0xe5, 0xdf, 0x4c, 0xdd, 0x67, 0x22, - 0x3d, 0xca, 0xe5, 0x9b, 0x8d, 0xec, 0x55, 0xa4, 0x76, 0x1f, 0xa5, 0x7e, 0xef, 0x0c, 0x30, 0x0b, - 0x8d, 0xe8, 0x06, 0x6c, 0x04, 0x29, 0xc1, 0x82, 0x72, 0xe6, 0xf5, 0xf5, 0x3f, 0x53, 0xb2, 0x5a, - 0x76, 0xd7, 0x67, 0xe9, 0x03, 0x95, 0x45, 0x8f, 0x60, 0x5d, 0x93, 0xa1, 0x2c, 0xfa, 0x2b, 0x2f, - 0xff, 0x3f, 0x1b, 0xd7, 0x76, 0x4a, 0x3a, 0xed, 0xde, 0xf1, 0xc4, 0x32, 0x4e, 0x26, 0x96, 0xf1, - 0x63, 0x62, 0x19, 0xef, 0xa7, 0x56, 0xe9, 0x64, 0x6a, 0x95, 0xbe, 0x4e, 0xad, 0xd2, 0x8b, 0x3b, - 0x85, 0x1b, 0x91, 0x12, 0x1c, 0x53, 0x2e, 0x48, 0xd0, 0xd7, 0xaf, 0xcb, 0xee, 0xec, 0xb9, 0x79, - 0x33, 0x17, 0xab, 0x8b, 0xe2, 0x97, 0xd5, 0x8d, 0xbf, 0xf5, 0x33, 0x00, 0x00, 0xff, 0xff, 0x22, - 0xba, 0xba, 0xa1, 0x9b, 0x04, 0x00, 0x00, + // 585 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x6b, 0x13, 0x41, + 0x14, 0xcf, 0xb6, 0x35, 0x4d, 0x67, 0xb1, 0xd5, 0xa1, 0x60, 0x52, 0x74, 0x53, 0x23, 0x68, 0x11, + 0xb2, 0x4b, 0x22, 0x1e, 0xac, 0xbd, 0x18, 0x23, 0x34, 0xe0, 0x1f, 0xdc, 0x58, 0x05, 0x41, 0x96, + 0xd9, 0xdd, 0x71, 0x33, 0x64, 0x77, 0x26, 0xec, 0x4e, 0x56, 0xfb, 0x0d, 0x3c, 0x78, 0xf0, 0xa8, + 0x37, 0x3f, 0x84, 0x1f, 0xa2, 0xc7, 0xe2, 0x49, 0x04, 0x8b, 0x24, 0x5f, 0x44, 0xe6, 0x4f, 0xea, + 0x36, 0xc1, 0x83, 0xe2, 0x29, 0xfb, 0x7e, 0xef, 0xbd, 0xdf, 0xfc, 0xde, 0xfb, 0x65, 0x06, 0x5c, + 0x4b, 0xc6, 0x31, 0x27, 0x19, 0x47, 0x43, 0x42, 0x23, 0x27, 0x6f, 0x39, 0x32, 0xf6, 0x34, 0x60, + 0x8f, 0x52, 0xc6, 0x19, 0xdc, 0x28, 0x16, 0xd9, 0x79, 0x6b, 0x6b, 0x33, 0x62, 0x11, 0x93, 0x39, + 0x47, 0x7c, 0xa9, 0xb2, 0xad, 0x5a, 0xc0, 0xb2, 0x84, 0x65, 0x9e, 0x4a, 0xa8, 0x40, 0xa7, 0x2c, + 0x15, 0x39, 0x3e, 0xca, 0xb0, 0x93, 0xb7, 0x7c, 0xcc, 0x51, 0xcb, 0x09, 0x18, 0xa1, 0x3a, 0x5f, + 0x8f, 0x18, 0x8b, 0x62, 0xec, 0xc8, 0xc8, 0x1f, 0xbf, 0x76, 0x38, 0x49, 0x70, 0xc6, 0x51, 0x32, + 0x52, 0x05, 0x8d, 0x1f, 0x06, 0xb8, 0xf0, 0x48, 0xa8, 0xe8, 0x2b, 0x15, 0xf7, 0x19, 0xa1, 0x70, + 0x13, 0x9c, 0x0b, 0x31, 0x65, 0x49, 0xd5, 0xd8, 0x36, 0x76, 0xd6, 0x5c, 0x15, 0xc0, 0x67, 0xa0, + 0x8c, 0x12, 0x36, 0xa6, 0xbc, 0xba, 0x24, 0xe0, 0xce, 0xde, 0xd1, 0x49, 0xbd, 0xf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m *MultiStakingCoin) Marshal() (dAtA []byte, err error) { @@ -528,18 +528,16 @@ func (m *MultiStakingLock) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - if m.LockID != nil { - { - size, err := m.LockID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMultiStaking(dAtA, i, uint64(size)) + { + size, err := m.LockID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintMultiStaking(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -651,18 +649,16 @@ func (m *MultiStakingUnlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if m.UnlockID != nil { - { - size, err := m.UnlockID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMultiStaking(dAtA, i, uint64(size)) + { + size, err := m.UnlockID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintMultiStaking(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -755,10 +751,8 @@ func (m *MultiStakingLock) Size() (n int) { } var l int _ = l - if m.LockID != nil { - l = m.LockID.Size() - n += 1 + l + sovMultiStaking(uint64(l)) - } + l = m.LockID.Size() + n += 1 + l + sovMultiStaking(uint64(l)) l = m.LockedCoin.Size() n += 1 + l + sovMultiStaking(uint64(l)) return n @@ -804,10 +798,8 @@ func (m *MultiStakingUnlock) Size() (n int) { } var l int _ = l - if m.UnlockID != nil { - l = m.UnlockID.Size() - n += 1 + l + sovMultiStaking(uint64(l)) - } + l = m.UnlockID.Size() + n += 1 + l + sovMultiStaking(uint64(l)) if len(m.Entries) > 0 { for _, e := range m.Entries { l = e.Size() @@ -1159,9 +1151,6 @@ func (m *MultiStakingLock) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.LockID == nil { - m.LockID = &LockID{} - } if err := m.LockID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1506,9 +1495,6 @@ func (m *MultiStakingUnlock) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.UnlockID == nil { - m.UnlockID = &UnlockID{} - } if err := m.UnlockID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err }