github.com/Finschia/finschia-sdk@v0.48.1/x/token/class/keeper/genesis.go (about)

     1  package keeper
     2  
     3  import (
     4  	sdk "github.com/Finschia/finschia-sdk/types"
     5  	"github.com/Finschia/finschia-sdk/x/token"
     6  )
     7  
     8  func (k Keeper) InitGenesis(ctx sdk.Context, data *token.ClassGenesisState) {
     9  	k.setNonce(ctx, data.Nonce)
    10  
    11  	for _, id := range data.Ids {
    12  		k.addID(ctx, id)
    13  	}
    14  }
    15  
    16  func (k Keeper) ExportGenesis(ctx sdk.Context) *token.ClassGenesisState {
    17  	var ids []string
    18  	k.iterateIDs(ctx, func(id string) (stop bool) {
    19  		ids = append(ids, id)
    20  		return false
    21  	})
    22  
    23  	return &token.ClassGenesisState{
    24  		Nonce: k.getNonce(ctx),
    25  		Ids:   ids,
    26  	}
    27  }