diff --git a/.github/workflows/build-ci-multiplatform.yml b/.github/workflows/build-ci-multiplatform.yml index 2c67ec3c..d56a104b 100644 --- a/.github/workflows/build-ci-multiplatform.yml +++ b/.github/workflows/build-ci-multiplatform.yml @@ -2,7 +2,7 @@ name: Build CI multiplatform on: push: - branches: [ develop, '**-release' ] + branches: [ develop, '**-release', 'feat/sdi-changes' ] workflow_dispatch: env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} diff --git a/app/app.go b/app/app.go index 56f52fa1..1b282c56 100644 --- a/app/app.go +++ b/app/app.go @@ -9,42 +9,35 @@ import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - "github.com/cosmos/cosmos-sdk/runtime" - runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" - - "swisstronik/x/evm" - "swisstronik/x/feemarket" - - "github.com/cosmos/cosmos-sdk/x/auth/posthandler" - "github.com/cosmos/cosmos-sdk/x/group" - "github.com/gorilla/mux" - "github.com/rakyll/statik/fs" - + simappparams "cosmossdk.io/simapp/params" + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + tmjson "github.com/cometbft/cometbft/libs/json" + "github.com/cometbft/cometbft/libs/log" + tmos "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/store/streaming" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/mempool" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - tmjson "github.com/cometbft/cometbft/libs/json" - "github.com/cometbft/cometbft/libs/log" - tmos "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/cosmos-sdk/x/authz" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" @@ -54,6 +47,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/capability" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + "github.com/cosmos/cosmos-sdk/x/consensus" + consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" "github.com/cosmos/cosmos-sdk/x/crisis" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" @@ -74,7 +70,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - + "github.com/cosmos/cosmos-sdk/x/group" "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" @@ -114,36 +110,30 @@ import ( ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v7/testing" ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types" + "github.com/gorilla/mux" + "github.com/rakyll/statik/fs" "github.com/spf13/cast" - vestingmodule "swisstronik/x/vesting" - vestingmodulekeeper "swisstronik/x/vesting/keeper" - vestingmoduletypes "swisstronik/x/vesting/types" - - compliancemodule "swisstronik/x/compliance" - compliancemoduleclient "swisstronik/x/compliance/client" - compliancemodulekeeper "swisstronik/x/compliance/keeper" - compliancemoduletypes "swisstronik/x/compliance/types" - + evmante "swisstronik/app/ante" + "swisstronik/app/upgrades/v1_0_3" "swisstronik/docs" "swisstronik/encoding" - - simappparams "cosmossdk.io/simapp/params" - - evmante "swisstronik/app/ante" + "swisstronik/ethereum/eip712" srvflags "swisstronik/server/flags" evmcommontypes "swisstronik/types" + compliancemodule "swisstronik/x/compliance" + compliancemoduleclient "swisstronik/x/compliance/client" + compliancemodulekeeper "swisstronik/x/compliance/keeper" + compliancemoduletypes "swisstronik/x/compliance/types" + "swisstronik/x/evm" evmkeeper "swisstronik/x/evm/keeper" evmtypes "swisstronik/x/evm/types" + "swisstronik/x/feemarket" feemarketkeeper "swisstronik/x/feemarket/keeper" feemarkettypes "swisstronik/x/feemarket/types" - - "swisstronik/ethereum/eip712" - - "github.com/cosmos/cosmos-sdk/types/mempool" - "github.com/cosmos/cosmos-sdk/x/consensus" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + vestingmodule "swisstronik/x/vesting" + vestingmodulekeeper "swisstronik/x/vesting/keeper" + vestingmoduletypes "swisstronik/x/vesting/types" ) const ( @@ -803,7 +793,7 @@ func New( app.setAnteHandler(encodingConfig.TxConfig, maxGasWanted) app.setPostHandler() app.SetEndBlocker(app.EndBlocker) - SetupHandlers(app, app.EvmKeeper, app.IBCKeeper.ClientKeeper, app.ParamsKeeper, appCodec) + app.setupUpgradeHandlers() if loadLatest { if err := app.LoadLatestVersion(); err != nil { @@ -1068,6 +1058,35 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino return paramsKeeper } +func (app *App) setupUpgradeHandlers() { + app.UpgradeKeeper.SetUpgradeHandler( + v1_0_3.UpgradeName, + v1_0_3.CreateUpgradeHandler( + app.mm, app.configurator, + ), + ) + + // When a planned update height is reached, the old binary will panic + // writing on disk the height and name of the update that triggered it + // This will read that value, and execute the preparations for the upgrade. + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() + if err != nil { + panic(fmt.Errorf("failed to read upgrade info from disk: %w", err)) + } + + if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + return + } + + if upgradeInfo.Name == v1_0_3.UpgradeName { + // Use upgrade store loader for the initial loading of all stores when app starts, + // it checks if version == upgradeHeight and applies store upgrades before loading the stores, + // so that new stores start with the correct version (the current height of chain), + // instead the default which is the latest version that store last committed i.e 0 for new stores. + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storetypes.StoreUpgrades{})) + } +} + // SimulationManager implements runtime.AppI func (*App) SimulationManager() *module.SimulationManager { panic("unimplemented") diff --git a/app/setup_handler.go b/app/setup_handler.go deleted file mode 100644 index 33636dc2..00000000 --- a/app/setup_handler.go +++ /dev/null @@ -1,153 +0,0 @@ -package app - -import ( - evmkeeper "swisstronik/x/evm/keeper" - evmmoduletypes "swisstronik/x/evm/types" - feemarketmoduletypes "swisstronik/x/feemarket/types" - vestmoduletypes "swisstronik/x/vesting/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - m "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/version" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" -) - -func SetupHandlers( - app *App, - ek *evmkeeper.Keeper, - clientKeeper ibctmmigrations.ClientKeeper, - pk paramskeeper.Keeper, - cdc codec.BinaryCodec) { - setUpgradeHandler(app, ek, clientKeeper, pk, cdc) - - loadUpgradeStore(app) -} - -func setUpgradeHandler( - app *App, - ek *evmkeeper.Keeper, - clientKeeper ibctmmigrations.ClientKeeper, - pk paramskeeper.Keeper, - cdc codec.BinaryCodec) { - // Set param key table for params module migration - for _, subspace := range app.ParamsKeeper.GetSubspaces() { - subspace := subspace - - app.Logger().Info("Setting up upgrade handler for " + subspace.Name()) - - var keyTable paramstypes.KeyTable - switch subspace.Name() { - case authtypes.ModuleName: - keyTable = authtypes.ParamKeyTable() //nolint:staticcheck - case banktypes.ModuleName: - keyTable = banktypes.ParamKeyTable() //nolint:staticcheck - case stakingtypes.ModuleName: - keyTable = stakingtypes.ParamKeyTable() //nolint:staticcheck - case minttypes.ModuleName: - keyTable = minttypes.ParamKeyTable() //nolint:staticcheck - case slashingtypes.ModuleName: - keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck - case govtypes.ModuleName: - keyTable = govv1.ParamKeyTable() //nolint:staticcheck - case crisistypes.ModuleName: - keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck - case evmmoduletypes.ModuleName: - keyTable = evmmoduletypes.ParamKeyTable() - case feemarketmoduletypes.ModuleName: - keyTable = feemarketmoduletypes.ParamKeyTable() - case vestmoduletypes.ModuleName: - keyTable = vestmoduletypes.ParamKeyTable() - case distrtypes.ModuleName: - keyTable = distrtypes.ParamKeyTable() - default: - continue - } - - if !subspace.HasKeyTable() { - subspace.WithKeyTable(keyTable) - } - } - - baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) - - app.UpgradeKeeper.SetUpgradeHandler( - version.Version, - func(ctx sdk.Context, plan upgradetypes.Plan, vm m.VersionMap) (m.VersionMap, error) { - app.Logger().Info("Running upgrade handler for " + version.Version) - - // Migrate Tendermint consensus parameters from x/params module to a - // dedicated x/consensus module. - baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper) - - // Include this when migrating to ibc-go v7 (optional) - // source: https://github.com/cosmos/ibc-go/blob/v7.2.0/docs/migrations/v6-to-v7.md - // prune expired tendermint consensus states to save storage space - if _, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, cdc, clientKeeper); err != nil { - return nil, err - } - // !! ATTENTION !! - - // Add EIP contained in Shanghai hard fork to the extra EIPs - // in the EVM parameters. This enables using the PUSH0 opcode and - // thus supports Solidity v0.8.20. - // - app.Logger().Info("adding EIP 3855 to EVM parameters") - err := EnableEIPs(ctx, ek, 3855) - if err != nil { - app.Logger().Error("error while enabling EIPs", "error", err) - } - - app.Logger().Debug("running module migrations ...") - return app.mm.RunMigrations(ctx, app.configurator, vm) - }, - ) -} - -// EnableEIPs enables the given EIPs in the EVM parameters. -func EnableEIPs(ctx sdk.Context, ek *evmkeeper.Keeper, eips ...int64) error { - evmParams := ek.GetParams(ctx) - evmParams.ExtraEIPs = append(evmParams.ExtraEIPs, eips...) - - return ek.SetParams(ctx, evmParams) -} - -func loadUpgradeStore(app *App) { - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(err) - } - - if shouldLoadUpgradeStore(app, upgradeInfo) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{ - consensusparamtypes.StoreKey, - crisistypes.ModuleName, - }, - } - // Use upgrade store loader for the initial loading of all stores when app starts, - // it checks if version == upgradeHeight and applies store upgrades before loading the stores, - // so that new stores start with the correct version (the current height of chain), - // instead the default which is the latest version that store last committed i.e 0 for new stores. - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } -} - -func shouldLoadUpgradeStore(app *App, upgradeInfo upgradetypes.Plan) bool { - return upgradeInfo.Name == version.Version && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) -} diff --git a/app/upgrades/v1_0_3/constants.go b/app/upgrades/v1_0_3/constants.go new file mode 100644 index 00000000..ee7efae4 --- /dev/null +++ b/app/upgrades/v1_0_3/constants.go @@ -0,0 +1,5 @@ +package v1_0_3 + +const ( + UpgradeName = "v1.0.3" +) diff --git a/app/upgrades/v1_0_3/upgrades.go b/app/upgrades/v1_0_3/upgrades.go new file mode 100644 index 00000000..5579d8c0 --- /dev/null +++ b/app/upgrades/v1_0_3/upgrades.go @@ -0,0 +1,24 @@ +package v1_0_3 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("Starting module migrations...") + + vm, err := mm.RunMigrations(ctx, configurator, vm) + if err != nil { + return vm, err + } + + ctx.Logger().Info("Upgrade complete") + return vm, err + } +} diff --git a/proto/swisstronik/compliance/entities.proto b/proto/swisstronik/compliance/entities.proto index f3988c93..6ed41ebb 100644 --- a/proto/swisstronik/compliance/entities.proto +++ b/proto/swisstronik/compliance/entities.proto @@ -40,6 +40,7 @@ message OperatorDetails { message IssuerDetails { // Allows to easily understand // what entity can be associated with issuer address. + // Issuer name string name = 1; // Basic issuer description string description = 2; @@ -49,6 +50,8 @@ message IssuerDetails { string logo = 4; // Legal entity name string legalEntity = 5; + // Issuer creator who created current issuer + string creator = 6; } message AddressDetails { diff --git a/proto/swisstronik/compliance/genesis.proto b/proto/swisstronik/compliance/genesis.proto index ff8514b6..920f35e8 100644 --- a/proto/swisstronik/compliance/genesis.proto +++ b/proto/swisstronik/compliance/genesis.proto @@ -10,13 +10,13 @@ option go_package = "swisstronik/x/compliance/types"; // GenesisState defines the compliance module's genesis state. message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; - repeated IssuerGenesisAccount issuers = 2; + repeated GenesisIssuerDetails issuerDetails = 2; repeated GenesisAddressDetails addressDetails = 3; repeated GenesisVerificationDetails verificationDetails = 4; repeated OperatorDetails operators = 5; } -message IssuerGenesisAccount { +message GenesisIssuerDetails { string address = 1; IssuerDetails details = 2; } diff --git a/proto/swisstronik/compliance/query.proto b/proto/swisstronik/compliance/query.proto index 7bd5323d..b6d425d4 100644 --- a/proto/swisstronik/compliance/query.proto +++ b/proto/swisstronik/compliance/query.proto @@ -125,6 +125,7 @@ message QueryIssuersDetailsResponse { string url = 4; string logo = 5; string legalEntity = 6; + string creator = 7; } // issuers is a slice of registered issuers for the compliance module diff --git a/proto/swisstronik/compliance/tx.proto b/proto/swisstronik/compliance/tx.proto index eda86321..d63c89cd 100644 --- a/proto/swisstronik/compliance/tx.proto +++ b/proto/swisstronik/compliance/tx.proto @@ -13,7 +13,7 @@ service Msg { rpc HandleAddOperator(MsgAddOperator) returns (MsgAddOperatorResponse); rpc HandleRemoveOperator(MsgRemoveOperator) returns (MsgRemoveOperatorResponse); rpc HandleSetVerificationStatus(MsgSetVerificationStatus) returns (MsgSetVerificationStatusResponse); - rpc HandleSetIssuerDetails(MsgSetIssuerDetails) returns (MsgSetIssuerDetailsResponse); + rpc HandleCreateIssuer(MsgCreateIssuer) returns (MsgCreateIssuerResponse); rpc HandleUpdateIssuerDetails(MsgUpdateIssuerDetails) returns (MsgUpdateIssuerDetailsResponse); rpc HandleRemoveIssuer(MsgRemoveIssuer) returns (MsgRemoveIssuerResponse); } @@ -42,13 +42,13 @@ message MsgSetVerificationStatus { } message MsgSetVerificationStatusResponse {} -message MsgSetIssuerDetails { +message MsgCreateIssuer { option (cosmos.msg.v1.signer) = "signer"; string signer = 1; string issuer = 2; IssuerDetails details = 3; } -message MsgSetIssuerDetailsResponse {} +message MsgCreateIssuerResponse {} message MsgUpdateIssuerDetails { option (cosmos.msg.v1.signer) = "signer"; diff --git a/scripts/debug/debug-precompile.sh b/scripts/debug/debug-precompile.sh index c8570f4d..0658281e 100755 --- a/scripts/debug/debug-precompile.sh +++ b/scripts/debug/debug-precompile.sh @@ -40,10 +40,10 @@ echo "Contract Address: $ISSUER" echo -e "\nNew Issuer Address for testing: $ISSUER" echo -e "\nStep 3" echo "Adding new issuer..." -swisstronikd tx compliance set-issuer-details $ISSUER issuer-name issuer-description issuer-url issuer-logo issuer-legal-entity -y --from operator --keyring-backend $KEYRING --home $HOMEDIR --gas-prices 100000000aswtr --output json | tail -n 1 | jq -r '.txhash' +swisstronikd tx compliance create-issuer $ISSUER issuer-name issuer-description issuer-url issuer-logo issuer-legal-entity -y --from operator --keyring-backend $KEYRING --home $HOMEDIR --gas-prices 100000000aswtr --output json | tail -n 1 | jq -r '.txhash' wait_for_tx echo -e "\nSet verification status for new issuer..." -swisstronikd tx compliance set-issuer-verification $ISSUER true -y --from operator --keyring-backend $KEYRING --home $HOMEDIR --gas-prices 100000000aswtr --output json | tail -n 1 | jq -r '.txhash' +swisstronikd tx compliance set-issuer-status $ISSUER true -y --from operator --keyring-backend $KEYRING --home $HOMEDIR --gas-prices 100000000aswtr --output json | tail -n 1 | jq -r '.txhash' wait_for_tx echo -e "\n\n##########################\n" diff --git a/x/compliance/client/cli/tx.go b/x/compliance/client/cli/tx.go index 623acf0e..e97776a0 100644 --- a/x/compliance/client/cli/tx.go +++ b/x/compliance/client/cli/tx.go @@ -31,7 +31,7 @@ func GetTxCmd() *cobra.Command { CmdAddOperator(), CmdRemoveOperator(), CmdSetIssuerVerificationStatus(), - CmdSetIssuerDetails(), + CmdCreateIssuer(), CmdUpdateIssuerDetails(), CmdRemoveIssuer(), ) @@ -106,7 +106,7 @@ func CmdRemoveOperator() *cobra.Command { // CmdSetIssuerVerificationStatus command set issuer's verification status with given parameter. func CmdSetIssuerVerificationStatus() *cobra.Command { cmd := &cobra.Command{ - Use: "set-issuer-verification [issuer-address] [verification-status]", + Use: "set-issuer-status [issuer-address] [verification-status]", Short: "Set issuer's verification status", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -140,11 +140,11 @@ func CmdSetIssuerVerificationStatus() *cobra.Command { return cmd } -// CmdSetIssuerDetails command sets provided issuer details. -func CmdSetIssuerDetails() *cobra.Command { +// CmdCreateIssuer command creates issuer with provided details. +func CmdCreateIssuer() *cobra.Command { cmd := &cobra.Command{ - Use: "set-issuer-details [issuer-address] [name] [description] [url] [logo-url] [legal-entity]", - Short: "Sets issuer details", + Use: "create-issuer [issuer-address] [name] [description] [url] [logo-url] [legal-entity]", + Short: "Create issuer with details", Args: cobra.ExactArgs(6), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) @@ -163,7 +163,7 @@ func CmdSetIssuerDetails() *cobra.Command { issuerLogo := args[4] issuerLegalEntity := args[5] - msg := types.NewSetIssuerDetailsMsg( + msg := types.NewCreateIssuerMsg( clientCtx.GetFromAddress().String(), issuerAddress.String(), issuerName, diff --git a/x/compliance/genesis.go b/x/compliance/genesis.go index 90a13986..d9efad26 100644 --- a/x/compliance/genesis.go +++ b/x/compliance/genesis.go @@ -21,18 +21,22 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) if operatorData.OperatorType <= types.OperatorType_OT_UNSPECIFIED || operatorData.OperatorType > types.OperatorType_OT_REGULAR { panic(errors.Wrap(types.ErrInvalidParam, "operator type is undefined")) } - if err := k.AddOperator(ctx, address, operatorData.OperatorType); err != nil { + if err = k.AddOperator(ctx, address, operatorData.OperatorType); err != nil { panic(err) } } // Restore issuers - for _, issuerData := range genState.Issuers { + for _, issuerData := range genState.IssuerDetails { address, err := sdk.AccAddressFromBech32(issuerData.Address) if err != nil { panic(err) } - if err := k.SetIssuerDetails(ctx, address, issuerData.Details); err != nil { + _, err = sdk.AccAddressFromBech32(issuerData.Details.Creator) + if err != nil { + panic(err) + } + if err = k.SetIssuerDetails(ctx, address, issuerData.Details); err != nil { panic(err) } } @@ -56,7 +60,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) panic(errors.Wrap(types.ErrInvalidParam, "empty proof data")) } - if err := k.SetVerificationDetails(ctx, verificationData.Id, verificationData.Details); err != nil { + if err = k.SetVerificationDetails(ctx, verificationData.Id, verificationData.Details); err != nil { panic(err) } } @@ -90,7 +94,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } } - if err := k.SetAddressDetails(ctx, address, addressData.Details); err != nil { + if err = k.SetAddressDetails(ctx, address, addressData.Details); err != nil { panic(err) } } @@ -107,11 +111,11 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { } genesis.Operators = operators - issuers, err := k.ExportIssuerAccounts(ctx) + issuerDetails, err := k.ExportIssuerDetails(ctx) if err != nil { panic(err) } - genesis.Issuers = issuers + genesis.IssuerDetails = issuerDetails addressDetails, err := k.ExportAddressDetails(ctx) if err != nil { diff --git a/x/compliance/genesis_test.go b/x/compliance/genesis_test.go index accf9c7d..e1afeb4c 100644 --- a/x/compliance/genesis_test.go +++ b/x/compliance/genesis_test.go @@ -45,7 +45,7 @@ func TestInitGenesis_Validation(t *testing.T) { { name: "invalid issuers", genState: &types.GenesisState{ - Issuers: []*types.IssuerGenesisAccount{ + IssuerDetails: []*types.GenesisIssuerDetails{ {Address: "wrong address"}, }, }, @@ -54,12 +54,28 @@ func TestInitGenesis_Validation(t *testing.T) { { name: "invalid issuer details", genState: &types.GenesisState{ - Issuers: []*types.IssuerGenesisAccount{ + IssuerDetails: []*types.GenesisIssuerDetails{ {Address: "swtr1tpvqt6zfl9yef58gl7jcdpkw88thgrkf38d5zx"}, }, }, expPanic: true, }, + { + name: "missing issuer creator", + genState: &types.GenesisState{ + IssuerDetails: []*types.GenesisIssuerDetails{ + { + Address: "swtr199wynlfwhj6ytkvujjf6mel5z7fl0mwzqck8l6", + // Creator: "", // missing issuer creator + Details: &types.IssuerDetails{ + Creator: "invalid issuer creator", // invalid issuer creator + Name: "test issuer", + }, + }, + }, + }, + expPanic: true, + }, { name: "invalid issuer in verification data", genState: &types.GenesisState{ @@ -142,11 +158,12 @@ func TestInitGenesis_Validation(t *testing.T) { { name: "verification id for verified account is nil", // there's no verification data with verification_id genState: &types.GenesisState{ - Issuers: []*types.IssuerGenesisAccount{ + IssuerDetails: []*types.GenesisIssuerDetails{ { Address: "swtr199wynlfwhj6ytkvujjf6mel5z7fl0mwzqck8l6", Details: &types.IssuerDetails{ - Name: "test issuer", + Creator: "swtr1734tyvkylw3f7vc9xmwxp6g5n79qvsrvjhsvs4", + Name: "test issuer", }, }, }, @@ -171,11 +188,12 @@ func TestInitGenesis_Validation(t *testing.T) { // There's no verification data with verification_id name: "not found verification data for verified account", genState: &types.GenesisState{ - Issuers: []*types.IssuerGenesisAccount{ + IssuerDetails: []*types.GenesisIssuerDetails{ { Address: "swtr199wynlfwhj6ytkvujjf6mel5z7fl0mwzqck8l6", Details: &types.IssuerDetails{ - Name: "test issuer", + Creator: "swtr1734tyvkylw3f7vc9xmwxp6g5n79qvsrvjhsvs4", + Name: "test issuer", }, }, }, @@ -211,11 +229,12 @@ func TestInitGenesis_Validation(t *testing.T) { { name: "invalid verification type", genState: &types.GenesisState{ - Issuers: []*types.IssuerGenesisAccount{ + IssuerDetails: []*types.GenesisIssuerDetails{ { Address: "swtr199wynlfwhj6ytkvujjf6mel5z7fl0mwzqck8l6", Details: &types.IssuerDetails{ - Name: "test issuer", + Creator: "swtr1734tyvkylw3f7vc9xmwxp6g5n79qvsrvjhsvs4", + Name: "test issuer", }, }, }, @@ -290,16 +309,18 @@ func TestGenesis_Success(t *testing.T) { OperatorType: types.OperatorType_OT_REGULAR, }, }, - Issuers: []*types.IssuerGenesisAccount{ + IssuerDetails: []*types.GenesisIssuerDetails{ { Address: "swtr199wynlfwhj6ytkvujjf6mel5z7fl0mwzqck8l6", Details: &types.IssuerDetails{ - Name: "test issuer", + Creator: "swtr16vgqffr8v0sh3n5qeqdksfpzdkqf3rtk49thun", + Name: "test issuer", }, }, { Address: "swtr13wl63dpe3xdhzvphp32cm9cv2vs9nvhkpaspwu", Details: &types.IssuerDetails{ + Creator: "swtr16vgqffr8v0sh3n5qeqdksfpzdkqf3rtk49thun", Name: "test issuer2", Description: "test description2", }, @@ -393,7 +414,7 @@ func TestGenesis_Success(t *testing.T) { } // Check if issuers were already initialized - for _, issuerData := range tc.genState.Issuers { + for _, issuerData := range tc.genState.IssuerDetails { address, err := sdk.AccAddressFromBech32(issuerData.Address) require.NoError(t, err) details, err := k.GetIssuerDetails(ctx, address) @@ -425,9 +446,11 @@ func TestGenesis_Success(t *testing.T) { require.Equal(t, tc.genState.Params, got.Params) // Sort by issuer address to check if two issuers are same - sort.Slice(tc.genState.Issuers, func(i, j int) bool { return tc.genState.Issuers[i].Address < tc.genState.Issuers[j].Address }) - sort.Slice(got.Issuers, func(i, j int) bool { return got.Issuers[i].Address < got.Issuers[j].Address }) - require.Equal(t, tc.genState.Issuers, got.Issuers) + sort.Slice(tc.genState.IssuerDetails, func(i, j int) bool { + return tc.genState.IssuerDetails[i].Address < tc.genState.IssuerDetails[j].Address + }) + sort.Slice(got.IssuerDetails, func(i, j int) bool { return got.IssuerDetails[i].Address < got.IssuerDetails[j].Address }) + require.Equal(t, tc.genState.IssuerDetails, got.IssuerDetails) // Sort by address to check if two address details are same sort.Slice(tc.genState.AddressDetails, func(i, j int) bool { return tc.genState.AddressDetails[i].Address < tc.genState.AddressDetails[j].Address diff --git a/x/compliance/keeper/integration_test.go b/x/compliance/keeper/integration_test.go index ee0fd6f2..9a082fb9 100644 --- a/x/compliance/keeper/integration_test.go +++ b/x/compliance/keeper/integration_test.go @@ -18,7 +18,7 @@ import ( ) var _ = Describe("VerifyIssuer", Ordered, func() { - from, _ := tests.RandomEthAddressWithPrivateKey() + issuerCreator := tests.RandomAccAddress() from, validIssuerPrivKey := tests.RandomEthAddressWithPrivateKey() validIssuer := sdk.AccAddress(from.Bytes()) @@ -64,7 +64,7 @@ var _ = Describe("VerifyIssuer", Ordered, func() { Describe("valid issuer has been verified", func() { BeforeEach(func() { // Set issuer details(not verified) - issuerDetails := &types.IssuerDetails{Name: "test issuer"} + issuerDetails := &types.IssuerDetails{Creator: issuerCreator.String(), Name: "test issuer"} _ = s.keeper.SetIssuerDetails(s.ctx, validIssuer, issuerDetails) // Submit proposal with sufficient deposit @@ -101,7 +101,7 @@ var _ = Describe("VerifyIssuer", Ordered, func() { Describe("invalid issuer has not been verified", func() { BeforeEach(func() { // Set issuer details(not verified) - issuerDetails := &types.IssuerDetails{Name: "test issuer"} + issuerDetails := &types.IssuerDetails{Creator: issuerCreator.String(), Name: "test issuer"} _ = s.keeper.SetIssuerDetails(s.ctx, invalidIssuer, issuerDetails) // Submit proposal with sufficient deposit @@ -133,7 +133,7 @@ var _ = Describe("VerifyIssuer", Ordered, func() { Describe("should not create a proposal for verified issuer", func() { BeforeEach(func() { // Set issuer details(verified) - issuerDetails := &types.IssuerDetails{Name: "test issuer"} + issuerDetails := &types.IssuerDetails{Creator: issuerCreator.String(), Name: "test issuer"} _ = s.keeper.SetIssuerDetails(s.ctx, validIssuer, issuerDetails) _ = s.keeper.SetAddressVerificationStatus(s.ctx, validIssuer, true) }) diff --git a/x/compliance/keeper/keeper.go b/x/compliance/keeper/keeper.go index 68debbfd..d6b3b2fb 100644 --- a/x/compliance/keeper/keeper.go +++ b/x/compliance/keeper/keeper.go @@ -45,7 +45,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { } // SetIssuerDetails sets details for provided issuer address -func (k Keeper) SetIssuerDetails(ctx sdk.Context, issuerAddress sdk.Address, details *types.IssuerDetails) error { +func (k Keeper) SetIssuerDetails(ctx sdk.Context, issuerAddress sdk.AccAddress, details *types.IssuerDetails) error { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixIssuerDetails) detailsBytes, err := details.Marshal() @@ -54,11 +54,12 @@ func (k Keeper) SetIssuerDetails(ctx sdk.Context, issuerAddress sdk.Address, det } store.Set(issuerAddress.Bytes(), detailsBytes) + return nil } // RemoveIssuer removes provided issuer -func (k Keeper) RemoveIssuer(ctx sdk.Context, issuerAddress sdk.Address) { +func (k Keeper) RemoveIssuer(ctx sdk.Context, issuerAddress sdk.AccAddress) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixIssuerDetails) store.Delete(issuerAddress.Bytes()) // NOTE, all the verification data verified by removed issuer must be deleted from store @@ -70,7 +71,7 @@ func (k Keeper) RemoveIssuer(ctx sdk.Context, issuerAddress sdk.Address) { } // GetIssuerDetails returns details of provided issuer address -func (k Keeper) GetIssuerDetails(ctx sdk.Context, issuerAddress sdk.Address) (*types.IssuerDetails, error) { +func (k Keeper) GetIssuerDetails(ctx sdk.Context, issuerAddress sdk.AccAddress) (*types.IssuerDetails, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixIssuerDetails) detailsBytes := store.Get(issuerAddress.Bytes()) @@ -86,8 +87,17 @@ func (k Keeper) GetIssuerDetails(ctx sdk.Context, issuerAddress sdk.Address) (*t return &issuerDetails, nil } +// IssuerExists checks if issuer exists by checking operator address +func (k Keeper) IssuerExists(ctx sdk.Context, issuerAddress sdk.AccAddress) (bool, error) { + res, err := k.GetIssuerDetails(ctx, issuerAddress) + if err != nil { + return false, err + } + return len(res.Name) > 0, nil +} + // GetAddressDetails returns address details -func (k Keeper) GetAddressDetails(ctx sdk.Context, address sdk.Address) (*types.AddressDetails, error) { +func (k Keeper) GetAddressDetails(ctx sdk.Context, address sdk.AccAddress) (*types.AddressDetails, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixAddressDetails) addressDetailsBytes := store.Get(address.Bytes()) @@ -121,7 +131,7 @@ func (k Keeper) GetAddressDetails(ctx sdk.Context, address sdk.Address) (*types. } // SetAddressDetails writes address details to the storage -func (k Keeper) SetAddressDetails(ctx sdk.Context, address sdk.Address, details *types.AddressDetails) error { +func (k Keeper) SetAddressDetails(ctx sdk.Context, address sdk.AccAddress, details *types.AddressDetails) error { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixAddressDetails) detailsBytes, err := details.Marshal() if err != nil { @@ -132,13 +142,13 @@ func (k Keeper) SetAddressDetails(ctx sdk.Context, address sdk.Address, details } // RemoveAddressDetails deletes address details from store -func (k Keeper) RemoveAddressDetails(ctx sdk.Context, address sdk.Address) { +func (k Keeper) RemoveAddressDetails(ctx sdk.Context, address sdk.AccAddress) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixAddressDetails) store.Delete(address.Bytes()) } // IsAddressVerified returns information if address is verified. -func (k Keeper) IsAddressVerified(ctx sdk.Context, address sdk.Address) (bool, error) { +func (k Keeper) IsAddressVerified(ctx sdk.Context, address sdk.AccAddress) (bool, error) { addressDetails, err := k.GetAddressDetails(ctx, address) if err != nil { return false, err @@ -149,7 +159,7 @@ func (k Keeper) IsAddressVerified(ctx sdk.Context, address sdk.Address) (bool, e } // SetAddressVerificationStatus marks provided address as verified or not verified. -func (k Keeper) SetAddressVerificationStatus(ctx sdk.Context, address sdk.Address, isVerifiedStatus bool) error { +func (k Keeper) SetAddressVerificationStatus(ctx sdk.Context, address sdk.AccAddress, isVerifiedStatus bool) error { addressDetails, err := k.GetAddressDetails(ctx, address) if err != nil { return err @@ -169,7 +179,7 @@ func (k Keeper) SetAddressVerificationStatus(ctx sdk.Context, address sdk.Addres } // AddVerificationDetails writes details of passed verification by provided address. -func (k Keeper) AddVerificationDetails(ctx sdk.Context, userAddress sdk.Address, verificationType types.VerificationType, details *types.VerificationDetails) ([]byte, error) { +func (k Keeper) AddVerificationDetails(ctx sdk.Context, userAddress sdk.AccAddress, verificationType types.VerificationType, details *types.VerificationDetails) ([]byte, error) { // Check if issuer is verified and not banned issuerAddress, err := sdk.AccAddressFromBech32(details.IssuerAddress) if err != nil { @@ -290,7 +300,7 @@ func (k Keeper) GetVerificationDetails(ctx sdk.Context, verificationDetailsId [] return &verificationDetails, nil } -func (k Keeper) GetVerificationDetailsByIssuer(ctx sdk.Context, userAddress sdk.Address, issuerAddress sdk.Address) ([]*types.Verification, []*types.VerificationDetails, error) { +func (k Keeper) GetVerificationDetailsByIssuer(ctx sdk.Context, userAddress sdk.AccAddress, issuerAddress sdk.AccAddress) ([]*types.Verification, []*types.VerificationDetails, error) { addressDetails, err := k.GetAddressDetails(ctx, userAddress) if err != nil { return nil, nil, err @@ -316,7 +326,7 @@ func (k Keeper) GetVerificationDetailsByIssuer(ctx sdk.Context, userAddress sdk. // HasVerificationOfType checks if user has verifications of specific type (for example, passed KYC) from provided issuers. // If there is no provided expected issuers, this function will check if user has any verification of appropriate type. -func (k Keeper) HasVerificationOfType(ctx sdk.Context, userAddress sdk.Address, expectedType types.VerificationType, expirationTimestamp uint32, expectedIssuers []sdk.Address) (bool, error) { +func (k Keeper) HasVerificationOfType(ctx sdk.Context, userAddress sdk.AccAddress, expectedType types.VerificationType, expirationTimestamp uint32, expectedIssuers []sdk.AccAddress) (bool, error) { // Obtain user address details userAddressDetails, err := k.GetAddressDetails(ctx, userAddress) if err != nil { @@ -357,7 +367,7 @@ func (k Keeper) HasVerificationOfType(ctx sdk.Context, userAddress sdk.Address, return false, nil } -func (k Keeper) GetVerificationsOfType(ctx sdk.Context, userAddress sdk.Address, expectedType types.VerificationType, expectedIssuers ...sdk.Address) ([]*types.VerificationDetails, error) { +func (k Keeper) GetVerificationsOfType(ctx sdk.Context, userAddress sdk.AccAddress, expectedType types.VerificationType, expectedIssuers ...sdk.AccAddress) ([]*types.VerificationDetails, error) { // Obtain user address details userAddressDetails, err := k.GetAddressDetails(ctx, userAddress) if err != nil { @@ -380,7 +390,7 @@ func (k Keeper) GetVerificationsOfType(ctx sdk.Context, userAddress sdk.Address, var verifications []*types.VerificationDetails for _, verification := range appropriateTypeVerifications { // Filter verifications by expected issuer - if expectedIssuers != nil && slices.ContainsFunc(expectedIssuers, func(expectedIssuer sdk.Address) bool { + if expectedIssuers != nil && slices.ContainsFunc(expectedIssuers, func(expectedIssuer sdk.AccAddress) bool { if expectedIssuer.String() == verification.IssuerAddress { return true } @@ -399,15 +409,6 @@ func (k Keeper) GetVerificationsOfType(ctx sdk.Context, userAddress sdk.Address, return verifications, nil } -// IssuerExists checks if issuer exists by checking operator address -func (k Keeper) IssuerExists(ctx sdk.Context, issuerAddress sdk.Address) (bool, error) { - res, err := k.GetIssuerDetails(ctx, issuerAddress) - if err != nil { - return false, err - } - return len(res.Name) > 0, nil -} - // GetOperatorDetails returns the operator details func (k Keeper) GetOperatorDetails(ctx sdk.Context, operator sdk.AccAddress) (*types.OperatorDetails, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixOperatorDetails) @@ -498,7 +499,7 @@ func (k Keeper) IterateVerificationDetails(ctx sdk.Context, callback func(id []b } } -func (k Keeper) IterateAddressDetails(ctx sdk.Context, callback func(address sdk.Address) (continue_ bool)) { +func (k Keeper) IterateAddressDetails(ctx sdk.Context, callback func(address sdk.AccAddress) (continue_ bool)) { latestVersionIterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.KeyPrefixAddressDetails) defer closeIteratorOrPanic(latestVersionIterator) @@ -511,7 +512,7 @@ func (k Keeper) IterateAddressDetails(ctx sdk.Context, callback func(address sdk } } -func (k Keeper) IterateIssuerDetails(ctx sdk.Context, callback func(address sdk.Address) (continue_ bool)) { +func (k Keeper) IterateIssuerDetails(ctx sdk.Context, callback func(address sdk.AccAddress) (continue_ bool)) { latestVersionIterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.KeyPrefixIssuerDetails) defer closeIteratorOrPanic(latestVersionIterator) @@ -575,7 +576,7 @@ func (k Keeper) ExportAddressDetails(ctx sdk.Context) ([]*types.GenesisAddressDe err error ) - k.IterateAddressDetails(ctx, func(address sdk.Address) bool { + k.IterateAddressDetails(ctx, func(address sdk.AccAddress) bool { details, err = k.GetAddressDetails(ctx, address) if err != nil { return false @@ -590,26 +591,29 @@ func (k Keeper) ExportAddressDetails(ctx sdk.Context) ([]*types.GenesisAddressDe return allAddressDetails, nil } -func (k Keeper) ExportIssuerAccounts(ctx sdk.Context) ([]*types.IssuerGenesisAccount, error) { +func (k Keeper) ExportIssuerDetails(ctx sdk.Context) ([]*types.GenesisIssuerDetails, error) { var ( - issuerAccs []*types.IssuerGenesisAccount - details *types.IssuerDetails - err error + issuerDetails []*types.GenesisIssuerDetails + details *types.IssuerDetails + err error ) - k.IterateIssuerDetails(ctx, func(address sdk.Address) bool { + k.IterateIssuerDetails(ctx, func(address sdk.AccAddress) bool { details, err = k.GetIssuerDetails(ctx, address) if err != nil { return false } - issuerAccs = append(issuerAccs, &types.IssuerGenesisAccount{Address: address.String(), Details: details}) + issuerDetails = append(issuerDetails, &types.GenesisIssuerDetails{ + Address: address.String(), + Details: details, + }) return true }) if err != nil { return nil, err } - return issuerAccs, nil + return issuerDetails, nil } func closeIteratorOrPanic(iterator sdk.Iterator) { diff --git a/x/compliance/keeper/keeper_test.go b/x/compliance/keeper/keeper_test.go index 1dcf78c7..1c6f33fc 100644 --- a/x/compliance/keeper/keeper_test.go +++ b/x/compliance/keeper/keeper_test.go @@ -116,33 +116,30 @@ func (suite *KeeperTestSuite) CommitAfter(t time.Duration) { } func (suite *KeeperTestSuite) TestCreateSimpleAndFetchSimpleIssuer() { - details := &types.IssuerDetails{Name: "testIssuer"} - from, _ := tests.RandomEthAddressWithPrivateKey() - address := sdk.AccAddress(from.Bytes()) - err := suite.keeper.SetIssuerDetails(suite.ctx, address, details) + details := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "testIssuer"} + issuer := tests.RandomAccAddress() + err := suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) suite.Require().NoError(err) - i, err := suite.keeper.GetIssuerDetails(suite.ctx, address) + i, err := suite.keeper.GetIssuerDetails(suite.ctx, issuer) suite.Require().Equal(details, i) suite.Require().NoError(err) - suite.keeper.RemoveIssuer(suite.ctx, address) - i, err = suite.keeper.GetIssuerDetails(suite.ctx, address) + suite.keeper.RemoveIssuer(suite.ctx, issuer) + i, err = suite.keeper.GetIssuerDetails(suite.ctx, issuer) suite.Require().Equal("", i.Name) suite.Require().NoError(err) } func (suite *KeeperTestSuite) TestNonExistingIssuer() { - from, _ := tests.RandomEthAddressWithPrivateKey() - address := sdk.AccAddress(from.Bytes()) - i, err := suite.keeper.GetIssuerDetails(suite.ctx, address) + issuer := tests.RandomAccAddress() + i, err := suite.keeper.GetIssuerDetails(suite.ctx, issuer) suite.Require().Equal("", i.Name) // todo, operator is empty suite.Require().NoError(err) } func (suite *KeeperTestSuite) TestSuspendedIssuer() { - details := &types.IssuerDetails{Name: "testIssuer"} - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer := sdk.AccAddress(from.Bytes()) + details := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "testIssuer"} + issuer := tests.RandomAccAddress() err := suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) suite.Require().NoError(err) @@ -150,8 +147,7 @@ func (suite *KeeperTestSuite) TestSuspendedIssuer() { err = suite.keeper.SetAddressVerificationStatus(suite.ctx, issuer, false) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - signer := sdk.AccAddress(from.Bytes()) + signer := tests.RandomAccAddress() // Should not allow to add verification details verified by suspended issuer // Even if issuer was suspended, verification data should exist @@ -170,23 +166,21 @@ func (suite *KeeperTestSuite) TestSuspendedIssuer() { suite.Require().Error(err) suite.Require().Nil(verificationId) - has, err := suite.keeper.HasVerificationOfType(suite.ctx, signer, types.VerificationType_VT_KYC, 1715018692, []sdk.Address{issuer}) + has, err := suite.keeper.HasVerificationOfType(suite.ctx, signer, types.VerificationType_VT_KYC, 1715018692, []sdk.AccAddress{issuer}) suite.Require().NoError(err) suite.Require().False(has) } func (suite *KeeperTestSuite) TestRemovedIssuer() { - issuerDetails := &types.IssuerDetails{Name: "testIssuer"} - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer := sdk.AccAddress(from.Bytes()) + issuerDetails := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "testIssuer"} + issuer := tests.RandomAccAddress() err := suite.keeper.SetIssuerDetails(suite.ctx, issuer, issuerDetails) suite.Require().NoError(err) err = suite.keeper.SetAddressVerificationStatus(suite.ctx, issuer, true) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - signer := sdk.AccAddress(from.Bytes()) + signer := tests.RandomAccAddress() // Add dummy verification details and address details with verifications err = suite.keeper.SetAddressDetails( @@ -241,17 +235,15 @@ func (suite *KeeperTestSuite) TestRemovedIssuer() { } func (suite *KeeperTestSuite) TestAddVerificationDetails() { - details := &types.IssuerDetails{Name: "testIssuer"} - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer := sdk.AccAddress(from.Bytes()) + details := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "testIssuer"} + issuer := tests.RandomAccAddress() err := suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) suite.Require().NoError(err) err = suite.keeper.SetAddressVerificationStatus(suite.ctx, issuer, true) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - signer := sdk.AccAddress(from.Bytes()) + signer := tests.RandomAccAddress() verificationDetails := &types.VerificationDetails{ IssuerAddress: issuer.String(), @@ -289,7 +281,7 @@ func (suite *KeeperTestSuite) TestAddVerificationDetails() { suite.Require().NoError(err) suite.Require().NotNil(verificationId) - has, err := suite.keeper.HasVerificationOfType(suite.ctx, signer, types.VerificationType_VT_KYC, 1715018692, []sdk.Address{issuer}) + has, err := suite.keeper.HasVerificationOfType(suite.ctx, signer, types.VerificationType_VT_KYC, 1715018692, []sdk.AccAddress{issuer}) suite.Require().NoError(err) suite.Require().True(has) @@ -309,20 +301,18 @@ func (suite *KeeperTestSuite) TestAddVerificationDetails() { has, err = suite.keeper.HasVerificationOfType(suite.ctx, signer, types.VerificationType_VT_KYC, 0, nil) suite.Require().NoError(err) suite.Require().False(has) - has, err = suite.keeper.HasVerificationOfType(suite.ctx, signer, types.VerificationType_VT_KYC, 0, []sdk.Address{issuer}) + has, err = suite.keeper.HasVerificationOfType(suite.ctx, signer, types.VerificationType_VT_KYC, 0, []sdk.AccAddress{issuer}) suite.Require().NoError(err) suite.Require().False(has) } func (suite *KeeperTestSuite) TestAddressDetailsCRUD() { - issuerDetails := &types.IssuerDetails{Name: "testIssuer"} - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer := sdk.AccAddress(from.Bytes()) + issuerDetails := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "testIssuer"} + issuer := tests.RandomAccAddress() err := suite.keeper.SetIssuerDetails(suite.ctx, issuer, issuerDetails) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - address := sdk.AccAddress(from.Bytes()) + address := tests.RandomAccAddress() addressDetails := &types.AddressDetails{IsVerified: true, IsRevoked: false, @@ -339,8 +329,7 @@ func (suite *KeeperTestSuite) TestAddressDetailsCRUD() { } func (suite *KeeperTestSuite) TestAddressVerified() { - from, _ := tests.RandomEthAddressWithPrivateKey() - address := sdk.AccAddress(from.Bytes()) + address := tests.RandomAccAddress() details := &types.AddressDetails{IsVerified: true, IsRevoked: false, Verifications: make([]*types.Verification, 0)} @@ -348,8 +337,7 @@ func (suite *KeeperTestSuite) TestAddressVerified() { suite.Require().NoError(err) i, err := suite.keeper.IsAddressVerified(suite.ctx, address) suite.Require().Equal(true, i) - from2, _ := tests.RandomEthAddressWithPrivateKey() - address2 := sdk.AccAddress(from2.Bytes()) + address2 := tests.RandomAccAddress() details2 := &types.AddressDetails{IsVerified: false, IsRevoked: false, Verifications: make([]*types.Verification, 0)} @@ -360,8 +348,7 @@ func (suite *KeeperTestSuite) TestAddressVerified() { } func (suite *KeeperTestSuite) TestAddressDetailsSetVerificationStatus() { - from, _ := tests.RandomEthAddressWithPrivateKey() - address := sdk.AccAddress(from.Bytes()) + address := tests.RandomAccAddress() details := &types.AddressDetails{ IsVerified: false, IsRevoked: false, @@ -393,9 +380,8 @@ func (suite *KeeperTestSuite) TestAddressDetailsSetVerificationStatus() { } func (suite *KeeperTestSuite) TestSetVerificationDetails() { - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer := sdk.AccAddress(from.Bytes()) - issuerDetails := &types.IssuerDetails{Name: "testIssuer"} + issuer := tests.RandomAccAddress() + issuerDetails := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "testIssuer"} err := suite.keeper.SetIssuerDetails(suite.ctx, issuer, issuerDetails) suite.Require().NoError(err) @@ -416,8 +402,7 @@ func (suite *KeeperTestSuite) TestSetVerificationDetails() { } func (suite *KeeperTestSuite) TestInvalidOperatorType() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator := sdk.AccAddress(from.Bytes()) + operator := tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_UNSPECIFIED) suite.Require().Error(err) @@ -427,8 +412,7 @@ func (suite *KeeperTestSuite) TestInvalidOperatorType() { } func (suite *KeeperTestSuite) TestInitialOperator() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator := sdk.AccAddress(from.Bytes()) + operator := tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_INITIAL) suite.Require().NoError(err) @@ -448,8 +432,7 @@ func (suite *KeeperTestSuite) TestInitialOperator() { } func (suite *KeeperTestSuite) TestRegularOperator() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator := sdk.AccAddress(from.Bytes()) + operator := tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) diff --git a/x/compliance/keeper/migrations.go b/x/compliance/keeper/migrations.go new file mode 100644 index 00000000..1dc16cf1 --- /dev/null +++ b/x/compliance/keeper/migrations.go @@ -0,0 +1,20 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "swisstronik/x/compliance/migrations/v1_0_3" +) + +type Migrator struct { + keeper Keeper +} + +func NewMigrator(keeper Keeper) Migrator { + return Migrator{ + keeper: keeper, + } +} + +func (m Migrator) Migrate1_0_2to1_0_3(ctx sdk.Context) error { + return v1_0_3.MigrateStore(ctx, m.keeper) +} diff --git a/x/compliance/keeper/msg_server.go b/x/compliance/keeper/msg_server.go index db859606..39bfc0e7 100644 --- a/x/compliance/keeper/msg_server.go +++ b/x/compliance/keeper/msg_server.go @@ -51,7 +51,7 @@ func (k msgServer) HandleAddOperator(goCtx context.Context, msg *types.MsgAddOpe return nil, errors.Wrapf(types.ErrInvalidOperator, "operator already exists") } - if err := k.AddOperator(ctx, operator, types.OperatorType_OT_REGULAR); err != nil { + if err = k.AddOperator(ctx, operator, types.OperatorType_OT_REGULAR); err != nil { return nil, err } @@ -76,7 +76,7 @@ func (k msgServer) HandleRemoveOperator(goCtx context.Context, msg *types.MsgRem // Only operator can remove regular operator if exists, err := k.OperatorExists(ctx, signer); !exists || err != nil { - return nil, types.ErrNotOperator + return nil, types.ErrNotOperatorOrIssuerCreator } // Check validity of operator addresses @@ -127,7 +127,7 @@ func (k msgServer) HandleSetVerificationStatus(goCtx context.Context, msg *types } if exists, err := k.IssuerExists(ctx, issuer); !exists || err != nil { - return nil, errors.Wrap(types.ErrInvalidIssuer, "issuer not exists") + return nil, errors.Wrap(types.ErrInvalidIssuer, "issuer does not exist") } if err = k.SetAddressVerificationStatus(ctx, issuer, msg.IsVerified); err != nil { @@ -145,7 +145,7 @@ func (k msgServer) HandleSetVerificationStatus(goCtx context.Context, msg *types return &types.MsgSetVerificationStatusResponse{}, nil } -func (k msgServer) HandleSetIssuerDetails(goCtx context.Context, msg *types.MsgSetIssuerDetails) (*types.MsgSetIssuerDetailsResponse, error) { +func (k msgServer) HandleCreateIssuer(goCtx context.Context, msg *types.MsgCreateIssuer) (*types.MsgCreateIssuerResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) // Check validity of signer address @@ -154,11 +154,6 @@ func (k msgServer) HandleSetIssuerDetails(goCtx context.Context, msg *types.MsgS return nil, err } - // Only operator can add issuer - if exists, err := k.OperatorExists(ctx, signer); !exists || err != nil { - return nil, types.ErrNotOperator - } - // Make sure that issuer does not exist issuer, err := sdk.AccAddressFromBech32(msg.Issuer) if err != nil { @@ -168,7 +163,10 @@ func (k msgServer) HandleSetIssuerDetails(goCtx context.Context, msg *types.MsgS return nil, errors.Wrap(types.ErrInvalidIssuer, "issuer already exists") } - if err := k.SetIssuerDetails(ctx, issuer, msg.Details); err != nil { + msg.Details.Creator = signer.String() + + // Store issuer details with creator address + if err = k.SetIssuerDetails(ctx, issuer, msg.Details); err != nil { return nil, err } @@ -180,13 +178,13 @@ func (k msgServer) HandleSetIssuerDetails(goCtx context.Context, msg *types.MsgS ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeAddIssuer, - sdk.NewAttribute(types.AttributeKeyOperator, msg.Signer), + sdk.NewAttribute(types.AttributeKeyIssuerCreator, msg.Signer), sdk.NewAttribute(types.AttributeKeyIssuer, msg.Issuer), sdk.NewAttribute(types.AttributeKeyIssuerDetails, msg.Details.String()), ), ) - return &types.MsgSetIssuerDetailsResponse{}, nil + return &types.MsgCreateIssuerResponse{}, nil } func (k msgServer) HandleUpdateIssuerDetails(goCtx context.Context, msg *types.MsgUpdateIssuerDetails) (*types.MsgUpdateIssuerDetailsResponse, error) { @@ -198,33 +196,38 @@ func (k msgServer) HandleUpdateIssuerDetails(goCtx context.Context, msg *types.M return nil, err } - // Only operator can update issuer - if exists, err := k.OperatorExists(ctx, signer); !exists || err != nil { - return nil, types.ErrNotOperator - } - // Check if issuer exists issuer, err := sdk.AccAddressFromBech32(msg.Issuer) if err != nil { return nil, err } - if exists, err := k.IssuerExists(ctx, issuer); !exists || err != nil { - return nil, errors.Wrap(types.ErrInvalidIssuer, "issuer not exists") + + details, err := k.GetIssuerDetails(ctx, issuer) + if err != nil || len(details.Name) < 1 { + return nil, errors.Wrap(types.ErrInvalidIssuer, "issuer does not exist") + } + + // Operator or issuer creator can update issuer + if details.Creator != signer.String() { + if exists, err := k.OperatorExists(ctx, signer); !exists || err != nil { + // If signer is neither an operator nor issuer creator + return nil, errors.Wrap(types.ErrNotOperatorOrIssuerCreator, "issuer creator does not match") + } } // Revoke verification if address was verified - if err := k.SetAddressVerificationStatus(ctx, issuer, false); err != nil { + if err = k.SetAddressVerificationStatus(ctx, issuer, false); err != nil { return nil, err } - if err := k.SetIssuerDetails(ctx, issuer, msg.Details); err != nil { + if err = k.SetIssuerDetails(ctx, issuer, msg.Details); err != nil { return nil, err } ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeUpdateIssuer, - sdk.NewAttribute(types.AttributeKeyOperator, msg.Signer), + sdk.NewAttribute(types.AttributeKeyIssuerCreator, msg.Signer), sdk.NewAttribute(types.AttributeKeyIssuer, msg.Issuer), sdk.NewAttribute(types.AttributeKeyIssuerDetails, msg.Details.String()), ), @@ -242,18 +245,23 @@ func (k msgServer) HandleRemoveIssuer(goCtx context.Context, msg *types.MsgRemov return nil, err } - // Only operator can remove issuer - if exists, err := k.OperatorExists(ctx, signer); !exists || err != nil { - return nil, types.ErrNotOperator - } - // Make sure that issuer exists issuer, err := sdk.AccAddressFromBech32(msg.Issuer) if err != nil { return nil, err } - if exists, err := k.IssuerExists(ctx, issuer); !exists || err != nil { - return nil, errors.Wrap(types.ErrInvalidIssuer, "issuer not exists") + + details, err := k.GetIssuerDetails(ctx, issuer) + if err != nil || len(details.Name) < 1 { + return nil, errors.Wrap(types.ErrInvalidIssuer, "issuer does not exist") + } + + // Operator or issuer creator can remove issuer + if details.Creator != signer.String() { + if exists, err := k.OperatorExists(ctx, signer); !exists || err != nil { + // If signer is neither an operator nor issuer creator + return nil, errors.Wrap(types.ErrNotOperatorOrIssuerCreator, "issuer creator does not match") + } } k.RemoveIssuer(ctx, issuer) @@ -261,7 +269,7 @@ func (k msgServer) HandleRemoveIssuer(goCtx context.Context, msg *types.MsgRemov ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeRemoveIssuer, - sdk.NewAttribute(types.AttributeKeyOperator, msg.Signer), + sdk.NewAttribute(types.AttributeKeyIssuerCreator, msg.Signer), sdk.NewAttribute(types.AttributeKeyIssuer, msg.Issuer), ), ) diff --git a/x/compliance/keeper/msg_server_test.go b/x/compliance/keeper/msg_server_test.go index 71416c2d..a32ef368 100644 --- a/x/compliance/keeper/msg_server_test.go +++ b/x/compliance/keeper/msg_server_test.go @@ -37,8 +37,7 @@ func (suite *KeeperTestSuite) TestAddOperator() { { name: "operator not exist", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) + operator = tests.RandomAccAddress() }, malleate: func() *types.MsgAddOperator { msg := types.NewMsgAddOperator( @@ -55,14 +54,11 @@ func (suite *KeeperTestSuite) TestAddOperator() { { name: "success", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - newOperator = sdk.AccAddress(from.Bytes()) + newOperator = tests.RandomAccAddress() }, malleate: func() *types.MsgAddOperator { msg := types.NewMsgAddOperator( @@ -89,9 +85,7 @@ func (suite *KeeperTestSuite) TestAddOperator() { { name: "existing operator", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) }, @@ -150,8 +144,7 @@ func (suite *KeeperTestSuite) TestRemoveOperator() { { name: "operator not exist", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) + operator = tests.RandomAccAddress() }, malleate: func() *types.MsgRemoveOperator { msg := types.NewMsgRemoveOperator( @@ -161,22 +154,18 @@ func (suite *KeeperTestSuite) TestRemoveOperator() { return &msg }, expected: func(resp *types.MsgRemoveOperatorResponse, error error) { - suite.Require().ErrorIs(error, types.ErrNotOperator) + suite.Require().ErrorIs(error, types.ErrNotOperatorOrIssuerCreator) suite.Require().Nil(resp) }, }, { name: "success", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - newOperator = sdk.AccAddress(from.Bytes()) - + newOperator = tests.RandomAccAddress() err = suite.keeper.AddOperator(suite.ctx, newOperator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) }, @@ -205,9 +194,7 @@ func (suite *KeeperTestSuite) TestRemoveOperator() { { name: "remove itself", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) }, @@ -236,14 +223,11 @@ func (suite *KeeperTestSuite) TestRemoveOperator() { { name: "remove initial operator", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_INITIAL) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - newOperator = sdk.AccAddress(from.Bytes()) + newOperator = tests.RandomAccAddress() err = suite.keeper.AddOperator(suite.ctx, newOperator, types.OperatorType_OT_INITIAL) suite.Require().NoError(err) @@ -314,11 +298,8 @@ func (suite *KeeperTestSuite) TestSetVerificationStatus() { { name: "operator not exist", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - - from, _ = tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) + operator = tests.RandomAccAddress() + issuer = tests.RandomAccAddress() }, malleate: func() *types.MsgSetVerificationStatus { msg := types.NewMsgSetVerificationStatus( @@ -336,14 +317,11 @@ func (suite *KeeperTestSuite) TestSetVerificationStatus() { { name: "issuer not exist", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) + issuer = tests.RandomAccAddress() }, malleate: func() *types.MsgSetVerificationStatus { msg := types.NewMsgSetVerificationStatus( @@ -361,16 +339,13 @@ func (suite *KeeperTestSuite) TestSetVerificationStatus() { { name: "success", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) + issuer = tests.RandomAccAddress() - details := &types.IssuerDetails{Name: "testIssuer"} + details := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "testIssuer"} err = suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) suite.Require().NoError(err) }, @@ -406,21 +381,22 @@ func (suite *KeeperTestSuite) TestSetVerificationStatus() { } } -func (suite *KeeperTestSuite) TestSetIssuerDetails() { +func (suite *KeeperTestSuite) TestCreateIssuer() { var ( operator sdk.AccAddress + creator sdk.AccAddress issuer sdk.AccAddress ) testCases := []struct { name string init func() - malleate func() *types.MsgSetIssuerDetails - expected func(resp *types.MsgSetIssuerDetailsResponse, error error) + malleate func() *types.MsgCreateIssuer + expected func(resp *types.MsgCreateIssuerResponse, error error) }{ { name: "invalid fields", - malleate: func() *types.MsgSetIssuerDetails { - msg := types.NewSetIssuerDetailsMsg( + malleate: func() *types.MsgCreateIssuer { + msg := types.NewCreateIssuerMsg( "operator address", "issuer address", "issuer name", @@ -431,7 +407,7 @@ func (suite *KeeperTestSuite) TestSetIssuerDetails() { ) return &msg }, - expected: func(resp *types.MsgSetIssuerDetailsResponse, error error) { + expected: func(resp *types.MsgCreateIssuerResponse, error error) { suite.Require().ErrorContains(error, "decoding bech32") suite.Require().Nil(resp) }, @@ -439,14 +415,12 @@ func (suite *KeeperTestSuite) TestSetIssuerDetails() { { name: "invalid issuer", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) }, - malleate: func() *types.MsgSetIssuerDetails { - msg := types.NewSetIssuerDetailsMsg( + malleate: func() *types.MsgCreateIssuer { + msg := types.NewCreateIssuerMsg( operator.String(), "issuer address", "issuer name", @@ -457,25 +431,22 @@ func (suite *KeeperTestSuite) TestSetIssuerDetails() { ) return &msg }, - expected: func(resp *types.MsgSetIssuerDetailsResponse, error error) { + expected: func(resp *types.MsgCreateIssuerResponse, error error) { suite.Require().ErrorContains(error, "decoding bech32") suite.Require().Nil(resp) }, }, { - name: "success", + name: "success-operator as creator", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) + issuer = tests.RandomAccAddress() }, - malleate: func() *types.MsgSetIssuerDetails { - msg := types.NewSetIssuerDetailsMsg( + malleate: func() *types.MsgCreateIssuer { + msg := types.NewCreateIssuerMsg( operator.String(), issuer.String(), "issuer name", @@ -486,9 +457,9 @@ func (suite *KeeperTestSuite) TestSetIssuerDetails() { ) return &msg }, - expected: func(resp *types.MsgSetIssuerDetailsResponse, error error) { + expected: func(resp *types.MsgCreateIssuerResponse, error error) { suite.Require().NoError(error) - suite.Require().Equal(resp, &types.MsgSetIssuerDetailsResponse{}) + suite.Require().Equal(resp, &types.MsgCreateIssuerResponse{}) // Issuer should exist issuerExists, err := suite.keeper.IssuerExists(suite.ctx, issuer) @@ -503,6 +474,56 @@ func (suite *KeeperTestSuite) TestSetIssuerDetails() { // Check if issuer details are stored correctly details, err := suite.keeper.GetIssuerDetails(suite.ctx, issuer) suite.Require().NoError(err) + suite.Require().Equal(operator.String(), details.Creator) + suite.Require().Equal("issuer name", details.Name) + suite.Require().Equal("issuer description", details.Description) + suite.Require().Equal("issuer url", details.Url) + suite.Require().Equal("issuer logo", details.Logo) + suite.Require().Equal("issuer legal entity", details.LegalEntity) + + // Check if issuer's verification status is false + verified, err := suite.keeper.IsAddressVerified(suite.ctx, issuer) + suite.Require().NoError(err) + suite.Require().False(verified) + }, + }, + { + name: "success-any creator", + init: func() { + creator = tests.RandomAccAddress() + issuer = tests.RandomAccAddress() + }, + malleate: func() *types.MsgCreateIssuer { + msg := types.NewCreateIssuerMsg( + creator.String(), + issuer.String(), + "issuer name", + "issuer description", + "issuer url", + "issuer logo", + "issuer legal entity", + ) + return &msg + }, + expected: func(resp *types.MsgCreateIssuerResponse, error error) { + suite.Require().NoError(error) + suite.Require().Equal(resp, &types.MsgCreateIssuerResponse{}) + + // Issuer should exist + issuerExists, err := suite.keeper.IssuerExists(suite.ctx, issuer) + suite.Require().True(issuerExists) + suite.Require().NoError(err) + + // Should be revoked verification if issuer address was verified + addressDetails, err := suite.keeper.GetAddressDetails(suite.ctx, issuer) + suite.Require().NoError(err) + suite.Require().Equal(false, addressDetails.IsVerified) + + // Check if issuer details are stored correctly + details, err := suite.keeper.GetIssuerDetails(suite.ctx, issuer) + suite.Require().NoError(err) + suite.Require().NotEqual(operator.String(), details.Creator) + suite.Require().Equal(creator.String(), details.Creator) suite.Require().Equal("issuer name", details.Name) suite.Require().Equal("issuer description", details.Description) suite.Require().Equal("issuer url", details.Url) @@ -518,19 +539,17 @@ func (suite *KeeperTestSuite) TestSetIssuerDetails() { { name: "existing issuer", init: func() { - details := &types.IssuerDetails{Name: "test issuer"} - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) + details := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "test issuer"} + issuer = tests.RandomAccAddress() _ = suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) - from, _ = tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) }, - malleate: func() *types.MsgSetIssuerDetails { - msg := types.NewSetIssuerDetailsMsg( + malleate: func() *types.MsgCreateIssuer { + msg := types.NewCreateIssuerMsg( operator.String(), issuer.String(), "issuer name", @@ -541,7 +560,7 @@ func (suite *KeeperTestSuite) TestSetIssuerDetails() { ) return &msg }, - expected: func(resp *types.MsgSetIssuerDetailsResponse, error error) { + expected: func(resp *types.MsgCreateIssuerResponse, error error) { suite.Require().ErrorIs(error, types.ErrInvalidIssuer) suite.Require().Nil(resp) }, @@ -555,7 +574,7 @@ func (suite *KeeperTestSuite) TestSetIssuerDetails() { tc.init() } msg := tc.malleate() - resp, err := msgServer.HandleSetIssuerDetails(sdk.WrapSDKContext(suite.ctx), msg) + resp, err := msgServer.HandleCreateIssuer(sdk.WrapSDKContext(suite.ctx), msg) tc.expected(resp, err) }) } @@ -563,6 +582,7 @@ func (suite *KeeperTestSuite) TestSetIssuerDetails() { func (suite *KeeperTestSuite) TestUpdateIssuerDetails() { var ( + creator sdk.AccAddress issuer sdk.AccAddress operator sdk.AccAddress signer sdk.AccAddress @@ -594,13 +614,15 @@ func (suite *KeeperTestSuite) TestUpdateIssuerDetails() { }, }, { - name: "not operator", + name: "issuer creator does not match", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) + issuer = tests.RandomAccAddress() + creator = tests.RandomAccAddress() + operator = tests.RandomAccAddress() - from, _ = tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) + issuer = tests.RandomAccAddress() + details := &types.IssuerDetails{Creator: creator.String(), Name: "test issuer"} + _ = suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) }, malleate: func() *types.MsgUpdateIssuerDetails { msg := types.NewUpdateIssuerDetailsMsg( @@ -615,19 +637,15 @@ func (suite *KeeperTestSuite) TestUpdateIssuerDetails() { return &msg }, expected: func(resp *types.MsgUpdateIssuerDetailsResponse, err error) { - suite.Require().ErrorIs(err, types.ErrNotOperator) + suite.Require().ErrorIs(err, types.ErrNotOperatorOrIssuerCreator) suite.Require().Nil(resp) }, }, { - name: "issuer not exist", + name: "issuer does not exist", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) - - from, _ = tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + issuer = tests.RandomAccAddress() + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) }, @@ -649,17 +667,14 @@ func (suite *KeeperTestSuite) TestUpdateIssuerDetails() { }, }, { - name: "success", + name: "success-operator as creator", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) - details := &types.IssuerDetails{Name: "test issuer"} + issuer = tests.RandomAccAddress() + details := &types.IssuerDetails{Creator: operator.String(), Name: "test issuer"} _ = suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) }, malleate: func() *types.MsgUpdateIssuerDetails { @@ -691,6 +706,59 @@ func (suite *KeeperTestSuite) TestUpdateIssuerDetails() { // Check if issuer details are stored correctly details, err := suite.keeper.GetIssuerDetails(suite.ctx, issuer) suite.Require().NoError(err) + suite.Require().Equal(operator.String(), details.Creator) + suite.Require().Equal("issuer name", details.Name) + suite.Require().Equal("issuer description", details.Description) + suite.Require().Equal("issuer url", details.Url) + suite.Require().Equal("issuer logo", details.Logo) + suite.Require().Equal("issuer legal entity", details.LegalEntity) + + // Check if issuer was revoked + verified, err := suite.keeper.IsAddressVerified(suite.ctx, issuer) + suite.Require().NoError(err) + suite.Require().False(verified) + }, + }, + { + name: "success-any creator", + init: func() { + creator = tests.RandomAccAddress() + issuer = tests.RandomAccAddress() + + details := &types.IssuerDetails{Creator: creator.String(), Name: "test issuer"} + _ = suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) + }, + malleate: func() *types.MsgUpdateIssuerDetails { + msg := types.NewUpdateIssuerDetailsMsg( + creator.String(), + issuer.String(), + "issuer name", + "issuer description", + "issuer url", + "issuer logo", + "issuer legal entity", + ) + return &msg + }, + expected: func(resp *types.MsgUpdateIssuerDetailsResponse, err error) { + suite.Require().NoError(err) + suite.Require().Equal(resp, &types.MsgUpdateIssuerDetailsResponse{}) + + // Issuer should exist + issuerExists, err := suite.keeper.IssuerExists(suite.ctx, issuer) + suite.Require().True(issuerExists) + suite.Require().NoError(err) + + // Should be revoked verification if issuer address was verified + addressDetails, err := suite.keeper.GetAddressDetails(suite.ctx, issuer) + suite.Require().NoError(err) + suite.Require().Equal(false, addressDetails.IsVerified) + + // Check if issuer details are stored correctly + details, err := suite.keeper.GetIssuerDetails(suite.ctx, issuer) + suite.Require().NoError(err) + suite.Require().NotEqual(operator.String(), details.Creator) + suite.Require().Equal(creator.String(), details.Creator) suite.Require().Equal("issuer name", details.Name) suite.Require().Equal("issuer description", details.Description) suite.Require().Equal("issuer url", details.Url) @@ -707,21 +775,18 @@ func (suite *KeeperTestSuite) TestUpdateIssuerDetails() { // Should revoke verification for all the accounts verified by updated issuer name: "past verification data still exists", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) - details := &types.IssuerDetails{Name: "test issuer"} + creator = tests.RandomAccAddress() + issuer = tests.RandomAccAddress() + details := &types.IssuerDetails{Creator: creator.String(), Name: "test issuer"} _ = suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) _ = suite.keeper.SetAddressVerificationStatus(suite.ctx, issuer, true) - from, _ = tests.RandomEthAddressWithPrivateKey() - signer = sdk.AccAddress(from.Bytes()) + signer = tests.RandomAccAddress() // Add address details with verification details _, _ = suite.keeper.AddVerificationDetails( @@ -806,12 +871,8 @@ func (suite *KeeperTestSuite) TestRemoveIssuer() { { name: "issuer not exist", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) - - from, _ = tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + issuer = tests.RandomAccAddress() + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) }, @@ -827,35 +888,30 @@ func (suite *KeeperTestSuite) TestRemoveIssuer() { { name: "not operator", init: func() { - details := &types.IssuerDetails{Name: "test issuer"} - from, _ := tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) + issuer = tests.RandomAccAddress() + details := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "test issuer"} _ = suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) - from, _ = tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) + operator = tests.RandomAccAddress() }, malleate: func() *types.MsgRemoveIssuer { msg := types.NewRemoveIssuerMsg(operator.String(), issuer.String()) return &msg }, expected: func(resp *types.MsgRemoveIssuerResponse, err error) { - suite.Require().ErrorIs(err, types.ErrNotOperator) + suite.Require().ErrorIs(err, types.ErrNotOperatorOrIssuerCreator) suite.Require().Nil(resp) }, }, { name: "success", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) - details := &types.IssuerDetails{Name: "test issuer"} + issuer = tests.RandomAccAddress() + details := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "test issuer"} _ = suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) }, malleate: func() *types.MsgRemoveIssuer { @@ -886,21 +942,17 @@ func (suite *KeeperTestSuite) TestRemoveIssuer() { // Should revoke verification for all the accounts verified by removed issuer name: "account was suspended", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - operator = sdk.AccAddress(from.Bytes()) - + operator = tests.RandomAccAddress() err := suite.keeper.AddOperator(suite.ctx, operator, types.OperatorType_OT_REGULAR) suite.Require().NoError(err) - from, _ = tests.RandomEthAddressWithPrivateKey() - issuer = sdk.AccAddress(from.Bytes()) - details := &types.IssuerDetails{Name: "test issuer"} + issuer = tests.RandomAccAddress() + details := &types.IssuerDetails{Creator: tests.RandomAccAddress().String(), Name: "test issuer"} _ = suite.keeper.SetIssuerDetails(suite.ctx, issuer, details) _ = suite.keeper.SetAddressVerificationStatus(suite.ctx, issuer, true) - from, _ = tests.RandomEthAddressWithPrivateKey() - signer = sdk.AccAddress(from.Bytes()) + signer = tests.RandomAccAddress() // Add address details with verification details _, _ = suite.keeper.AddVerificationDetails( diff --git a/x/compliance/keeper/query.go b/x/compliance/keeper/query.go index 78ed56a9..707f3174 100644 --- a/x/compliance/keeper/query.go +++ b/x/compliance/keeper/query.go @@ -129,6 +129,7 @@ func (k Querier) IssuersDetails(goCtx context.Context, req *types.QueryIssuersDe // NOTE: MUST CONTAIN ALL THE MEMBERS OF `IssuerDetails` AND ITERATING KEY issuers = append(issuers, types.QueryIssuersDetailsResponse_MergedIssuerDetails{ IssuerAddress: sdk.AccAddress(key).String(), + Creator: issuerDetails.Creator, Name: issuerDetails.Name, Description: issuerDetails.Description, Url: issuerDetails.Url, diff --git a/x/compliance/keeper/query_test.go b/x/compliance/keeper/query_test.go index a284e9b0..13db8a14 100644 --- a/x/compliance/keeper/query_test.go +++ b/x/compliance/keeper/query_test.go @@ -25,8 +25,9 @@ type QuerierTestSuite struct { querier keeper.Querier app *app.App - issuer sdk.AccAddress - user sdk.AccAddress + issuerCreator sdk.AccAddress + issuer sdk.AccAddress + user sdk.AccAddress } func TestQuerierTestSuite(t *testing.T) { @@ -41,14 +42,12 @@ func TestQuerierTestSuite(t *testing.T) { } func (suite *QuerierTestSuite) SetupTest() { - from, _ := tests.RandomEthAddressWithPrivateKey() - suite.issuer = sdk.AccAddress(from.Bytes()) + suite.issuerCreator = tests.RandomAccAddress() + suite.issuer = tests.RandomAccAddress() + suite.user = tests.RandomAccAddress() - from, _ = tests.RandomEthAddressWithPrivateKey() - suite.user = sdk.AccAddress(from.Bytes()) - - // Set issuer details - issuerDetails := &types.IssuerDetails{Name: "testIssuer"} + // Create issuer + issuerDetails := &types.IssuerDetails{Creator: suite.issuerCreator.String(), Name: "testIssuer"} err := suite.keeper.SetIssuerDetails(suite.ctx, suite.issuer, issuerDetails) suite.Require().NoError(err) @@ -115,8 +114,7 @@ func (suite *QuerierTestSuite) TestSuccess() { } func (suite *QuerierTestSuite) TestFailed() { - from, _ := tests.RandomEthAddressWithPrivateKey() - anyUser := sdk.AccAddress(from.Bytes()) + anyUser := tests.RandomAccAddress() // Query invalid issuer details issuerRequest := &types.QueryIssuerDetailsRequest{ diff --git a/x/compliance/migrations/v1_0_3/migrate.go b/x/compliance/migrations/v1_0_3/migrate.go new file mode 100644 index 00000000..8a0147e2 --- /dev/null +++ b/x/compliance/migrations/v1_0_3/migrate.go @@ -0,0 +1,50 @@ +package v1_0_3 + +import ( + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "swisstronik/x/compliance/types" +) + +func MigrateStore(ctx sdk.Context, k types.ComplianceKeeper) error { + var ( + operators []*types.OperatorDetails + operatorDetails *types.OperatorDetails + issuerDetails *types.IssuerDetails + err error + ) + k.IterateOperatorDetails(ctx, func(address sdk.AccAddress) (continue_ bool) { + operatorDetails, err = k.GetOperatorDetails(ctx, address) + if err != nil { + return false + } + if operatorDetails.OperatorType == types.OperatorType_OT_INITIAL { + operators = append(operators, operatorDetails) + } + return true + }) + + if len(operators) < 1 || err != nil { + panic(errors.Wrapf(types.ErrInvalidOperator, "empty initial operators")) + } + + defaultIssuerCreator, _ := sdk.AccAddressFromBech32(operators[0].Operator) + k.IterateIssuerDetails(ctx, func(address sdk.AccAddress) bool { + issuerDetails, err = k.GetIssuerDetails(ctx, address) + if issuerDetails == nil || err != nil { + return false + } + if len(issuerDetails.Creator) < 1 { + // In v1.0.2, only operator can create/update/remove issuer. + // The operators who signed the transaction for creating/updating issuer were stored in + // EventManager as event log. + // There's no guarantee if any node in the network can fetch all the signers from EventManager during upgrade. + // So let's initialize issuer's creator with first initial operator by default if issuer is valid + issuerDetails.Creator = defaultIssuerCreator.String() + _ = k.SetIssuerDetails(ctx, address, issuerDetails) + } + return true + }) + + return nil +} diff --git a/x/compliance/migrations/v1_0_3/types/entities.pb.go b/x/compliance/migrations/v1_0_3/types/entities.pb.go new file mode 100644 index 00000000..25962fc1 --- /dev/null +++ b/x/compliance/migrations/v1_0_3/types/entities.pb.go @@ -0,0 +1,1904 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: swisstronik/compliance/entities.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type VerificationType int32 + +const ( + // VT_UNSPECIFIED defines an invalid/undefined verification type. + VerificationType_VT_UNSPECIFIED VerificationType = 0 + VerificationType_VT_KYC VerificationType = 1 + VerificationType_VT_KYB VerificationType = 2 + VerificationType_VT_KYW VerificationType = 3 + VerificationType_VT_HUMANITY VerificationType = 4 + VerificationType_VT_AML VerificationType = 5 + VerificationType_VT_ADDRESS VerificationType = 6 + VerificationType_VT_CUSTOM VerificationType = 7 + VerificationType_VT_CREDIT_SCORE VerificationType = 8 +) + +var VerificationType_name = map[int32]string{ + 0: "VT_UNSPECIFIED", + 1: "VT_KYC", + 2: "VT_KYB", + 3: "VT_KYW", + 4: "VT_HUMANITY", + 5: "VT_AML", + 6: "VT_ADDRESS", + 7: "VT_CUSTOM", + 8: "VT_CREDIT_SCORE", +} + +var VerificationType_value = map[string]int32{ + "VT_UNSPECIFIED": 0, + "VT_KYC": 1, + "VT_KYB": 2, + "VT_KYW": 3, + "VT_HUMANITY": 4, + "VT_AML": 5, + "VT_ADDRESS": 6, + "VT_CUSTOM": 7, + "VT_CREDIT_SCORE": 8, +} + +func (x VerificationType) String() string { + return proto.EnumName(VerificationType_name, int32(x)) +} + +func (VerificationType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_a6b6c3ec8e3c39ee, []int{0} +} + +type OperatorType int32 + +const ( + // OT_UNSPECIFIED defines an invalid/undefined operator type. + OperatorType_OT_UNSPECIFIED OperatorType = 0 + // Initial Operator, can't be removed from the list of operators. + // Both initial (constant) and regular operators can add or remove regular operators. + OperatorType_OT_INITIAL OperatorType = 1 + OperatorType_OT_REGULAR OperatorType = 2 +) + +var OperatorType_name = map[int32]string{ + 0: "OT_UNSPECIFIED", + 1: "OT_INITIAL", + 2: "OT_REGULAR", +} + +var OperatorType_value = map[string]int32{ + "OT_UNSPECIFIED": 0, + "OT_INITIAL": 1, + "OT_REGULAR": 2, +} + +func (x OperatorType) String() string { + return proto.EnumName(OperatorType_name, int32(x)) +} + +func (OperatorType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_a6b6c3ec8e3c39ee, []int{1} +} + +type OperatorDetails struct { + // Operator address, who can add / update / remove issuers + Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` + // Operator type + OperatorType OperatorType `protobuf:"varint,2,opt,name=operator_type,json=operatorType,proto3,enum=swisstronik.compliance.OperatorType" json:"operator_type,omitempty"` +} + +func (m *OperatorDetails) Reset() { *m = OperatorDetails{} } +func (m *OperatorDetails) String() string { return proto.CompactTextString(m) } +func (*OperatorDetails) ProtoMessage() {} +func (*OperatorDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_a6b6c3ec8e3c39ee, []int{0} +} +func (m *OperatorDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OperatorDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OperatorDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OperatorDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_OperatorDetails.Merge(m, src) +} +func (m *OperatorDetails) XXX_Size() int { + return m.Size() +} +func (m *OperatorDetails) XXX_DiscardUnknown() { + xxx_messageInfo_OperatorDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_OperatorDetails proto.InternalMessageInfo + +func (m *OperatorDetails) GetOperator() string { + if m != nil { + return m.Operator + } + return "" +} + +func (m *OperatorDetails) GetOperatorType() OperatorType { + if m != nil { + return m.OperatorType + } + return OperatorType_OT_UNSPECIFIED +} + +type IssuerDetails struct { + // Allows to easily understand + // what entity can be associated with issuer address. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Basic issuer description + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // URL to issuer website + Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` + // URL to issuer logo + Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` + // Legal entity name + LegalEntity string `protobuf:"bytes,5,opt,name=legalEntity,proto3" json:"legalEntity,omitempty"` +} + +func (m *IssuerDetails) Reset() { *m = IssuerDetails{} } +func (m *IssuerDetails) String() string { return proto.CompactTextString(m) } +func (*IssuerDetails) ProtoMessage() {} +func (*IssuerDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_a6b6c3ec8e3c39ee, []int{1} +} +func (m *IssuerDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IssuerDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IssuerDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *IssuerDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_IssuerDetails.Merge(m, src) +} +func (m *IssuerDetails) XXX_Size() int { + return m.Size() +} +func (m *IssuerDetails) XXX_DiscardUnknown() { + xxx_messageInfo_IssuerDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_IssuerDetails proto.InternalMessageInfo + +func (m *IssuerDetails) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *IssuerDetails) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *IssuerDetails) GetUrl() string { + if m != nil { + return m.Url + } + return "" +} + +func (m *IssuerDetails) GetLogo() string { + if m != nil { + return m.Logo + } + return "" +} + +func (m *IssuerDetails) GetLegalEntity() string { + if m != nil { + return m.LegalEntity + } + return "" +} + +type AddressDetails struct { + // Marks if contract deployed under this address is verified + // by community. Only verified contracts will be allowed to write + // to x/compliance module. + IsVerified bool `protobuf:"varint,1,opt,name=is_verified,json=isVerified,proto3" json:"is_verified,omitempty"` + // Marks if verification for this address was revoked. + IsRevoked bool `protobuf:"varint,2,opt,name=is_revoked,json=isRevoked,proto3" json:"is_revoked,omitempty"` + // Verifications passed by this address + Verifications []*Verification `protobuf:"bytes,3,rep,name=verifications,proto3" json:"verifications,omitempty"` +} + +func (m *AddressDetails) Reset() { *m = AddressDetails{} } +func (m *AddressDetails) String() string { return proto.CompactTextString(m) } +func (*AddressDetails) ProtoMessage() {} +func (*AddressDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_a6b6c3ec8e3c39ee, []int{2} +} +func (m *AddressDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddressDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddressDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AddressDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddressDetails.Merge(m, src) +} +func (m *AddressDetails) XXX_Size() int { + return m.Size() +} +func (m *AddressDetails) XXX_DiscardUnknown() { + xxx_messageInfo_AddressDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_AddressDetails proto.InternalMessageInfo + +func (m *AddressDetails) GetIsVerified() bool { + if m != nil { + return m.IsVerified + } + return false +} + +func (m *AddressDetails) GetIsRevoked() bool { + if m != nil { + return m.IsRevoked + } + return false +} + +func (m *AddressDetails) GetVerifications() []*Verification { + if m != nil { + return m.Verifications + } + return nil +} + +type Verification struct { + // Contains information about verification type (KYC, proof-of-humanity, etc). + Type VerificationType `protobuf:"varint,1,opt,name=type,proto3,enum=swisstronik.compliance.VerificationType" json:"type,omitempty"` + // Contains ID of details of passed verification in storage. + VerificationId []byte `protobuf:"bytes,2,opt,name=verification_id,json=verificationId,proto3" json:"verification_id,omitempty"` + // Issuer of verification + IssuerAddress string `protobuf:"bytes,3,opt,name=issuer_address,json=issuerAddress,proto3" json:"issuer_address,omitempty"` +} + +func (m *Verification) Reset() { *m = Verification{} } +func (m *Verification) String() string { return proto.CompactTextString(m) } +func (*Verification) ProtoMessage() {} +func (*Verification) Descriptor() ([]byte, []int) { + return fileDescriptor_a6b6c3ec8e3c39ee, []int{3} +} +func (m *Verification) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Verification) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Verification.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Verification) XXX_Merge(src proto.Message) { + xxx_messageInfo_Verification.Merge(m, src) +} +func (m *Verification) XXX_Size() int { + return m.Size() +} +func (m *Verification) XXX_DiscardUnknown() { + xxx_messageInfo_Verification.DiscardUnknown(m) +} + +var xxx_messageInfo_Verification proto.InternalMessageInfo + +func (m *Verification) GetType() VerificationType { + if m != nil { + return m.Type + } + return VerificationType_VT_UNSPECIFIED +} + +func (m *Verification) GetVerificationId() []byte { + if m != nil { + return m.VerificationId + } + return nil +} + +func (m *Verification) GetIssuerAddress() string { + if m != nil { + return m.IssuerAddress + } + return "" +} + +// VerificationDetails must have same members with VerificationDetails in "proto/swisstronik/compliance/entities.proto" +// But the member types can be different, such as string(address) to bytes +type VerificationDetails struct { + // Verification type + Type VerificationType `protobuf:"varint,1,opt,name=type,proto3,enum=swisstronik.compliance.VerificationType" json:"type,omitempty"` + // Verification issuer address + IssuerAddress string `protobuf:"bytes,2,opt,name=issuer_address,json=issuerAddress,proto3" json:"issuer_address,omitempty"` + // From which chain proof was transferred + OriginChain string `protobuf:"bytes,3,opt,name=origin_chain,json=originChain,proto3" json:"origin_chain,omitempty"` + // Original issuance timestamp + IssuanceTimestamp uint32 `protobuf:"varint,4,opt,name=issuance_timestamp,json=issuanceTimestamp,proto3" json:"issuance_timestamp,omitempty"` + // Original expiration timestamp + ExpirationTimestamp uint32 `protobuf:"varint,5,opt,name=expiration_timestamp,json=expirationTimestamp,proto3" json:"expiration_timestamp,omitempty"` + // Original proof data (ZK-proof) + OriginalData []byte `protobuf:"bytes,6,opt,name=original_data,json=originalData,proto3" json:"original_data,omitempty"` + // ZK-proof original schema + Schema string `protobuf:"bytes,7,opt,name=schema,proto3" json:"schema,omitempty"` + // Verification id for checking(KYC/KYB/AML etc) from issuer side + IssuerVerificationId string `protobuf:"bytes,8,opt,name=issuer_verification_id,json=issuerVerificationId,proto3" json:"issuer_verification_id,omitempty"` + // Version + Version uint32 `protobuf:"varint,9,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *VerificationDetails) Reset() { *m = VerificationDetails{} } +func (m *VerificationDetails) String() string { return proto.CompactTextString(m) } +func (*VerificationDetails) ProtoMessage() {} +func (*VerificationDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_a6b6c3ec8e3c39ee, []int{4} +} +func (m *VerificationDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VerificationDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VerificationDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *VerificationDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_VerificationDetails.Merge(m, src) +} +func (m *VerificationDetails) XXX_Size() int { + return m.Size() +} +func (m *VerificationDetails) XXX_DiscardUnknown() { + xxx_messageInfo_VerificationDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_VerificationDetails proto.InternalMessageInfo + +func (m *VerificationDetails) GetType() VerificationType { + if m != nil { + return m.Type + } + return VerificationType_VT_UNSPECIFIED +} + +func (m *VerificationDetails) GetIssuerAddress() string { + if m != nil { + return m.IssuerAddress + } + return "" +} + +func (m *VerificationDetails) GetOriginChain() string { + if m != nil { + return m.OriginChain + } + return "" +} + +func (m *VerificationDetails) GetIssuanceTimestamp() uint32 { + if m != nil { + return m.IssuanceTimestamp + } + return 0 +} + +func (m *VerificationDetails) GetExpirationTimestamp() uint32 { + if m != nil { + return m.ExpirationTimestamp + } + return 0 +} + +func (m *VerificationDetails) GetOriginalData() []byte { + if m != nil { + return m.OriginalData + } + return nil +} + +func (m *VerificationDetails) GetSchema() string { + if m != nil { + return m.Schema + } + return "" +} + +func (m *VerificationDetails) GetIssuerVerificationId() string { + if m != nil { + return m.IssuerVerificationId + } + return "" +} + +func (m *VerificationDetails) GetVersion() uint32 { + if m != nil { + return m.Version + } + return 0 +} + +func init() { + proto.RegisterEnum("swisstronik.compliance.VerificationType", VerificationType_name, VerificationType_value) + proto.RegisterEnum("swisstronik.compliance.OperatorType", OperatorType_name, OperatorType_value) + proto.RegisterType((*OperatorDetails)(nil), "swisstronik.compliance.OperatorDetails") + proto.RegisterType((*IssuerDetails)(nil), "swisstronik.compliance.IssuerDetails") + proto.RegisterType((*AddressDetails)(nil), "swisstronik.compliance.AddressDetails") + proto.RegisterType((*Verification)(nil), "swisstronik.compliance.Verification") + proto.RegisterType((*VerificationDetails)(nil), "swisstronik.compliance.VerificationDetails") +} + +func init() { + proto.RegisterFile("swisstronik/compliance/entities.proto", fileDescriptor_a6b6c3ec8e3c39ee) +} + +var fileDescriptor_a6b6c3ec8e3c39ee = []byte{ + // 703 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcf, 0x6f, 0x12, 0x41, + 0x14, 0x66, 0x81, 0x52, 0x78, 0xfc, 0x5a, 0xa7, 0x4d, 0xb3, 0x69, 0x22, 0x22, 0xb5, 0x91, 0x34, + 0x91, 0xc6, 0x1f, 0x07, 0x0f, 0x5e, 0x28, 0xa0, 0xae, 0xb6, 0xc5, 0x0c, 0x0b, 0xa6, 0x5e, 0x26, + 0x23, 0x8c, 0x74, 0x52, 0x60, 0x36, 0x3b, 0xdb, 0xda, 0xfe, 0x0f, 0x9a, 0x78, 0xd7, 0x3f, 0xc8, + 0x63, 0x8f, 0x1e, 0x4d, 0xfb, 0x8f, 0x98, 0x99, 0xdd, 0x85, 0x6d, 0x6d, 0x13, 0x13, 0x6f, 0xef, + 0x7d, 0xef, 0xbd, 0xef, 0x7d, 0x7c, 0x6f, 0x19, 0xd8, 0x94, 0x9f, 0xb9, 0x94, 0xbe, 0x27, 0x66, + 0xfc, 0x68, 0x7b, 0x28, 0xa6, 0xee, 0x84, 0xd3, 0xd9, 0x90, 0x6d, 0xb3, 0x99, 0xcf, 0x7d, 0xce, + 0x64, 0xc3, 0xf5, 0x84, 0x2f, 0xd0, 0x5a, 0xac, 0xad, 0xb1, 0x68, 0x5b, 0x5f, 0x1d, 0x8b, 0xb1, + 0xd0, 0x2d, 0xdb, 0x2a, 0x0a, 0xba, 0xd7, 0x37, 0x6e, 0x21, 0x75, 0xa9, 0x47, 0xa7, 0x21, 0x65, + 0xed, 0x14, 0xca, 0x5d, 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x38, 0x68, 0xf2, 0xa4, 0x75, 0x05, 0x00, 0x00, +} + +func (m *OperatorDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OperatorDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OperatorDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OperatorType != 0 { + i = encodeVarintEntities(dAtA, i, uint64(m.OperatorType)) + i-- + dAtA[i] = 0x10 + } + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintEntities(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *IssuerDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IssuerDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IssuerDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.LegalEntity) > 0 { + i -= len(m.LegalEntity) + copy(dAtA[i:], m.LegalEntity) + i = encodeVarintEntities(dAtA, i, uint64(len(m.LegalEntity))) + i-- + dAtA[i] = 0x2a + } + if len(m.Logo) > 0 { + i -= len(m.Logo) + copy(dAtA[i:], m.Logo) + i = encodeVarintEntities(dAtA, i, uint64(len(m.Logo))) + i-- + dAtA[i] = 0x22 + } + if len(m.Url) > 0 { + i -= len(m.Url) + copy(dAtA[i:], m.Url) + i = encodeVarintEntities(dAtA, i, uint64(len(m.Url))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintEntities(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintEntities(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AddressDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AddressDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AddressDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Verifications) > 0 { + for iNdEx := len(m.Verifications) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Verifications[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEntities(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.IsRevoked { + i-- + if m.IsRevoked { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.IsVerified { + i-- + if m.IsVerified { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Verification) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Verification) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Verification) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.IssuerAddress) > 0 { + i -= len(m.IssuerAddress) + copy(dAtA[i:], m.IssuerAddress) + i = encodeVarintEntities(dAtA, i, uint64(len(m.IssuerAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.VerificationId) > 0 { + i -= len(m.VerificationId) + copy(dAtA[i:], m.VerificationId) + i = encodeVarintEntities(dAtA, i, uint64(len(m.VerificationId))) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = encodeVarintEntities(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *VerificationDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerificationDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerificationDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Version != 0 { + i = encodeVarintEntities(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x48 + } + if len(m.IssuerVerificationId) > 0 { + i -= len(m.IssuerVerificationId) + copy(dAtA[i:], m.IssuerVerificationId) + i = encodeVarintEntities(dAtA, i, uint64(len(m.IssuerVerificationId))) + i-- + dAtA[i] = 0x42 + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarintEntities(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0x3a + } + if len(m.OriginalData) > 0 { + i -= len(m.OriginalData) + copy(dAtA[i:], m.OriginalData) + i = encodeVarintEntities(dAtA, i, uint64(len(m.OriginalData))) + i-- + dAtA[i] = 0x32 + } + if m.ExpirationTimestamp != 0 { + i = encodeVarintEntities(dAtA, i, uint64(m.ExpirationTimestamp)) + i-- + dAtA[i] = 0x28 + } + if m.IssuanceTimestamp != 0 { + i = encodeVarintEntities(dAtA, i, uint64(m.IssuanceTimestamp)) + i-- + dAtA[i] = 0x20 + } + if len(m.OriginChain) > 0 { + i -= len(m.OriginChain) + copy(dAtA[i:], m.OriginChain) + i = encodeVarintEntities(dAtA, i, uint64(len(m.OriginChain))) + i-- + dAtA[i] = 0x1a + } + if len(m.IssuerAddress) > 0 { + i -= len(m.IssuerAddress) + copy(dAtA[i:], m.IssuerAddress) + i = encodeVarintEntities(dAtA, i, uint64(len(m.IssuerAddress))) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = encodeVarintEntities(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintEntities(dAtA []byte, offset int, v uint64) int { + offset -= sovEntities(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *OperatorDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + if m.OperatorType != 0 { + n += 1 + sovEntities(uint64(m.OperatorType)) + } + return n +} + +func (m *IssuerDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + l = len(m.Url) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + l = len(m.Logo) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + l = len(m.LegalEntity) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + return n +} + +func (m *AddressDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsVerified { + n += 2 + } + if m.IsRevoked { + n += 2 + } + if len(m.Verifications) > 0 { + for _, e := range m.Verifications { + l = e.Size() + n += 1 + l + sovEntities(uint64(l)) + } + } + return n +} + +func (m *Verification) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovEntities(uint64(m.Type)) + } + l = len(m.VerificationId) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + l = len(m.IssuerAddress) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + return n +} + +func (m *VerificationDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovEntities(uint64(m.Type)) + } + l = len(m.IssuerAddress) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + l = len(m.OriginChain) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + if m.IssuanceTimestamp != 0 { + n += 1 + sovEntities(uint64(m.IssuanceTimestamp)) + } + if m.ExpirationTimestamp != 0 { + n += 1 + sovEntities(uint64(m.ExpirationTimestamp)) + } + l = len(m.OriginalData) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + l = len(m.Schema) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + l = len(m.IssuerVerificationId) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovEntities(uint64(m.Version)) + } + return n +} + +func sovEntities(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEntities(x uint64) (n int) { + return sovEntities(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *OperatorDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OperatorDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OperatorDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorType", wireType) + } + m.OperatorType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OperatorType |= OperatorType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEntities(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEntities + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IssuerDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: IssuerDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IssuerDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Url", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Url = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LegalEntity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LegalEntity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEntities(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEntities + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AddressDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddressDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddressDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsVerified", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsVerified = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsRevoked", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsRevoked = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Verifications", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Verifications = append(m.Verifications, &Verification{}) + if err := m.Verifications[len(m.Verifications)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEntities(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEntities + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Verification) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Verification: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Verification: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= VerificationType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerificationId", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VerificationId = append(m.VerificationId[:0], dAtA[iNdEx:postIndex]...) + if m.VerificationId == nil { + m.VerificationId = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IssuerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IssuerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEntities(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEntities + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VerificationDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerificationDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerificationDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= VerificationType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IssuerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IssuerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginChain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OriginChain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IssuanceTimestamp", wireType) + } + m.IssuanceTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IssuanceTimestamp |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationTimestamp", wireType) + } + m.ExpirationTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationTimestamp |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginalData", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OriginalData = append(m.OriginalData[:0], dAtA[iNdEx:postIndex]...) + if m.OriginalData == nil { + m.OriginalData = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Schema = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IssuerVerificationId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IssuerVerificationId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEntities(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEntities + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEntities(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEntities + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEntities + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEntities + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEntities + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEntities + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEntities + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEntities = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEntities = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEntities = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/compliance/migrations/v1_0_3/types/genesis.pb.go b/x/compliance/migrations/v1_0_3/types/genesis.pb.go new file mode 100644 index 00000000..26ad3a9e --- /dev/null +++ b/x/compliance/migrations/v1_0_3/types/genesis.pb.go @@ -0,0 +1,1327 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: swisstronik/compliance/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the compliance module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Issuers []*IssuerGenesisAccount `protobuf:"bytes,2,rep,name=issuers,proto3" json:"issuers,omitempty"` + AddressDetails []*GenesisAddressDetails `protobuf:"bytes,3,rep,name=addressDetails,proto3" json:"addressDetails,omitempty"` + VerificationDetails []*GenesisVerificationDetails `protobuf:"bytes,4,rep,name=verificationDetails,proto3" json:"verificationDetails,omitempty"` + Operators []*OperatorDetails `protobuf:"bytes,5,rep,name=operators,proto3" json:"operators,omitempty"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_d430e46e02363948, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetIssuers() []*IssuerGenesisAccount { + if m != nil { + return m.Issuers + } + return nil +} + +func (m *GenesisState) GetAddressDetails() []*GenesisAddressDetails { + if m != nil { + return m.AddressDetails + } + return nil +} + +func (m *GenesisState) GetVerificationDetails() []*GenesisVerificationDetails { + if m != nil { + return m.VerificationDetails + } + return nil +} + +func (m *GenesisState) GetOperators() []*OperatorDetails { + if m != nil { + return m.Operators + } + return nil +} + +type IssuerGenesisAccount struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Details *IssuerDetails `protobuf:"bytes,2,opt,name=details,proto3" json:"details,omitempty"` + +} + +func (m *IssuerGenesisAccount) Reset() { *m = IssuerGenesisAccount{} } +func (m *IssuerGenesisAccount) String() string { return proto.CompactTextString(m) } +func (*IssuerGenesisAccount) ProtoMessage() {} +func (*IssuerGenesisAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_d430e46e02363948, []int{1} +} +func (m *IssuerGenesisAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IssuerGenesisAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IssuerGenesisAccount.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *IssuerGenesisAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_IssuerGenesisAccount.Merge(m, src) +} +func (m *IssuerGenesisAccount) XXX_Size() int { + return m.Size() +} +func (m *IssuerGenesisAccount) XXX_DiscardUnknown() { + xxx_messageInfo_IssuerGenesisAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_IssuerGenesisAccount proto.InternalMessageInfo + +func (m *IssuerGenesisAccount) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *IssuerGenesisAccount) GetDetails() *IssuerDetails { + + + + + + + + if m != nil { + return m.Details + } + return nil +} + +type GenesisAddressDetails struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Details *AddressDetails `protobuf:"bytes,2,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *GenesisAddressDetails) Reset() { *m = GenesisAddressDetails{} } +func (m *GenesisAddressDetails) String() string { return proto.CompactTextString(m) } +func (*GenesisAddressDetails) ProtoMessage() {} +func (*GenesisAddressDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_d430e46e02363948, []int{2} +} +func (m *GenesisAddressDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisAddressDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisAddressDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisAddressDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisAddressDetails.Merge(m, src) +} +func (m *GenesisAddressDetails) XXX_Size() int { + return m.Size() +} +func (m *GenesisAddressDetails) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisAddressDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisAddressDetails proto.InternalMessageInfo + +func (m *GenesisAddressDetails) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *GenesisAddressDetails) GetDetails() *AddressDetails { + if m != nil { + return m.Details + } + return nil +} + +type GenesisVerificationDetails struct { + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Details *VerificationDetails `protobuf:"bytes,2,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *GenesisVerificationDetails) Reset() { *m = GenesisVerificationDetails{} } +func (m *GenesisVerificationDetails) String() string { return proto.CompactTextString(m) } +func (*GenesisVerificationDetails) ProtoMessage() {} +func (*GenesisVerificationDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_d430e46e02363948, []int{3} +} +func (m *GenesisVerificationDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisVerificationDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisVerificationDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisVerificationDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisVerificationDetails.Merge(m, src) +} +func (m *GenesisVerificationDetails) XXX_Size() int { + return m.Size() +} +func (m *GenesisVerificationDetails) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisVerificationDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisVerificationDetails proto.InternalMessageInfo + +func (m *GenesisVerificationDetails) GetId() []byte { + if m != nil { + return m.Id + } + return nil +} + +func (m *GenesisVerificationDetails) GetDetails() *VerificationDetails { + if m != nil { + return m.Details + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "swisstronik.compliance.GenesisState") + proto.RegisterType((*IssuerGenesisAccount)(nil), "swisstronik.compliance.IssuerGenesisAccount") + proto.RegisterType((*GenesisAddressDetails)(nil), "swisstronik.compliance.GenesisAddressDetails") + proto.RegisterType((*GenesisVerificationDetails)(nil), "swisstronik.compliance.GenesisVerificationDetails") +} + +func init() { + proto.RegisterFile("swisstronik/compliance/genesis.proto", fileDescriptor_d430e46e02363948) +} + +var fileDescriptor_d430e46e02363948 = []byte{ + // 404 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4f, 0x6f, 0xda, 0x30, + 0x18, 0xc6, 0x93, 0xc0, 0x40, 0x18, 0xc4, 0xc1, 0x63, 0x53, 0x94, 0x83, 0x87, 0xd8, 0xd8, 0x90, + 0xb6, 0x05, 0x89, 0x5d, 0x76, 0x98, 0xb4, 0x0d, 0x8d, 0x55, 0x3d, 0xb5, 0x4a, 0xd5, 0x1e, 0x7a, + 0x73, 0x13, 0x17, 0x59, 0x85, 0x38, 0xb5, 0x4d, 0xff, 0x7c, 0x8b, 0x1e, 0xfb, 0x91, 0x38, 0x72, + 0xec, 0xa9, 0xaa, 0xe0, 0x8b, 0x54, 0x35, 0xb1, 0x48, 0xd3, 0x98, 0xde, 0x12, 0xe9, 0x79, 0x7e, + 0x3f, 0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x84, 0x70, 0x2c, 0x19, 0x17, 0xee, 0x1b, 0xc5, + 0xfe, 0x62, 0x62, 0xef, 0xa5, 0x41, 0x0d, 0xdc, 0x34, 0x3b, 0xe7, 0xa0, 0x55, 0x34, 0x24, 0xe8, + 0x82, 0x6a, 0x7a, 0x2d, 0xb5, 0xa2, 0x5a, 0xa0, 0x7f, 0xe1, 0x6f, 0x50, 0x8d, 0xd2, 0x2b, 0x39, + 0x6a, 0x79, 0xdd, 0xed, 0xd3, 0xd7, 0x52, 0xdd, 0xea, 0x08, 0xf0, 0xae, 0x70, 0x90, 0x5b, 0x9c, + 0x7f, 0xf2, 0xce, 0xcf, 0x26, 0x67, 0x6e, 0x37, 0x19, 0xa9, 0x67, 0x9e, 0x30, 0x6c, 0x02, 0x87, + 0x46, 0x4a, 0xda, 0x08, 0x1c, 0x1a, 0xc1, 0x51, 0xde, 0xf7, 0xd5, 0xe4, 0x2b, 0xda, 0x97, 0xee, + 0x0e, 0x7f, 0xce, 0x97, 0xc8, 0x5e, 0x2c, 0x91, 0xfd, 0xb0, 0x44, 0xf6, 0xcd, 0x0a, 0x59, 0x8b, + 0x15, 0xb2, 0xee, 0x56, 0xc8, 0x3a, 0x46, 0xd9, 0x87, 0x73, 0x95, 0x7d, 0x3a, 0xf2, 0x3a, 0x21, + 0xe2, 0xa4, 0xa2, 0x1e, 0xce, 0x8f, 0xc7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x67, 0x42, 0x89, 0x3c, + 0xda, 0x03, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Operators) > 0 { + for iNdEx := len(m.Operators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Operators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.VerificationDetails) > 0 { + for iNdEx := len(m.VerificationDetails) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.VerificationDetails[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.AddressDetails) > 0 { + for iNdEx := len(m.AddressDetails) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AddressDetails[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Issuers) > 0 { + for iNdEx := len(m.Issuers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Issuers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *IssuerGenesisAccount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IssuerGenesisAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IssuerGenesisAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Details != nil { + { + size, err := m.Details.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + + + + + + + + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GenesisAddressDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisAddressDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisAddressDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Details != nil { + { + size, err := m.Details.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GenesisVerificationDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisVerificationDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisVerificationDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Details != nil { + { + size, err := m.Details.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Issuers) > 0 { + for _, e := range m.Issuers { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.AddressDetails) > 0 { + for _, e := range m.AddressDetails { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.VerificationDetails) > 0 { + for _, e := range m.VerificationDetails { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Operators) > 0 { + for _, e := range m.Operators { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *IssuerGenesisAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + + + + + if m.Details != nil { + l = m.Details.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func (m *GenesisAddressDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Details != nil { + l = m.Details.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func (m *GenesisVerificationDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Details != nil { + l = m.Details.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Issuers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Issuers = append(m.Issuers, &IssuerGenesisAccount{}) + if err := m.Issuers[len(m.Issuers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddressDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AddressDetails = append(m.AddressDetails, &GenesisAddressDetails{}) + if err := m.AddressDetails[len(m.AddressDetails)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerificationDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VerificationDetails = append(m.VerificationDetails, &GenesisVerificationDetails{}) + if err := m.VerificationDetails[len(m.VerificationDetails)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operators = append(m.Operators, &OperatorDetails{}) + if err := m.Operators[len(m.Operators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IssuerGenesisAccount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: IssuerGenesisAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IssuerGenesisAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Details == nil { + m.Details = &IssuerDetails{} + } + if err := m.Details.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GenesisAddressDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisAddressDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisAddressDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Details == nil { + m.Details = &AddressDetails{} + } + if err := m.Details.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GenesisVerificationDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisVerificationDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisVerificationDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) + if m.Id == nil { + m.Id = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Details == nil { + m.Details = &VerificationDetails{} + } + if err := m.Details.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/compliance/migrations/v1_0_3/types/params.go b/x/compliance/migrations/v1_0_3/types/params.go new file mode 100644 index 00000000..357196ad --- /dev/null +++ b/x/compliance/migrations/v1_0_3/types/params.go @@ -0,0 +1,39 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "gopkg.in/yaml.v2" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/x/compliance/migrations/v1_0_3/types/params.pb.go b/x/compliance/migrations/v1_0_3/types/params.pb.go new file mode 100644 index 00000000..c9a502b0 --- /dev/null +++ b/x/compliance/migrations/v1_0_3/types/params.pb.go @@ -0,0 +1,265 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: swisstronik/compliance/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_25da6e1942c61052, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "swisstronik.compliance.Params") +} + +func init() { + proto.RegisterFile("swisstronik/compliance/params.proto", fileDescriptor_25da6e1942c61052) +} + +var fileDescriptor_25da6e1942c61052 = []byte{ + // 139 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0x2e, 0xcf, 0x2c, + 0x2e, 0x2e, 0x29, 0xca, 0xcf, 0xcb, 0xcc, 0xd6, 0x4f, 0xce, 0xcf, 0x2d, 0xc8, 0xc9, 0x4c, 0xcc, + 0x4b, 0x4e, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0x43, 0x52, 0xa4, 0x87, 0x50, 0x24, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa2, 0x0f, + 0x62, 0x41, 0x54, 0x2b, 0xf1, 0x71, 0xb1, 0x05, 0x80, 0x75, 0x5b, 0xb1, 0xcc, 0x58, 0x20, 0xcf, + 0xe0, 0x64, 0x71, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, + 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x72, 0xc8, 0x96, + 0x57, 0x20, 0x5b, 0x5f, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x36, 0xd0, 0x18, 0x10, 0x00, + 0x00, 0xff, 0xff, 0xb1, 0x48, 0x30, 0x5b, 0xa5, 0x00, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/compliance/module.go b/x/compliance/module.go index 8c69e545..140b5579 100644 --- a/x/compliance/module.go +++ b/x/compliance/module.go @@ -21,6 +21,9 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" ) +// ConsensusVersion defines the current x/compliance module consensus version. +const ConsensusVersion = 2 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -105,6 +108,11 @@ func NewAppModule( func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), keeper.Querier{Keeper: am.keeper}) + + m := keeper.NewMigrator(am.keeper) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1_0_2to1_0_3); err != nil { + panic(err) + } } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) @@ -128,7 +136,9 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { + return ConsensusVersion +} // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/compliance/types/entities.pb.go b/x/compliance/types/entities.pb.go index 25962fc1..80017148 100644 --- a/x/compliance/types/entities.pb.go +++ b/x/compliance/types/entities.pb.go @@ -158,6 +158,7 @@ func (m *OperatorDetails) GetOperatorType() OperatorType { type IssuerDetails struct { // Allows to easily understand // what entity can be associated with issuer address. + // Issuer name Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Basic issuer description Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` @@ -167,6 +168,8 @@ type IssuerDetails struct { Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` // Legal entity name LegalEntity string `protobuf:"bytes,5,opt,name=legalEntity,proto3" json:"legalEntity,omitempty"` + // Issuer creator who created current issuer + Creator string `protobuf:"bytes,6,opt,name=creator,proto3" json:"creator,omitempty"` } func (m *IssuerDetails) Reset() { *m = IssuerDetails{} } @@ -237,6 +240,13 @@ func (m *IssuerDetails) GetLegalEntity() string { return "" } +func (m *IssuerDetails) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + type AddressDetails struct { // Marks if contract deployed under this address is verified // by community. Only verified contracts will be allowed to write @@ -499,51 +509,52 @@ func init() { } var fileDescriptor_a6b6c3ec8e3c39ee = []byte{ - // 703 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcf, 0x6f, 0x12, 0x41, - 0x14, 0x66, 0x81, 0x52, 0x78, 0xfc, 0x5a, 0xa7, 0x4d, 0xb3, 0x69, 0x22, 0x22, 0xb5, 0x91, 0x34, - 0x91, 0xc6, 0x1f, 0x07, 0x0f, 0x5e, 0x28, 0xa0, 0xae, 0xb6, 0xc5, 0x0c, 0x0b, 0xa6, 0x5e, 0x26, - 0x23, 0x8c, 0x74, 0x52, 0x60, 0x36, 0x3b, 0xdb, 0xda, 0xfe, 0x0f, 0x9a, 0x78, 0xd7, 0x3f, 0xc8, - 0x63, 0x8f, 0x1e, 0x4d, 0xfb, 0x8f, 0x98, 0x99, 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 0xe2, 0x0f, 0x83, 0x12, 0xd6, - 0xbd, 0x2e, 0xac, 0x04, 0xd0, 0x75, 0x88, 0xbd, 0x6f, 0x3b, 0x76, 0x73, 0xd7, 0x34, 0xc2, 0x1c, - 0x77, 0x5e, 0xf5, 0x77, 0x9b, 0xd8, 0x4c, 0xee, 0x3c, 0xff, 0x79, 0x51, 0x31, 0xce, 0x2f, 0x2a, - 0xc6, 0xef, 0x8b, 0x8a, 0xf1, 0xed, 0xb2, 0x92, 0x38, 0xbf, 0xac, 0x24, 0x7e, 0x5d, 0x56, 0x12, - 0x1f, 0x2a, 0xf1, 0x77, 0xef, 0x34, 0xfe, 0xf2, 0xa9, 0x6f, 0x4a, 0x7e, 0xcc, 0xe8, 0x97, 0xef, - 0xe9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x38, 0x68, 0xf2, 0xa4, 0x75, 0x05, 0x00, 0x00, + // 718 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x4c, + 0x10, 0x8e, 0x93, 0x34, 0x1f, 0x93, 0x2f, 0xbf, 0xdb, 0xaa, 0xb2, 0x2a, 0xbd, 0x79, 0xf3, 0xa6, + 0x54, 0x44, 0x95, 0x48, 0xc5, 0xc7, 0x81, 0x03, 0x97, 0x34, 0x09, 0x60, 0x68, 0x1b, 0xb4, 0x71, + 0x82, 0xca, 0xc5, 0x5a, 0x92, 0x25, 0x5d, 0x35, 0xc9, 0x5a, 0xbb, 0x6e, 0x69, 0xff, 0x03, 0x07, + 0xee, 0x70, 0xe7, 0xaf, 0x70, 0xec, 0x91, 0x23, 0x6a, 0xff, 0x08, 0xda, 0xb5, 0x9d, 0xb8, 0xa5, + 0x95, 0x90, 0xb8, 0xcd, 0x3c, 0x33, 0xf3, 0xcc, 0xe3, 0x99, 0xf5, 0xc0, 0x96, 0xfc, 0xc8, 0xa4,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, 0x3d, 0xc7, 0xb5, 0x0f, 0x6c, 0xc7, 0x6e, 0xed, 0x99, 0x46, 0xe8, 0xe3, + 0xee, 0x8b, 0xc1, 0x5e, 0x0b, 0x9b, 0xc9, 0xdd, 0xa7, 0xdf, 0x2f, 0xab, 0xc6, 0xc5, 0x65, 0xd5, + 0xf8, 0x79, 0x59, 0x35, 0x3e, 0x5f, 0x55, 0x13, 0x17, 0x57, 0xd5, 0xc4, 0x8f, 0xab, 0x6a, 0xe2, + 0x5d, 0x35, 0x7e, 0x11, 0xcf, 0xe2, 0x37, 0x51, 0xbd, 0x29, 0xf9, 0x3e, 0xa3, 0x6f, 0xe2, 0xe3, + 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x27, 0x51, 0x2e, 0x1d, 0x8f, 0x05, 0x00, 0x00, } func (m *OperatorDetails) Marshal() (dAtA []byte, err error) { @@ -601,6 +612,13 @@ func (m *IssuerDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintEntities(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x32 + } if len(m.LegalEntity) > 0 { i -= len(m.LegalEntity) copy(dAtA[i:], m.LegalEntity) @@ -869,6 +887,10 @@ func (m *IssuerDetails) Size() (n int) { if l > 0 { n += 1 + l + sovEntities(uint64(l)) } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovEntities(uint64(l)) + } return n } @@ -1250,6 +1272,38 @@ func (m *IssuerDetails) Unmarshal(dAtA []byte) error { } m.LegalEntity = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEntities + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEntities + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEntities + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEntities(dAtA[iNdEx:]) diff --git a/x/compliance/types/errors.go b/x/compliance/types/errors.go index cf21802a..d771466b 100644 --- a/x/compliance/types/errors.go +++ b/x/compliance/types/errors.go @@ -13,17 +13,19 @@ const ( codeErrNotAuthorized codeErrInvalidOperator codeErrNotOperator + codeErrNotOperatorOrIssuer codeErrInvalidIssuer ) var ( - ErrBadRequest = sdkerrors.Register(ModuleName, codeErrBadRequest, "bad request") - ErrInvalidSignature = sdkerrors.Register(ModuleName, codeErrInvalidSignature, "invalid signature detected") - ErrSignatureNotFound = sdkerrors.Register(ModuleName, codeErrSignatureNotFound, "signature is required but not found") - ErrBasicValidation = sdkerrors.Register(ModuleName, codeErrBasicValidation, "basic validation failed") - ErrInvalidParam = sdkerrors.Register(ModuleName, codeErrInvalidParam, "invalid param provided") - ErrNotAuthorized = sdkerrors.Register(ModuleName, codeErrNotAuthorized, "not authorized") - ErrInvalidOperator = sdkerrors.Register(ModuleName, codeErrInvalidOperator, "invalid operator") - ErrNotOperator = sdkerrors.Register(ModuleName, codeErrNotOperator, "not operator") - ErrInvalidIssuer = sdkerrors.Register(ModuleName, codeErrInvalidIssuer, "invalid issuer") + ErrBadRequest = sdkerrors.Register(ModuleName, codeErrBadRequest, "bad request") + ErrInvalidSignature = sdkerrors.Register(ModuleName, codeErrInvalidSignature, "invalid signature detected") + ErrSignatureNotFound = sdkerrors.Register(ModuleName, codeErrSignatureNotFound, "signature is required but not found") + ErrBasicValidation = sdkerrors.Register(ModuleName, codeErrBasicValidation, "basic validation failed") + ErrInvalidParam = sdkerrors.Register(ModuleName, codeErrInvalidParam, "invalid param provided") + ErrNotAuthorized = sdkerrors.Register(ModuleName, codeErrNotAuthorized, "not authorized") + ErrInvalidOperator = sdkerrors.Register(ModuleName, codeErrInvalidOperator, "invalid operator") + ErrNotOperatorOrIssuerCreator = sdkerrors.Register(ModuleName, codeErrNotOperatorOrIssuer, "signer is not operator or issuer creator") + ErrNotOperator = sdkerrors.Register(ModuleName, codeErrNotOperator, "signer is not operator") + ErrInvalidIssuer = sdkerrors.Register(ModuleName, codeErrInvalidIssuer, "invalid issuer") ) diff --git a/x/compliance/types/events.go b/x/compliance/types/events.go index 03099bc5..e66c762d 100644 --- a/x/compliance/types/events.go +++ b/x/compliance/types/events.go @@ -9,6 +9,7 @@ const ( EventTypeVerifyIssuer = "verify_issuer" AttributeKeyOperator = "operator" + AttributeKeyIssuerCreator = "creator" AttributeKeyIssuer = "issuer" AttributeKeyIssuerDetails = "issuer_details" AttributeKeyVerificationStatus = "verification_status" diff --git a/x/compliance/types/genesis.pb.go b/x/compliance/types/genesis.pb.go index e613cdb3..39b94315 100644 --- a/x/compliance/types/genesis.pb.go +++ b/x/compliance/types/genesis.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the compliance module's genesis state. type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - Issuers []*IssuerGenesisAccount `protobuf:"bytes,2,rep,name=issuers,proto3" json:"issuers,omitempty"` + IssuerDetails []*GenesisIssuerDetails `protobuf:"bytes,2,rep,name=issuerDetails,proto3" json:"issuerDetails,omitempty"` AddressDetails []*GenesisAddressDetails `protobuf:"bytes,3,rep,name=addressDetails,proto3" json:"addressDetails,omitempty"` VerificationDetails []*GenesisVerificationDetails `protobuf:"bytes,4,rep,name=verificationDetails,proto3" json:"verificationDetails,omitempty"` Operators []*OperatorDetails `protobuf:"bytes,5,rep,name=operators,proto3" json:"operators,omitempty"` @@ -72,9 +72,9 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetIssuers() []*IssuerGenesisAccount { +func (m *GenesisState) GetIssuerDetails() []*GenesisIssuerDetails { if m != nil { - return m.Issuers + return m.IssuerDetails } return nil } @@ -100,23 +100,23 @@ func (m *GenesisState) GetOperators() []*OperatorDetails { return nil } -type IssuerGenesisAccount struct { +type GenesisIssuerDetails struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Details *IssuerDetails `protobuf:"bytes,2,opt,name=details,proto3" json:"details,omitempty"` } -func (m *IssuerGenesisAccount) Reset() { *m = IssuerGenesisAccount{} } -func (m *IssuerGenesisAccount) String() string { return proto.CompactTextString(m) } -func (*IssuerGenesisAccount) ProtoMessage() {} -func (*IssuerGenesisAccount) Descriptor() ([]byte, []int) { +func (m *GenesisIssuerDetails) Reset() { *m = GenesisIssuerDetails{} } +func (m *GenesisIssuerDetails) String() string { return proto.CompactTextString(m) } +func (*GenesisIssuerDetails) ProtoMessage() {} +func (*GenesisIssuerDetails) Descriptor() ([]byte, []int) { return fileDescriptor_d430e46e02363948, []int{1} } -func (m *IssuerGenesisAccount) XXX_Unmarshal(b []byte) error { +func (m *GenesisIssuerDetails) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *IssuerGenesisAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *GenesisIssuerDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_IssuerGenesisAccount.Marshal(b, m, deterministic) + return xxx_messageInfo_GenesisIssuerDetails.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -126,26 +126,26 @@ func (m *IssuerGenesisAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *IssuerGenesisAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_IssuerGenesisAccount.Merge(m, src) +func (m *GenesisIssuerDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisIssuerDetails.Merge(m, src) } -func (m *IssuerGenesisAccount) XXX_Size() int { +func (m *GenesisIssuerDetails) XXX_Size() int { return m.Size() } -func (m *IssuerGenesisAccount) XXX_DiscardUnknown() { - xxx_messageInfo_IssuerGenesisAccount.DiscardUnknown(m) +func (m *GenesisIssuerDetails) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisIssuerDetails.DiscardUnknown(m) } -var xxx_messageInfo_IssuerGenesisAccount proto.InternalMessageInfo +var xxx_messageInfo_GenesisIssuerDetails proto.InternalMessageInfo -func (m *IssuerGenesisAccount) GetAddress() string { +func (m *GenesisIssuerDetails) GetAddress() string { if m != nil { return m.Address } return "" } -func (m *IssuerGenesisAccount) GetDetails() *IssuerDetails { +func (m *GenesisIssuerDetails) GetDetails() *IssuerDetails { if m != nil { return m.Details } @@ -258,7 +258,7 @@ func (m *GenesisVerificationDetails) GetDetails() *VerificationDetails { func init() { proto.RegisterType((*GenesisState)(nil), "swisstronik.compliance.GenesisState") - proto.RegisterType((*IssuerGenesisAccount)(nil), "swisstronik.compliance.IssuerGenesisAccount") + proto.RegisterType((*GenesisIssuerDetails)(nil), "swisstronik.compliance.GenesisIssuerDetails") proto.RegisterType((*GenesisAddressDetails)(nil), "swisstronik.compliance.GenesisAddressDetails") proto.RegisterType((*GenesisVerificationDetails)(nil), "swisstronik.compliance.GenesisVerificationDetails") } @@ -268,33 +268,32 @@ func init() { } var fileDescriptor_d430e46e02363948 = []byte{ - // 404 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4f, 0x6f, 0xda, 0x30, - 0x18, 0xc6, 0x93, 0xc0, 0x40, 0x18, 0xc4, 0xc1, 0x63, 0x53, 0x94, 0x83, 0x87, 0xd8, 0xd8, 0x90, - 0xb6, 0x05, 0x89, 0x5d, 0x76, 0x98, 0xb4, 0x0d, 0x8d, 0x55, 0x3d, 0xb5, 0x4a, 0xd5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x37, 0xe1, 0x34, 0xe8, 0x59, 0x29, 0xc8, 0x41, 0x60, 0x04, 0xde, 0x5e, - 0x10, 0x4e, 0x4f, 0x69, 0x88, 0x25, 0x65, 0xb1, 0x66, 0x97, 0x15, 0x7b, 0xf0, 0x0a, 0xfb, 0xe8, - 0x65, 0x33, 0x28, 0xc2, 0xc1, 0x11, 0xa8, 0xb1, 0x84, 0x70, 0x2c, 0x19, 0x17, 0xee, 0x1b, 0xc5, - 0xfe, 0x62, 0x62, 0xef, 0xa5, 0x41, 0x0d, 0xdc, 0x34, 0x3b, 0xe7, 0xa0, 0x55, 0x34, 0x24, 0xe8, - 0x82, 0x6a, 0x7a, 0x2d, 0xb5, 0xa2, 0x5a, 0xa0, 0x7f, 0xe1, 0x6f, 0x50, 0x8d, 0xd2, 0x2b, 0x39, - 0x6a, 0x79, 0xdd, 0xed, 0xd3, 0xd7, 0x52, 0xdd, 0xea, 0x08, 0xf0, 0xae, 0x70, 0x90, 0x5b, 0x9c, - 0x7f, 0xf2, 0xce, 0xcf, 0x26, 0x67, 0x6e, 0x37, 0x19, 0xa9, 0x67, 0x9e, 0x30, 0x6c, 0x02, 0x87, - 0x46, 0x4a, 0xda, 0x08, 0x1c, 0x1a, 0xc1, 0x51, 0xde, 0xf7, 0xd5, 0xe4, 0x2b, 0xda, 0x97, 0xee, - 0x0e, 0x7f, 0xce, 0x97, 0xc8, 0x5e, 0x2c, 0x91, 0xfd, 0xb0, 0x44, 0xf6, 0xcd, 0x0a, 0x59, 0x8b, - 0x15, 0xb2, 0xee, 0x56, 0xc8, 0x3a, 0x46, 0xd9, 0x87, 0x73, 0x95, 0x7d, 0x3a, 0xf2, 0x3a, 0x21, - 0xe2, 0xa4, 0xa2, 0x1e, 0xce, 0x8f, 0xc7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x67, 0x42, 0x89, 0x3c, - 0xda, 0x03, 0x00, 0x00, + // 397 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00,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, 0x47, 0xf4, 0x18, 0x3f, 0x23, 0xf9, 0x14, 0x10, 0x71, 0x95, 0x57, 0x47, 0xb4, 0xfd, + 0x11, 0x00, 0x00, 0xff, 0xff, 0x96, 0xf3, 0x85, 0xab, 0xe6, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -359,10 +358,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } } - if len(m.Issuers) > 0 { - for iNdEx := len(m.Issuers) - 1; iNdEx >= 0; iNdEx-- { + if len(m.IssuerDetails) > 0 { + for iNdEx := len(m.IssuerDetails) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Issuers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.IssuerDetails[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -386,7 +385,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *IssuerGenesisAccount) Marshal() (dAtA []byte, err error) { +func (m *GenesisIssuerDetails) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -396,12 +395,12 @@ func (m *IssuerGenesisAccount) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *IssuerGenesisAccount) MarshalTo(dAtA []byte) (int, error) { +func (m *GenesisIssuerDetails) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *IssuerGenesisAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GenesisIssuerDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -531,8 +530,8 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.Issuers) > 0 { - for _, e := range m.Issuers { + if len(m.IssuerDetails) > 0 { + for _, e := range m.IssuerDetails { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -558,7 +557,7 @@ func (m *GenesisState) Size() (n int) { return n } -func (m *IssuerGenesisAccount) Size() (n int) { +func (m *GenesisIssuerDetails) Size() (n int) { if m == nil { return 0 } @@ -679,7 +678,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Issuers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IssuerDetails", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -706,8 +705,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Issuers = append(m.Issuers, &IssuerGenesisAccount{}) - if err := m.Issuers[len(m.Issuers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.IssuerDetails = append(m.IssuerDetails, &GenesisIssuerDetails{}) + if err := m.IssuerDetails[len(m.IssuerDetails)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -834,7 +833,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } -func (m *IssuerGenesisAccount) Unmarshal(dAtA []byte) error { +func (m *GenesisIssuerDetails) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -857,10 +856,10 @@ func (m *IssuerGenesisAccount) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: IssuerGenesisAccount: wiretype end group for non-group") + return fmt.Errorf("proto: GenesisIssuerDetails: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: IssuerGenesisAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GenesisIssuerDetails: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/compliance/types/interfaces.go b/x/compliance/types/interfaces.go new file mode 100644 index 00000000..e83d4bff --- /dev/null +++ b/x/compliance/types/interfaces.go @@ -0,0 +1,13 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type ComplianceKeeper interface { + IterateOperatorDetails(ctx sdk.Context, callback func(address sdk.AccAddress) (continue_ bool)) + IterateIssuerDetails(ctx sdk.Context, callback func(address sdk.AccAddress) (continue_ bool)) + GetOperatorDetails(ctx sdk.Context, operator sdk.AccAddress) (*OperatorDetails, error) + GetIssuerDetails(ctx sdk.Context, issuerAddress sdk.AccAddress) (*IssuerDetails, error) + SetIssuerDetails(ctx sdk.Context, issuerAddress sdk.AccAddress, details *IssuerDetails) error +} diff --git a/x/compliance/types/msg.go b/x/compliance/types/msg.go index 282ede3f..3a3b9a1e 100644 --- a/x/compliance/types/msg.go +++ b/x/compliance/types/msg.go @@ -108,7 +108,7 @@ func (msg *MsgSetVerificationStatus) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{signer} } -func NewSetIssuerDetailsMsg(operatorAddress, issuerAddress, issuerName, issuerDescription, issuerURL, issuerLogo, issuerLegalEntity string) MsgSetIssuerDetails { +func NewCreateIssuerMsg(createAddress, issuerAddress, issuerName, issuerDescription, issuerURL, issuerLogo, issuerLegalEntity string) MsgCreateIssuer { issuerDetails := IssuerDetails{ Name: issuerName, Description: issuerDescription, @@ -116,19 +116,19 @@ func NewSetIssuerDetailsMsg(operatorAddress, issuerAddress, issuerName, issuerDe Logo: issuerLogo, LegalEntity: issuerLegalEntity, } - return MsgSetIssuerDetails{ - Signer: operatorAddress, + return MsgCreateIssuer{ + Signer: createAddress, Issuer: issuerAddress, Details: &issuerDetails, } } -func (msg *MsgSetIssuerDetails) GetSignBytes() []byte { +func (msg *MsgCreateIssuer) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } -func (msg *MsgSetIssuerDetails) ValidateBasic() error { +func (msg *MsgCreateIssuer) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid signer address (%s)", err) @@ -142,7 +142,7 @@ func (msg *MsgSetIssuerDetails) ValidateBasic() error { return nil } -func (msg *MsgSetIssuerDetails) GetSigners() []sdk.AccAddress { +func (msg *MsgCreateIssuer) GetSigners() []sdk.AccAddress { signer, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { panic(err) @@ -150,8 +150,9 @@ func (msg *MsgSetIssuerDetails) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{signer} } -func NewUpdateIssuerDetailsMsg(operatorAddress, issuerAddress, issuerName, issuerDescription, issuerURL, issuerLogo, issuerLegalEntity string) MsgUpdateIssuerDetails { +func NewUpdateIssuerDetailsMsg(creatorAddress, issuerAddress, issuerName, issuerDescription, issuerURL, issuerLogo, issuerLegalEntity string) MsgUpdateIssuerDetails { issuerDetails := IssuerDetails{ + Creator: creatorAddress, Name: issuerName, Description: issuerDescription, Url: issuerURL, @@ -159,7 +160,7 @@ func NewUpdateIssuerDetailsMsg(operatorAddress, issuerAddress, issuerName, issue LegalEntity: issuerLegalEntity, } return MsgUpdateIssuerDetails{ - Signer: operatorAddress, + Signer: creatorAddress, Issuer: issuerAddress, Details: &issuerDetails, } @@ -173,7 +174,7 @@ func (msg *MsgUpdateIssuerDetails) GetSignBytes() []byte { func (msg *MsgUpdateIssuerDetails) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid operator address (%s)", err) + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid signer address (%s)", err) } _, err = sdk.AccAddressFromBech32(msg.Issuer) @@ -207,7 +208,7 @@ func (msg *MsgRemoveIssuer) GetSignBytes() []byte { func (msg *MsgRemoveIssuer) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid operator address (%s)", err) + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid signer address (%s)", err) } _, err = sdk.AccAddressFromBech32(msg.Issuer) diff --git a/x/compliance/types/proposal_test.go b/x/compliance/types/proposal_test.go index 8cd1986d..944a962a 100644 --- a/x/compliance/types/proposal_test.go +++ b/x/compliance/types/proposal_test.go @@ -18,7 +18,8 @@ type ProposalTestSuite struct { ctx sdk.Context keeper keeper.Keeper - validIssuer sdk.AccAddress + issuerCreator sdk.AccAddress + validIssuer sdk.AccAddress } func TestProposalTestSuite(t *testing.T) { @@ -31,11 +32,11 @@ func TestProposalTestSuite(t *testing.T) { } func (suite *ProposalTestSuite) SetupTest() { - from, _ := tests.RandomEthAddressWithPrivateKey() - suite.validIssuer = sdk.AccAddress(from.Bytes()) + suite.issuerCreator = tests.RandomAccAddress() + suite.validIssuer = tests.RandomAccAddress() // Set issuer details - issuerDetails := &types.IssuerDetails{Name: "testIssuer"} + issuerDetails := &types.IssuerDetails{Creator: suite.issuerCreator.String(), Name: "testIssuer"} err := suite.keeper.SetIssuerDetails(suite.ctx, suite.validIssuer, issuerDetails) suite.Require().NoError(err) diff --git a/x/compliance/types/query.pb.go b/x/compliance/types/query.pb.go index c0300c6a..4395e239 100644 --- a/x/compliance/types/query.pb.go +++ b/x/compliance/types/query.pb.go @@ -669,6 +669,7 @@ type QueryIssuersDetailsResponse_MergedIssuerDetails struct { Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"` Logo string `protobuf:"bytes,5,opt,name=logo,proto3" json:"logo,omitempty"` LegalEntity string `protobuf:"bytes,6,opt,name=legalEntity,proto3" json:"legalEntity,omitempty"` + Creator string `protobuf:"bytes,7,opt,name=creator,proto3" json:"creator,omitempty"` } func (m *QueryIssuersDetailsResponse_MergedIssuerDetails) Reset() { @@ -750,6 +751,13 @@ func (m *QueryIssuersDetailsResponse_MergedIssuerDetails) GetLegalEntity() strin return "" } +func (m *QueryIssuersDetailsResponse_MergedIssuerDetails) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + // QueryVerificationDetailsRequest is request type for the Query/VerificationDetails RPC method. type QueryVerificationDetailsRequest struct { VerificationID string `protobuf:"bytes,1,opt,name=verificationID,proto3" json:"verificationID,omitempty"` @@ -1090,83 +1098,83 @@ func init() { } var fileDescriptor_f80d6bdaf4aa1245 = []byte{ - // 1201 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6f, 0xdc, 0x44, + // 1212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcf, 0x6f, 0xdc, 0x44, 0x14, 0x8e, 0xbb, 0xe9, 0xa6, 0x79, 0x9b, 0xa4, 0x61, 0xb2, 0x8a, 0xdc, 0xa5, 0xdd, 0x24, 0x4e, 0xf3, 0xa3, 0x8d, 0xba, 0x26, 0x9b, 0xb4, 0x0d, 0x15, 0x08, 0xa5, 0xa4, 0x44, 0xa9, 0x84, 0x28, 0x6e, 0x54, 0x09, 0x24, 0xb4, 0x9a, 0xac, 0xa7, 0xee, 0xd0, 0x5d, 0xdb, 0xf5, 0x38, 0xa1, 0x51, - 0x14, 0x21, 0x71, 0x41, 0x88, 0x0b, 0x12, 0x07, 0xee, 0x1c, 0x11, 0xe2, 0x0c, 0x88, 0x13, 0x17, - 0x7a, 0xac, 0xe0, 0xc2, 0x09, 0xa1, 0x84, 0x3f, 0x04, 0x79, 0x66, 0xdc, 0xb5, 0xa7, 0xf6, 0x76, - 0x37, 0x6a, 0x6f, 0xde, 0x37, 0xef, 0xbd, 0xef, 0x7b, 0x33, 0xdf, 0x9b, 0x79, 0x0b, 0x06, 0xfb, - 0x8c, 0x32, 0x16, 0x06, 0x9e, 0x4b, 0x1f, 0x9a, 0x4d, 0xaf, 0xed, 0xb7, 0x28, 0x76, 0x9b, 0xc4, - 0x7c, 0xb4, 0x4b, 0x82, 0xfd, 0x9a, 0x1f, 0x78, 0xa1, 0x87, 0x26, 0x13, 0x3e, 0xb5, 0x8e, 0x4f, - 0xa5, 0xec, 0x78, 0x8e, 0xc7, 0x5d, 0xcc, 0xe8, 0x4b, 0x78, 0x57, 0xce, 0x3b, 0x9e, 0xe7, 0xb4, - 0x88, 0x89, 0x7d, 0x6a, 0x62, 0xd7, 0xf5, 0x42, 0x1c, 0x52, 0xcf, 0x65, 0x72, 0xf5, 0x72, 0xd3, - 0x63, 0x6d, 0x8f, 0x99, 0x3b, 0x98, 0x49, 0x10, 0x73, 0x6f, 0x79, 0x87, 0x84, 0x78, 0xd9, 0xf4, - 0xb1, 0x43, 0x5d, 0xee, 0x2c, 0x7d, 0x67, 0x73, 0xb8, 0xf9, 0x38, 0xc0, 0xed, 0x38, 0xe1, 0x5c, - 0x8e, 0x13, 0x71, 0x43, 0x1a, 0x52, 0x22, 0xdd, 0x8c, 0x32, 0xa0, 0x0f, 0x23, 0xb4, 0x3b, 0x3c, - 0xd6, 0x22, 0x8f, 0x76, 0x09, 0x0b, 0x8d, 0xbb, 0x30, 0x91, 0xb2, 0x32, 0xdf, 0x73, 0x19, 0x41, - 0x6f, 0x41, 0x51, 0x60, 0xe8, 0xda, 0xb4, 0xb6, 0x58, 0xaa, 0x57, 0x6b, 0xd9, 0x3b, 0x50, 0x13, - 0x71, 0x37, 0x07, 0x9f, 0xfc, 0x33, 0x35, 0x60, 0xc9, 0x18, 0x63, 0x13, 0x5e, 0xe7, 0x49, 0x3f, - 0xf0, 0x49, 0x80, 0x43, 0x2f, 0xd8, 0x20, 0x21, 0xa6, 0xad, 0x18, 0x13, 0x2d, 0xc2, 0x59, 0x4f, - 0xae, 0xac, 0xdb, 0x76, 0x40, 0x98, 0x40, 0x19, 0xb6, 0x54, 0xb3, 0x81, 0xe1, 0x7c, 0x76, 0x22, - 0x49, 0x73, 0x1d, 0x86, 0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b8, 0x3a, 0xf0, 0xf7, 0x71, 0x75, 0xe0, 0xd3, 0x6a, + 0x32, 0xff, 0x71, 0xb2, 0x42, 0xb8, 0xef, 0x13, 0xb6, 0x53, 0xe4, 0xff, 0x06, 0xac, 0xfc, 0x1f, + 0x00, 0x00, 0xff, 0xff, 0x24, 0x98, 0xa0, 0xc1, 0xf7, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2006,6 +2014,13 @@ func (m *QueryIssuersDetailsResponse_MergedIssuerDetails) MarshalToSizedBuffer(d _ = i var l int _ = l + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x3a + } if len(m.LegalEntity) > 0 { i -= len(m.LegalEntity) copy(dAtA[i:], m.LegalEntity) @@ -2513,6 +2528,10 @@ func (m *QueryIssuersDetailsResponse_MergedIssuerDetails) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4051,6 +4070,38 @@ func (m *QueryIssuersDetailsResponse_MergedIssuerDetails) Unmarshal(dAtA []byte) } m.LegalEntity = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/compliance/types/tx.pb.go b/x/compliance/types/tx.pb.go index 91231056..4ae1cae3 100644 --- a/x/compliance/types/tx.pb.go +++ b/x/compliance/types/tx.pb.go @@ -304,24 +304,24 @@ func (m *MsgSetVerificationStatusResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetVerificationStatusResponse proto.InternalMessageInfo -type MsgSetIssuerDetails struct { +type MsgCreateIssuer struct { Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` Issuer string `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` Details *IssuerDetails `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"` } -func (m *MsgSetIssuerDetails) Reset() { *m = MsgSetIssuerDetails{} } -func (m *MsgSetIssuerDetails) String() string { return proto.CompactTextString(m) } -func (*MsgSetIssuerDetails) ProtoMessage() {} -func (*MsgSetIssuerDetails) Descriptor() ([]byte, []int) { +func (m *MsgCreateIssuer) Reset() { *m = MsgCreateIssuer{} } +func (m *MsgCreateIssuer) String() string { return proto.CompactTextString(m) } +func (*MsgCreateIssuer) ProtoMessage() {} +func (*MsgCreateIssuer) Descriptor() ([]byte, []int) { return fileDescriptor_b617e43f088d8eed, []int{6} } -func (m *MsgSetIssuerDetails) XXX_Unmarshal(b []byte) error { +func (m *MsgCreateIssuer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSetIssuerDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgCreateIssuer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSetIssuerDetails.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgCreateIssuer.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -331,54 +331,54 @@ func (m *MsgSetIssuerDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgSetIssuerDetails) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetIssuerDetails.Merge(m, src) +func (m *MsgCreateIssuer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateIssuer.Merge(m, src) } -func (m *MsgSetIssuerDetails) XXX_Size() int { +func (m *MsgCreateIssuer) XXX_Size() int { return m.Size() } -func (m *MsgSetIssuerDetails) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetIssuerDetails.DiscardUnknown(m) +func (m *MsgCreateIssuer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateIssuer.DiscardUnknown(m) } -var xxx_messageInfo_MsgSetIssuerDetails proto.InternalMessageInfo +var xxx_messageInfo_MsgCreateIssuer proto.InternalMessageInfo -func (m *MsgSetIssuerDetails) GetSigner() string { +func (m *MsgCreateIssuer) GetSigner() string { if m != nil { return m.Signer } return "" } -func (m *MsgSetIssuerDetails) GetIssuer() string { +func (m *MsgCreateIssuer) GetIssuer() string { if m != nil { return m.Issuer } return "" } -func (m *MsgSetIssuerDetails) GetDetails() *IssuerDetails { +func (m *MsgCreateIssuer) GetDetails() *IssuerDetails { if m != nil { return m.Details } return nil } -type MsgSetIssuerDetailsResponse struct { +type MsgCreateIssuerResponse struct { } -func (m *MsgSetIssuerDetailsResponse) Reset() { *m = MsgSetIssuerDetailsResponse{} } -func (m *MsgSetIssuerDetailsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSetIssuerDetailsResponse) ProtoMessage() {} -func (*MsgSetIssuerDetailsResponse) Descriptor() ([]byte, []int) { +func (m *MsgCreateIssuerResponse) Reset() { *m = MsgCreateIssuerResponse{} } +func (m *MsgCreateIssuerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateIssuerResponse) ProtoMessage() {} +func (*MsgCreateIssuerResponse) Descriptor() ([]byte, []int) { return fileDescriptor_b617e43f088d8eed, []int{7} } -func (m *MsgSetIssuerDetailsResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgCreateIssuerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSetIssuerDetailsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgCreateIssuerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSetIssuerDetailsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgCreateIssuerResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -388,17 +388,17 @@ func (m *MsgSetIssuerDetailsResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *MsgSetIssuerDetailsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetIssuerDetailsResponse.Merge(m, src) +func (m *MsgCreateIssuerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateIssuerResponse.Merge(m, src) } -func (m *MsgSetIssuerDetailsResponse) XXX_Size() int { +func (m *MsgCreateIssuerResponse) XXX_Size() int { return m.Size() } -func (m *MsgSetIssuerDetailsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetIssuerDetailsResponse.DiscardUnknown(m) +func (m *MsgCreateIssuerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateIssuerResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgSetIssuerDetailsResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgCreateIssuerResponse proto.InternalMessageInfo type MsgUpdateIssuerDetails struct { Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` @@ -655,8 +655,8 @@ func init() { proto.RegisterType((*MsgRemoveOperatorResponse)(nil), "swisstronik.compliance.MsgRemoveOperatorResponse") proto.RegisterType((*MsgSetVerificationStatus)(nil), "swisstronik.compliance.MsgSetVerificationStatus") proto.RegisterType((*MsgSetVerificationStatusResponse)(nil), "swisstronik.compliance.MsgSetVerificationStatusResponse") - proto.RegisterType((*MsgSetIssuerDetails)(nil), "swisstronik.compliance.MsgSetIssuerDetails") - proto.RegisterType((*MsgSetIssuerDetailsResponse)(nil), "swisstronik.compliance.MsgSetIssuerDetailsResponse") + proto.RegisterType((*MsgCreateIssuer)(nil), "swisstronik.compliance.MsgCreateIssuer") + proto.RegisterType((*MsgCreateIssuerResponse)(nil), "swisstronik.compliance.MsgCreateIssuerResponse") proto.RegisterType((*MsgUpdateIssuerDetails)(nil), "swisstronik.compliance.MsgUpdateIssuerDetails") proto.RegisterType((*MsgUpdateIssuerDetailsResponse)(nil), "swisstronik.compliance.MsgUpdateIssuerDetailsResponse") proto.RegisterType((*MsgRemoveIssuer)(nil), "swisstronik.compliance.MsgRemoveIssuer") @@ -667,47 +667,47 @@ func init() { func init() { proto.RegisterFile("swisstronik/compliance/tx.proto", fileDescriptor_b617e43f088d8eed) } var fileDescriptor_b617e43f088d8eed = []byte{ - // 626 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0xcf, 0x6f, 0x12, 0x41, - 0x14, 0xc7, 0x59, 0x6b, 0x6b, 0x7d, 0xc4, 0x9a, 0xae, 0x84, 0xc2, 0x12, 0x17, 0x42, 0x82, 0x56, - 0x4d, 0x58, 0x69, 0x13, 0xd3, 0xf4, 0x62, 0x6a, 0x3c, 0xe8, 0x01, 0x7f, 0x50, 0xed, 0xc1, 0x4b, - 0x33, 0xec, 0x8e, 0x9b, 0x49, 0x61, 0x67, 0xb3, 0x6f, 0x8a, 0xad, 0xde, 0xf4, 0x60, 0xbc, 0x99, - 0x98, 0x78, 0xf6, 0x4f, 0xf0, 0xcf, 0xf0, 0xd8, 0xa3, 0x47, 0x03, 0x89, 0xfa, 0x67, 0x18, 0x76, - 0x86, 0x91, 0xad, 0x0b, 0x42, 0xe2, 0xc1, 0x13, 0xcc, 0x9b, 0xef, 0x7b, 0xdf, 0x0f, 0xbc, 0xf7, - 0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0x30, 0xc4, 0x43, 0x1a, 0xed, 0x13, 0xcf, 0x8b, 0x28, - 0xa2, 0x02, 0xb8, 0x20, 0xa3, 0x3b, 0x32, 0x68, 0x96, 0x21, 0xcb, 0x70, 0xbf, 0x17, 0xd7, 0xa5, - 0x5e, 0x61, 0xa1, 0x62, 0xac, 0x2f, 0xb7, 0x80, 0xe1, 0x9e, 0x8a, 0x24, 0x31, 0xab, 0x50, 0x99, - 0x04, 0xa2, 0x69, 0x3f, 0x18, 0x70, 0x49, 0x8a, 0xee, 0xc7, 0x4e, 0x77, 0xa9, 0x20, 0xac, 0x33, - 0x19, 0x34, 0x0f, 0x4b, 0x12, 0x49, 0x01, 0xaa, 0x93, 0x79, 0x1b, 0xce, 0x79, 0x32, 0x35, 0xa6, - 0xca, 0x6e, 0xd4, 0xea, 0xe9, 0x53, 0x57, 0x4f, 0xf8, 0xb4, 0x46, 0x59, 0x49, 0xf2, 0xcb, 0x50, - 0x4a, 0x81, 0xd2, 0xd0, 0x1f, 0x8d, 0xb8, 0xe1, 0x4f, 0x43, 0x8f, 0x08, 0xfa, 0x3f, 0x71, 0x57, - 0xc0, 0x4e, 0xe7, 0xd2, 0xe8, 0x0f, 0xe0, 0xa2, 0x1e, 0x1d, 0xa9, 0x98, 0x17, 0x39, 0xe9, 0x58, - 0x84, 0xb5, 0x53, 0xf5, 0xb4, 0xd5, 0x2b, 0xc8, 0xc5, 0x8d, 0x3f, 0x96, 0xf1, 0x47, 0x11, 0x0f, - 0x39, 0x92, 0x8e, 0x99, 0x83, 0x45, 0xc1, 0x44, 0x87, 0x2a, 0x3b, 0x79, 0x30, 0x2b, 0x90, 0xf5, - 0x28, 0xba, 0x11, 0x0b, 0x87, 0x53, 0xa2, 0x2c, 0xc7, 0x43, 0x29, 0x33, 0xba, 0x90, 0x32, 0xa3, - 0xdb, 0x67, 0x7f, 0x7e, 0x2a, 0x67, 0x36, 0xbe, 0x2f, 0xc2, 0x42, 0x13, 0x7d, 0xf3, 0x00, 0x56, - 0xef, 0x91, 0xc0, 0xeb, 0xd0, 0xf1, 0x85, 0xbf, 0x32, 0xe9, 0x3f, 0x4e, 0x6e, 0xb1, 0x55, 0x9f, - 0x4d, 0x37, 0xfa, 0xc5, 0xa6, 0x80, 0x9c, 0x34, 0x3b, 0xb5, 0xf0, 0xd7, 0xa6, 0xd4, 0x49, 0x4a, - 0xad, 0xc6, 0xcc, 0x52, 0xed, 0xfa, 0xce, 0x80, 0x92, 0xb4, 0x4d, 0xdf, 0xf9, 0x9b, 0x53, 0x4a, - 0xa6, 0x66, 0x58, 0x5b, 0xf3, 0x66, 0x68, 0x96, 0x97, 0x90, 0xd7, 0x28, 0xc9, 0xc5, 0xb8, 0x31, - 0xbd, 0x66, 0x42, 0x6c, 0x6d, 0xce, 0x21, 0xd6, 0xde, 0x6f, 0x0c, 0x28, 0x4a, 0xf3, 0xb4, 0xc5, - 0x9c, 0xd6, 0xcb, 0x14, 0xbd, 0x75, 0x6b, 0x3e, 0xbd, 0xa6, 0x08, 0xc0, 0x1c, 0x9f, 0x01, 0xb5, - 0x63, 0x57, 0xff, 0xda, 0x56, 0x29, 0xb4, 0x9c, 0x19, 0x85, 0x23, 0xbf, 0x3b, 0x5b, 0x5f, 0xfa, - 0xb6, 0x71, 0xd2, 0xb7, 0x8d, 0x6f, 0x7d, 0xdb, 0x78, 0x3f, 0xb0, 0x33, 0x27, 0x03, 0x3b, 0xf3, - 0x75, 0x60, 0x67, 0x9e, 0xd9, 0xe3, 0xef, 0xe1, 0x51, 0xe2, 0x65, 0x3e, 0x0e, 0x29, 0xb6, 0x97, - 0xe2, 0xf7, 0x70, 0xf3, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcf, 0xc8, 0x12, 0x76, 0xc0, 0x07, - 0x00, 0x00, + // 625 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x95, 0x4f, 0x6f, 0xd3, 0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, 0xf6, 0x2a, 0xe7, 0xd8, 0x75, 0xd6, 0x64, 0xdd, 0xde, 0xfc, 0x3c, 0x32, + 0xb5, 0xe3, 0x91, 0xa9, 0x7d, 0x1b, 0x99, 0xda, 0xfb, 0xb1, 0x99, 0x3b, 0x1e, 0x9b, 0xb9, 0x2f, + 0x63, 0x33, 0xf7, 0xcc, 0x4c, 0xbe, 0x7d, 0x87, 0xa9, 0x57, 0xf8, 0x28, 0x40, 0xea, 0x15, 0xa2, + 0xb7, 0xef, 0xc6, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0xd5, 0xf4, 0x9d, 0xac, 0x07, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -725,7 +725,7 @@ type MsgClient interface { HandleAddOperator(ctx context.Context, in *MsgAddOperator, opts ...grpc.CallOption) (*MsgAddOperatorResponse, error) HandleRemoveOperator(ctx context.Context, in *MsgRemoveOperator, opts ...grpc.CallOption) (*MsgRemoveOperatorResponse, error) HandleSetVerificationStatus(ctx context.Context, in *MsgSetVerificationStatus, opts ...grpc.CallOption) (*MsgSetVerificationStatusResponse, error) - HandleSetIssuerDetails(ctx context.Context, in *MsgSetIssuerDetails, opts ...grpc.CallOption) (*MsgSetIssuerDetailsResponse, error) + HandleCreateIssuer(ctx context.Context, in *MsgCreateIssuer, opts ...grpc.CallOption) (*MsgCreateIssuerResponse, error) HandleUpdateIssuerDetails(ctx context.Context, in *MsgUpdateIssuerDetails, opts ...grpc.CallOption) (*MsgUpdateIssuerDetailsResponse, error) HandleRemoveIssuer(ctx context.Context, in *MsgRemoveIssuer, opts ...grpc.CallOption) (*MsgRemoveIssuerResponse, error) } @@ -765,9 +765,9 @@ func (c *msgClient) HandleSetVerificationStatus(ctx context.Context, in *MsgSetV return out, nil } -func (c *msgClient) HandleSetIssuerDetails(ctx context.Context, in *MsgSetIssuerDetails, opts ...grpc.CallOption) (*MsgSetIssuerDetailsResponse, error) { - out := new(MsgSetIssuerDetailsResponse) - err := c.cc.Invoke(ctx, "/swisstronik.compliance.Msg/HandleSetIssuerDetails", in, out, opts...) +func (c *msgClient) HandleCreateIssuer(ctx context.Context, in *MsgCreateIssuer, opts ...grpc.CallOption) (*MsgCreateIssuerResponse, error) { + out := new(MsgCreateIssuerResponse) + err := c.cc.Invoke(ctx, "/swisstronik.compliance.Msg/HandleCreateIssuer", in, out, opts...) if err != nil { return nil, err } @@ -797,7 +797,7 @@ type MsgServer interface { HandleAddOperator(context.Context, *MsgAddOperator) (*MsgAddOperatorResponse, error) HandleRemoveOperator(context.Context, *MsgRemoveOperator) (*MsgRemoveOperatorResponse, error) HandleSetVerificationStatus(context.Context, *MsgSetVerificationStatus) (*MsgSetVerificationStatusResponse, error) - HandleSetIssuerDetails(context.Context, *MsgSetIssuerDetails) (*MsgSetIssuerDetailsResponse, error) + HandleCreateIssuer(context.Context, *MsgCreateIssuer) (*MsgCreateIssuerResponse, error) HandleUpdateIssuerDetails(context.Context, *MsgUpdateIssuerDetails) (*MsgUpdateIssuerDetailsResponse, error) HandleRemoveIssuer(context.Context, *MsgRemoveIssuer) (*MsgRemoveIssuerResponse, error) } @@ -815,8 +815,8 @@ func (*UnimplementedMsgServer) HandleRemoveOperator(ctx context.Context, req *Ms func (*UnimplementedMsgServer) HandleSetVerificationStatus(ctx context.Context, req *MsgSetVerificationStatus) (*MsgSetVerificationStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HandleSetVerificationStatus not implemented") } -func (*UnimplementedMsgServer) HandleSetIssuerDetails(ctx context.Context, req *MsgSetIssuerDetails) (*MsgSetIssuerDetailsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HandleSetIssuerDetails not implemented") +func (*UnimplementedMsgServer) HandleCreateIssuer(ctx context.Context, req *MsgCreateIssuer) (*MsgCreateIssuerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleCreateIssuer not implemented") } func (*UnimplementedMsgServer) HandleUpdateIssuerDetails(ctx context.Context, req *MsgUpdateIssuerDetails) (*MsgUpdateIssuerDetailsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HandleUpdateIssuerDetails not implemented") @@ -883,20 +883,20 @@ func _Msg_HandleSetVerificationStatus_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } -func _Msg_HandleSetIssuerDetails_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSetIssuerDetails) +func _Msg_HandleCreateIssuer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateIssuer) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).HandleSetIssuerDetails(ctx, in) + return srv.(MsgServer).HandleCreateIssuer(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/swisstronik.compliance.Msg/HandleSetIssuerDetails", + FullMethod: "/swisstronik.compliance.Msg/HandleCreateIssuer", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).HandleSetIssuerDetails(ctx, req.(*MsgSetIssuerDetails)) + return srv.(MsgServer).HandleCreateIssuer(ctx, req.(*MsgCreateIssuer)) } return interceptor(ctx, in, info, handler) } @@ -954,8 +954,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_HandleSetVerificationStatus_Handler, }, { - MethodName: "HandleSetIssuerDetails", - Handler: _Msg_HandleSetIssuerDetails_Handler, + MethodName: "HandleCreateIssuer", + Handler: _Msg_HandleCreateIssuer_Handler, }, { MethodName: "HandleUpdateIssuerDetails", @@ -1160,7 +1160,7 @@ func (m *MsgSetVerificationStatusResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func (m *MsgSetIssuerDetails) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateIssuer) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1170,12 +1170,12 @@ func (m *MsgSetIssuerDetails) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSetIssuerDetails) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateIssuer) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSetIssuerDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateIssuer) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1209,7 +1209,7 @@ func (m *MsgSetIssuerDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgSetIssuerDetailsResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateIssuerResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1219,12 +1219,12 @@ func (m *MsgSetIssuerDetailsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSetIssuerDetailsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateIssuerResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSetIssuerDetailsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateIssuerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1500,7 +1500,7 @@ func (m *MsgSetVerificationStatusResponse) Size() (n int) { return n } -func (m *MsgSetIssuerDetails) Size() (n int) { +func (m *MsgCreateIssuer) Size() (n int) { if m == nil { return 0 } @@ -1521,7 +1521,7 @@ func (m *MsgSetIssuerDetails) Size() (n int) { return n } -func (m *MsgSetIssuerDetailsResponse) Size() (n int) { +func (m *MsgCreateIssuerResponse) Size() (n int) { if m == nil { return 0 } @@ -2125,7 +2125,7 @@ func (m *MsgSetVerificationStatusResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSetIssuerDetails) Unmarshal(dAtA []byte) error { +func (m *MsgCreateIssuer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2148,10 +2148,10 @@ func (m *MsgSetIssuerDetails) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSetIssuerDetails: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateIssuer: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetIssuerDetails: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateIssuer: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2275,7 +2275,7 @@ func (m *MsgSetIssuerDetails) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSetIssuerDetailsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreateIssuerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2298,10 +2298,10 @@ func (m *MsgSetIssuerDetailsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSetIssuerDetailsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateIssuerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetIssuerDetailsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateIssuerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/evm/keeper/sgxvm_connector.go b/x/evm/keeper/sgxvm_connector.go index a96eb4ed..6c866f4e 100644 --- a/x/evm/keeper/sgxvm_connector.go +++ b/x/evm/keeper/sgxvm_connector.go @@ -235,7 +235,7 @@ func (q Connector) HasVerification(req *librustgo.CosmosRequest_HasVerification) verificationType := compliancetypes.VerificationType(req.HasVerification.VerificationType) expirationTimestamp := req.HasVerification.ExpirationTimestamp - var allowedIssuers []sdk.Address + var allowedIssuers []sdk.AccAddress for _, issuer := range req.HasVerification.AllowedIssuers { allowedIssuers = append(allowedIssuers, sdk.AccAddress(issuer)) } diff --git a/x/evm/keeper/sgxvm_connector_test.go b/x/evm/keeper/sgxvm_connector_test.go index af1c5e55..4853ad39 100644 --- a/x/evm/keeper/sgxvm_connector_test.go +++ b/x/evm/keeper/sgxvm_connector_test.go @@ -307,6 +307,7 @@ func (suite *KeeperTestSuite) TestSingleVerificationDetails() { var ( userAddress common.Address userAccount sdk.AccAddress + issuerCreator sdk.AccAddress issuerAddress common.Address issuerAccount sdk.AccAddress illegalIssuerAccount sdk.AccAddress @@ -318,13 +319,15 @@ func (suite *KeeperTestSuite) TestSingleVerificationDetails() { setup := func() { userAddress = tests.RandomEthAddress() userAccount = sdk.AccAddress(userAddress.Bytes()) + issuerCreator = tests.RandomAccAddress() issuerAddress = tests.RandomEthAddress() issuerAccount = sdk.AccAddress(issuerAddress.Bytes()) illegalIssuerAccount = tests.RandomAccAddress() // Verify issuer to add verification details which are verified by issuer _ = suite.app.ComplianceKeeper.SetIssuerDetails(suite.ctx, issuerAccount, &compliancetypes.IssuerDetails{ - Name: "test issuer", + Creator: issuerCreator.String(), + Name: "test issuer", }) _ = suite.app.ComplianceKeeper.SetAddressVerificationStatus(suite.ctx, issuerAccount, true) @@ -374,15 +377,15 @@ func (suite *KeeperTestSuite) TestSingleVerificationDetails() { suite.Require().NoError(err) suite.Require().True(has) - has, err = connector.EVMKeeper.ComplianceKeeper.HasVerificationOfType(connector.Context, userAccount, verificationType, 0, []sdk.Address{issuerAccount}) + has, err = connector.EVMKeeper.ComplianceKeeper.HasVerificationOfType(connector.Context, userAccount, verificationType, 0, []sdk.AccAddress{issuerAccount}) suite.Require().NoError(err) suite.Require().True(has) - has, err = connector.EVMKeeper.ComplianceKeeper.HasVerificationOfType(connector.Context, userAccount, verificationType, uint32(time.Now().Unix()), []sdk.Address{issuerAccount}) + has, err = connector.EVMKeeper.ComplianceKeeper.HasVerificationOfType(connector.Context, userAccount, verificationType, uint32(time.Now().Unix()), []sdk.AccAddress{issuerAccount}) suite.Require().NoError(err) suite.Require().True(has) - has, err = connector.EVMKeeper.ComplianceKeeper.HasVerificationOfType(connector.Context, userAccount, verificationType, 0, []sdk.Address{illegalIssuerAccount}) + has, err = connector.EVMKeeper.ComplianceKeeper.HasVerificationOfType(connector.Context, userAccount, verificationType, 0, []sdk.AccAddress{illegalIssuerAccount}) suite.Require().NoError(err) suite.Require().False(has) @@ -528,6 +531,7 @@ func (suite *KeeperTestSuite) TestMultipleVerificationDetails() { var ( userAddress = tests.RandomEthAddress() + issuerCreator = tests.RandomAccAddress() issuerAddress = tests.RandomEthAddress() issuerAccount = sdk.AccAddress(issuerAddress.Bytes()) @@ -538,7 +542,8 @@ func (suite *KeeperTestSuite) TestMultipleVerificationDetails() { // Verify issuer to add verification details which are verified by issuer _ = suite.app.ComplianceKeeper.SetIssuerDetails(suite.ctx, issuerAccount, &compliancetypes.IssuerDetails{ - Name: "test issuer", + Creator: issuerCreator.String(), + Name: "test issuer", }) _ = suite.app.ComplianceKeeper.SetAddressVerificationStatus(suite.ctx, issuerAccount, true) diff --git a/x/evm/types/interfaces.go b/x/evm/types/interfaces.go index 21455f84..459fbb61 100644 --- a/x/evm/types/interfaces.go +++ b/x/evm/types/interfaces.go @@ -67,9 +67,9 @@ type FeeMarketKeeper interface { // ComplianceKeeper type ComplianceKeeper interface { - AddVerificationDetails(ctx sdk.Context, userAddress sdk.Address, verificationType compliancetypes.VerificationType, details *compliancetypes.VerificationDetails) ([]byte, error) - HasVerificationOfType(ctx sdk.Context, userAddress sdk.Address, expectedType compliancetypes.VerificationType, expirationTimestamp uint32, expectedIssuers []sdk.Address) (bool, error) - GetVerificationDetailsByIssuer(ctx sdk.Context, userAddress sdk.Address, issuerAddress sdk.Address) ([]*compliancetypes.Verification, []*compliancetypes.VerificationDetails, error) + AddVerificationDetails(ctx sdk.Context, userAddress sdk.AccAddress, verificationType compliancetypes.VerificationType, details *compliancetypes.VerificationDetails) ([]byte, error) + HasVerificationOfType(ctx sdk.Context, userAddress sdk.AccAddress, expectedType compliancetypes.VerificationType, expirationTimestamp uint32, expectedIssuers []sdk.AccAddress) (bool, error) + GetVerificationDetailsByIssuer(ctx sdk.Context, userAddress, issuerAddress sdk.AccAddress) ([]*compliancetypes.Verification, []*compliancetypes.VerificationDetails, error) } // Event Hooks diff --git a/x/vesting/keeper/integration_test.go b/x/vesting/keeper/integration_test.go index 8f228cfd..f0ba917d 100644 --- a/x/vesting/keeper/integration_test.go +++ b/x/vesting/keeper/integration_test.go @@ -44,7 +44,7 @@ type VestingTestSuite struct { func TestVestingTestSuite(t *testing.T) { // Run Ginkgo integration tests RegisterFailHandler(Fail) - RunSpecs(t, "Compliance Keeper Suite") + RunSpecs(t, "Vesting Keeper Suite") } // Commit commits and starts a new block with an updated context. diff --git a/x/vesting/keeper/msg_server_test.go b/x/vesting/keeper/msg_server_test.go index 81866459..7a40709f 100644 --- a/x/vesting/keeper/msg_server_test.go +++ b/x/vesting/keeper/msg_server_test.go @@ -122,10 +122,8 @@ func (suite *KeeperTestSuite) TestCreateMonthlyVestingAccount() { { name: "create for existing account", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - fromAddress = sdk.AccAddress(from.Bytes()) - to, _ := tests.RandomEthAddressWithPrivateKey() - toAddress = sdk.AccAddress(to.Bytes()) + fromAddress = tests.RandomAccAddress() + toAddress = tests.RandomAccAddress() // Set to account baseAccount := authtypes.NewBaseAccountWithAddress(toAddress) @@ -144,10 +142,8 @@ func (suite *KeeperTestSuite) TestCreateMonthlyVestingAccount() { { name: "create a valid periodic vesting account", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - fromAddress = sdk.AccAddress(from.Bytes()) - to, _ := tests.RandomEthAddressWithPrivateKey() - toAddress = sdk.AccAddress(to.Bytes()) + fromAddress = tests.RandomAccAddress() + toAddress = tests.RandomAccAddress() coins = sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 50)) suite.bankKeeper.EXPECT().IsSendEnabledCoins(suite.ctx, coins).Return(nil) @@ -162,10 +158,8 @@ func (suite *KeeperTestSuite) TestCreateMonthlyVestingAccount() { { name: "blocked account", init: func() { - from, _ := tests.RandomEthAddressWithPrivateKey() - fromAddress = sdk.AccAddress(from.Bytes()) - to, _ := tests.RandomEthAddressWithPrivateKey() - toAddress = sdk.AccAddress(to.Bytes()) + fromAddress = tests.RandomAccAddress() + toAddress = tests.RandomAccAddress() coins = sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 50)) suite.bankKeeper.EXPECT().IsSendEnabledCoins(suite.ctx, coins).Return(nil) diff --git a/x/vesting/keeper/query_test.go b/x/vesting/keeper/query_test.go index 5b809d92..fac317b6 100644 --- a/x/vesting/keeper/query_test.go +++ b/x/vesting/keeper/query_test.go @@ -59,8 +59,7 @@ func (suite *KeeperTestSuite) TestBalances() { { name: "unknown address", init: func() { - to, _ := tests.RandomEthAddressWithPrivateKey() - toAddress = sdk.AccAddress(to.Bytes()) + toAddress = tests.RandomAccAddress() }, malleate: func() *types.QueryBalancesRequest { return &types.QueryBalancesRequest{ @@ -75,8 +74,7 @@ func (suite *KeeperTestSuite) TestBalances() { { name: "not found vesting account", init: func() { - to, _ := tests.RandomEthAddressWithPrivateKey() - toAddress = sdk.AccAddress(to.Bytes()) + toAddress = tests.RandomAccAddress() // Set to account baseAccount := authtypes.NewBaseAccountWithAddress(toAddress) @@ -96,8 +94,7 @@ func (suite *KeeperTestSuite) TestBalances() { { name: "success", init: func() { - to, _ := tests.RandomEthAddressWithPrivateKey() - toAddress = sdk.AccAddress(to.Bytes()) + toAddress = tests.RandomAccAddress() // Set to account baseAccount := authtypes.NewBaseAccountWithAddress(toAddress) diff --git a/x/vesting/types/vesting_account_test.go b/x/vesting/types/vesting_account_test.go index 5770f2d8..59f7e335 100644 --- a/x/vesting/types/vesting_account_test.go +++ b/x/vesting/types/vesting_account_test.go @@ -398,8 +398,7 @@ func (suite *VestingAccountTestSuite) TestTrackUndelegationMonthlyVestingAcc() { } func initBaseAccount(amount int64) (*authtypes.BaseAccount, sdk.Coins) { - from, _ := tests.RandomEthAddressWithPrivateKey() - addr := sdk.AccAddress(from.Bytes()) + addr := tests.RandomAccAddress() baseAcc := authtypes.NewBaseAccountWithAddress(addr) initialVesting := sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, amount)) return baseAcc, initialVesting