laconicd-deprecated/x/nameservice/keeper/invariants.go
Sai Kumar 95dde36e1c
Migrating the nameservice module from dxns (#2)
* WIP: migrating the nameservice module

* WIP: migrating the nameservice module from dxns to ethermint

* refactor: move the proto package version from `v1` to `v1beta1` for vulcanize modules

* refactor: added bond module dependency to nameserivce module

* feat: added auction module dependency to nameservice module

* refactor: refactored the nameservice module

* refactor: add human-readable attributes output to cli nameservice `list`

* fix: fix the sub names authority storing issue

* refactor: removed legacyCodec from nameservice

* fix: fix the responses for `authority-expiry` and `records-expiry` commands query result

* refactor: sort the imports in app

* refactor: removed json encoder and decoder
2021-10-06 11:35:51 +05:30

37 lines
1.1 KiB
Go

package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/x/nameservice/types"
)
// RegisterInvariants registers all nameservice module invariants.
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) {
ir.RegisterRoute(types.ModuleName, "record", RecordInvariants(k))
}
// RecordInvariants checks that every record:
// (1) has a corresponding naming record &
// (2) associated bond exists, if bondID is not null.
func RecordInvariants(k Keeper) sdk.Invariant {
return func(ctx sdk.Context) (string, bool) {
//store := ctx.KVStore(k.storeKey)
//itr := sdk.KVStorePrefixIterator(store, PrefixCIDToRecordIndex)
//defer itr.Close()
//for ; itr.Valid(); itr.Next() {
// bz := store.Get(itr.Key())
// if bz != nil {
// var obj types.RecordObj
// k.cdc.MustUnmarshalBinaryBare(bz, &obj)
// record := obj.ToRecord()
//
// if record.BondID != "" && !k.bondKeeper.HasBond(ctx, record.BondID) {
// return sdk.FormatInvariant(types.ModuleName, "record-bond", fmt.Sprintf("Bond not found for record ID: '%s'.", record.ID)), true
// }
// }
//}
return "", false
}
}