* Add proto files for onboarding module * Add generated proto bindings * Define onboarding object * Define the participants state in keeper * Update genesis file to initialize and export module state to/from genesis * Add msg to onboard participant * Register command to enroll participant * Add functionality to decode ethereum address from signature * Add comments for messages and fields * Fix lint errors in proto files * Add message validation and events in msg_server * Reuse crypto utils from go-nitro * Sign entire eth_payload object * Use google API for rpc method * Regenerate proto bindings --------- Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package keeper
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 
 | |
| 	"git.vdb.to/cerc-io/laconicd/x/onboarding"
 | |
| )
 | |
| 
 | |
| // InitGenesis initializes the module state from a genesis state.
 | |
| func (k *Keeper) InitGenesis(ctx context.Context, data *onboarding.GenesisState) error {
 | |
| 	if err := k.Params.Set(ctx, data.Params); err != nil {
 | |
| 		return err
 | |
| 	}
 | |
| 
 | |
| 	for _, participant := range data.Participants {
 | |
| 		if err := k.Participants.Set(ctx, participant.CosmosAddress, participant); err != nil {
 | |
| 			return err
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	return nil
 | |
| }
 | |
| 
 | |
| // ExportGenesis exports the module state to a genesis state.
 | |
| func (k *Keeper) ExportGenesis(ctx context.Context) (*onboarding.GenesisState, error) {
 | |
| 	params, err := k.Params.Get(ctx)
 | |
| 	if err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 
 | |
| 	var participants []onboarding.Participant
 | |
| 	if err := k.Participants.Walk(ctx, nil, func(cosmosAddress string, participant onboarding.Participant) (bool, error) {
 | |
| 		participants = append(participants, participant)
 | |
| 		return false, nil
 | |
| 	}); err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 
 | |
| 	return &onboarding.GenesisState{
 | |
| 		Params:       params,
 | |
| 		Participants: participants,
 | |
| 	}, nil
 | |
| }
 |