From 3e948cbc0c61ca419b7dca2bb8014d724cde57b1 Mon Sep 17 00:00:00 2001 From: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> Date: Tue, 30 Aug 2022 12:54:55 -0700 Subject: [PATCH] refactor(x/ecocredit)!: update base submodule architecture (#1429) * refactor(x/ecocredit)!: update base submodule architecture * update changelog * merge cleanup * merge cleanup --- CHANGELOG.md | 4 + proto/regen/ecocredit/v1/events.proto | 2 +- proto/regen/ecocredit/v1/query.proto | 2 +- proto/regen/ecocredit/v1/state.proto | 2 +- proto/regen/ecocredit/v1/tx.proto | 2 +- proto/regen/ecocredit/v1/types.proto | 2 +- proto/regen/ecocredit/v1alpha1/events.proto | 2 +- proto/regen/ecocredit/v1alpha1/genesis.proto | 2 +- proto/regen/ecocredit/v1alpha1/query.proto | 2 +- proto/regen/ecocredit/v1alpha1/tx.proto | 2 +- proto/regen/ecocredit/v1alpha1/types.proto | 2 +- x/ecocredit/base/client/query.go | 588 +++++++++++++++ x/ecocredit/base/client/tx.go | 662 +++++++++++++++++ .../{client/util.go => base/client/utils.go} | 26 +- .../client/utils_test.go} | 16 +- .../features/msg_add_class_creator.feature | 0 .../features/msg_add_credit_type.feature | 0 .../keeper}/features/msg_bridge.feature | 0 .../features/msg_bridge_receive.feature | 0 .../keeper}/features/msg_cancel.feature | 0 .../keeper}/features/msg_create_batch.feature | 0 .../keeper}/features/msg_create_class.feature | 0 .../features/msg_create_project.feature | 0 .../features/msg_mint_batch_credits.feature | 0 .../features/msg_remove_class_creator.feature | 0 .../keeper}/features/msg_retire.feature | 0 .../keeper}/features/msg_seal_batch.feature | 0 .../keeper}/features/msg_send.feature | 0 .../msg_toggle_class_allowlist.feature | 0 .../features/msg_update_class_admin.feature | 0 .../features/msg_update_class_fee.feature | 0 .../features/msg_update_class_issuers.feature | 0 .../msg_update_class_metadata.feature | 0 .../features/msg_update_project_admin.feature | 0 .../msg_update_project_metadata.feature | 0 .../core => base/keeper}/invariants.go | 8 +- .../{server/core => base/keeper}/keeper.go | 8 +- .../core => base/keeper}/keeper_test.go | 2 +- .../keeper}/msg_add_class_creator.go | 13 +- .../keeper}/msg_add_class_creator_test.go | 15 +- .../keeper}/msg_add_credit_type.go | 12 +- .../keeper}/msg_add_credit_type_test.go | 12 +- .../core => base/keeper}/msg_bridge.go | 12 +- .../keeper}/msg_bridge_receive.go | 30 +- .../keeper}/msg_bridge_receive_test.go | 79 +- .../core => base/keeper}/msg_bridge_test.go | 22 +- .../core => base/keeper}/msg_cancel.go | 19 +- .../core => base/keeper}/msg_cancel_test.go | 20 +- .../core => base/keeper}/msg_create_batch.go | 19 +- .../keeper}/msg_create_batch_test.go | 84 +-- .../core => base/keeper}/msg_create_class.go | 17 +- .../keeper}/msg_create_class_test.go | 28 +- .../keeper}/msg_create_project.go | 13 +- .../keeper}/msg_create_project_test.go | 27 +- .../keeper}/msg_mint_batch_credits.go | 16 +- .../keeper}/msg_mint_batch_credits_test.go | 53 +- .../keeper}/msg_remove_class_creators.go | 8 +- .../keeper}/msg_remove_class_creators_test.go | 14 +- .../core => base/keeper}/msg_retire.go | 16 +- .../core => base/keeper}/msg_retire_test.go | 20 +- .../core => base/keeper}/msg_seal_batch.go | 12 +- .../keeper}/msg_seal_batch_test.go | 15 +- .../{server/core => base/keeper}/msg_send.go | 20 +- .../core => base/keeper}/msg_send_test.go | 26 +- .../base/keeper/msg_toggle_class_allowlist.go | 24 + .../msg_toggle_class_allowlist_test.go | 6 +- .../keeper}/msg_update_class_admin.go | 10 +- .../keeper}/msg_update_class_admin_test.go | 17 +- .../base/keeper/msg_update_class_fee.go | 26 + .../keeper}/msg_update_class_fee_test.go | 6 +- .../keeper}/msg_update_class_issuers.go | 10 +- .../keeper}/msg_update_class_issuers_test.go | 21 +- .../keeper}/msg_update_class_metadata.go | 10 +- .../keeper}/msg_update_class_metadata_test.go | 19 +- .../keeper}/msg_update_project_admin.go | 10 +- .../keeper}/msg_update_project_admin_test.go | 17 +- .../keeper}/msg_update_project_metadata.go | 10 +- .../msg_update_project_metadata_test.go | 17 +- .../keeper}/query_all_balances.go | 10 +- .../keeper}/query_all_balances_test.go | 6 +- .../keeper}/query_allowed_class_creators.go | 9 +- .../query_allowed_class_creators_test.go | 19 +- .../keeper}/query_allowlist_enabled.go | 8 +- .../keeper/query_allowlist_enabled_test.go | 28 + .../core => base/keeper}/query_balance.go | 10 +- .../keeper}/query_balance_test.go | 10 +- .../core => base/keeper}/query_balances.go | 12 +- .../keeper}/query_balances_test.go | 12 +- .../core => base/keeper}/query_batch_info.go | 21 +- .../keeper}/query_batch_info_test.go | 22 +- .../core => base/keeper}/query_batches.go | 20 +- .../keeper}/query_batches_by_class.go | 20 +- .../keeper}/query_batches_by_class_test.go | 16 +- .../keeper}/query_batches_by_issuer.go | 20 +- .../keeper}/query_batches_by_issuer_test.go | 18 +- .../keeper}/query_batches_by_project.go | 20 +- .../keeper}/query_batches_by_project_test.go | 8 +- .../keeper}/query_batches_test.go | 24 +- .../core => base/keeper}/query_class_info.go | 10 +- .../keeper}/query_class_info_test.go | 8 +- .../keeper}/query_class_issuers.go | 8 +- .../keeper}/query_class_issuers_test.go | 26 +- .../core => base/keeper}/query_classes.go | 12 +- .../keeper}/query_classes_by_admin.go | 12 +- .../keeper}/query_classes_by_admin_test.go | 10 +- .../keeper}/query_classes_test.go | 6 +- .../base/keeper/query_credit_class_fees.go | 27 + .../keeper}/query_credit_class_fees_test.go | 23 +- .../core => base/keeper}/query_credit_type.go | 10 +- .../keeper}/query_credit_type_test.go | 9 +- .../keeper}/query_credit_types.go | 12 +- .../keeper}/query_credit_types_test.go | 6 +- .../core => base/keeper}/query_params.go | 24 +- .../core => base/keeper}/query_params_test.go | 28 +- .../keeper}/query_project_info.go | 10 +- .../keeper}/query_project_info_test.go | 8 +- .../core => base/keeper}/query_projects.go | 12 +- .../keeper}/query_projects_by_admin.go | 13 +- .../keeper}/query_projects_by_admin_test.go | 10 +- .../keeper}/query_projects_by_class.go | 12 +- .../keeper}/query_projects_by_class_test.go | 8 +- .../keeper}/query_projects_by_reference_id.go | 12 +- .../query_projects_by_reference_id_test.go | 8 +- .../keeper}/query_projects_test.go | 6 +- .../core => base/keeper}/query_supply.go | 8 +- .../core => base/keeper}/query_supply_test.go | 8 +- .../{server/core => base/keeper}/utils.go | 18 +- .../{ => base}/simulation/operations.go | 135 ++-- x/ecocredit/{core => base/types/v1}/codec.go | 2 +- .../{core => base/types/v1}/events.pb.go | 82 +-- .../features/msg_add_class_creator.feature | 0 .../v1}/features/msg_add_credit_type.feature | 0 .../types/v1}/features/msg_bridge.feature | 0 .../v1}/features/msg_bridge_receive.feature | 0 .../types/v1}/features/msg_cancel.feature | 0 .../v1}/features/msg_create_batch.feature | 0 .../v1}/features/msg_create_class.feature | 0 .../v1}/features/msg_create_project.feature | 0 .../features/msg_mint_batch_credits.feature | 0 .../features/msg_remove_class_creator.feature | 0 .../types/v1}/features/msg_retire.feature | 0 .../types/v1}/features/msg_seal_batch.feature | 0 .../types/v1}/features/msg_send.feature | 0 .../msg_toggle_class_allowlist.feature | 0 .../features/msg_update_class_admin.feature | 0 .../features/msg_update_class_fees.feature | 0 .../features/msg_update_class_issuers.feature | 0 .../msg_update_class_metadata.feature | 0 .../features/msg_update_project_admin.feature | 0 .../msg_update_project_metadata.feature | 0 .../types/v1}/features/state_batch.feature | 0 .../v1}/features/state_batch_balance.feature | 0 .../v1}/features/state_batch_contract.feature | 0 .../v1}/features/state_batch_sequence.feature | 0 .../v1}/features/state_batch_supply.feature | 0 .../types/v1}/features/state_class.feature | 0 .../v1}/features/state_class_issuer.feature | 0 .../v1}/features/state_class_sequence.feature | 0 .../v1}/features/state_credit_type.feature | 0 .../features/state_origin_tx_index.feature | 0 .../types/v1}/features/state_project.feature | 0 .../features/state_project_sequence.feature | 0 .../v1}/features/types_batch_issuance.feature | 0 .../types/v1}/features/types_credits.feature | 0 .../types/v1}/msg_add_class_creator.go | 2 +- .../types/v1}/msg_add_class_creator_test.go | 2 +- .../types/v1}/msg_add_credit_type.go | 2 +- .../types/v1}/msg_add_credit_type_test.go | 2 +- .../{core => base/types/v1}/msg_bridge.go | 9 +- .../types/v1}/msg_bridge_receive.go | 17 +- .../types/v1}/msg_bridge_receive_test.go | 2 +- .../types/v1}/msg_bridge_test.go | 2 +- .../{core => base/types/v1}/msg_cancel.go | 7 +- .../types/v1}/msg_cancel_test.go | 2 +- .../types/v1}/msg_create_batch.go | 9 +- .../types/v1}/msg_create_batch_test.go | 2 +- .../types/v1}/msg_create_class.go | 10 +- .../types/v1}/msg_create_class_test.go | 2 +- .../types/v1}/msg_create_project.go | 11 +- .../types/v1}/msg_create_project_test.go | 2 +- .../types/v1}/msg_credit_type_proposal.go | 2 +- .../v1}/msg_credit_type_proposal_test.go | 2 +- .../types/v1}/msg_mint_batch_credits.go | 5 +- .../types/v1}/msg_mint_batch_credits_test.go | 2 +- .../types/v1}/msg_remove_class_creator.go | 2 +- .../v1}/msg_remove_class_creator_test.go | 2 +- .../{core => base/types/v1}/msg_retire.go | 5 +- .../types/v1}/msg_retire_test.go | 2 +- .../{core => base/types/v1}/msg_seal_batch.go | 7 +- .../types/v1}/msg_seal_batch_test.go | 2 +- .../{core => base/types/v1}/msg_send.go | 7 +- .../{core => base/types/v1}/msg_send_test.go | 2 +- .../types/v1}/msg_toggle_class_allowlist.go | 2 +- .../v1}/msg_toggle_class_allowlist_test.go | 2 +- .../types/v1}/msg_update_class_admin.go | 5 +- .../types/v1}/msg_update_class_admin_test.go | 2 +- .../types/v1}/msg_update_class_fees.go | 2 +- .../types/v1}/msg_update_class_fees_test.go | 2 +- .../types/v1}/msg_update_class_issuers.go | 5 +- .../v1}/msg_update_class_issuers_test.go | 2 +- .../types/v1}/msg_update_class_metadata.go | 9 +- .../v1}/msg_update_class_metadata_test.go | 2 +- .../types/v1}/msg_update_project_admin.go | 5 +- .../v1}/msg_update_project_admin_test.go | 2 +- .../types/v1}/msg_update_project_metadata.go | 9 +- .../v1}/msg_update_project_metadata_test.go | 2 +- x/ecocredit/{core => base/types/v1}/params.go | 2 +- .../{core => base/types/v1}/query.pb.go | 308 ++++---- .../{core => base/types/v1}/query.pb.gw.go | 4 +- .../{core => base/types/v1}/state.pb.go | 148 ++-- .../{core => base/types/v1}/state_batch.go | 7 +- .../types/v1}/state_batch_balance.go | 2 +- .../types/v1}/state_batch_balance_test.go | 2 +- .../types/v1}/state_batch_contract.go | 2 +- .../types/v1}/state_batch_contract_test.go | 2 +- .../types/v1}/state_batch_sequence.go | 2 +- .../types/v1}/state_batch_sequence_test.go | 2 +- .../types/v1}/state_batch_supply.go | 2 +- .../types/v1}/state_batch_supply_test.go | 2 +- .../types/v1}/state_batch_test.go | 2 +- .../{core => base/types/v1}/state_class.go | 9 +- .../types/v1}/state_class_issuer.go | 2 +- .../types/v1}/state_class_issuer_test.go | 2 +- .../types/v1}/state_class_sequence.go | 5 +- .../types/v1}/state_class_sequence_test.go | 2 +- .../types/v1}/state_class_test.go | 2 +- .../types/v1}/state_credit_type.go | 5 +- .../types/v1}/state_credit_type_test.go | 2 +- .../types/v1}/state_origin_tx_index.go | 2 +- .../types/v1}/state_origin_tx_index_test.go | 2 +- .../{core => base/types/v1}/state_project.go | 9 +- .../types/v1}/state_project_sequence.go | 2 +- .../types/v1}/state_project_sequence_test.go | 2 +- .../types/v1}/state_project_test.go | 2 +- x/ecocredit/{core => base/types/v1}/tx.pb.go | 226 +++--- .../{core => base/types/v1}/types.pb.go | 80 +- .../types/v1}/types_batch_issuance.go | 5 +- .../types/v1}/types_batch_issuance_test.go | 2 +- .../{core => base/types/v1}/types_credits.go | 6 +- .../types/v1}/types_credits_test.go | 2 +- .../types/v1}/types_origin_tx.go | 7 +- .../types/v1}/types_origin_tx_test.go | 2 +- .../{core => base/types}/v1alpha1/codec.go | 0 .../types}/v1alpha1/events.pb.go | 62 +- .../types}/v1alpha1/genesis.pb.go | 60 +- .../{core => base/types}/v1alpha1/query.pb.go | 110 +-- .../types}/v1alpha1/query.pb.gw.go | 0 .../{core => base/types}/v1alpha1/tx.go | 0 .../{core => base/types}/v1alpha1/tx.pb.go | 121 ++-- .../{core => base/types}/v1alpha1/types.pb.go | 98 +-- x/ecocredit/{core => base}/utils.go | 2 +- x/ecocredit/{core => base}/utils_test.go | 41 +- x/ecocredit/basket/keeper/msg_create_test.go | 16 +- x/ecocredit/basket/keeper/msg_put.go | 13 +- x/ecocredit/basket/keeper/msg_put_test.go | 69 +- x/ecocredit/basket/keeper/msg_take.go | 17 +- x/ecocredit/basket/keeper/msg_take_test.go | 27 +- x/ecocredit/basket/simulation/operations.go | 28 +- x/ecocredit/basket/types/v1/msg_create.go | 6 +- x/ecocredit/basket/types/v1/msg_put.go | 4 +- x/ecocredit/basket/types/v1/msg_take.go | 6 +- x/ecocredit/basket/types/v1/state_basket.go | 4 +- .../basket/types/v1/state_basket_balance.go | 4 +- .../basket/types/v1/state_basket_class.go | 4 +- x/ecocredit/basket/utils.go | 4 +- x/ecocredit/client/query.go | 623 +--------------- x/ecocredit/client/testsuite/grpc.go | 40 +- x/ecocredit/client/testsuite/query.go | 107 +-- x/ecocredit/client/testsuite/query_basket.go | 4 +- x/ecocredit/client/testsuite/suite.go | 50 +- x/ecocredit/client/testsuite/tx.go | 66 +- x/ecocredit/client/tx.go | 682 +----------------- x/ecocredit/core/default.go | 37 - x/ecocredit/genesis/default.go | 50 +- x/ecocredit/genesis/genesis.go | 74 +- x/ecocredit/genesis/genesis_test.go | 162 ++--- x/ecocredit/marketplace/keeper/keeper_test.go | 22 +- .../marketplace/keeper/msg_sell_test.go | 14 +- .../keeper/query_sell_orders_test.go | 4 +- x/ecocredit/marketplace/keeper/utils.go | 7 +- .../marketplace/simulation/operations.go | 16 +- .../marketplace/types/v1/msg_buy_direct.go | 10 +- x/ecocredit/marketplace/types/v1/msg_sell.go | 4 +- .../types/v1/state_allowed_denom.go | 6 +- .../marketplace/types/v1/state_market.go | 4 +- x/ecocredit/migrations/v3/state.go | 21 +- x/ecocredit/migrations/v3/state_test.go | 24 +- x/ecocredit/module/module.go | 27 +- .../server/core/msg_toggle_class_allowlist.go | 23 - .../server/core/msg_update_class_fee.go | 26 - .../core/query_allowlist_enabled_test.go | 27 - .../server/core/query_credit_class_fees.go | 26 - x/ecocredit/server/expected_keepers.go | 4 +- x/ecocredit/server/genesis.go | 11 +- x/ecocredit/server/invariants.go | 4 +- x/ecocredit/server/invariants_test.go | 60 +- x/ecocredit/server/server.go | 20 +- x/ecocredit/server/server_test.go | 12 +- x/ecocredit/server/tests/bridge_test.go | 48 +- x/ecocredit/server/testsuite/genesis.go | 47 +- x/ecocredit/server/testsuite/suite.go | 96 +-- x/ecocredit/server/utils/utils.go | 4 +- x/ecocredit/simulation/genesis.go | 8 +- x/ecocredit/simulation/utils/utils.go | 12 +- 304 files changed, 3672 insertions(+), 3600 deletions(-) create mode 100644 x/ecocredit/base/client/query.go create mode 100644 x/ecocredit/base/client/tx.go rename x/ecocredit/{client/util.go => base/client/utils.go} (64%) rename x/ecocredit/{client/util_test.go => base/client/utils_test.go} (94%) rename x/ecocredit/{server/core => base/keeper}/features/msg_add_class_creator.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_add_credit_type.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_bridge.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_bridge_receive.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_cancel.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_create_batch.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_create_class.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_create_project.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_mint_batch_credits.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_remove_class_creator.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_retire.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_seal_batch.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_send.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_toggle_class_allowlist.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_update_class_admin.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_update_class_fee.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_update_class_issuers.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_update_class_metadata.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_update_project_admin.feature (100%) rename x/ecocredit/{server/core => base/keeper}/features/msg_update_project_metadata.feature (100%) rename x/ecocredit/{server/core => base/keeper}/invariants.go (92%) rename x/ecocredit/{server/core => base/keeper}/keeper.go (87%) rename x/ecocredit/{server/core => base/keeper}/keeper_test.go (99%) rename x/ecocredit/{server/core => base/keeper}/msg_add_class_creator.go (68%) rename x/ecocredit/{server/core => base/keeper}/msg_add_class_creator_test.go (82%) rename x/ecocredit/{server/core => base/keeper}/msg_add_credit_type.go (71%) rename x/ecocredit/{server/core => base/keeper}/msg_add_credit_type_test.go (85%) rename x/ecocredit/{server/core => base/keeper}/msg_bridge.go (79%) rename x/ecocredit/{server/core => base/keeper}/msg_bridge_receive.go (86%) rename x/ecocredit/{server/core => base/keeper}/msg_bridge_receive_test.go (85%) rename x/ecocredit/{server/core => base/keeper}/msg_bridge_test.go (93%) rename x/ecocredit/{server/core => base/keeper}/msg_cancel.go (90%) rename x/ecocredit/{server/core => base/keeper}/msg_cancel_test.go (94%) rename x/ecocredit/{server/core => base/keeper}/msg_create_batch.go (91%) rename x/ecocredit/{server/core => base/keeper}/msg_create_batch_test.go (87%) rename x/ecocredit/{server/core => base/keeper}/msg_create_class.go (89%) rename x/ecocredit/{server/core => base/keeper}/msg_create_class_test.go (91%) rename x/ecocredit/{server/core => base/keeper}/msg_create_project.go (87%) rename x/ecocredit/{server/core => base/keeper}/msg_create_project_test.go (87%) rename x/ecocredit/{server/core => base/keeper}/msg_mint_batch_credits.go (90%) rename x/ecocredit/{server/core => base/keeper}/msg_mint_batch_credits_test.go (87%) rename x/ecocredit/{server/core => base/keeper}/msg_remove_class_creators.go (77%) rename x/ecocredit/{server/core => base/keeper}/msg_remove_class_creators_test.go (85%) rename x/ecocredit/{server/core => base/keeper}/msg_retire.go (91%) rename x/ecocredit/{server/core => base/keeper}/msg_retire_test.go (94%) rename x/ecocredit/{server/core => base/keeper}/msg_seal_batch.go (73%) rename x/ecocredit/{server/core => base/keeper}/msg_seal_batch_test.go (87%) rename x/ecocredit/{server/core => base/keeper}/msg_send.go (91%) rename x/ecocredit/{server/core => base/keeper}/msg_send_test.go (94%) create mode 100644 x/ecocredit/base/keeper/msg_toggle_class_allowlist.go rename x/ecocredit/{server/core => base/keeper}/msg_toggle_class_allowlist_test.go (90%) rename x/ecocredit/{server/core => base/keeper}/msg_update_class_admin.go (77%) rename x/ecocredit/{server/core => base/keeper}/msg_update_class_admin_test.go (83%) create mode 100644 x/ecocredit/base/keeper/msg_update_class_fee.go rename x/ecocredit/{server/core => base/keeper}/msg_update_class_fee_test.go (91%) rename x/ecocredit/{server/core => base/keeper}/msg_update_class_issuers.go (83%) rename x/ecocredit/{server/core => base/keeper}/msg_update_class_issuers_test.go (86%) rename x/ecocredit/{server/core => base/keeper}/msg_update_class_metadata.go (71%) rename x/ecocredit/{server/core => base/keeper}/msg_update_class_metadata_test.go (83%) rename x/ecocredit/{server/core => base/keeper}/msg_update_project_admin.go (75%) rename x/ecocredit/{server/core => base/keeper}/msg_update_project_admin_test.go (84%) rename x/ecocredit/{server/core => base/keeper}/msg_update_project_metadata.go (78%) rename x/ecocredit/{server/core => base/keeper}/msg_update_project_metadata_test.go (83%) rename x/ecocredit/{server/core => base/keeper}/query_all_balances.go (81%) rename x/ecocredit/{server/core => base/keeper}/query_all_balances_test.go (88%) rename x/ecocredit/{server/core => base/keeper}/query_allowed_class_creators.go (77%) rename x/ecocredit/{server/core => base/keeper}/query_allowed_class_creators_test.go (57%) rename x/ecocredit/{server/core => base/keeper}/query_allowlist_enabled.go (53%) create mode 100644 x/ecocredit/base/keeper/query_allowlist_enabled_test.go rename x/ecocredit/{server/core => base/keeper}/query_balance.go (75%) rename x/ecocredit/{server/core => base/keeper}/query_balance_test.go (86%) rename x/ecocredit/{server/core => base/keeper}/query_balances.go (74%) rename x/ecocredit/{server/core => base/keeper}/query_balances_test.go (86%) rename x/ecocredit/{server/core => base/keeper}/query_batch_info.go (54%) rename x/ecocredit/{server/core => base/keeper}/query_batch_info_test.go (64%) rename x/ecocredit/{server/core => base/keeper}/query_batches.go (66%) rename x/ecocredit/{server/core => base/keeper}/query_batches_by_class.go (72%) rename x/ecocredit/{server/core => base/keeper}/query_batches_by_class_test.go (78%) rename x/ecocredit/{server/core => base/keeper}/query_batches_by_issuer.go (66%) rename x/ecocredit/{server/core => base/keeper}/query_batches_by_issuer_test.go (73%) rename x/ecocredit/{server/core => base/keeper}/query_batches_by_project.go (68%) rename x/ecocredit/{server/core => base/keeper}/query_batches_by_project_test.go (83%) rename x/ecocredit/{server/core => base/keeper}/query_batches_test.go (72%) rename x/ecocredit/{server/core => base/keeper}/query_class_info.go (67%) rename x/ecocredit/{server/core => base/keeper}/query_class_info_test.go (78%) rename x/ecocredit/{server/core => base/keeper}/query_class_issuers.go (82%) rename x/ecocredit/{server/core => base/keeper}/query_class_issuers_test.go (66%) rename x/ecocredit/{server/core => base/keeper}/query_classes.go (76%) rename x/ecocredit/{server/core => base/keeper}/query_classes_by_admin.go (76%) rename x/ecocredit/{server/core => base/keeper}/query_classes_by_admin_test.go (82%) rename x/ecocredit/{server/core => base/keeper}/query_classes_test.go (87%) create mode 100644 x/ecocredit/base/keeper/query_credit_class_fees.go rename x/ecocredit/{server/core => base/keeper}/query_credit_class_fees_test.go (56%) rename x/ecocredit/{server/core => base/keeper}/query_credit_type.go (56%) rename x/ecocredit/{server/core => base/keeper}/query_credit_type_test.go (79%) rename x/ecocredit/{server/core => base/keeper}/query_credit_types.go (61%) rename x/ecocredit/{server/core => base/keeper}/query_credit_types_test.go (86%) rename x/ecocredit/{server/core => base/keeper}/query_params.go (69%) rename x/ecocredit/{server/core => base/keeper}/query_params_test.go (57%) rename x/ecocredit/{server/core => base/keeper}/query_project_info.go (71%) rename x/ecocredit/{server/core => base/keeper}/query_project_info_test.go (81%) rename x/ecocredit/{server/core => base/keeper}/query_projects.go (78%) rename x/ecocredit/{server/core => base/keeper}/query_projects_by_admin.go (74%) rename x/ecocredit/{server/core => base/keeper}/query_projects_by_admin_test.go (84%) rename x/ecocredit/{server/core => base/keeper}/query_projects_by_class.go (81%) rename x/ecocredit/{server/core => base/keeper}/query_projects_by_class_test.go (85%) rename x/ecocredit/{server/core => base/keeper}/query_projects_by_reference_id.go (82%) rename x/ecocredit/{server/core => base/keeper}/query_projects_by_reference_id_test.go (85%) rename x/ecocredit/{server/core => base/keeper}/query_projects_test.go (89%) rename x/ecocredit/{server/core => base/keeper}/query_supply.go (72%) rename x/ecocredit/{server/core => base/keeper}/query_supply_test.go (79%) rename x/ecocredit/{server/core => base/keeper}/utils.go (82%) rename x/ecocredit/{ => base}/simulation/operations.go (90%) rename x/ecocredit/{core => base/types/v1}/codec.go (99%) rename x/ecocredit/{core => base/types/v1}/events.pb.go (96%) rename x/ecocredit/{core => base/types/v1}/features/msg_add_class_creator.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_add_credit_type.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_bridge.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_bridge_receive.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_cancel.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_create_batch.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_create_class.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_create_project.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_mint_batch_credits.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_remove_class_creator.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_retire.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_seal_batch.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_send.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_toggle_class_allowlist.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_update_class_admin.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_update_class_fees.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_update_class_issuers.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_update_class_metadata.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_update_project_admin.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/msg_update_project_metadata.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_batch.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_batch_balance.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_batch_contract.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_batch_sequence.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_batch_supply.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_class.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_class_issuer.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_class_sequence.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_credit_type.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_origin_tx_index.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_project.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/state_project_sequence.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/types_batch_issuance.feature (100%) rename x/ecocredit/{core => base/types/v1}/features/types_credits.feature (100%) rename x/ecocredit/{core => base/types/v1}/msg_add_class_creator.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_add_class_creator_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_add_credit_type.go (99%) rename x/ecocredit/{core => base/types/v1}/msg_add_credit_type_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_bridge.go (91%) rename x/ecocredit/{core => base/types/v1}/msg_bridge_receive.go (89%) rename x/ecocredit/{core => base/types/v1}/msg_bridge_receive_test.go (99%) rename x/ecocredit/{core => base/types/v1}/msg_bridge_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_cancel.go (88%) rename x/ecocredit/{core => base/types/v1}/msg_cancel_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_create_batch.go (90%) rename x/ecocredit/{core => base/types/v1}/msg_create_batch_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_create_class.go (91%) rename x/ecocredit/{core => base/types/v1}/msg_create_class_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_create_project.go (85%) rename x/ecocredit/{core => base/types/v1}/msg_create_project_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_credit_type_proposal.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_credit_type_proposal_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_mint_batch_credits.go (92%) rename x/ecocredit/{core => base/types/v1}/msg_mint_batch_credits_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_remove_class_creator.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_remove_class_creator_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_retire.go (91%) rename x/ecocredit/{core => base/types/v1}/msg_retire_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_seal_batch.go (89%) rename x/ecocredit/{core => base/types/v1}/msg_seal_batch_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_send.go (90%) rename x/ecocredit/{core => base/types/v1}/msg_send_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_toggle_class_allowlist.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_toggle_class_allowlist_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_update_class_admin.go (90%) rename x/ecocredit/{core => base/types/v1}/msg_update_class_admin_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_update_class_fees.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_update_class_fees_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_update_class_issuers.go (94%) rename x/ecocredit/{core => base/types/v1}/msg_update_class_issuers_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_update_class_metadata.go (83%) rename x/ecocredit/{core => base/types/v1}/msg_update_class_metadata_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_update_project_admin.go (90%) rename x/ecocredit/{core => base/types/v1}/msg_update_project_admin_test.go (98%) rename x/ecocredit/{core => base/types/v1}/msg_update_project_metadata.go (83%) rename x/ecocredit/{core => base/types/v1}/msg_update_project_metadata_test.go (98%) rename x/ecocredit/{core => base/types/v1}/params.go (99%) rename x/ecocredit/{core => base/types/v1}/query.pb.go (95%) rename x/ecocredit/{core => base/types/v1}/query.pb.gw.go (99%) rename x/ecocredit/{core => base/types/v1}/state.pb.go (93%) rename x/ecocredit/{core => base/types/v1}/state_batch.go (88%) rename x/ecocredit/{core => base/types/v1}/state_batch_balance.go (98%) rename x/ecocredit/{core => base/types/v1}/state_batch_balance_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_batch_contract.go (97%) rename x/ecocredit/{core => base/types/v1}/state_batch_contract_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_batch_sequence.go (96%) rename x/ecocredit/{core => base/types/v1}/state_batch_sequence_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_batch_supply.go (98%) rename x/ecocredit/{core => base/types/v1}/state_batch_supply_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_batch_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_class.go (74%) rename x/ecocredit/{core => base/types/v1}/state_class_issuer.go (97%) rename x/ecocredit/{core => base/types/v1}/state_class_issuer_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_class_sequence.go (72%) rename x/ecocredit/{core => base/types/v1}/state_class_sequence_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_class_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_credit_type.go (84%) rename x/ecocredit/{core => base/types/v1}/state_credit_type_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_origin_tx_index.go (98%) rename x/ecocredit/{core => base/types/v1}/state_origin_tx_index_test.go (99%) rename x/ecocredit/{core => base/types/v1}/state_project.go (76%) rename x/ecocredit/{core => base/types/v1}/state_project_sequence.go (96%) rename x/ecocredit/{core => base/types/v1}/state_project_sequence_test.go (98%) rename x/ecocredit/{core => base/types/v1}/state_project_test.go (98%) rename x/ecocredit/{core => base/types/v1}/tx.pb.go (96%) rename x/ecocredit/{core => base/types/v1}/types.pb.go (91%) rename x/ecocredit/{core => base/types/v1}/types_batch_issuance.go (87%) rename x/ecocredit/{core => base/types/v1}/types_batch_issuance_test.go (98%) rename x/ecocredit/{core => base/types/v1}/types_credits.go (77%) rename x/ecocredit/{core => base/types/v1}/types_credits_test.go (98%) rename x/ecocredit/{core => base/types/v1}/types_origin_tx.go (87%) rename x/ecocredit/{core => base/types/v1}/types_origin_tx_test.go (99%) rename x/ecocredit/{core => base/types}/v1alpha1/codec.go (100%) rename x/ecocredit/{core => base/types}/v1alpha1/events.pb.go (94%) rename x/ecocredit/{core => base/types}/v1alpha1/genesis.pb.go (91%) rename x/ecocredit/{core => base/types}/v1alpha1/query.pb.go (94%) rename x/ecocredit/{core => base/types}/v1alpha1/query.pb.gw.go (100%) rename x/ecocredit/{core => base/types}/v1alpha1/tx.go (100%) rename x/ecocredit/{core => base/types}/v1alpha1/tx.pb.go (95%) rename x/ecocredit/{core => base/types}/v1alpha1/types.pb.go (91%) rename x/ecocredit/{core => base}/utils.go (99%) rename x/ecocredit/{core => base}/utils_test.go (80%) delete mode 100644 x/ecocredit/core/default.go delete mode 100644 x/ecocredit/server/core/msg_toggle_class_allowlist.go delete mode 100644 x/ecocredit/server/core/msg_update_class_fee.go delete mode 100644 x/ecocredit/server/core/query_allowlist_enabled_test.go delete mode 100644 x/ecocredit/server/core/query_credit_class_fees.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 038b2dd6a9..f638f5c6d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -121,6 +121,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#1428](https://github.com/regen-network/regen-ledger/pull/1428) Migrated `ecocredit/client/basket` to `ecocredit/basket/client` - [#1428](https://github.com/regen-network/regen-ledger/pull/1428) Migrated `ecocredit/server/basket` to `ecocredit/basket/keeper` - [#1428](https://github.com/regen-network/regen-ledger/pull/1428) Migrated `ecocredit/simulation/basket` to `ecocredit/basket/simulation` +- [#1429](https://github.com/regen-network/regen-ledger/pull/1429) Migrated `ecocredit/core` to `ecocredit/base/types/v1` +- [#1429](https://github.com/regen-network/regen-ledger/pull/1429) Migrated `ecocredit/client` core commands to `ecocredit/base/client` +- [#1429](https://github.com/regen-network/regen-ledger/pull/1429) Migrated `ecocredit/server/core` to `ecocredit/base/keeper` +- [#1429](https://github.com/regen-network/regen-ledger/pull/1429) Migrated `ecocredit/simulation` core operations to `ecocredit/base/simulation` ### Fixed diff --git a/proto/regen/ecocredit/v1/events.proto b/proto/regen/ecocredit/v1/events.proto index 019300ba0a..a535dc58aa 100644 --- a/proto/regen/ecocredit/v1/events.proto +++ b/proto/regen/ecocredit/v1/events.proto @@ -4,7 +4,7 @@ package regen.ecocredit.v1; import "regen/ecocredit/v1/types.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1"; // EventCreateClass is an event emitted when a credit class is created. message EventCreateClass { diff --git a/proto/regen/ecocredit/v1/query.proto b/proto/regen/ecocredit/v1/query.proto index 478eabe008..d3d97e97f9 100644 --- a/proto/regen/ecocredit/v1/query.proto +++ b/proto/regen/ecocredit/v1/query.proto @@ -10,7 +10,7 @@ import "google/protobuf/timestamp.proto"; import "regen/ecocredit/v1/state.proto"; import "regen/ecocredit/v1/types.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1"; // Msg is the regen.ecocredit.v1 Query service. service Query { diff --git a/proto/regen/ecocredit/v1/state.proto b/proto/regen/ecocredit/v1/state.proto index c6384db262..9c2344abc3 100644 --- a/proto/regen/ecocredit/v1/state.proto +++ b/proto/regen/ecocredit/v1/state.proto @@ -6,7 +6,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "cosmos/orm/v1alpha1/orm.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1"; // CreditType defines the measurement unit/precision of a certain credit type // (e.g. carbon, biodiversity...) diff --git a/proto/regen/ecocredit/v1/tx.proto b/proto/regen/ecocredit/v1/tx.proto index 6bc5503b3e..74537ffbc6 100644 --- a/proto/regen/ecocredit/v1/tx.proto +++ b/proto/regen/ecocredit/v1/tx.proto @@ -9,7 +9,7 @@ import "google/protobuf/timestamp.proto"; import "regen/ecocredit/v1/state.proto"; import "regen/ecocredit/v1/types.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1"; // Msg is the regen.ecocredit.v1 Msg service. service Msg { diff --git a/proto/regen/ecocredit/v1/types.proto b/proto/regen/ecocredit/v1/types.proto index a64e5026af..fd7029d898 100644 --- a/proto/regen/ecocredit/v1/types.proto +++ b/proto/regen/ecocredit/v1/types.proto @@ -6,7 +6,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "regen/ecocredit/v1/state.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1"; // Params defines the updatable global parameters of the ecocredit module for // use with the x/params module. diff --git a/proto/regen/ecocredit/v1alpha1/events.proto b/proto/regen/ecocredit/v1alpha1/events.proto index 257d3320d2..97ac558a6b 100644 --- a/proto/regen/ecocredit/v1alpha1/events.proto +++ b/proto/regen/ecocredit/v1alpha1/events.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package regen.ecocredit.v1alpha1; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core/v1alpha1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1alpha1"; // EventCreateClass is an event emitted when a credit class is created. message EventCreateClass { diff --git a/proto/regen/ecocredit/v1alpha1/genesis.proto b/proto/regen/ecocredit/v1alpha1/genesis.proto index 8ed7ebfaad..949d9afec3 100644 --- a/proto/regen/ecocredit/v1alpha1/genesis.proto +++ b/proto/regen/ecocredit/v1alpha1/genesis.proto @@ -5,7 +5,7 @@ package regen.ecocredit.v1alpha1; import "gogoproto/gogo.proto"; import "regen/ecocredit/v1alpha1/types.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core/v1alpha1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1alpha1"; // GenesisState defines ecocredit module's genesis state. message GenesisState { diff --git a/proto/regen/ecocredit/v1alpha1/query.proto b/proto/regen/ecocredit/v1alpha1/query.proto index a525652314..987199d6ae 100644 --- a/proto/regen/ecocredit/v1alpha1/query.proto +++ b/proto/regen/ecocredit/v1alpha1/query.proto @@ -6,7 +6,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; import "regen/ecocredit/v1alpha1/types.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core/v1alpha1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1alpha1"; // Msg is the regen.ecocredit.v1alpha1 Query service. service Query { diff --git a/proto/regen/ecocredit/v1alpha1/tx.proto b/proto/regen/ecocredit/v1alpha1/tx.proto index df54af85a0..c327395fb9 100644 --- a/proto/regen/ecocredit/v1alpha1/tx.proto +++ b/proto/regen/ecocredit/v1alpha1/tx.proto @@ -5,7 +5,7 @@ package regen.ecocredit.v1alpha1; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core/v1alpha1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1alpha1"; // Msg is the regen.ecocredit.v1alpha1 Msg service. service Msg { diff --git a/proto/regen/ecocredit/v1alpha1/types.proto b/proto/regen/ecocredit/v1alpha1/types.proto index 9c8b47a8eb..4d4d3a64da 100644 --- a/proto/regen/ecocredit/v1alpha1/types.proto +++ b/proto/regen/ecocredit/v1alpha1/types.proto @@ -6,7 +6,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/core/v1alpha1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1alpha1"; // ClassInfo represents the high-level on-chain information for a credit class. message ClassInfo { diff --git a/x/ecocredit/base/client/query.go b/x/ecocredit/base/client/query.go new file mode 100644 index 0000000000..2255420876 --- /dev/null +++ b/x/ecocredit/base/client/query.go @@ -0,0 +1,588 @@ +package client + +import ( + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" +) + +// QueryClassesCmd returns a query command that lists all credit classes. +func QueryClassesCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "classes", + Short: "List all credit classes", + Long: "List all credit classes with optional pagination flags.", + Example: `regen q ecocredit classes +regen q ecocredit classes --limit 10 --offset 10`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.Classes(cmd.Context(), &types.QueryClassesRequest{ + Pagination: pagination, + }) + return printQueryResponse(ctx, res, err) + }, + } + flags.AddPaginationFlagsToCmd(cmd, "classes") + return qflags(cmd) +} + +// QueryClassCmd returns a query command that retrieves information for a +// given credit class. +func QueryClassCmd() *cobra.Command { + return qflags(&cobra.Command{ + Use: "class [class-id]", + Short: "Retrieve credit class information", + Long: "Retrieve credit class information.", + Example: "regen q ecocredit class C01", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + res, err := c.Class(cmd.Context(), &types.QueryClassRequest{ + ClassId: args[0], + }) + return printQueryResponse(ctx, res, err) + }, + }) +} + +// QueryClassIssuersCmd returns a query command that retrieves addresses of the +// credit class issuers. +func QueryClassIssuersCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "class-issuers [class-id]", + Short: "Retrieve issuer addresses for a credit class", + Long: "Retrieve issuer addresses for a credit class with optional pagination flags.", + Example: `regen q ecocredit class-issuers C01 +regen q ecocredit class-issuers C01 --limit 10 --offset 10`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.ClassIssuers(cmd.Context(), &types.QueryClassIssuersRequest{ + ClassId: args[0], + Pagination: pagination, + }) + if err != nil { + return err + } + + return printQueryResponse(ctx, res, err) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "class-issuers") + return qflags(cmd) +} + +// QueryProjectsCmd returns a query command that retrieves all projects. +func QueryProjectsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "projects", + Short: "List all projects", + Long: "List all projects with optional pagination flags.", + Example: `regen q ecocredit projects +regen q ecocredit projects --limit 10 --offset 10`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.Projects(cmd.Context(), &types.QueryProjectsRequest{ + Pagination: pagination, + }) + + return printQueryResponse(ctx, res, err) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "projects") + + return qflags(cmd) +} + +// QueryProjectsByClassCmd returns a query command that retrieves projects by credit class. +func QueryProjectsByClassCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "projects-by-class [class-id]", + Short: "List projects by credit class", + Long: "List projects by credit class with optional pagination flags.", + Example: `regen q ecocredit projects-by-class C01 +regen q ecocredit projects-by-class C01 --limit 10 --offset 10`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.ProjectsByClass(cmd.Context(), &types.QueryProjectsByClassRequest{ + ClassId: args[0], + Pagination: pagination, + }) + return printQueryResponse(ctx, res, err) + }, + } + flags.AddPaginationFlagsToCmd(cmd, "projects-by-class") + return qflags(cmd) +} + +// QueryProjectCmd returns a query command that retrieves project information. +func QueryProjectCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "project [project-id]", + Short: "Retrieve project information", + Long: "Retrieve project information.", + Example: `regen q ecocredit project C01-001`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + res, err := c.Project(cmd.Context(), &types.QueryProjectRequest{ + ProjectId: args[0], + }) + return printQueryResponse(ctx, res, err) + }, + } + + return qflags(cmd) +} + +// QueryBatchesCmd returns a query command that retrieves credit batches for a +// given project. +func QueryBatchesCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "batches", + Short: "List all credit batches", + Long: "List all credit batches with optional pagination flags.", + Example: `regen q ecocredit batches +regen q ecocredit batches --limit 10 --offset 10`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.Batches(cmd.Context(), &types.QueryBatchesRequest{ + Pagination: pagination, + }) + + return printQueryResponse(ctx, res, err) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "batches") + + return qflags(cmd) +} + +// QueryBatchesByIssuerCmd returns a query command that retrieves credit batches by issuer. +func QueryBatchesByIssuerCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "batches-by-issuer [issuer]", + Short: "List all credit batches by issuer", + Long: "List all credit batches by issuer with optional pagination flags.", + Example: `regen q ecocredit batches-by-issuer regen1r9pl9gvr56kmclgkpjg3ynh4rm5am66f2a6y38 +regen q ecocredit batches-by-issuer regen1r9pl9gvr56kmclgkpjg3ynh4rm5am66f2a6y38 --limit 10 --offset 10`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.BatchesByIssuer(cmd.Context(), &types.QueryBatchesByIssuerRequest{ + Issuer: args[0], + Pagination: pagination, + }) + + return printQueryResponse(ctx, res, err) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "batches-by-issuer") + + return qflags(cmd) +} + +// QueryBatchesByClassCmd returns a query command that retrieves credit batches for a +// given credit class. +func QueryBatchesByClassCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "batches-by-class [class-id]", + Short: "List all credit batches by credit class", + Long: "List all credit batches by credit class with pagination flags.", + Example: `regen q ecocredit batches-by-class C01 +regen q ecocredit batches-by-class C01 --limit 10 --offset 10`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.BatchesByClass(cmd.Context(), &types.QueryBatchesByClassRequest{ + ClassId: args[0], + Pagination: pagination, + }) + + return printQueryResponse(ctx, res, err) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "batches-by-class") + + return qflags(cmd) +} + +// QueryBatchesByProjectCmd returns a query command that retrieves credit batches for a +// given project. +func QueryBatchesByProjectCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "batches-by-project [project-id]", + Short: "List all credit batches by project", + Long: "List all credit batches by project with optional pagination flags.", + Example: `regen q ecocredit batches-by-project C01-001 +regen q ecocredit batches-by-project C01-001 --limit 10 --offset 10`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.BatchesByProject(cmd.Context(), &types.QueryBatchesByProjectRequest{ + ProjectId: args[0], + Pagination: pagination, + }) + + return printQueryResponse(ctx, res, err) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "batches-by-project") + + return qflags(cmd) +} + +// QueryBatchCmd returns a query command that retrieves information for a +// given credit batch. +func QueryBatchCmd() *cobra.Command { + return qflags(&cobra.Command{ + Use: "batch [batch-denom]", + Short: "Retrieve credit batch information", + Long: "Retrieve credit batch information.", + Example: "regen q ecocredit batch C01-001-20200101-20210101-001", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + res, err := c.Batch(cmd.Context(), &types.QueryBatchRequest{ + BatchDenom: args[0], + }) + return printQueryResponse(ctx, res, err) + }, + }) +} + +// QueryBatchBalanceCmd returns a query command that retrieves the tradable and +// retired balances for a given credit batch and account address. +func QueryBatchBalanceCmd() *cobra.Command { + return qflags(&cobra.Command{ + Use: "batch-balance [batch-denom] [account]", + Short: "Retrieve the batch balance of an account", + Long: "Retrieve the batch balance of an account.", + Example: "regen q ecocredit batch-balance C01-001-20200101-20210101-001 regen1r9pl9gvr56kmclgkpjg3ynh4rm5am66f2a6y38", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + res, err := c.Balance(cmd.Context(), &types.QueryBalanceRequest{ + BatchDenom: args[0], Address: args[1], + }) + return printQueryResponse(ctx, res, err) + }, + }) +} + +// QueryBatchSupplyCmd returns a query command that retrieves the tradable and +// retired supply of credits for a given credit batch. +func QueryBatchSupplyCmd() *cobra.Command { + return qflags(&cobra.Command{ + Use: "batch-supply [batch-denom]", + Short: "Retrieve the supply of a credit batch", + Long: "Retrieve the supply of a credit batch.", + Example: "regen q ecocredit batch-supply C01-001-20200101-20210101-001", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + res, err := c.Supply(cmd.Context(), &types.QuerySupplyRequest{ + BatchDenom: args[0], + }) + return printQueryResponse(ctx, res, err) + }, + }) +} + +// QueryCreditTypesCmd returns a query command that retrieves the list of +// approved credit types. +func QueryCreditTypesCmd() *cobra.Command { + return qflags(&cobra.Command{ + Use: "credit-types", + Short: "List all credit types", + Long: "List all credit types.", + Example: "regen q ecocredit types", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + res, err := c.CreditTypes(cmd.Context(), &types.QueryCreditTypesRequest{}) + return printQueryResponse(ctx, res, err) + }, + }) +} + +// QueryParamsCmd returns ecocredit module parameters. +func QueryParamsCmd() *cobra.Command { + return qflags(&cobra.Command{ + Use: "params", + Short: "List the current ecocredit module parameters", + Long: "List the current ecocredit module parameters.", + Example: "regen q ecocredit params", + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + res, err := c.Params(cmd.Context(), &types.QueryParamsRequest{}) + return printQueryResponse(ctx, res, err) + }, + }) +} + +// QueryProjectsByReferenceIDCmd returns command that retrieves list of projects by reference id with pagination. +func QueryProjectsByReferenceIDCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "projects-by-reference-id [reference-id]", + Short: "List all projects by reference ID", + Long: "List all projects by reference ID with optional pagination flags.", + Example: `regen q ecocredit projects-by-reference-id VCS-001 +regen q ecocredit projects-by-reference-id VCS-001 --limit 10 --offset 10`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.ProjectsByReferenceId(cmd.Context(), &types.QueryProjectsByReferenceIdRequest{ + ReferenceId: args[0], + Pagination: pagination, + }) + return printQueryResponse(ctx, res, err) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "projects-by-reference-id") + + return qflags(cmd) +} + +// QueryProjectsByAdminCmd returns command that retrieves list of projects by admin with pagination. +func QueryProjectsByAdminCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "projects-by-admin [admin]", + Short: "List projects by admin", + Long: "List projects by admin with optional pagination flags.", + Example: `regen q ecocredit projects-by-admin regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw +regen q ecocredit projects-by-admin regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw --limit 10 --offset 10`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.ProjectsByAdmin(cmd.Context(), &types.QueryProjectsByAdminRequest{ + Admin: args[0], + Pagination: pagination, + }) + return printQueryResponse(ctx, res, err) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "projects-by-admin") + + return qflags(cmd) +} + +// QueryCreditTypeCmd returns a query command that retrieves credit type +// information by abbreviation. +func QueryCreditTypeCmd() *cobra.Command { + return qflags(&cobra.Command{ + Use: "credit-type [abbreviation]", + Short: "Retrieve credit type information", + Long: "Retrieve credit type information.", + Example: "regen q ecocredit credit-type C", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + res, err := c.CreditType(cmd.Context(), &types.QueryCreditTypeRequest{ + Abbreviation: args[0], + }) + return printQueryResponse(ctx, res, err) + }, + }) +} + +// QueryCreditClassFeesCmd returns a query command that retrives the credit class fees. +func QueryCreditClassFeesCmd() *cobra.Command { + return qflags(&cobra.Command{ + Use: "credit-class-fees", + Short: "Retrieve the credit class fees", + Long: "Retrieve the credit class fess", + Example: "regen q ecocredit credit-class-fees", + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + res, err := c.CreditClassFees(cmd.Context(), &types.QueryCreditClassFeesRequest{}) + return printQueryResponse(ctx, res, err) + }, + }) +} + +// QueryCreditClassAllowlistEnabledCmd returns a query command that retrives the +// class allow-list enable/disable flag. +func QueryCreditClassAllowlistEnabledCmd() *cobra.Command { + return qflags(&cobra.Command{ + Use: "credit-class-allowlist-enabled", + Short: "Retrieve the credit class allow-list setting", + Long: "Retrieve the credit class allow-list setting", + Example: "regen q ecocredit credit-class-allowlist-enabled", + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + res, err := c.CreditClassAllowlistEnabled(cmd.Context(), &types.QueryCreditClassAllowlistEnabledRequest{}) + return printQueryResponse(ctx, res, err) + }, + }) +} + +// QueryAllowedClassCreatorsCmd returns a query command that retrives the list of allowed +// credit class creators with pagination. +func QueryAllowedClassCreatorsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "allowed-class-creators", + Short: "Retrieve the allowed credit class creators", + Long: "Retrieve the list of allowed credit class creators with pagination", + Example: ` + regen q ecocredit allowed-class-creators + regen q ecocredit allowed-class-creators --limit 10`, + RunE: func(cmd *cobra.Command, args []string) error { + c, ctx, err := mkQueryClient(cmd) + if err != nil { + return err + } + + pagination, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := c.AllowedClassCreators(cmd.Context(), &types.QueryAllowedClassCreatorsRequest{ + Pagination: pagination, + }) + return printQueryResponse(ctx, res, err) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "batches-by-project") + + return qflags(cmd) +} diff --git a/x/ecocredit/base/client/tx.go b/x/ecocredit/base/client/tx.go new file mode 100644 index 0000000000..eff06a9bef --- /dev/null +++ b/x/ecocredit/base/client/tx.go @@ -0,0 +1,662 @@ +package client + +import ( + "bytes" + "encoding/json" + "fmt" + "strconv" + "strings" + + "github.com/spf13/cobra" + + sdkclient "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" +) + +const ( + FlagAddIssuers string = "add-issuers" + FlagRemoveIssuers string = "remove-issuers" + FlagReferenceID string = "reference-id" + FlagRetirementJurisdiction string = "retirement-jurisdiction" +) + +// TxCreateClassCmd returns a transaction command that creates a credit class. +func TxCreateClassCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-class [issuers] [credit-type-abbrev] [metadata] [fee] [flags]", + Short: "Creates a new credit class with transaction author (--from) as admin", + Long: fmt.Sprintf(`Creates a new credit class with transaction author (--from) as admin. + +The transaction author must have permission to create a new credit class by +being on the list of %s. This is a governance parameter, which +can be queried via the command line. + +They must also pay a fee (separate from the transaction fee) to create a credit +class. The list of accepted fees is defined by the %s parameter. + +Parameters: + +- issuers: comma separated (no spaces) list of issuer account addresses +- credit-type-abbrev: the abbreviation of a credit type +- metadata: arbitrary data attached to the credit class info +- fee: fee to pay for the creation of the credit class`, + types.KeyAllowedClassCreators, + types.KeyCreditClassFee, + ), + Example: `regen tx ecocredit create-class regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw C regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf 20000000uregen +regen tx ecocredit create-class regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw,regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6 C regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf 20000000uregen`, + Args: cobra.ExactArgs(4), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + // Get the class admin from the --from flag + admin := clientCtx.GetFromAddress() + + // Parse the comma-separated list of issuers + issuers := strings.Split(args[0], ",") + for i := range issuers { + issuers[i] = strings.TrimSpace(issuers[i]) + } + + // Parse and normalize credit class fee + fee, err := sdk.ParseCoinNormalized(args[3]) + if err != nil { + return err + } + + msg := types.MsgCreateClass{ + Admin: admin.String(), + Issuers: issuers, + Metadata: args[2], + CreditTypeAbbrev: args[1], + Fee: &fee, + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + return txFlags(cmd) +} + +// TxCreateProjectCmd returns a transaction command that creates a new project. +func TxCreateProjectCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-project [class-id] [jurisdiction] [metadata] [flags]", + Short: "Create a new project within a credit class", + Long: `Create a new project within a credit class. + +Parameters: + +- class-id: the ID of the credit class +- jurisdiction: the jurisdiction of the project +- metadata: any arbitrary metadata to attach to the project + +Optional Flags: + +- reference-id: a reference ID for the project`, + Example: `regen tx ecocredit create-project C01 "US-WA 98225" regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf +regen tx ecocredit create-project C01 "US-WA 98225" regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf --reference-id VCS-001`, + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + referenceID, err := cmd.Flags().GetString(FlagReferenceID) + if err != nil { + return err + } + + msg := types.MsgCreateProject{ + Admin: clientCtx.GetFromAddress().String(), + ClassId: args[0], + Jurisdiction: args[1], + Metadata: args[2], + ReferenceId: referenceID, + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + + }, + } + + cmd.Flags().String(FlagReferenceID, "", "a reference ID for the project") + + return txFlags(cmd) +} + +// TxGenBatchJSONCmd returns a transaction command that generates JSON to +// represent a new credit batch. +func TxGenBatchJSONCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: `gen-batch-json [issuer] [project-id] [issuance-count] [metadata] [start-date] [end-date]`, + Short: "Generates JSON to represent a new credit batch for use with create-batch command", + Long: `Generates JSON to represent a new credit batch for use with create-batch command. + +Parameters: + +- issuer: the account address of the credit batch issuer +- project-id: the ID of the project +- issuance-count: the number of issuance items to generate +- metadata: any arbitrary metadata to attach to the credit batch +- start-date: the beginning of the period during which this credit batch was + quantified and verified (format: yyyy-mm-dd) +- end-date: the end of the period during which this credit batch was + quantified and verified (format: yyyy-mm-dd)`, + Example: "regen tx ecocredit gen-batch-json regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw C01-001 2 regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf 2020-01-01 2021-01-01", + Args: cobra.ExactArgs(6), + RunE: func(cmd *cobra.Command, args []string) error { + issuanceCount, err := strconv.ParseUint(args[2], 10, 8) + if err != nil { + return err + } + + issuance := make([]*types.BatchIssuance, issuanceCount) + for i := range issuance { + issuance[i] = &types.BatchIssuance{} + } + + startDate, err := regentypes.ParseDate("start date", args[4]) + if err != nil { + return err + } + + endDate, err := regentypes.ParseDate("end date", args[5]) + if err != nil { + return err + } + + msg := &types.MsgCreateBatch{ + Issuer: args[0], + ProjectId: args[1], + Issuance: issuance, + Metadata: args[3], + StartDate: &startDate, + EndDate: &endDate, + } + + // Marshal and output JSON of message + ctx := sdkclient.GetClientContextFromCmd(cmd) + msgJSON, err := ctx.Codec.MarshalJSON(msg) + if err != nil { + return err + } + + var formattedJSON bytes.Buffer + err = json.Indent(&formattedJSON, msgJSON, "", " ") + if err != nil { + return err + } + fmt.Println(formattedJSON.String()) + + return nil + }, + } + + return cmd +} + +// TxCreateBatchCmd returns a transaction command that creates a credit batch. +func TxCreateBatchCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-batch [batch-json]", + Short: "Issues a new credit batch", + Long: `Issues a new credit batch. + +Parameters: + +- batch-json: path to JSON file containing credit batch information`, + Example: `regen tx ecocredit create-batch batch.json + +Example JSON: + +{ + "project_id": "C01-001", + "issuer": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw", + "issuance": [ + { + "recipient": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw", + "tradable_amount": "1000", + "retired_amount": "500", + "retirement_jurisdiction": "US-WA" + }, + { + "recipient": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6", + "tradable_amount": "1000", + "retired_amount": "500", + "retirement_jurisdiction": "US-OR" + } + ], + "metadata": "regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf", + "start_date": "2020-01-01T00:00:00Z", + "end_date": "2021-01-01T00:00:00Z", + "open": false +}`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + // Parse the JSON file representing the request + msg, err := parseMsgCreateBatch(clientCtx, args[0]) + if err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse json: %s", err) + } + + // Get the batch issuer from the --from flag + msg.Issuer = clientCtx.GetFromAddress().String() + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + return txFlags(cmd) +} + +// TxSendCmd returns a transaction command that sends credits from a single batch from one account +// to another. +func TxSendCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "send [amount] [batch-denom] [recipient] [flags]", + Short: "Sends credits from a single batch from the transaction author (--from) to the recipient", + Long: `Sends credits from a single batch from the transaction author (--from) to the recipient. + +By default, the credits will be sent as tradable. Use the --retirement-jurisdiction flag to retire the credits to the recipient address. + +Parameters: + +- amount: the amount of credits to send +- batch-denom: the denomination of the credit batch +- recipient: the recipient account address`, + Example: "regen tx ecocredit send 20 C01-001-20200101-20210101-001 regen18xvpj53vaupyfejpws5sktv5lnas5xj2phm3cf --from myKey", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + retireTo, err := cmd.Flags().GetString(FlagRetirementJurisdiction) + if err != nil { + return err + } + tradableAmount := args[0] + retiredAmount := "0" + if len(retireTo) > 0 { + tradableAmount = "0" + retiredAmount = args[0] + } + credit := types.MsgSend_SendCredits{ + TradableAmount: tradableAmount, + BatchDenom: args[1], + RetiredAmount: retiredAmount, + RetirementJurisdiction: retireTo, + } + msg := types.MsgSend{ + Sender: clientCtx.GetFromAddress().String(), + Recipient: args[2], + Credits: []*types.MsgSend_SendCredits{&credit}, + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + cmd.Flags().String(FlagRetirementJurisdiction, "", "Jurisdiction to retire the credits to. If empty, credits are not retired. (default empty)") + return txFlags(cmd) +} + +// TxSendBulkCmd returns a transaction command that can send credits from multiple batches from one account +// to another +func TxSendBulkCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "send-bulk [recipient] [credits-json]", + Short: "Sends credits from multiple batches from the transaction author (--from) to the recipient", + Long: `Sends credits from multiple batches from the transaction author (--from) to the recipient. + +Parameters: + +- recipient: the recipient account address +- credits-json: path to JSON file containing credits to send`, + Example: `regen tx ecocredit send-bulk regen18xvpj53vaupyfejpws5sktv5lnas5xj2phm3cf credits.json + +Example JSON: + +[ + { + "batch_denom": "C01-001-20200101-20210101-001", + "tradable_amount": "500" + }, + { + "batch_denom": "C01-001-20200101-20210101-002", + "tradable_amount": "50", + "retired_amount": "100", + "retirement_jurisdiction": "YY-ZZ 12345" + } +]`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + // Parse the JSON file representing the credits + credits, err := parseSendCredits(args[1]) + if err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse json: %s", err) + } + + msg := types.MsgSend{ + Sender: clientCtx.GetFromAddress().String(), + Recipient: args[0], + Credits: credits, + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + return txFlags(cmd) +} + +// TxRetireCmd returns a transaction command that retires credits. +func TxRetireCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "retire [credits] [retirement-jurisdiction]", + Short: "Retires a specified amount of credits from the account of the transaction author (--from)", + Long: `Retires a specified amount of credits from the account of the transaction author (--from) + +Parameters: + +- credits: path to JSON file containing credits to retire +- retirement-jurisdiction: the jurisdiction in which the credit will be retired`, + Example: ` +regen tx ecocredit retire credits.json "US-WA 98225" + +Example JSON: +[ + { + "batch_denom": "C01-001-20200101-20210101-001", + "amount": "5" + }, + { + "batch_denom": "C01-001-20200101-20210101-002", + "amount": "10" + } +]`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + // Parse the JSON file representing the credits + credits, err := parseCredits(args[0]) + if err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse json: %s", err) + } + + msg := types.MsgRetire{ + Owner: clientCtx.GetFromAddress().String(), + Credits: credits, + Jurisdiction: args[1], + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + return txFlags(cmd) +} + +// TxCancelCmd returns a transaction command that cancels credits. +func TxCancelCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "cancel [credits-json] [reason]", + Short: "Cancels a specified amount of credits from the account of the transaction author (--from)", + Long: `Cancels a specified amount of credits from the account of the transaction author (--from) + +Parameters: + +- credits-json: path to JSON file containing credits to retire +- reason: any arbitrary string that specifies the reason for cancelling credits`, + Example: `regen tx ecocredit cancel credits.json "transferring credits to another registry" + +Example JSON: + +[ + { + "batch_denom": "C01-001-20200101-20210101-001", + "amount": "5" + }, + { + "batch_denom": "C01-001-20200101-20210101-002", + "amount": "10" + } +]`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + // Parse the JSON file representing the credits + credits, err := parseCredits(args[0]) + if err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse json: %s", err) + } + + msg := types.MsgCancel{ + Owner: clientCtx.GetFromAddress().String(), + Credits: credits, + Reason: args[1], + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + return txFlags(cmd) +} + +func TxUpdateClassMetadataCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-class-metadata [class-id] [new-metadata]", + Short: "Updates the metadata for a specific credit class", + Long: `Updates the metadata for a specific credit class. + +The '--from' flag must equal the credit class admin. + +Parameters: + +- class-id: the class id that corresponds with the credit class you want to update +- new-metadata: any arbitrary metadata to attach to the credit class`, + Args: cobra.ExactArgs(2), + Example: `regen tx ecocredit update-class-metadata C01 regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf`, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.MsgUpdateClassMetadata{ + Admin: clientCtx.GetFromAddress().String(), + ClassId: args[0], + NewMetadata: args[1], + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + return txFlags(cmd) +} + +func TxUpdateClassAdminCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-class-admin [class-id] [new-admin]", + Short: "Updates the admin for a specific credit class", + Long: `Updates the admin for a specific credit class. + +The '--from' flag must equal the current credit class admin. + +WARNING: Updating the admin replaces the current admin. Be sure the new admin account address is entered correctly. + +Parameters: + +- class-id: the ID of the credit class to update +- new-admin: the new admin account address that will overwrite the current admin account address`, + Example: "regen tx ecocredit update-class-admin C01 regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.MsgUpdateClassAdmin{ + Admin: clientCtx.GetFromAddress().String(), + ClassId: args[0], + NewAdmin: args[1], + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + return txFlags(cmd) +} + +func TxUpdateClassIssuersCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-class-issuers [class-id]", + Short: "Update the list of issuers for a specific credit class", + Long: `Update the list of issuers for a specific credit class. + +The '--from' flag must equal the current credit class admin. + +Parameters: + +- class-id: the ID of the credit class to update + +Flags: + +- add-issuers: the new list of issuers to add to the class issuers list +- remove-issuers: the new list of issuers to remove from the class issuers list`, + Example: `regen tx ecocredit update-class-issuers C01 --add-issuers addr1,addr2,addr3 +regen tx ecocredit update-class-issuers C01 --add-issuers addr1,addr2 --remove-issuers addr3,addr4`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + + // parse add issuers + addIssuers, err := cmd.Flags().GetStringSlice(FlagAddIssuers) + if err != nil { + return err + } + for i := range addIssuers { + addIssuers[i] = strings.TrimSpace(addIssuers[i]) + } + + // parse remove issuers + removeIssuers, err := cmd.Flags().GetStringSlice(FlagRemoveIssuers) + if err != nil { + return err + } + for i := range removeIssuers { + removeIssuers[i] = strings.TrimSpace(removeIssuers[i]) + } + + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.MsgUpdateClassIssuers{ + Admin: clientCtx.GetFromAddress().String(), + ClassId: args[0], + AddIssuers: addIssuers, + RemoveIssuers: removeIssuers, + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + cmd.Flags().StringSlice(FlagAddIssuers, []string{}, "comma separated (no spaces) list of addresses") + cmd.Flags().StringSlice(FlagRemoveIssuers, []string{}, "comma separated (no spaces) list of addresses") + + return txFlags(cmd) +} + +func TxUpdateProjectAdminCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-project-admin [project-id] [new-admin] [flags]", + Short: "Update the project admin address", + Long: `Update the project admin to the provided new_admin_address. + +The '--from' flag must equal the current credit class admin. + +WARNING: Updating the admin replaces the current admin. Be sure the new admin account address is entered correctly. + +Parameters: + +- project-id: the ID of the project to update +- new-admin: the new admin account address that will overwrite the current admin account address`, + Example: "regen tx ecocredit update-project-admin C01-001 regen1ynugxwpp4lfpy0epvfqwqkpuzkz62htnex3op", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.MsgUpdateProjectAdmin{ + Admin: clientCtx.GetFromAddress().String(), + NewAdmin: args[1], + ProjectId: args[0], + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + return txFlags(cmd) +} + +func TxUpdateProjectMetadataCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-project-metadata [project-id] [new-metadata]", + Short: "Update the project metadata", + Long: "Update the project metadata, overwriting the project's current metadata.", + Example: "regen tx ecocredit update-project-metadata C01-001 regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := sdkclient.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.MsgUpdateProjectMetadata{ + Admin: clientCtx.GetFromAddress().String(), + NewMetadata: args[1], + ProjectId: args[0], + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + return txFlags(cmd) +} diff --git a/x/ecocredit/client/util.go b/x/ecocredit/base/client/utils.go similarity index 64% rename from x/ecocredit/client/util.go rename to x/ecocredit/base/client/utils.go index 0fca5ce75b..e5e0752559 100644 --- a/x/ecocredit/client/util.go +++ b/x/ecocredit/base/client/utils.go @@ -11,8 +11,8 @@ import ( sdkclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func txFlags(cmd *cobra.Command) *cobra.Command { @@ -33,25 +33,25 @@ func printQueryResponse(clientCtx sdkclient.Context, res proto.Message, err erro return clientCtx.PrintProto(res) } -func mkQueryClient(cmd *cobra.Command) (core.QueryClient, sdkclient.Context, error) { +func mkQueryClient(cmd *cobra.Command) (types.QueryClient, sdkclient.Context, error) { ctx, err := sdkclient.GetClientQueryContext(cmd) if err != nil { return nil, sdkclient.Context{}, err } - return core.NewQueryClient(ctx), ctx, err + return types.NewQueryClient(ctx), ctx, err } -func parseMsgCreateBatch(clientCtx sdkclient.Context, jsonFile string) (*core.MsgCreateBatch, error) { +func parseMsgCreateBatch(clientCtx sdkclient.Context, jsonFile string) (*types.MsgCreateBatch, error) { bz, err := ioutil.ReadFile(jsonFile) if err != nil { return nil, err } - if err := types.CheckDuplicateKey(json.NewDecoder(bytes.NewReader(bz)), nil); err != nil { + if err := regentypes.CheckDuplicateKey(json.NewDecoder(bytes.NewReader(bz)), nil); err != nil { return nil, err } - var msg core.MsgCreateBatch + var msg types.MsgCreateBatch err = clientCtx.Codec.UnmarshalJSON(bz, &msg) if err != nil { return nil, err @@ -60,17 +60,17 @@ func parseMsgCreateBatch(clientCtx sdkclient.Context, jsonFile string) (*core.Ms return &msg, nil } -func parseCredits(jsonFile string) ([]*core.Credits, error) { +func parseCredits(jsonFile string) ([]*types.Credits, error) { bz, err := ioutil.ReadFile(jsonFile) if err != nil { return nil, err } - if err := types.CheckDuplicateKey(json.NewDecoder(bytes.NewReader(bz)), nil); err != nil { + if err := regentypes.CheckDuplicateKey(json.NewDecoder(bytes.NewReader(bz)), nil); err != nil { return nil, err } - var credits []*core.Credits + var credits []*types.Credits // using json package because array is not a proto message err = json.Unmarshal(bz, &credits) @@ -81,17 +81,17 @@ func parseCredits(jsonFile string) ([]*core.Credits, error) { return credits, nil } -func parseSendCredits(jsonFile string) ([]*core.MsgSend_SendCredits, error) { +func parseSendCredits(jsonFile string) ([]*types.MsgSend_SendCredits, error) { bz, err := ioutil.ReadFile(jsonFile) if err != nil { return nil, err } - if err := types.CheckDuplicateKey(json.NewDecoder(bytes.NewReader(bz)), nil); err != nil { + if err := regentypes.CheckDuplicateKey(json.NewDecoder(bytes.NewReader(bz)), nil); err != nil { return nil, err } - var sendCredits []*core.MsgSend_SendCredits + var sendCredits []*types.MsgSend_SendCredits // using json package because array is not a proto message err = json.Unmarshal(bz, &sendCredits) diff --git a/x/ecocredit/client/util_test.go b/x/ecocredit/base/client/utils_test.go similarity index 94% rename from x/ecocredit/client/util_test.go rename to x/ecocredit/base/client/utils_test.go index bad5d35a39..cedf6db523 100644 --- a/x/ecocredit/client/util_test.go +++ b/x/ecocredit/base/client/utils_test.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestParseMsgCreateBatch(t *testing.T) { @@ -42,7 +42,7 @@ func TestParseMsgCreateBatch(t *testing.T) { file string expErr bool expErrMsg string - expRes *core.MsgCreateBatch + expRes *types.MsgCreateBatch }{ { name: "empty file path", @@ -65,10 +65,10 @@ func TestParseMsgCreateBatch(t *testing.T) { { name: "valid test", file: validJSON, - expRes: &core.MsgCreateBatch{ + expRes: &types.MsgCreateBatch{ Issuer: "regen1", ProjectId: "C01-001", - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: "regen2", TradableAmount: "10", @@ -118,7 +118,7 @@ func TestParseSendCredits(t *testing.T) { file string expErr bool expErrMsg string - expRes []*core.MsgSend_SendCredits + expRes []*types.MsgSend_SendCredits }{ { name: "empty file path", @@ -147,7 +147,7 @@ func TestParseSendCredits(t *testing.T) { { name: "valid test", file: validJSON, - expRes: []*core.MsgSend_SendCredits{ + expRes: []*types.MsgSend_SendCredits{ { BatchDenom: "C01-001-20210101-20210101-001", TradableAmount: "10", @@ -195,7 +195,7 @@ func TestParseCredits(t *testing.T) { file string expErr bool expErrMsg string - expRes []*core.Credits + expRes []*types.Credits }{ { name: "empty file path", @@ -224,7 +224,7 @@ func TestParseCredits(t *testing.T) { { name: "valid test", file: validJSON, - expRes: []*core.Credits{ + expRes: []*types.Credits{ { BatchDenom: "C01-001-20210101-20210101-001", Amount: "10", diff --git a/x/ecocredit/server/core/features/msg_add_class_creator.feature b/x/ecocredit/base/keeper/features/msg_add_class_creator.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_add_class_creator.feature rename to x/ecocredit/base/keeper/features/msg_add_class_creator.feature diff --git a/x/ecocredit/server/core/features/msg_add_credit_type.feature b/x/ecocredit/base/keeper/features/msg_add_credit_type.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_add_credit_type.feature rename to x/ecocredit/base/keeper/features/msg_add_credit_type.feature diff --git a/x/ecocredit/server/core/features/msg_bridge.feature b/x/ecocredit/base/keeper/features/msg_bridge.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_bridge.feature rename to x/ecocredit/base/keeper/features/msg_bridge.feature diff --git a/x/ecocredit/server/core/features/msg_bridge_receive.feature b/x/ecocredit/base/keeper/features/msg_bridge_receive.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_bridge_receive.feature rename to x/ecocredit/base/keeper/features/msg_bridge_receive.feature diff --git a/x/ecocredit/server/core/features/msg_cancel.feature b/x/ecocredit/base/keeper/features/msg_cancel.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_cancel.feature rename to x/ecocredit/base/keeper/features/msg_cancel.feature diff --git a/x/ecocredit/server/core/features/msg_create_batch.feature b/x/ecocredit/base/keeper/features/msg_create_batch.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_create_batch.feature rename to x/ecocredit/base/keeper/features/msg_create_batch.feature diff --git a/x/ecocredit/server/core/features/msg_create_class.feature b/x/ecocredit/base/keeper/features/msg_create_class.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_create_class.feature rename to x/ecocredit/base/keeper/features/msg_create_class.feature diff --git a/x/ecocredit/server/core/features/msg_create_project.feature b/x/ecocredit/base/keeper/features/msg_create_project.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_create_project.feature rename to x/ecocredit/base/keeper/features/msg_create_project.feature diff --git a/x/ecocredit/server/core/features/msg_mint_batch_credits.feature b/x/ecocredit/base/keeper/features/msg_mint_batch_credits.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_mint_batch_credits.feature rename to x/ecocredit/base/keeper/features/msg_mint_batch_credits.feature diff --git a/x/ecocredit/server/core/features/msg_remove_class_creator.feature b/x/ecocredit/base/keeper/features/msg_remove_class_creator.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_remove_class_creator.feature rename to x/ecocredit/base/keeper/features/msg_remove_class_creator.feature diff --git a/x/ecocredit/server/core/features/msg_retire.feature b/x/ecocredit/base/keeper/features/msg_retire.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_retire.feature rename to x/ecocredit/base/keeper/features/msg_retire.feature diff --git a/x/ecocredit/server/core/features/msg_seal_batch.feature b/x/ecocredit/base/keeper/features/msg_seal_batch.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_seal_batch.feature rename to x/ecocredit/base/keeper/features/msg_seal_batch.feature diff --git a/x/ecocredit/server/core/features/msg_send.feature b/x/ecocredit/base/keeper/features/msg_send.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_send.feature rename to x/ecocredit/base/keeper/features/msg_send.feature diff --git a/x/ecocredit/server/core/features/msg_toggle_class_allowlist.feature b/x/ecocredit/base/keeper/features/msg_toggle_class_allowlist.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_toggle_class_allowlist.feature rename to x/ecocredit/base/keeper/features/msg_toggle_class_allowlist.feature diff --git a/x/ecocredit/server/core/features/msg_update_class_admin.feature b/x/ecocredit/base/keeper/features/msg_update_class_admin.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_update_class_admin.feature rename to x/ecocredit/base/keeper/features/msg_update_class_admin.feature diff --git a/x/ecocredit/server/core/features/msg_update_class_fee.feature b/x/ecocredit/base/keeper/features/msg_update_class_fee.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_update_class_fee.feature rename to x/ecocredit/base/keeper/features/msg_update_class_fee.feature diff --git a/x/ecocredit/server/core/features/msg_update_class_issuers.feature b/x/ecocredit/base/keeper/features/msg_update_class_issuers.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_update_class_issuers.feature rename to x/ecocredit/base/keeper/features/msg_update_class_issuers.feature diff --git a/x/ecocredit/server/core/features/msg_update_class_metadata.feature b/x/ecocredit/base/keeper/features/msg_update_class_metadata.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_update_class_metadata.feature rename to x/ecocredit/base/keeper/features/msg_update_class_metadata.feature diff --git a/x/ecocredit/server/core/features/msg_update_project_admin.feature b/x/ecocredit/base/keeper/features/msg_update_project_admin.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_update_project_admin.feature rename to x/ecocredit/base/keeper/features/msg_update_project_admin.feature diff --git a/x/ecocredit/server/core/features/msg_update_project_metadata.feature b/x/ecocredit/base/keeper/features/msg_update_project_metadata.feature similarity index 100% rename from x/ecocredit/server/core/features/msg_update_project_metadata.feature rename to x/ecocredit/base/keeper/features/msg_update_project_metadata.feature diff --git a/x/ecocredit/server/core/invariants.go b/x/ecocredit/base/keeper/invariants.go similarity index 92% rename from x/ecocredit/server/core/invariants.go rename to x/ecocredit/base/keeper/invariants.go index 9a8e0198cc..b4674f1278 100644 --- a/x/ecocredit/server/core/invariants.go +++ b/x/ecocredit/base/keeper/invariants.go @@ -1,10 +1,10 @@ -package core +package keeper import ( "context" "fmt" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/math" ) @@ -16,7 +16,7 @@ func BatchSupplyInvariant(ctx context.Context, k Keeper, basketBalances map[uint batchIDToBalanceTradable := make(map[uint64]math.Dec) // map batch id => tradable balance batchIDToBalanceRetired := make(map[uint64]math.Dec) // map batch id => retired balance - itr, err := k.stateStore.BatchBalanceTable().List(ctx, ecocreditv1.BatchBalancePrimaryKey{}) + itr, err := k.stateStore.BatchBalanceTable().List(ctx, api.BatchBalancePrimaryKey{}) if err != nil { return err.Error(), true } @@ -88,7 +88,7 @@ func BatchSupplyInvariant(ctx context.Context, k Keeper, basketBalances map[uint } } - sItr, err := k.stateStore.BatchSupplyTable().List(ctx, ecocreditv1.BatchSupplyPrimaryKey{}) + sItr, err := k.stateStore.BatchSupplyTable().List(ctx, api.BatchSupplyPrimaryKey{}) if err != nil { return msg + err.Error(), true } diff --git a/x/ecocredit/server/core/keeper.go b/x/ecocredit/base/keeper/keeper.go similarity index 87% rename from x/ecocredit/server/core/keeper.go rename to x/ecocredit/base/keeper/keeper.go index b313fb0cdd..df09a7ef5f 100644 --- a/x/ecocredit/server/core/keeper.go +++ b/x/ecocredit/base/keeper/keeper.go @@ -1,4 +1,4 @@ -package core +package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" @@ -7,11 +7,11 @@ import ( marketplaceapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) -var _ core.MsgServer = &Keeper{} -var _ core.QueryServer = &Keeper{} +var _ types.MsgServer = &Keeper{} +var _ types.QueryServer = &Keeper{} type Keeper struct { stateStore api.StateStore diff --git a/x/ecocredit/server/core/keeper_test.go b/x/ecocredit/base/keeper/keeper_test.go similarity index 99% rename from x/ecocredit/server/core/keeper_test.go rename to x/ecocredit/base/keeper/keeper_test.go index 276e9f85eb..76de5516d4 100644 --- a/x/ecocredit/server/core/keeper_test.go +++ b/x/ecocredit/base/keeper/keeper_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" diff --git a/x/ecocredit/server/core/msg_add_class_creator.go b/x/ecocredit/base/keeper/msg_add_class_creator.go similarity index 68% rename from x/ecocredit/server/core/msg_add_class_creator.go rename to x/ecocredit/base/keeper/msg_add_class_creator.go index 95199a48a1..6f8cfa9c21 100644 --- a/x/ecocredit/server/core/msg_add_class_creator.go +++ b/x/ecocredit/base/keeper/msg_add_class_creator.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,11 +6,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) -func (k Keeper) AddClassCreator(ctx context.Context, req *core.MsgAddClassCreator) (*core.MsgAddClassCreatorResponse, error) { +func (k Keeper) AddClassCreator(ctx context.Context, req *types.MsgAddClassCreator) (*types.MsgAddClassCreatorResponse, error) { if k.authority.String() != req.Authority { return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority: expected %s, got %s", k.authority, req.Authority) } @@ -29,11 +30,11 @@ func (k Keeper) AddClassCreator(ctx context.Context, req *core.MsgAddClassCreato return nil, sdkerrors.ErrInvalidRequest.Wrapf("class creator %s already exists", req.Creator) } - if err := k.stateStore.AllowedClassCreatorTable().Insert(ctx, &ecocreditv1.AllowedClassCreator{ + if err := k.stateStore.AllowedClassCreatorTable().Insert(ctx, &api.AllowedClassCreator{ Address: creatorAddr, }); err != nil { return nil, err } - return &core.MsgAddClassCreatorResponse{}, nil + return &types.MsgAddClassCreatorResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_add_class_creator_test.go b/x/ecocredit/base/keeper/msg_add_class_creator_test.go similarity index 82% rename from x/ecocredit/server/core/msg_add_class_creator_test.go rename to x/ecocredit/base/keeper/msg_add_class_creator_test.go index 38c4a8ebfa..68d19d9a10 100644 --- a/x/ecocredit/server/core/msg_add_class_creator_test.go +++ b/x/ecocredit/base/keeper/msg_add_class_creator_test.go @@ -1,15 +1,16 @@ -package core +package keeper import ( "encoding/json" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/gocuke" "github.com/stretchr/testify/require" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + sdk "github.com/cosmos/cosmos-sdk/types" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type addClassCreator struct { @@ -26,7 +27,7 @@ func (s *addClassCreator) Before(t gocuke.TestingT) { } func (s *addClassCreator) ClassCreatorWithProperties(a gocuke.DocString) { - var msg *core.MsgAddClassCreator + var msg *types.MsgAddClassCreator err := json.Unmarshal([]byte(a.Content), &msg) require.NoError(s.t, err) @@ -34,7 +35,7 @@ func (s *addClassCreator) ClassCreatorWithProperties(a gocuke.DocString) { creatorAddr, err := sdk.AccAddressFromBech32(msg.Creator) require.NoError(s.t, err) - err = s.stateStore.AllowedClassCreatorTable().Save(s.ctx, &ecocreditv1.AllowedClassCreator{ + err = s.stateStore.AllowedClassCreatorTable().Save(s.ctx, &api.AllowedClassCreator{ Address: creatorAddr, }) require.NoError(s.t, err) @@ -42,7 +43,7 @@ func (s *addClassCreator) ClassCreatorWithProperties(a gocuke.DocString) { } func (s *addClassCreator) AliceAttemptsToAddClassCreatorWithProperties(a gocuke.DocString) { - var msg *core.MsgAddClassCreator + var msg *types.MsgAddClassCreator err := json.Unmarshal([]byte(a.Content), &msg) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_add_credit_type.go b/x/ecocredit/base/keeper/msg_add_credit_type.go similarity index 71% rename from x/ecocredit/server/core/msg_add_credit_type.go rename to x/ecocredit/base/keeper/msg_add_credit_type.go index 7a41dc2b1e..c6a090c520 100644 --- a/x/ecocredit/server/core/msg_add_credit_type.go +++ b/x/ecocredit/base/keeper/msg_add_credit_type.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -7,17 +7,17 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - ecocreditApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // AddCreditType adds a new credit type to the network. -func (k Keeper) AddCreditType(ctx context.Context, req *core.MsgAddCreditType) (*core.MsgAddCreditTypeResponse, error) { +func (k Keeper) AddCreditType(ctx context.Context, req *types.MsgAddCreditType) (*types.MsgAddCreditTypeResponse, error) { if k.authority.String() != req.Authority { return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority: expected %s, got %s", k.authority, req.Authority) } - if err := k.stateStore.CreditTypeTable().Insert(ctx, &ecocreditApi.CreditType{ + if err := k.stateStore.CreditTypeTable().Insert(ctx, &api.CreditType{ Abbreviation: req.CreditType.Abbreviation, Name: req.CreditType.Name, Unit: req.CreditType.Unit, @@ -32,5 +32,5 @@ func (k Keeper) AddCreditType(ctx context.Context, req *core.MsgAddCreditType) ( return nil, sdkerrors.ErrInvalidRequest.Wrapf("could not add credit type: %s", err.Error()) } - return &core.MsgAddCreditTypeResponse{}, nil + return &types.MsgAddCreditTypeResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_add_credit_type_test.go b/x/ecocredit/base/keeper/msg_add_credit_type_test.go similarity index 85% rename from x/ecocredit/server/core/msg_add_credit_type_test.go rename to x/ecocredit/base/keeper/msg_add_credit_type_test.go index 8c6a747411..eeb81fcb51 100644 --- a/x/ecocredit/server/core/msg_add_credit_type_test.go +++ b/x/ecocredit/base/keeper/msg_add_credit_type_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "encoding/json" @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type addCreditTypeSuite struct { @@ -25,16 +25,16 @@ func (s *addCreditTypeSuite) Before(t gocuke.TestingT) { } func (s *addCreditTypeSuite) AliceAttemptsToAddACreditTypeWithName(name string) { - _, s.err = s.k.AddCreditType(s.ctx, &core.MsgAddCreditType{ + _, s.err = s.k.AddCreditType(s.ctx, &types.MsgAddCreditType{ Authority: s.authority.String(), - CreditType: &core.CreditType{ + CreditType: &types.CreditType{ Name: name, }, }) } func (s *addCreditTypeSuite) ACreditTypeWithProperties(a gocuke.DocString) { - var msg *core.MsgAddCreditType + var msg *types.MsgAddCreditType err := json.Unmarshal([]byte(a.Content), &msg) require.NoError(s.t, err) @@ -49,7 +49,7 @@ func (s *addCreditTypeSuite) ACreditTypeWithProperties(a gocuke.DocString) { } func (s *addCreditTypeSuite) AliceAttemptsToAddACreditTypeWithProperties(a gocuke.DocString) { - var msg *core.MsgAddCreditType + var msg *types.MsgAddCreditType err := json.Unmarshal([]byte(a.Content), &msg) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_bridge.go b/x/ecocredit/base/keeper/msg_bridge.go similarity index 79% rename from x/ecocredit/server/core/msg_bridge.go rename to x/ecocredit/base/keeper/msg_bridge.go index 0ee3fdb301..e00e482bf9 100644 --- a/x/ecocredit/server/core/msg_bridge.go +++ b/x/ecocredit/base/keeper/msg_bridge.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,12 +8,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // Bridge cancel credits, removing them from the supply and balance of the holder -func (k Keeper) Bridge(ctx context.Context, req *core.MsgBridge) (*core.MsgBridgeResponse, error) { - _, err := k.Cancel(ctx, &core.MsgCancel{ +func (k Keeper) Bridge(ctx context.Context, req *types.MsgBridge) (*types.MsgBridgeResponse, error) { + _, err := k.Cancel(ctx, &types.MsgCancel{ Owner: req.Owner, Credits: req.Credits, Reason: fmt.Sprintf("bridge-%s", req.Target), @@ -42,7 +42,7 @@ func (k Keeper) Bridge(ctx context.Context, req *core.MsgBridge) (*core.MsgBridg return nil, err } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventBridge{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventBridge{ Target: req.Target, Recipient: req.Recipient, Contract: batchContract.Contract, @@ -52,5 +52,5 @@ func (k Keeper) Bridge(ctx context.Context, req *core.MsgBridge) (*core.MsgBridg } } - return &core.MsgBridgeResponse{}, nil + return &types.MsgBridgeResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_bridge_receive.go b/x/ecocredit/base/keeper/msg_bridge_receive.go similarity index 86% rename from x/ecocredit/server/core/msg_bridge_receive.go rename to x/ecocredit/base/keeper/msg_bridge_receive.go index 86125b4eec..600fc488ed 100644 --- a/x/ecocredit/server/core/msg_bridge_receive.go +++ b/x/ecocredit/base/keeper/msg_bridge_receive.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,11 +8,11 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // BridgeReceive bridges credits received from another chain. -func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) (*core.MsgBridgeReceiveResponse, error) { +func (k Keeper) BridgeReceive(ctx context.Context, req *types.MsgBridgeReceive) (*types.MsgBridgeReceiveResponse, error) { // check class id and get class information (specifically class key) class, err := k.stateStore.ClassTable().GetById(ctx, req.ClassId) if err != nil { @@ -30,8 +30,8 @@ func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) ( } } - var event *core.EventBridgeReceive - var response *core.MsgBridgeReceiveResponse + var event *types.EventBridgeReceive + var response *types.MsgBridgeReceiveResponse // if batch contract entry with matching contract exists, and therefore a // project exists, dynamically mint credits to the existing credit batch, @@ -54,10 +54,10 @@ func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) ( } // mint credits to the existing credit batch - _, err = k.MintBatchCredits(ctx, &core.MsgMintBatchCredits{ + _, err = k.MintBatchCredits(ctx, &types.MsgMintBatchCredits{ Issuer: req.Issuer, BatchDenom: batch.Denom, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: req.Batch.Recipient, TradableAmount: req.Batch.Amount, @@ -70,13 +70,13 @@ func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) ( } // set bridge receive event - event = &core.EventBridgeReceive{ + event = &types.EventBridgeReceive{ BatchDenom: batch.Denom, ProjectId: project.Id, } // set bridge receive response - response = &core.MsgBridgeReceiveResponse{ + response = &types.MsgBridgeReceiveResponse{ BatchDenom: batch.Denom, ProjectId: project.Id, } @@ -91,7 +91,7 @@ func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) ( // if no project exists that matches the credit class and project reference // id, then we create a new project with the information provided if project == nil { - projectRes, err := k.CreateProject(ctx, &core.MsgCreateProject{ + projectRes, err := k.CreateProject(ctx, &types.MsgCreateProject{ Admin: req.Issuer, ClassId: req.ClassId, Metadata: req.Project.Metadata, @@ -107,10 +107,10 @@ func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) ( } // create a new credit batch with the information provided - batchRes, err := k.CreateBatch(ctx, &core.MsgCreateBatch{ + batchRes, err := k.CreateBatch(ctx, &types.MsgCreateBatch{ Issuer: req.Issuer, ProjectId: project.Id, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: req.Batch.Recipient, TradableAmount: req.Batch.Amount, @@ -127,13 +127,13 @@ func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) ( } // set bridge receive event - event = &core.EventBridgeReceive{ + event = &types.EventBridgeReceive{ BatchDenom: batchRes.BatchDenom, ProjectId: project.Id, } // set bridge receive response - response = &core.MsgBridgeReceiveResponse{ + response = &types.MsgBridgeReceiveResponse{ BatchDenom: batchRes.BatchDenom, ProjectId: project.Id, } @@ -151,7 +151,7 @@ func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) ( // class id and reference id because we enforce uniqueness on non-empty reference ids within the scope // of a credit class (and we do this at the message server level and not the ORM level because reference // id is optional when using Msg/CreateProject). If no project is found, nil is returned for both values. -func (k Keeper) getProjectFromBridgeReq(ctx context.Context, req *core.MsgBridgeReceive_Project, classID string) (*api.Project, error) { +func (k Keeper) getProjectFromBridgeReq(ctx context.Context, req *types.MsgBridgeReceive_Project, classID string) (*api.Project, error) { class, err := k.stateStore.ClassTable().GetById(ctx, classID) if err != nil { return nil, sdkerrors.ErrInvalidRequest.Wrapf("could not get class with id %s: %s", classID, err.Error()) diff --git a/x/ecocredit/server/core/msg_bridge_receive_test.go b/x/ecocredit/base/keeper/msg_bridge_receive_test.go similarity index 85% rename from x/ecocredit/server/core/msg_bridge_receive_test.go rename to x/ecocredit/base/keeper/msg_bridge_receive_test.go index 513c0942fa..3995ca340a 100644 --- a/x/ecocredit/server/core/msg_bridge_receive_test.go +++ b/x/ecocredit/base/keeper/msg_bridge_receive_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "strconv" @@ -9,13 +9,14 @@ import ( "github.com/gogo/protobuf/jsonpb" "github.com/regen-network/gocuke" + "github.com/regen-network/regen-ledger/x/ecocredit/base" "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type bridgeReceiveSuite struct { @@ -33,8 +34,8 @@ type bridgeReceiveSuite struct { tradableAmount string startDate *time.Time endDate *time.Time - originTx *core.OriginTx - res *core.MsgBridgeReceiveResponse + originTx *types.OriginTx + res *types.MsgBridgeReceiveResponse err error } @@ -52,16 +53,16 @@ func (s *bridgeReceiveSuite) Before(t gocuke.TestingT) { s.metadata = "regen:113gdjFKcVCt13Za6vN7TtbgMM6LMSjRnu89BMCxeuHdkJ1hWUmy.rdf" s.tradableAmount = "10" - startDate, err := types.ParseDate("start date", "2020-01-01") + startDate, err := regentypes.ParseDate("start date", "2020-01-01") require.NoError(s.t, err) - endDate, err := types.ParseDate("end date", "2021-01-01") + endDate, err := regentypes.ParseDate("end date", "2021-01-01") require.NoError(s.t, err) s.startDate = &startDate s.endDate = &endDate - s.originTx = &core.OriginTx{ + s.originTx = &types.OriginTx{ Id: "0x7a70692a348e8688f54ab2bdfe87d925d8cc88932520492a11eaa02dc128243e", Source: "polygon", Contract: "0x0E65079a29d7793ab5CA500c2d88e60EE99Ba606", @@ -132,7 +133,7 @@ func (s *bridgeReceiveSuite) AProjectWithIdAndReferenceId(a, b string) { } func (s *bridgeReceiveSuite) ACreditBatchWithDenomAndIssuerAlice(a string) { - projectID := core.GetProjectIDFromBatchDenom(a) + projectID := base.GetProjectIDFromBatchDenom(a) project, err := s.k.stateStore.ProjectTable().GetById(s.ctx, projectID) require.NoError(s.t, err) @@ -174,15 +175,15 @@ func (s *bridgeReceiveSuite) TheBatchContract(a gocuke.DocString) { } func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithClassId(a string) { - s.res, s.err = s.k.BridgeReceive(s.ctx, &core.MsgBridgeReceive{ + s.res, s.err = s.k.BridgeReceive(s.ctx, &types.MsgBridgeReceive{ Issuer: s.alice.String(), ClassId: a, - Project: &core.MsgBridgeReceive_Project{ + Project: &types.MsgBridgeReceive_Project{ ReferenceId: s.referenceID, Jurisdiction: s.jurisdiction, Metadata: s.metadata, }, - Batch: &core.MsgBridgeReceive_Batch{ + Batch: &types.MsgBridgeReceive_Batch{ Recipient: s.bob.String(), Amount: s.tradableAmount, StartDate: s.startDate, @@ -194,15 +195,15 @@ func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithClassId(a string) { } func (s *bridgeReceiveSuite) BobAttemptsToBridgeCreditsWithClassId(a string) { - s.res, s.err = s.k.BridgeReceive(s.ctx, &core.MsgBridgeReceive{ + s.res, s.err = s.k.BridgeReceive(s.ctx, &types.MsgBridgeReceive{ Issuer: s.bob.String(), ClassId: a, - Project: &core.MsgBridgeReceive_Project{ + Project: &types.MsgBridgeReceive_Project{ ReferenceId: s.referenceID, Jurisdiction: s.jurisdiction, Metadata: s.metadata, }, - Batch: &core.MsgBridgeReceive_Batch{ + Batch: &types.MsgBridgeReceive_Batch{ Recipient: s.alice.String(), Amount: s.tradableAmount, StartDate: s.startDate, @@ -214,22 +215,22 @@ func (s *bridgeReceiveSuite) BobAttemptsToBridgeCreditsWithClassId(a string) { } func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithContract(a string) { - s.res, s.err = s.k.BridgeReceive(s.ctx, &core.MsgBridgeReceive{ + s.res, s.err = s.k.BridgeReceive(s.ctx, &types.MsgBridgeReceive{ Issuer: s.alice.String(), ClassId: s.classID, - Project: &core.MsgBridgeReceive_Project{ + Project: &types.MsgBridgeReceive_Project{ ReferenceId: s.referenceID, Jurisdiction: s.jurisdiction, Metadata: s.metadata, }, - Batch: &core.MsgBridgeReceive_Batch{ + Batch: &types.MsgBridgeReceive_Batch{ Recipient: s.bob.String(), Amount: s.tradableAmount, StartDate: s.startDate, EndDate: s.endDate, Metadata: s.metadata, }, - OriginTx: &core.OriginTx{ + OriginTx: &types.OriginTx{ Id: s.originTx.Id, Source: s.originTx.Source, Contract: a, @@ -238,22 +239,22 @@ func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithContract(a string) } func (s *bridgeReceiveSuite) BobAttemptsToBridgeCreditsWithContract(a string) { - s.res, s.err = s.k.BridgeReceive(s.ctx, &core.MsgBridgeReceive{ + s.res, s.err = s.k.BridgeReceive(s.ctx, &types.MsgBridgeReceive{ Issuer: s.bob.String(), ClassId: s.classID, - Project: &core.MsgBridgeReceive_Project{ + Project: &types.MsgBridgeReceive_Project{ ReferenceId: s.referenceID, Jurisdiction: s.jurisdiction, Metadata: s.metadata, }, - Batch: &core.MsgBridgeReceive_Batch{ + Batch: &types.MsgBridgeReceive_Batch{ Recipient: s.bob.String(), Amount: s.tradableAmount, StartDate: s.startDate, EndDate: s.endDate, Metadata: s.metadata, }, - OriginTx: &core.OriginTx{ + OriginTx: &types.OriginTx{ Id: s.originTx.Id, Source: s.originTx.Source, Contract: a, @@ -262,15 +263,15 @@ func (s *bridgeReceiveSuite) BobAttemptsToBridgeCreditsWithContract(a string) { } func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithClassIdAndProjectReferenceId(a, b string) { - s.res, s.err = s.k.BridgeReceive(s.ctx, &core.MsgBridgeReceive{ + s.res, s.err = s.k.BridgeReceive(s.ctx, &types.MsgBridgeReceive{ Issuer: s.alice.String(), ClassId: a, - Project: &core.MsgBridgeReceive_Project{ + Project: &types.MsgBridgeReceive_Project{ ReferenceId: b, Jurisdiction: s.jurisdiction, Metadata: s.metadata, }, - Batch: &core.MsgBridgeReceive_Batch{ + Batch: &types.MsgBridgeReceive_Batch{ Recipient: s.bob.String(), Amount: s.tradableAmount, StartDate: s.startDate, @@ -282,19 +283,19 @@ func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithClassIdAndProjectRe } func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithProjectProperties(a gocuke.DocString) { - var project core.MsgBridgeReceive_Project + var project types.MsgBridgeReceive_Project err := jsonpb.UnmarshalString(a.Content, &project) require.NoError(s.t, err) - s.res, s.err = s.k.BridgeReceive(s.ctx, &core.MsgBridgeReceive{ + s.res, s.err = s.k.BridgeReceive(s.ctx, &types.MsgBridgeReceive{ Issuer: s.alice.String(), ClassId: s.classID, - Project: &core.MsgBridgeReceive_Project{ + Project: &types.MsgBridgeReceive_Project{ ReferenceId: project.ReferenceId, Jurisdiction: project.Jurisdiction, Metadata: project.Metadata, }, - Batch: &core.MsgBridgeReceive_Batch{ + Batch: &types.MsgBridgeReceive_Batch{ Recipient: s.bob.String(), Amount: s.tradableAmount, StartDate: s.startDate, @@ -308,19 +309,19 @@ func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithProjectProperties(a } func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithBatchProperties(a gocuke.DocString) { - var batch core.MsgBridgeReceive_Batch + var batch types.MsgBridgeReceive_Batch err := jsonpb.UnmarshalString(a.Content, &batch) require.NoError(s.t, err) - s.res, s.err = s.k.BridgeReceive(s.ctx, &core.MsgBridgeReceive{ + s.res, s.err = s.k.BridgeReceive(s.ctx, &types.MsgBridgeReceive{ Issuer: s.alice.String(), ClassId: s.classID, - Project: &core.MsgBridgeReceive_Project{ + Project: &types.MsgBridgeReceive_Project{ ReferenceId: s.referenceID, Jurisdiction: s.jurisdiction, Metadata: s.metadata, }, - Batch: &core.MsgBridgeReceive_Batch{ + Batch: &types.MsgBridgeReceive_Batch{ Recipient: s.bob.String(), Amount: s.tradableAmount, StartDate: batch.StartDate, @@ -334,15 +335,15 @@ func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsWithBatchProperties(a g } func (s *bridgeReceiveSuite) AliceAttemptsToBridgeCreditsToBobWithTradableAmount(a string) { - s.res, s.err = s.k.BridgeReceive(s.ctx, &core.MsgBridgeReceive{ + s.res, s.err = s.k.BridgeReceive(s.ctx, &types.MsgBridgeReceive{ Issuer: s.alice.String(), ClassId: s.classID, - Project: &core.MsgBridgeReceive_Project{ + Project: &types.MsgBridgeReceive_Project{ ReferenceId: s.referenceID, Jurisdiction: s.jurisdiction, Metadata: s.metadata, }, - Batch: &core.MsgBridgeReceive_Batch{ + Batch: &types.MsgBridgeReceive_Batch{ Recipient: s.bob.String(), Amount: a, StartDate: s.startDate, @@ -400,7 +401,7 @@ func (s *bridgeReceiveSuite) ExpectTotalProjects(a string) { } func (s *bridgeReceiveSuite) ExpectProjectProperties(a gocuke.DocString) { - var expected core.Project + var expected types.Project err := jsonpb.UnmarshalString(a.Content, &expected) require.NoError(s.t, err) @@ -413,7 +414,7 @@ func (s *bridgeReceiveSuite) ExpectProjectProperties(a gocuke.DocString) { } func (s *bridgeReceiveSuite) ExpectBatchProperties(a gocuke.DocString) { - var expected core.Batch + var expected types.Batch err := jsonpb.UnmarshalString(a.Content, &expected) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_bridge_test.go b/x/ecocredit/base/keeper/msg_bridge_test.go similarity index 93% rename from x/ecocredit/server/core/msg_bridge_test.go rename to x/ecocredit/base/keeper/msg_bridge_test.go index d34358e60f..4e558995dd 100644 --- a/x/ecocredit/server/core/msg_bridge_test.go +++ b/x/ecocredit/base/keeper/msg_bridge_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "encoding/json" @@ -13,7 +13,7 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type bridgeSuite struct { @@ -29,8 +29,8 @@ type bridgeSuite struct { contract string target string recipient string - credits []*core.Credits - res *core.MsgBridgeResponse + credits []*types.Credits + res *types.MsgBridgeResponse err error } @@ -49,7 +49,7 @@ func (s *bridgeSuite) Before(t gocuke.TestingT) { s.target = "polygon" s.contract = "0x01" s.recipient = "0x02" - s.credits = []*core.Credits{ + s.credits = []*types.Credits{ { BatchDenom: s.batchDenom, Amount: s.tradableAmount, @@ -116,7 +116,7 @@ func (s *bridgeSuite) TheBatchSupply(a gocuke.DocString) { } func (s *bridgeSuite) AliceAttemptsToBridgeCreditsFromTheCreditBatch() { - s.res, s.err = s.k.Bridge(s.ctx, &core.MsgBridge{ + s.res, s.err = s.k.Bridge(s.ctx, &types.MsgBridge{ Owner: s.alice.String(), Target: s.target, Recipient: s.recipient, @@ -125,11 +125,11 @@ func (s *bridgeSuite) AliceAttemptsToBridgeCreditsFromTheCreditBatch() { } func (s *bridgeSuite) AliceAttemptsToBridgeCreditAmountFromTheCreditBatch(a string) { - s.res, s.err = s.k.Bridge(s.ctx, &core.MsgBridge{ + s.res, s.err = s.k.Bridge(s.ctx, &types.MsgBridge{ Owner: s.alice.String(), Target: s.target, Recipient: s.recipient, - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: s.batchDenom, Amount: a, @@ -209,11 +209,11 @@ func (s *bridgeSuite) creditBatchSetup() { } func (s *bridgeSuite) AliceAttemptsToBridgeCreditAmountFromTheCreditBatchTo(a, b string) { - s.res, s.err = s.k.Bridge(s.ctx, &core.MsgBridge{ + s.res, s.err = s.k.Bridge(s.ctx, &types.MsgBridge{ Owner: s.alice.String(), Target: s.target, Recipient: b, - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: s.batchDenom, Amount: a, @@ -223,7 +223,7 @@ func (s *bridgeSuite) AliceAttemptsToBridgeCreditAmountFromTheCreditBatchTo(a, b } func (s *bridgeSuite) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventBridge + var event types.EventBridge err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_cancel.go b/x/ecocredit/base/keeper/msg_cancel.go similarity index 90% rename from x/ecocredit/server/core/msg_cancel.go rename to x/ecocredit/base/keeper/msg_cancel.go index b358269093..4deadabb27 100644 --- a/x/ecocredit/server/core/msg_cancel.go +++ b/x/ecocredit/base/keeper/msg_cancel.go @@ -1,23 +1,20 @@ -package core +package keeper import ( "context" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/regen-network/regen-ledger/x/ecocredit" - - "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" - sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" + "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) // Cancel credits, removing them from the supply and balance of the owner -func (k Keeper) Cancel(ctx context.Context, req *core.MsgCancel) (*core.MsgCancelResponse, error) { +func (k Keeper) Cancel(ctx context.Context, req *types.MsgCancel) (*types.MsgCancelResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) owner, err := sdk.AccAddressFromBech32(req.Owner) if err != nil { @@ -80,7 +77,7 @@ func (k Keeper) Cancel(ctx context.Context, req *core.MsgCancel) (*core.MsgCance return nil, err } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventCancel{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventCancel{ Owner: owner.String(), BatchDenom: credit.BatchDenom, Amount: credit.Amount, @@ -91,5 +88,5 @@ func (k Keeper) Cancel(ctx context.Context, req *core.MsgCancel) (*core.MsgCance sdkCtx.GasMeter().ConsumeGas(ecocredit.GasCostPerIteration, "ecocredit/core/MsgCancel credit iteration") } - return &core.MsgCancelResponse{}, nil + return &types.MsgCancelResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_cancel_test.go b/x/ecocredit/base/keeper/msg_cancel_test.go similarity index 94% rename from x/ecocredit/server/core/msg_cancel_test.go rename to x/ecocredit/base/keeper/msg_cancel_test.go index 1ad81281c0..c5225ce86b 100644 --- a/x/ecocredit/server/core/msg_cancel_test.go +++ b/x/ecocredit/base/keeper/msg_cancel_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "encoding/json" @@ -14,7 +14,7 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type cancel struct { @@ -28,7 +28,7 @@ type cancel struct { batchDenom string batchKey uint64 tradableAmount string - res *core.MsgCancelResponse + res *types.MsgCancelResponse err error } @@ -164,9 +164,9 @@ func (s *cancel) TheBatchSupply(a gocuke.DocString) { } func (s *cancel) AliceAttemptsToCancelCreditAmount(a string) { - s.res, s.err = s.k.Cancel(s.ctx, &core.MsgCancel{ + s.res, s.err = s.k.Cancel(s.ctx, &types.MsgCancel{ Owner: s.alice.String(), - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: s.batchDenom, Amount: a, @@ -176,9 +176,9 @@ func (s *cancel) AliceAttemptsToCancelCreditAmount(a string) { } func (s *cancel) AliceAttemptsToCancelCreditsWithBatchDenom(a string) { - s.res, s.err = s.k.Cancel(s.ctx, &core.MsgCancel{ + s.res, s.err = s.k.Cancel(s.ctx, &types.MsgCancel{ Owner: s.alice.String(), - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: a, Amount: s.tradableAmount, @@ -264,9 +264,9 @@ func (s *cancel) creditBatchSetup() { } func (s *cancel) AliceAttemptsToCancelCreditAmountWithReason(a, b string) { - s.res, s.err = s.k.Cancel(s.ctx, &core.MsgCancel{ + s.res, s.err = s.k.Cancel(s.ctx, &types.MsgCancel{ Owner: s.alice.String(), - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: s.batchDenom, Amount: a, @@ -283,7 +283,7 @@ func (s *cancel) AlicesAddress(a string) { } func (s *cancel) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventCancel + var event types.EventCancel err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) event.Owner = s.alice.String() diff --git a/x/ecocredit/server/core/msg_create_batch.go b/x/ecocredit/base/keeper/msg_create_batch.go similarity index 91% rename from x/ecocredit/server/core/msg_create_batch.go rename to x/ecocredit/base/keeper/msg_create_batch.go index 6281327d71..b5404030cd 100644 --- a/x/ecocredit/server/core/msg_create_batch.go +++ b/x/ecocredit/base/keeper/msg_create_batch.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -12,13 +12,14 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) // CreateBatch creates a new batch of credits. // Credits in the batch must not have more decimal places than the credit type's specified precision. -func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*core.MsgCreateBatchResponse, error) { +func (k Keeper) CreateBatch(ctx context.Context, req *types.MsgCreateBatch) (*types.MsgCreateBatchResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) project, err := k.stateStore.ProjectTable().GetById(ctx, req.ProjectId) @@ -46,7 +47,7 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor return nil, err } - batchDenom, err := core.FormatBatchDenom(project.Id, batchSeqNo, req.StartDate, req.EndDate) + batchDenom, err := base.FormatBatchDenom(project.Id, batchSeqNo, req.StartDate, req.EndDate) if err != nil { return nil, err } @@ -149,7 +150,7 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor return nil, err } // emit retired event only if retired amount is positive - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventRetire{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventRetire{ Owner: issuance.Recipient, BatchDenom: batchDenom, Amount: retiredAmount.String(), @@ -159,7 +160,7 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor } } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventMint{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventMint{ BatchDenom: batchDenom, TradableAmount: tradableAmount.String(), RetiredAmount: retiredAmount.String(), @@ -167,7 +168,7 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor return nil, err } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventTransfer{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventTransfer{ Sender: moduleAddrString, // ecocredit module Recipient: issuance.Recipient, BatchDenom: batchDenom, @@ -221,14 +222,14 @@ func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*cor } } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventCreateBatch{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventCreateBatch{ BatchDenom: batchDenom, OriginTx: req.OriginTx, }); err != nil { return nil, err } - return &core.MsgCreateBatchResponse{BatchDenom: batchDenom}, nil + return &types.MsgCreateBatchResponse{BatchDenom: batchDenom}, nil } // getBatchSeqNo gets the batch sequence number diff --git a/x/ecocredit/server/core/msg_create_batch_test.go b/x/ecocredit/base/keeper/msg_create_batch_test.go similarity index 87% rename from x/ecocredit/server/core/msg_create_batch_test.go rename to x/ecocredit/base/keeper/msg_create_batch_test.go index 2b22d4d740..6cb36a7447 100644 --- a/x/ecocredit/server/core/msg_create_batch_test.go +++ b/x/ecocredit/base/keeper/msg_create_batch_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "encoding/json" @@ -8,16 +8,18 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/gogo/protobuf/jsonpb" "github.com/regen-network/gocuke" "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" + regentypes "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/ormutil" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type createBatchSuite struct { @@ -32,8 +34,8 @@ type createBatchSuite struct { tradableAmount string startDate *time.Time endDate *time.Time - originTx *core.OriginTx - res *core.MsgCreateBatchResponse + originTx *types.OriginTx + res *types.MsgCreateBatchResponse err error } @@ -50,10 +52,10 @@ func (s *createBatchSuite) Before(t gocuke.TestingT) { s.projectID = testProjectID s.tradableAmount = "10" - startDate, err := types.ParseDate("start date", "2020-01-01") + startDate, err := regentypes.ParseDate("start date", "2020-01-01") require.NoError(s.t, err) - endDate, err := types.ParseDate("end date", "2021-01-01") + endDate, err := regentypes.ParseDate("end date", "2021-01-01") require.NoError(s.t, err) s.startDate = &startDate @@ -101,7 +103,7 @@ func (s *createBatchSuite) ACreditClassWithIssuerAlice() { } func (s *createBatchSuite) ACreditClassWithClassIdAndIssuerAlice(a string) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) cKey, err := s.k.stateStore.ClassTable().InsertReturningID(s.ctx, &api.Class{ Id: a, @@ -119,7 +121,7 @@ func (s *createBatchSuite) ACreditClassWithClassIdAndIssuerAlice(a string) { } func (s *createBatchSuite) AProjectWithProjectId(a string) { - classID := core.GetClassIDFromProjectID(a) + classID := base.GetClassIDFromProjectID(a) class, err := s.k.stateStore.ClassTable().GetById(s.ctx, classID) require.NoError(s.t, err) @@ -175,10 +177,10 @@ func (s *createBatchSuite) ABatchContract(a gocuke.DocString) { } func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectId(a string) { - s.res, s.err = s.k.CreateBatch(s.ctx, &core.MsgCreateBatch{ + s.res, s.err = s.k.CreateBatch(s.ctx, &types.MsgCreateBatch{ Issuer: s.alice.String(), ProjectId: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.bob.String(), TradableAmount: s.tradableAmount, @@ -190,10 +192,10 @@ func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectId(a string) { } func (s *createBatchSuite) BobAttemptsToCreateABatchWithProjectId(a string) { - s.res, s.err = s.k.CreateBatch(s.ctx, &core.MsgCreateBatch{ + s.res, s.err = s.k.CreateBatch(s.ctx, &types.MsgCreateBatch{ Issuer: s.bob.String(), ProjectId: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.alice.String(), TradableAmount: s.tradableAmount, @@ -205,16 +207,16 @@ func (s *createBatchSuite) BobAttemptsToCreateABatchWithProjectId(a string) { } func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdStartDateAndEndDate(a, b, c string) { - startDate, err := types.ParseDate("start date", b) + startDate, err := regentypes.ParseDate("start date", b) require.NoError(s.t, err) - endDate, err := types.ParseDate("end date", c) + endDate, err := regentypes.ParseDate("end date", c) require.NoError(s.t, err) - s.res, s.err = s.k.CreateBatch(s.ctx, &core.MsgCreateBatch{ + s.res, s.err = s.k.CreateBatch(s.ctx, &types.MsgCreateBatch{ Issuer: s.alice.String(), ProjectId: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.bob.String(), TradableAmount: s.tradableAmount, @@ -226,10 +228,10 @@ func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdStartDateAndE } func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdAndTradableAmount(a, b string) { - s.res, s.err = s.k.CreateBatch(s.ctx, &core.MsgCreateBatch{ + s.res, s.err = s.k.CreateBatch(s.ctx, &types.MsgCreateBatch{ Issuer: s.alice.String(), ProjectId: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.bob.String(), TradableAmount: b, @@ -241,10 +243,10 @@ func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdAndTradableAm } func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdAndRetiredAmount(a, b string) { - s.res, s.err = s.k.CreateBatch(s.ctx, &core.MsgCreateBatch{ + s.res, s.err = s.k.CreateBatch(s.ctx, &types.MsgCreateBatch{ Issuer: s.alice.String(), ProjectId: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.bob.String(), RetiredAmount: b, @@ -256,14 +258,14 @@ func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdAndRetiredAmo } func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdAndOriginTx(a string, b gocuke.DocString) { - var originTx core.OriginTx + var originTx types.OriginTx err := jsonpb.UnmarshalString(b.Content, &originTx) require.NoError(s.t, err) - s.res, s.err = s.k.CreateBatch(s.ctx, &core.MsgCreateBatch{ + s.res, s.err = s.k.CreateBatch(s.ctx, &types.MsgCreateBatch{ Issuer: s.alice.String(), ProjectId: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.bob.String(), TradableAmount: s.tradableAmount, @@ -276,12 +278,12 @@ func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdAndOriginTx(a } func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdAndIssuance(a string, b gocuke.DocString) { - var issuance []*core.BatchIssuance + var issuance []*types.BatchIssuance // unmarshal with json because issuance array is not a proto message err := json.Unmarshal([]byte(b.Content), &issuance) require.NoError(s.t, err) - s.res, s.err = s.k.CreateBatch(s.ctx, &core.MsgCreateBatch{ + s.res, s.err = s.k.CreateBatch(s.ctx, &types.MsgCreateBatch{ Issuer: s.alice.String(), ProjectId: a, Issuance: issuance, @@ -291,7 +293,7 @@ func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProjectIdAndIssuance(a } func (s *createBatchSuite) AliceAttemptsToCreateABatchWithProperties(a gocuke.DocString) { - var msg core.MsgCreateBatch + var msg types.MsgCreateBatch err := jsonpb.UnmarshalString(a.Content, &msg) require.NoError(s.t, err) @@ -360,14 +362,14 @@ func (s *createBatchSuite) ExpectBatchSequenceWithProjectIdAndNextSequence(a str } func (s *createBatchSuite) ExpectBatchProperties(a gocuke.DocString) { - var expected core.Batch + var expected types.Batch err := jsonpb.UnmarshalString(a.Content, &expected) require.NoError(s.t, err) batch, err := s.stateStore.BatchTable().GetByDenom(s.ctx, expected.Denom) require.NoError(s.t, err) - coreBatch := new(core.Batch) + coreBatch := new(types.Batch) require.NoError(s.t, ormutil.PulsarToGogoSlow(batch, coreBatch)) // set the properties that get set during state machine execution. @@ -380,7 +382,7 @@ func (s *createBatchSuite) ExpectBatchProperties(a gocuke.DocString) { } func (s *createBatchSuite) ExpectBatchContract(a gocuke.DocString) { - var expected core.BatchContract + var expected types.BatchContract err := jsonpb.UnmarshalString(a.Content, &expected) require.NoError(s.t, err) @@ -391,7 +393,7 @@ func (s *createBatchSuite) ExpectBatchContract(a gocuke.DocString) { } func (s *createBatchSuite) ExpectTheResponse(a gocuke.DocString) { - var res core.MsgCreateBatchResponse + var res types.MsgCreateBatchResponse err := jsonpb.UnmarshalString(a.Content, &res) require.NoError(s.t, err) @@ -399,7 +401,7 @@ func (s *createBatchSuite) ExpectTheResponse(a gocuke.DocString) { } func (s *createBatchSuite) ExpectEventRetireWithProperties(a gocuke.DocString) { - var event core.EventRetire + var event types.EventRetire err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) @@ -411,7 +413,7 @@ func (s *createBatchSuite) ExpectEventRetireWithProperties(a gocuke.DocString) { } func (s *createBatchSuite) ExpectEventMintWithProperties(a gocuke.DocString) { - var event core.EventMint + var event types.EventMint err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) @@ -422,7 +424,7 @@ func (s *createBatchSuite) ExpectEventMintWithProperties(a gocuke.DocString) { } func (s *createBatchSuite) ExpectEventTransferWithProperties(a gocuke.DocString) { - var event core.EventTransfer + var event types.EventTransfer err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) event.Sender = s.k.moduleAddress.String() @@ -435,10 +437,10 @@ func (s *createBatchSuite) ExpectEventTransferWithProperties(a gocuke.DocString) } func (s *createBatchSuite) CreatesABatchFromProjectAndIssuesRetiredCreditsToFrom(a, b, c, d string) { - s.res, s.err = s.k.CreateBatch(s.ctx, &core.MsgCreateBatch{ + s.res, s.err = s.k.CreateBatch(s.ctx, &types.MsgCreateBatch{ Issuer: s.alice.String(), ProjectId: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: c, RetiredAmount: b, @@ -453,10 +455,10 @@ func (s *createBatchSuite) CreatesABatchFromProjectAndIssuesRetiredCreditsToFrom } func (s *createBatchSuite) CreatesABatchFromProjectAndIssuesTradableCreditsTo(a string, b string, c string) { - s.res, s.err = s.k.CreateBatch(s.ctx, &core.MsgCreateBatch{ + s.res, s.err = s.k.CreateBatch(s.ctx, &types.MsgCreateBatch{ Issuer: s.alice.String(), ProjectId: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: c, TradableAmount: b, @@ -470,7 +472,7 @@ func (s *createBatchSuite) CreatesABatchFromProjectAndIssuesTradableCreditsTo(a } func (s *createBatchSuite) ExpectEventCreateBatchWithProperties(a gocuke.DocString) { - var event core.EventCreateBatch + var event types.EventCreateBatch err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) @@ -488,7 +490,7 @@ func (s *createBatchSuite) EcocreditModulesAddress(a string) { } func (s *createBatchSuite) OriginTx(a gocuke.DocString) { - var ot core.OriginTx + var ot types.OriginTx err := json.Unmarshal([]byte(a.Content), &ot) require.NoError(s.t, err) s.originTx = &ot diff --git a/x/ecocredit/server/core/msg_create_class.go b/x/ecocredit/base/keeper/msg_create_class.go similarity index 89% rename from x/ecocredit/server/core/msg_create_class.go rename to x/ecocredit/base/keeper/msg_create_class.go index 8b9a232321..72d45061e3 100644 --- a/x/ecocredit/server/core/msg_create_class.go +++ b/x/ecocredit/base/keeper/msg_create_class.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,9 +8,10 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" + regentypes "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // CreateClass creates a new class of ecocredit @@ -18,7 +19,7 @@ import ( // The admin is charged a fee for creating the class. This is controlled by // the global parameter CreditClassFee, which can be updated through the // governance process. -func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*core.MsgCreateClassResponse, error) { +func (k Keeper) CreateClass(goCtx context.Context, req *types.MsgCreateClass) (*types.MsgCreateClassResponse, error) { sdkCtx := sdk.UnwrapSDKContext(goCtx) adminAddress, err := sdk.AccAddressFromBech32(req.Admin) if err != nil { @@ -38,7 +39,7 @@ func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*c fees = &api.ClassFees{} } - allowedFees, ok := types.ProtoCoinsToCoins(fees.Fees) + allowedFees, ok := regentypes.ProtoCoinsToCoins(fees.Fees) if !ok { return nil, sdkerrors.ErrInvalidType.Wrap("credit class fee") } @@ -117,7 +118,7 @@ func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*c return nil, err } - classID := core.FormatClassID(creditType.Abbreviation, seq) + classID := base.FormatClassID(creditType.Abbreviation, seq) key, err := k.stateStore.ClassTable().InsertReturningID(goCtx, &api.Class{ Id: classID, @@ -144,14 +145,14 @@ func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*c sdkCtx.GasMeter().ConsumeGas(ecocredit.GasCostPerIteration, "ecocredit/core/MsgCreateClass issuer iteration") } - err = sdkCtx.EventManager().EmitTypedEvent(&core.EventCreateClass{ + err = sdkCtx.EventManager().EmitTypedEvent(&types.EventCreateClass{ ClassId: classID, }) if err != nil { return nil, err } - return &core.MsgCreateClassResponse{ClassId: classID}, nil + return &types.MsgCreateClassResponse{ClassId: classID}, nil } func (k Keeper) assertCanCreateClass(ctx context.Context, adminAddress sdk.AccAddress) error { diff --git a/x/ecocredit/server/core/msg_create_class_test.go b/x/ecocredit/base/keeper/msg_create_class_test.go similarity index 91% rename from x/ecocredit/server/core/msg_create_class_test.go rename to x/ecocredit/base/keeper/msg_create_class_test.go index 71f8715c81..a2dc8b29ee 100644 --- a/x/ecocredit/server/core/msg_create_class_test.go +++ b/x/ecocredit/base/keeper/msg_create_class_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "encoding/json" @@ -8,13 +8,13 @@ import ( "github.com/regen-network/gocuke" "github.com/stretchr/testify/require" - v1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" + sdkbase "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" sdk "github.com/cosmos/cosmos-sdk/types" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type createClassSuite struct { @@ -23,9 +23,9 @@ type createClassSuite struct { aliceBalance sdk.Coin creditTypeAbbrev string allowedClassCreators []string - creditClassFee []*v1beta1.Coin + creditClassFee []*sdkbase.Coin classID string - res *core.MsgCreateClassResponse + res *types.MsgCreateClassResponse err error } @@ -83,7 +83,7 @@ func (s *createClassSuite) AllowedCreditClassFee(a string) { require.NoError(s.t, err) for _, fee := range creditClassFee { - s.creditClassFee = append(s.creditClassFee, &v1beta1.Coin{ + s.creditClassFee = append(s.creditClassFee, &sdkbase.Coin{ Denom: fee.Denom, Amount: fee.Amount.String(), }) @@ -116,7 +116,7 @@ func (s *createClassSuite) AClassSequenceWithCreditTypeAndNextSequence(a string, func (s *createClassSuite) AliceAttemptsToCreateACreditClass() { s.createClassExpectCalls() - s.res, s.err = s.k.CreateClass(s.ctx, &core.MsgCreateClass{ + s.res, s.err = s.k.CreateClass(s.ctx, &types.MsgCreateClass{ Admin: s.alice.String(), CreditTypeAbbrev: s.creditTypeAbbrev, }) @@ -125,7 +125,7 @@ func (s *createClassSuite) AliceAttemptsToCreateACreditClass() { func (s *createClassSuite) AliceAttemptsToCreateACreditClassWithCreditType(a string) { s.createClassExpectCalls() - s.res, s.err = s.k.CreateClass(s.ctx, &core.MsgCreateClass{ + s.res, s.err = s.k.CreateClass(s.ctx, &types.MsgCreateClass{ Admin: s.alice.String(), CreditTypeAbbrev: a, }) @@ -139,7 +139,7 @@ func (s *createClassSuite) AliceAttemptsToCreateACreditClassWithIssuers(a gocuke s.createClassExpectCalls() - s.res, s.err = s.k.CreateClass(s.ctx, &core.MsgCreateClass{ + s.res, s.err = s.k.CreateClass(s.ctx, &types.MsgCreateClass{ Admin: s.alice.String(), CreditTypeAbbrev: s.creditTypeAbbrev, Issuers: issuers, @@ -147,14 +147,14 @@ func (s *createClassSuite) AliceAttemptsToCreateACreditClassWithIssuers(a gocuke } func (s *createClassSuite) AliceAttemptsToCreateACreditClassWithProperties(a gocuke.DocString) { - var msg *core.MsgCreateClass + var msg *types.MsgCreateClass err := json.Unmarshal([]byte(a.Content), &msg) require.NoError(s.t, err) s.createClassExpectCalls() - s.res, s.err = s.k.CreateClass(s.ctx, &core.MsgCreateClass{ + s.res, s.err = s.k.CreateClass(s.ctx, &types.MsgCreateClass{ Admin: s.alice.String(), CreditTypeAbbrev: msg.CreditTypeAbbrev, Metadata: msg.Metadata, @@ -167,7 +167,7 @@ func (s *createClassSuite) AliceAttemptsToCreateACreditClassWithFee(a string) { s.createClassExpectCalls() - s.res, s.err = s.k.CreateClass(s.ctx, &core.MsgCreateClass{ + s.res, s.err = s.k.CreateClass(s.ctx, &types.MsgCreateClass{ Admin: s.alice.String(), CreditTypeAbbrev: s.creditTypeAbbrev, Fee: &fee, @@ -229,7 +229,7 @@ func (s *createClassSuite) ExpectClassProperties(a gocuke.DocString) { } func (s *createClassSuite) ExpectTheResponse(a gocuke.DocString) { - var res *core.MsgCreateClassResponse + var res *types.MsgCreateClassResponse err := json.Unmarshal([]byte(a.Content), &res) require.NoError(s.t, err) @@ -238,7 +238,7 @@ func (s *createClassSuite) ExpectTheResponse(a gocuke.DocString) { } func (s *createClassSuite) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventCreateClass + var event types.EventCreateClass err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_create_project.go b/x/ecocredit/base/keeper/msg_create_project.go similarity index 87% rename from x/ecocredit/server/core/msg_create_project.go rename to x/ecocredit/base/keeper/msg_create_project.go index a594a39c8f..4569b6561d 100644 --- a/x/ecocredit/server/core/msg_create_project.go +++ b/x/ecocredit/base/keeper/msg_create_project.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,11 +8,12 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // CreateProject creates a new project for a specific credit class. -func (k Keeper) CreateProject(ctx context.Context, req *core.MsgCreateProject) (*core.MsgCreateProjectResponse, error) { +func (k Keeper) CreateProject(ctx context.Context, req *types.MsgCreateProject) (*types.MsgCreateProjectResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) classInfo, err := k.stateStore.ClassTable().GetById(ctx, req.ClassId) if err != nil { @@ -51,13 +52,13 @@ func (k Keeper) CreateProject(ctx context.Context, req *core.MsgCreateProject) ( return nil, err } - if err := sdkCtx.EventManager().EmitTypedEvent(&core.EventCreateProject{ + if err := sdkCtx.EventManager().EmitTypedEvent(&types.EventCreateProject{ ProjectId: projectID, }); err != nil { return nil, err } - return &core.MsgCreateProjectResponse{ + return &types.MsgCreateProjectResponse{ ProjectId: projectID, }, nil } @@ -83,7 +84,7 @@ func (k Keeper) genProjectID(ctx context.Context, classKey uint64, classID strin return "", err } - return core.FormatProjectID(classID, nextSeq), nil + return base.FormatProjectID(classID, nextSeq), nil } // verifyReferenceID prevents multiple projects from having the same reference id within the diff --git a/x/ecocredit/server/core/msg_create_project_test.go b/x/ecocredit/base/keeper/msg_create_project_test.go similarity index 87% rename from x/ecocredit/server/core/msg_create_project_test.go rename to x/ecocredit/base/keeper/msg_create_project_test.go index 58d023e338..4fb95fceee 100644 --- a/x/ecocredit/server/core/msg_create_project_test.go +++ b/x/ecocredit/base/keeper/msg_create_project_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "encoding/json" @@ -15,14 +15,15 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type createProjectSuite struct { *baseSuite alice sdk.AccAddress bob sdk.AccAddress - res *core.MsgCreateProjectResponse + res *types.MsgCreateProjectResponse err error } @@ -45,7 +46,7 @@ func (s *createProjectSuite) ACreditTypeWithAbbreviation(a string) { } func (s *createProjectSuite) ACreditClassWithClassIdAndIssuerAlice(a string) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) cKey, err := s.k.stateStore.ClassTable().InsertReturningID(s.ctx, &api.Class{ Id: a, @@ -75,7 +76,7 @@ func (s *createProjectSuite) AProjectSequenceWithClassIdAndNextSequence(a, b str } func (s *createProjectSuite) AProjectWithProjectIdAndReferenceId(a, b string) { - classID := core.GetClassIDFromProjectID(a) + classID := base.GetClassIDFromProjectID(a) class, err := s.k.stateStore.ClassTable().GetById(s.ctx, classID) require.NoError(s.t, err) @@ -98,21 +99,21 @@ func (s *createProjectSuite) AProjectWithProjectIdAndReferenceId(a, b string) { } func (s *createProjectSuite) AliceAttemptsToCreateAProjectWithClassId(a string) { - s.res, s.err = s.k.CreateProject(s.ctx, &core.MsgCreateProject{ + s.res, s.err = s.k.CreateProject(s.ctx, &types.MsgCreateProject{ Admin: s.alice.String(), ClassId: a, }) } func (s *createProjectSuite) BobAttemptsToCreateAProjectWithClassId(a string) { - s.res, s.err = s.k.CreateProject(s.ctx, &core.MsgCreateProject{ + s.res, s.err = s.k.CreateProject(s.ctx, &types.MsgCreateProject{ Admin: s.bob.String(), ClassId: a, }) } func (s *createProjectSuite) AliceAttemptsToCreateAProjectWithClassIdAndReferenceId(a, b string) { - s.res, s.err = s.k.CreateProject(s.ctx, &core.MsgCreateProject{ + s.res, s.err = s.k.CreateProject(s.ctx, &types.MsgCreateProject{ Admin: s.alice.String(), ClassId: a, ReferenceId: b, @@ -120,11 +121,11 @@ func (s *createProjectSuite) AliceAttemptsToCreateAProjectWithClassIdAndReferenc } func (s *createProjectSuite) AliceAttemptsToCreateAProjectWithProperties(a gocuke.DocString) { - var msg core.MsgCreateProject + var msg types.MsgCreateProject err := jsonpb.UnmarshalString(a.Content, &msg) require.NoError(s.t, err) - s.res, s.err = s.k.CreateProject(s.ctx, &core.MsgCreateProject{ + s.res, s.err = s.k.CreateProject(s.ctx, &types.MsgCreateProject{ Admin: s.alice.String(), ClassId: msg.ClassId, Metadata: msg.Metadata, @@ -159,7 +160,7 @@ func (s *createProjectSuite) ExpectProjectSequenceWithClassIdAndNextSequence(a s } func (s *createProjectSuite) ExpectProjectProperties(a gocuke.DocString) { - var expected core.Project + var expected types.Project err := jsonpb.UnmarshalString(a.Content, &expected) require.NoError(s.t, err) @@ -172,7 +173,7 @@ func (s *createProjectSuite) ExpectProjectProperties(a gocuke.DocString) { } func (s *createProjectSuite) ExpectTheResponse(a gocuke.DocString) { - var res core.MsgCreateProjectResponse + var res types.MsgCreateProjectResponse err := jsonpb.UnmarshalString(a.Content, &res) require.NoError(s.t, err) @@ -180,7 +181,7 @@ func (s *createProjectSuite) ExpectTheResponse(a gocuke.DocString) { } func (s *createProjectSuite) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventCreateProject + var event types.EventCreateProject err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_mint_batch_credits.go b/x/ecocredit/base/keeper/msg_mint_batch_credits.go similarity index 90% rename from x/ecocredit/server/core/msg_mint_batch_credits.go rename to x/ecocredit/base/keeper/msg_mint_batch_credits.go index 6062e90c59..0325572086 100644 --- a/x/ecocredit/server/core/msg_mint_batch_credits.go +++ b/x/ecocredit/base/keeper/msg_mint_batch_credits.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,12 +8,12 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) // MintBatchCredits issues additional credits from an open batch. -func (k Keeper) MintBatchCredits(ctx context.Context, req *core.MsgMintBatchCredits) (*core.MsgMintBatchCreditsResponse, error) { +func (k Keeper) MintBatchCredits(ctx context.Context, req *types.MsgMintBatchCredits) (*types.MsgMintBatchCreditsResponse, error) { issuer, err := sdk.AccAddressFromBech32(req.Issuer) if err != nil { return nil, err @@ -87,7 +87,7 @@ func (k Keeper) MintBatchCredits(ctx context.Context, req *core.MsgMintBatchCred if err != nil { return nil, err } - if err := sdkCtx.EventManager().EmitTypedEvent(&core.EventRetire{ + if err := sdkCtx.EventManager().EmitTypedEvent(&types.EventRetire{ Owner: iss.Recipient, BatchDenom: req.BatchDenom, Amount: retired.String(), @@ -107,7 +107,7 @@ func (k Keeper) MintBatchCredits(ctx context.Context, req *core.MsgMintBatchCred if err != nil { return nil, err } - if err := sdkCtx.EventManager().EmitTypedEvent(&core.EventTransfer{ + if err := sdkCtx.EventManager().EmitTypedEvent(&types.EventTransfer{ Sender: moduleAddrString, // ecocredit module Recipient: iss.Recipient, BatchDenom: req.BatchDenom, @@ -126,7 +126,7 @@ func (k Keeper) MintBatchCredits(ctx context.Context, req *core.MsgMintBatchCred return nil, err } - if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&core.EventMint{ + if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&types.EventMint{ BatchDenom: batch.Denom, TradableAmount: tradable.String(), RetiredAmount: retired.String(), @@ -135,14 +135,14 @@ func (k Keeper) MintBatchCredits(ctx context.Context, req *core.MsgMintBatchCred } } - if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&core.EventMintBatchCredits{ + if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&types.EventMintBatchCredits{ BatchDenom: batch.Denom, OriginTx: req.OriginTx, }); err != nil { return nil, err } - return &core.MsgMintBatchCreditsResponse{}, nil + return &types.MsgMintBatchCreditsResponse{}, nil } // asserts that the batch is open for minting and that the requester address matches the batch issuer address. diff --git a/x/ecocredit/server/core/msg_mint_batch_credits_test.go b/x/ecocredit/base/keeper/msg_mint_batch_credits_test.go similarity index 87% rename from x/ecocredit/server/core/msg_mint_batch_credits_test.go rename to x/ecocredit/base/keeper/msg_mint_batch_credits_test.go index 1e21895ea9..6d50d3998e 100644 --- a/x/ecocredit/server/core/msg_mint_batch_credits_test.go +++ b/x/ecocredit/base/keeper/msg_mint_batch_credits_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "encoding/json" @@ -15,7 +15,8 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type mintBatchCredits struct { @@ -26,9 +27,9 @@ type mintBatchCredits struct { classKey uint64 projectKey uint64 batchDenom string - originTx *core.OriginTx + originTx *types.OriginTx tradableAmount string - res *core.MsgMintBatchCreditsResponse + res *types.MsgMintBatchCreditsResponse err error } @@ -40,7 +41,7 @@ func (s *mintBatchCredits) Before(t gocuke.TestingT) { s.baseSuite = setupBase(t) s.alice = s.addr s.bob = s.addr2 - s.originTx = &core.OriginTx{ + s.originTx = &types.OriginTx{ Id: "0x7a70692a348e8688f54ab2bdfe87d925d8cc88932520492a11eaa02dc128243e", Source: "polygon", } @@ -83,7 +84,7 @@ func (s *mintBatchCredits) AProjectWithId(a string) { } func (s *mintBatchCredits) ACreditBatchWithDenomAndIssuerAlice(a string) { - projectID := core.GetProjectIDFromBatchDenom(a) + projectID := base.GetProjectIDFromBatchDenom(a) project, err := s.k.stateStore.ProjectTable().GetById(s.ctx, projectID) require.NoError(s.t, err) @@ -148,10 +149,10 @@ func (s *mintBatchCredits) AnOriginTxIndex(a gocuke.DocString) { } func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenom(a string) { - s.res, s.err = s.k.MintBatchCredits(s.ctx, &core.MsgMintBatchCredits{ + s.res, s.err = s.k.MintBatchCredits(s.ctx, &types.MsgMintBatchCredits{ Issuer: s.alice.String(), BatchDenom: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.bob.String(), TradableAmount: s.tradableAmount, @@ -162,10 +163,10 @@ func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenom(a string) { } func (s *mintBatchCredits) BobAttemptsToMintCreditsWithBatchDenom(a string) { - s.res, s.err = s.k.MintBatchCredits(s.ctx, &core.MsgMintBatchCredits{ + s.res, s.err = s.k.MintBatchCredits(s.ctx, &types.MsgMintBatchCredits{ Issuer: s.bob.String(), BatchDenom: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.alice.String(), TradableAmount: s.tradableAmount, @@ -176,14 +177,14 @@ func (s *mintBatchCredits) BobAttemptsToMintCreditsWithBatchDenom(a string) { } func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenomAndOriginTx(a string, b gocuke.DocString) { - originTx := &core.OriginTx{} + originTx := &types.OriginTx{} err := jsonpb.UnmarshalString(b.Content, originTx) require.NoError(s.t, err) - s.res, s.err = s.k.MintBatchCredits(s.ctx, &core.MsgMintBatchCredits{ + s.res, s.err = s.k.MintBatchCredits(s.ctx, &types.MsgMintBatchCredits{ Issuer: s.alice.String(), BatchDenom: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.bob.String(), TradableAmount: s.tradableAmount, @@ -194,10 +195,10 @@ func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenomAndOriginTx(a } func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenomAndTradableAmount(a, b string) { - s.res, s.err = s.k.MintBatchCredits(s.ctx, &core.MsgMintBatchCredits{ + s.res, s.err = s.k.MintBatchCredits(s.ctx, &types.MsgMintBatchCredits{ Issuer: s.alice.String(), BatchDenom: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.bob.String(), TradableAmount: b, @@ -208,10 +209,10 @@ func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenomAndTradableAm } func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenomRecipientBobAndTradableAmount(a, b string) { - s.res, s.err = s.k.MintBatchCredits(s.ctx, &core.MsgMintBatchCredits{ + s.res, s.err = s.k.MintBatchCredits(s.ctx, &types.MsgMintBatchCredits{ Issuer: s.alice.String(), BatchDenom: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: s.bob.String(), TradableAmount: b, @@ -262,10 +263,10 @@ func (s *mintBatchCredits) ExpectBatchSupply(a gocuke.DocString) { } func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenomWithRetiredAmountFromTo(a, b, c, d string) { - s.res, s.err = s.k.MintBatchCredits(s.ctx, &core.MsgMintBatchCredits{ + s.res, s.err = s.k.MintBatchCredits(s.ctx, &types.MsgMintBatchCredits{ Issuer: s.alice.String(), BatchDenom: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: d, RetiredAmount: b, @@ -278,7 +279,7 @@ func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenomWithRetiredAm } func (s *mintBatchCredits) ExpectEventRetireWithProperties(a gocuke.DocString) { - var event core.EventRetire + var event types.EventRetire err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) @@ -290,7 +291,7 @@ func (s *mintBatchCredits) ExpectEventRetireWithProperties(a gocuke.DocString) { } func (s *mintBatchCredits) ExpectEventMintWithProperties(a gocuke.DocString) { - var event core.EventMint + var event types.EventMint err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) @@ -302,7 +303,7 @@ func (s *mintBatchCredits) ExpectEventMintWithProperties(a gocuke.DocString) { } func (s *mintBatchCredits) ExpectEventMintBatchCreditsWithProperties(a gocuke.DocString) { - var event core.EventMintBatchCredits + var event types.EventMintBatchCredits err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) @@ -314,14 +315,14 @@ func (s *mintBatchCredits) ExpectEventMintBatchCreditsWithProperties(a gocuke.Do } func (s *mintBatchCredits) AnOriginTxWithProperties(a gocuke.DocString) { - var ot core.OriginTx + var ot types.OriginTx err := json.Unmarshal([]byte(a.Content), &ot) require.NoError(s.t, err) s.originTx = &ot } func (s *mintBatchCredits) ExpectEventTransferWithProperties(a gocuke.DocString) { - var event core.EventTransfer + var event types.EventTransfer err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) event.Sender = s.k.moduleAddress.String() @@ -334,10 +335,10 @@ func (s *mintBatchCredits) ExpectEventTransferWithProperties(a gocuke.DocString) } func (s *mintBatchCredits) AliceAttemptsToMintCreditsWithBatchDenomWithTradableAmountTo(a string, b string, c string) { - s.res, s.err = s.k.MintBatchCredits(s.ctx, &core.MsgMintBatchCredits{ + s.res, s.err = s.k.MintBatchCredits(s.ctx, &types.MsgMintBatchCredits{ Issuer: s.alice.String(), BatchDenom: a, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: c, TradableAmount: b, diff --git a/x/ecocredit/server/core/msg_remove_class_creators.go b/x/ecocredit/base/keeper/msg_remove_class_creators.go similarity index 77% rename from x/ecocredit/server/core/msg_remove_class_creators.go rename to x/ecocredit/base/keeper/msg_remove_class_creators.go index fa7ce3d764..2ac195fe59 100644 --- a/x/ecocredit/server/core/msg_remove_class_creators.go +++ b/x/ecocredit/base/keeper/msg_remove_class_creators.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,10 +8,10 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) -func (k Keeper) RemoveClassCreator(ctx context.Context, req *core.MsgRemoveClassCreator) (*core.MsgRemoveClassCreatorResponse, error) { +func (k Keeper) RemoveClassCreator(ctx context.Context, req *types.MsgRemoveClassCreator) (*types.MsgRemoveClassCreatorResponse, error) { if k.authority.String() != req.Authority { return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority: expected %s, got %s", k.authority, req.Authority) } @@ -33,5 +33,5 @@ func (k Keeper) RemoveClassCreator(ctx context.Context, req *core.MsgRemoveClass return nil, sdkerrors.ErrInvalidRequest.Wrapf("unable to remove %s from class creator list: %s", req.Creator, err.Error()) } - return &core.MsgRemoveClassCreatorResponse{}, nil + return &types.MsgRemoveClassCreatorResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_remove_class_creators_test.go b/x/ecocredit/base/keeper/msg_remove_class_creators_test.go similarity index 85% rename from x/ecocredit/server/core/msg_remove_class_creators_test.go rename to x/ecocredit/base/keeper/msg_remove_class_creators_test.go index b0ffe2e821..83d95bb3c4 100644 --- a/x/ecocredit/server/core/msg_remove_class_creators_test.go +++ b/x/ecocredit/base/keeper/msg_remove_class_creators_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "encoding/json" @@ -8,8 +8,8 @@ import ( "github.com/regen-network/gocuke" "github.com/stretchr/testify/require" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type removeClassClassCreator struct { @@ -39,7 +39,7 @@ func (s *removeClassClassCreator) ClassCreatorsWithProperties(a gocuke.DocString creatorAddr, err := sdk.AccAddressFromBech32(creator) require.NoError(s.t, err) - err = s.stateStore.AllowedClassCreatorTable().Insert(s.ctx, &ecocreditv1.AllowedClassCreator{ + err = s.stateStore.AllowedClassCreatorTable().Insert(s.ctx, &api.AllowedClassCreator{ Address: creatorAddr, }) require.NoError(s.t, err) @@ -47,7 +47,7 @@ func (s *removeClassClassCreator) ClassCreatorsWithProperties(a gocuke.DocString } func (s *removeClassClassCreator) AliceAttemptsToRemoveAClassCreatorWithProperties(a gocuke.DocString) { - var msg *core.MsgRemoveClassCreator + var msg *types.MsgRemoveClassCreator err := json.Unmarshal([]byte(a.Content), &msg) require.NoError(s.t, err) @@ -61,7 +61,7 @@ func (s *removeClassClassCreator) ExpectClassCreatorsWithProperties(a gocuke.Doc err := json.Unmarshal([]byte(a.Content), &creators) require.NoError(s.t, err) - itr, err := s.stateStore.AllowedClassCreatorTable().List(s.ctx, ecocreditv1.AllowedClassCreatorPrimaryKey{}) + itr, err := s.stateStore.AllowedClassCreatorTable().List(s.ctx, api.AllowedClassCreatorPrimaryKey{}) require.NoError(s.t, err) found := 0 @@ -81,7 +81,7 @@ func (s *removeClassClassCreator) ExpectClassCreatorsWithProperties(a gocuke.Doc } func (s *removeClassClassCreator) ExpectClassCreatorsListToBeEmpty() { - itr, err := s.stateStore.AllowedClassCreatorTable().List(s.ctx, ecocreditv1.AllowedClassCreatorPrimaryKey{}) + itr, err := s.stateStore.AllowedClassCreatorTable().List(s.ctx, api.AllowedClassCreatorPrimaryKey{}) require.NoError(s.t, err) ok := itr.Next() diff --git a/x/ecocredit/server/core/msg_retire.go b/x/ecocredit/base/keeper/msg_retire.go similarity index 91% rename from x/ecocredit/server/core/msg_retire.go rename to x/ecocredit/base/keeper/msg_retire.go index 006a4f8495..14bcd15a6a 100644 --- a/x/ecocredit/server/core/msg_retire.go +++ b/x/ecocredit/base/keeper/msg_retire.go @@ -1,23 +1,21 @@ -package core +package keeper import ( "context" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" - sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" + "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) // Retire credits to the specified jurisdiction. // WARNING: retiring credits is permanent. Retired credits cannot be un-retired. -func (k Keeper) Retire(ctx context.Context, req *core.MsgRetire) (*core.MsgRetireResponse, error) { +func (k Keeper) Retire(ctx context.Context, req *types.MsgRetire) (*types.MsgRetireResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) owner, _ := sdk.AccAddressFromBech32(req.Owner) @@ -92,7 +90,7 @@ func (k Keeper) Retire(ctx context.Context, req *core.MsgRetire) (*core.MsgRetir return nil, err } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventRetire{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventRetire{ Owner: req.Owner, BatchDenom: credit.BatchDenom, Amount: credit.Amount, @@ -103,5 +101,5 @@ func (k Keeper) Retire(ctx context.Context, req *core.MsgRetire) (*core.MsgRetir sdkCtx.GasMeter().ConsumeGas(ecocredit.GasCostPerIteration, "ecocredit/core/MsgRetire credit iteration") } - return &core.MsgRetireResponse{}, nil + return &types.MsgRetireResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_retire_test.go b/x/ecocredit/base/keeper/msg_retire_test.go similarity index 94% rename from x/ecocredit/server/core/msg_retire_test.go rename to x/ecocredit/base/keeper/msg_retire_test.go index 9060dbb8ec..f509ad98e1 100644 --- a/x/ecocredit/server/core/msg_retire_test.go +++ b/x/ecocredit/base/keeper/msg_retire_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "encoding/json" @@ -13,7 +13,7 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type retire struct { @@ -27,7 +27,7 @@ type retire struct { batchDenom string batchKey uint64 tradableAmount string - res *core.MsgRetireResponse + res *types.MsgRetireResponse err error } @@ -169,9 +169,9 @@ func (s *retire) TheBatchSupply(a gocuke.DocString) { } func (s *retire) AliceAttemptsToRetireCreditAmount(a string) { - s.res, s.err = s.k.Retire(s.ctx, &core.MsgRetire{ + s.res, s.err = s.k.Retire(s.ctx, &types.MsgRetire{ Owner: s.alice.String(), - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: s.batchDenom, Amount: a, @@ -181,9 +181,9 @@ func (s *retire) AliceAttemptsToRetireCreditAmount(a string) { } func (s *retire) AliceAttemptsToRetireCreditsWithBatchDenom(a string) { - s.res, s.err = s.k.Retire(s.ctx, &core.MsgRetire{ + s.res, s.err = s.k.Retire(s.ctx, &types.MsgRetire{ Owner: s.alice.String(), - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: a, Amount: s.tradableAmount, @@ -226,9 +226,9 @@ func (s *retire) ExpectBatchSupply(a gocuke.DocString) { } func (s *retire) AliceAttemptsToRetireCreditAmountFrom(a string, b string) { - s.res, s.err = s.k.Retire(s.ctx, &core.MsgRetire{ + s.res, s.err = s.k.Retire(s.ctx, &types.MsgRetire{ Owner: s.alice.String(), - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: s.batchDenom, Amount: a, @@ -240,7 +240,7 @@ func (s *retire) AliceAttemptsToRetireCreditAmountFrom(a string, b string) { } func (s *retire) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventRetire + var event types.EventRetire err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) event.Owner = s.alice.String() diff --git a/x/ecocredit/server/core/msg_seal_batch.go b/x/ecocredit/base/keeper/msg_seal_batch.go similarity index 73% rename from x/ecocredit/server/core/msg_seal_batch.go rename to x/ecocredit/base/keeper/msg_seal_batch.go index 76323bb7f0..a3b27fd607 100644 --- a/x/ecocredit/server/core/msg_seal_batch.go +++ b/x/ecocredit/base/keeper/msg_seal_batch.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,12 +6,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // SealBatch sets the Open field to false in a batch IFF the requester address matches the batch issuer address. // This method is a no-op for batches which already have Open set to false. -func (k Keeper) SealBatch(ctx context.Context, req *core.MsgSealBatch) (*core.MsgSealBatchResponse, error) { +func (k Keeper) SealBatch(ctx context.Context, req *types.MsgSealBatch) (*types.MsgSealBatchResponse, error) { issuer, err := sdk.AccAddressFromBech32(req.Issuer) if err != nil { return nil, err @@ -27,7 +27,7 @@ func (k Keeper) SealBatch(ctx context.Context, req *core.MsgSealBatch) (*core.Ms } if !batch.Open { - return &core.MsgSealBatchResponse{}, nil + return &types.MsgSealBatchResponse{}, nil } batch.Open = false @@ -35,9 +35,9 @@ func (k Keeper) SealBatch(ctx context.Context, req *core.MsgSealBatch) (*core.Ms return nil, err } - if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&core.EventSealBatch{BatchDenom: batch.Denom}); err != nil { + if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&types.EventSealBatch{BatchDenom: batch.Denom}); err != nil { return nil, err } - return &core.MsgSealBatchResponse{}, nil + return &types.MsgSealBatchResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_seal_batch_test.go b/x/ecocredit/base/keeper/msg_seal_batch_test.go similarity index 87% rename from x/ecocredit/server/core/msg_seal_batch_test.go rename to x/ecocredit/base/keeper/msg_seal_batch_test.go index ebbb6cf6da..e0280d1210 100644 --- a/x/ecocredit/server/core/msg_seal_batch_test.go +++ b/x/ecocredit/base/keeper/msg_seal_batch_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "encoding/json" @@ -12,7 +12,8 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type sealBatch struct { @@ -21,7 +22,7 @@ type sealBatch struct { bob sdk.AccAddress creditTypeAbbrev string classKey uint64 - res *core.MsgSealBatchResponse + res *types.MsgSealBatchResponse err error } @@ -70,7 +71,7 @@ func (s *sealBatch) AProjectWithId(a string) { } func (s *sealBatch) ACreditBatchWithDenomAndIssuerAlice(a string) { - projectID := core.GetProjectIDFromBatchDenom(a) + projectID := base.GetProjectIDFromBatchDenom(a) project, err := s.k.stateStore.ProjectTable().GetById(s.ctx, projectID) require.NoError(s.t, err) @@ -93,14 +94,14 @@ func (s *sealBatch) ACreditBatchWithDenomAndIssuerAlice(a string) { } func (s *sealBatch) AliceAttemptsToSealBatchWithDenom(a string) { - s.res, s.err = s.k.SealBatch(s.ctx, &core.MsgSealBatch{ + s.res, s.err = s.k.SealBatch(s.ctx, &types.MsgSealBatch{ Issuer: s.alice.String(), BatchDenom: a, }) } func (s *sealBatch) BobAttemptsToSealBatchWithDenom(a string) { - s.res, s.err = s.k.SealBatch(s.ctx, &core.MsgSealBatch{ + s.res, s.err = s.k.SealBatch(s.ctx, &types.MsgSealBatch{ Issuer: s.bob.String(), BatchDenom: a, }) @@ -115,7 +116,7 @@ func (s *sealBatch) ExpectTheError(a string) { } func (s *sealBatch) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventSealBatch + var event types.EventSealBatch err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_send.go b/x/ecocredit/base/keeper/msg_send.go similarity index 91% rename from x/ecocredit/server/core/msg_send.go rename to x/ecocredit/base/keeper/msg_send.go index 20d7b1e202..326539f322 100644 --- a/x/ecocredit/server/core/msg_send.go +++ b/x/ecocredit/base/keeper/msg_send.go @@ -1,24 +1,22 @@ -package core +package keeper import ( "context" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" - "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" + "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) // Send sends credits to a recipient. // Send also retires credits if the amount to retire is specified in the request. -func (k Keeper) Send(ctx context.Context, req *core.MsgSend) (*core.MsgSendResponse, error) { +func (k Keeper) Send(ctx context.Context, req *types.MsgSend) (*types.MsgSendResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) sender, _ := sdk.AccAddressFromBech32(req.Sender) recipient, _ := sdk.AccAddressFromBech32(req.Recipient) @@ -31,10 +29,10 @@ func (k Keeper) Send(ctx context.Context, req *core.MsgSend) (*core.MsgSendRespo sdkCtx.GasMeter().ConsumeGas(ecocredit.GasCostPerIteration, "ecocredit/core/MsgSend credit iteration") } - return &core.MsgSendResponse{}, nil + return &types.MsgSendResponse{}, nil } -func (k Keeper) sendEcocredits(sdkCtx sdk.Context, credit *core.MsgSend_SendCredits, to, from sdk.AccAddress) error { +func (k Keeper) sendEcocredits(sdkCtx sdk.Context, credit *types.MsgSend_SendCredits, to, from sdk.AccAddress) error { ctx := sdk.WrapSDKContext(sdkCtx) batch, err := k.stateStore.BatchTable().GetByDenom(ctx, credit.BatchDenom) if err != nil { @@ -147,7 +145,7 @@ func (k Keeper) sendEcocredits(sdkCtx sdk.Context, credit *core.MsgSend_SendCred }); err != nil { return err } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventRetire{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventRetire{ Owner: to.String(), BatchDenom: credit.BatchDenom, Amount: sendAmtRetired.String(), @@ -156,7 +154,7 @@ func (k Keeper) sendEcocredits(sdkCtx sdk.Context, credit *core.MsgSend_SendCred return err } } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventTransfer{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventTransfer{ Sender: from.String(), Recipient: to.String(), BatchDenom: credit.BatchDenom, diff --git a/x/ecocredit/server/core/msg_send_test.go b/x/ecocredit/base/keeper/msg_send_test.go similarity index 94% rename from x/ecocredit/server/core/msg_send_test.go rename to x/ecocredit/base/keeper/msg_send_test.go index 338db70d31..3149461712 100644 --- a/x/ecocredit/server/core/msg_send_test.go +++ b/x/ecocredit/base/keeper/msg_send_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "encoding/json" @@ -13,7 +13,7 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type send struct { @@ -28,7 +28,7 @@ type send struct { batchDenom string batchKey uint64 tradableAmount string - res *core.MsgSendResponse + res *types.MsgSendResponse err error } @@ -178,10 +178,10 @@ func (s *send) TheBatchSupply(a gocuke.DocString) { } func (s *send) AliceAttemptsToSendCreditsToBobWithTradableAmount(a string) { - s.res, s.err = s.k.Send(s.ctx, &core.MsgSend{ + s.res, s.err = s.k.Send(s.ctx, &types.MsgSend{ Sender: s.alice.String(), Recipient: s.bob.String(), - Credits: []*core.MsgSend_SendCredits{ + Credits: []*types.MsgSend_SendCredits{ { BatchDenom: s.batchDenom, TradableAmount: a, @@ -191,10 +191,10 @@ func (s *send) AliceAttemptsToSendCreditsToBobWithTradableAmount(a string) { } func (s *send) AliceAttemptsToSendCreditsToBobWithRetiredAmount(a string) { - s.res, s.err = s.k.Send(s.ctx, &core.MsgSend{ + s.res, s.err = s.k.Send(s.ctx, &types.MsgSend{ Sender: s.alice.String(), Recipient: s.bob.String(), - Credits: []*core.MsgSend_SendCredits{ + Credits: []*types.MsgSend_SendCredits{ { BatchDenom: s.batchDenom, RetiredAmount: a, @@ -204,10 +204,10 @@ func (s *send) AliceAttemptsToSendCreditsToBobWithRetiredAmount(a string) { } func (s *send) AliceAttemptsToSendCreditsToBobWithBatchDenom(a string) { - s.res, s.err = s.k.Send(s.ctx, &core.MsgSend{ + s.res, s.err = s.k.Send(s.ctx, &types.MsgSend{ Sender: s.alice.String(), Recipient: s.bob.String(), - Credits: []*core.MsgSend_SendCredits{ + Credits: []*types.MsgSend_SendCredits{ { BatchDenom: a, TradableAmount: s.tradableAmount, @@ -269,10 +269,10 @@ func (s *send) BobsAddress(a string) { } func (s *send) AliceAttemptsToSendCreditsToBobWithRetiredAmountFrom(a, b string) { - s.res, s.err = s.k.Send(s.ctx, &core.MsgSend{ + s.res, s.err = s.k.Send(s.ctx, &types.MsgSend{ Sender: s.alice.String(), Recipient: s.bob.String(), - Credits: []*core.MsgSend_SendCredits{ + Credits: []*types.MsgSend_SendCredits{ { BatchDenom: s.batchDenom, RetiredAmount: a, @@ -284,7 +284,7 @@ func (s *send) AliceAttemptsToSendCreditsToBobWithRetiredAmountFrom(a, b string) } func (s *send) ExpectEventRetireWithProperties(a gocuke.DocString) { - var event core.EventRetire + var event types.EventRetire err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) @@ -296,7 +296,7 @@ func (s *send) ExpectEventRetireWithProperties(a gocuke.DocString) { } func (s *send) ExpectEventTransferWithProperties(a gocuke.DocString) { - var event core.EventTransfer + var event types.EventTransfer err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/base/keeper/msg_toggle_class_allowlist.go b/x/ecocredit/base/keeper/msg_toggle_class_allowlist.go new file mode 100644 index 0000000000..eeb8fa06cb --- /dev/null +++ b/x/ecocredit/base/keeper/msg_toggle_class_allowlist.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" +) + +func (k Keeper) ToggleCreditClassAllowlist(ctx context.Context, req *types.MsgToggleCreditClassAllowlist) (*types.MsgToggleCreditClassAllowlistResponse, error) { + if k.authority.String() != req.Authority { + return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority: expected %s, got %s", k.authority, req.Authority) + } + + if err := k.stateStore.AllowListEnabledTable().Save(ctx, &api.AllowListEnabled{ + Enabled: req.Enabled, + }); err != nil { + return nil, err + } + + return &types.MsgToggleCreditClassAllowlistResponse{}, nil +} diff --git a/x/ecocredit/server/core/msg_toggle_class_allowlist_test.go b/x/ecocredit/base/keeper/msg_toggle_class_allowlist_test.go similarity index 90% rename from x/ecocredit/server/core/msg_toggle_class_allowlist_test.go rename to x/ecocredit/base/keeper/msg_toggle_class_allowlist_test.go index 88c13213d1..bc3c5f1ff2 100644 --- a/x/ecocredit/server/core/msg_toggle_class_allowlist_test.go +++ b/x/ecocredit/base/keeper/msg_toggle_class_allowlist_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "encoding/json" @@ -8,7 +8,7 @@ import ( "github.com/regen-network/gocuke" "github.com/stretchr/testify/require" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type toggleClassCreatorAllowlist struct { @@ -25,7 +25,7 @@ func (s *toggleClassCreatorAllowlist) Before(t gocuke.TestingT) { } func (s *toggleClassCreatorAllowlist) AliceAttemptsToToggleClassAllowlistWithProperties(a gocuke.DocString) { - var msg *core.MsgToggleCreditClassAllowlist + var msg *types.MsgToggleCreditClassAllowlist err := json.Unmarshal([]byte(a.Content), &msg) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_update_class_admin.go b/x/ecocredit/base/keeper/msg_update_class_admin.go similarity index 77% rename from x/ecocredit/server/core/msg_update_class_admin.go rename to x/ecocredit/base/keeper/msg_update_class_admin.go index 4b0f234014..e6a38e45f8 100644 --- a/x/ecocredit/server/core/msg_update_class_admin.go +++ b/x/ecocredit/base/keeper/msg_update_class_admin.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,13 +6,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // UpdateClassAdmin updates the admin address for a class. // WARNING: this method will forfeit control of the entire class to the provided address. // double check your inputs to ensure you do not lose control of the class. -func (k Keeper) UpdateClassAdmin(ctx context.Context, req *core.MsgUpdateClassAdmin) (*core.MsgUpdateClassAdminResponse, error) { +func (k Keeper) UpdateClassAdmin(ctx context.Context, req *types.MsgUpdateClassAdmin) (*types.MsgUpdateClassAdminResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) reqAddr, err := sdk.AccAddressFromBech32(req.Admin) if err != nil { @@ -41,11 +41,11 @@ func (k Keeper) UpdateClassAdmin(ctx context.Context, req *core.MsgUpdateClassAd return nil, err } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventUpdateClassAdmin{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventUpdateClassAdmin{ ClassId: req.ClassId, }); err != nil { return nil, err } - return &core.MsgUpdateClassAdminResponse{}, err + return &types.MsgUpdateClassAdminResponse{}, err } diff --git a/x/ecocredit/server/core/msg_update_class_admin_test.go b/x/ecocredit/base/keeper/msg_update_class_admin_test.go similarity index 83% rename from x/ecocredit/server/core/msg_update_class_admin_test.go rename to x/ecocredit/base/keeper/msg_update_class_admin_test.go index d8ed6815d4..ae91c1e206 100644 --- a/x/ecocredit/server/core/msg_update_class_admin_test.go +++ b/x/ecocredit/base/keeper/msg_update_class_admin_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "encoding/json" @@ -12,14 +12,15 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type updateClassAdmin struct { *baseSuite alice sdk.AccAddress bob sdk.AccAddress - res *core.MsgUpdateClassAdminResponse + res *types.MsgUpdateClassAdminResponse err error } @@ -43,7 +44,7 @@ func (s *updateClassAdmin) ACreditTypeWithAbbreviation(a string) { } func (s *updateClassAdmin) ACreditClassWithClassIdAndAdminAlice(a string) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) err := s.k.stateStore.ClassTable().Insert(s.ctx, &api.Class{ Id: a, @@ -54,7 +55,7 @@ func (s *updateClassAdmin) ACreditClassWithClassIdAndAdminAlice(a string) { } func (s *updateClassAdmin) AliceAttemptsToUpdateClassAdminWithClassId(a string) { - s.res, s.err = s.k.UpdateClassAdmin(s.ctx, &core.MsgUpdateClassAdmin{ + s.res, s.err = s.k.UpdateClassAdmin(s.ctx, &types.MsgUpdateClassAdmin{ Admin: s.alice.String(), ClassId: a, NewAdmin: s.bob.String(), @@ -62,7 +63,7 @@ func (s *updateClassAdmin) AliceAttemptsToUpdateClassAdminWithClassId(a string) } func (s *updateClassAdmin) BobAttemptsToUpdateClassAdminWithClassId(a string) { - s.res, s.err = s.k.UpdateClassAdmin(s.ctx, &core.MsgUpdateClassAdmin{ + s.res, s.err = s.k.UpdateClassAdmin(s.ctx, &types.MsgUpdateClassAdmin{ Admin: s.bob.String(), ClassId: a, NewAdmin: s.bob.String(), @@ -70,7 +71,7 @@ func (s *updateClassAdmin) BobAttemptsToUpdateClassAdminWithClassId(a string) { } func (s *updateClassAdmin) AliceAttemptsToUpdateClassAdminWithClassIdAndNewAdminBob(a string) { - s.res, s.err = s.k.UpdateClassAdmin(s.ctx, &core.MsgUpdateClassAdmin{ + s.res, s.err = s.k.UpdateClassAdmin(s.ctx, &types.MsgUpdateClassAdmin{ Admin: s.alice.String(), ClassId: a, NewAdmin: s.bob.String(), @@ -97,7 +98,7 @@ func (s *updateClassAdmin) ExpectCreditClassWithClassIdAndAdminBob(a string) { } func (s *updateClassAdmin) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventUpdateClassAdmin + var event types.EventUpdateClassAdmin err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/base/keeper/msg_update_class_fee.go b/x/ecocredit/base/keeper/msg_update_class_fee.go new file mode 100644 index 0000000000..d26cf7d763 --- /dev/null +++ b/x/ecocredit/base/keeper/msg_update_class_fee.go @@ -0,0 +1,26 @@ +package keeper + +import ( + "context" + + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" +) + +func (k Keeper) UpdateClassFees(ctx context.Context, req *types.MsgUpdateClassFees) (*types.MsgUpdateClassFeesResponse, error) { + if k.authority.String() != req.Authority { + return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority: expected %s, got %s", k.authority, req.Authority) + } + + classFee := regentypes.CoinsToProtoCoins(req.Fees) + if err := k.stateStore.ClassFeesTable().Save(ctx, &api.ClassFees{ + Fees: classFee, + }); err != nil { + return nil, err + } + + return &types.MsgUpdateClassFeesResponse{}, nil +} diff --git a/x/ecocredit/server/core/msg_update_class_fee_test.go b/x/ecocredit/base/keeper/msg_update_class_fee_test.go similarity index 91% rename from x/ecocredit/server/core/msg_update_class_fee_test.go rename to x/ecocredit/base/keeper/msg_update_class_fee_test.go index ae09b161e7..289313ad05 100644 --- a/x/ecocredit/server/core/msg_update_class_fee_test.go +++ b/x/ecocredit/base/keeper/msg_update_class_fee_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "encoding/json" @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type updateClassFeesSuite struct { @@ -25,7 +25,7 @@ func (s *updateClassFeesSuite) Before(t gocuke.TestingT) { } func (s *updateClassFeesSuite) AliceAttemptsToUpdateClassFeesWithProperties(a gocuke.DocString) { - var msg *core.MsgUpdateClassFees + var msg *types.MsgUpdateClassFees err := json.Unmarshal([]byte(a.Content), &msg) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_update_class_issuers.go b/x/ecocredit/base/keeper/msg_update_class_issuers.go similarity index 83% rename from x/ecocredit/server/core/msg_update_class_issuers.go rename to x/ecocredit/base/keeper/msg_update_class_issuers.go index cc3af3a302..9806e11f25 100644 --- a/x/ecocredit/server/core/msg_update_class_issuers.go +++ b/x/ecocredit/base/keeper/msg_update_class_issuers.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,11 +8,11 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // UpdateClassIssuers updates a class's issuers by either adding more issuers, or removing issuers from the class issuer store. -func (k Keeper) UpdateClassIssuers(ctx context.Context, req *core.MsgUpdateClassIssuers) (*core.MsgUpdateClassIssuersResponse, error) { +func (k Keeper) UpdateClassIssuers(ctx context.Context, req *types.MsgUpdateClassIssuers) (*types.MsgUpdateClassIssuersResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) reqAddr, err := sdk.AccAddressFromBech32(req.Admin) if err != nil { @@ -65,11 +65,11 @@ func (k Keeper) UpdateClassIssuers(ctx context.Context, req *core.MsgUpdateClass sdkCtx.GasMeter().ConsumeGas(ecocredit.GasCostPerIteration, "ecocredit/core/MsgUpdateClassIssuers issuer iteration") } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventUpdateClassIssuers{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventUpdateClassIssuers{ ClassId: req.ClassId, }); err != nil { return nil, err } - return &core.MsgUpdateClassIssuersResponse{}, nil + return &types.MsgUpdateClassIssuersResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_update_class_issuers_test.go b/x/ecocredit/base/keeper/msg_update_class_issuers_test.go similarity index 86% rename from x/ecocredit/server/core/msg_update_class_issuers_test.go rename to x/ecocredit/base/keeper/msg_update_class_issuers_test.go index f8704627ce..a87c688b7b 100644 --- a/x/ecocredit/server/core/msg_update_class_issuers_test.go +++ b/x/ecocredit/base/keeper/msg_update_class_issuers_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "encoding/json" @@ -12,14 +12,15 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type updateClassIssuers struct { *baseSuite alice sdk.AccAddress bob sdk.AccAddress - res *core.MsgUpdateClassIssuersResponse + res *types.MsgUpdateClassIssuersResponse err error } @@ -47,7 +48,7 @@ func (s *updateClassIssuers) ACreditTypeWithAbbreviation(a string) { } func (s *updateClassIssuers) ACreditClassWithClassIdAndAdminAlice(a string) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) err := s.k.stateStore.ClassTable().Insert(s.ctx, &api.Class{ Id: a, @@ -58,7 +59,7 @@ func (s *updateClassIssuers) ACreditClassWithClassIdAndAdminAlice(a string) { } func (s *updateClassIssuers) ACreditClassWithClassIdAdminAliceAndIssuers(a string, b gocuke.DocString) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) cKey, err := s.k.stateStore.ClassTable().InsertReturningID(s.ctx, &api.Class{ Id: a, @@ -84,14 +85,14 @@ func (s *updateClassIssuers) ACreditClassWithClassIdAdminAliceAndIssuers(a strin } func (s *updateClassIssuers) AliceAttemptsToUpdateClassIssuersWithClassId(a string) { - s.res, s.err = s.k.UpdateClassIssuers(s.ctx, &core.MsgUpdateClassIssuers{ + s.res, s.err = s.k.UpdateClassIssuers(s.ctx, &types.MsgUpdateClassIssuers{ Admin: s.alice.String(), ClassId: a, }) } func (s *updateClassIssuers) BobAttemptsToUpdateClassIssuersWithClassId(a string) { - s.res, s.err = s.k.UpdateClassIssuers(s.ctx, &core.MsgUpdateClassIssuers{ + s.res, s.err = s.k.UpdateClassIssuers(s.ctx, &types.MsgUpdateClassIssuers{ Admin: s.bob.String(), ClassId: a, }) @@ -102,7 +103,7 @@ func (s *updateClassIssuers) AliceAttemptsToUpdateClassIssuersWithClassIdAndAddI err := json.Unmarshal([]byte(b.Content), &addIssuers) require.NoError(s.t, err) - s.res, s.err = s.k.UpdateClassIssuers(s.ctx, &core.MsgUpdateClassIssuers{ + s.res, s.err = s.k.UpdateClassIssuers(s.ctx, &types.MsgUpdateClassIssuers{ Admin: s.alice.String(), ClassId: a, AddIssuers: addIssuers, @@ -114,7 +115,7 @@ func (s *updateClassIssuers) AliceAttemptsToUpdateClassIssuersWithClassIdAndRemo err := json.Unmarshal([]byte(b.Content), &removeIssuers) require.NoError(s.t, err) - s.res, s.err = s.k.UpdateClassIssuers(s.ctx, &core.MsgUpdateClassIssuers{ + s.res, s.err = s.k.UpdateClassIssuers(s.ctx, &types.MsgUpdateClassIssuers{ Admin: s.alice.String(), ClassId: a, RemoveIssuers: removeIssuers, @@ -153,7 +154,7 @@ func (s *updateClassIssuers) ExpectCreditClassWithClassIdAndIssuers(a string, b } func (s *updateClassIssuers) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventUpdateClassIssuers + var event types.EventUpdateClassIssuers err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_update_class_metadata.go b/x/ecocredit/base/keeper/msg_update_class_metadata.go similarity index 71% rename from x/ecocredit/server/core/msg_update_class_metadata.go rename to x/ecocredit/base/keeper/msg_update_class_metadata.go index f7a4f71c79..a28b95a066 100644 --- a/x/ecocredit/server/core/msg_update_class_metadata.go +++ b/x/ecocredit/base/keeper/msg_update_class_metadata.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,11 +6,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // UpdateClassMetadata updates the metadata for the class. -func (k Keeper) UpdateClassMetadata(ctx context.Context, req *core.MsgUpdateClassMetadata) (*core.MsgUpdateClassMetadataResponse, error) { +func (k Keeper) UpdateClassMetadata(ctx context.Context, req *types.MsgUpdateClassMetadata) (*types.MsgUpdateClassMetadataResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) reqAddr, err := sdk.AccAddressFromBech32(req.Admin) if err != nil { @@ -36,11 +36,11 @@ func (k Keeper) UpdateClassMetadata(ctx context.Context, req *core.MsgUpdateClas return nil, err } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventUpdateClassMetadata{ + if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventUpdateClassMetadata{ ClassId: req.ClassId, }); err != nil { return nil, err } - return &core.MsgUpdateClassMetadataResponse{}, err + return &types.MsgUpdateClassMetadataResponse{}, err } diff --git a/x/ecocredit/server/core/msg_update_class_metadata_test.go b/x/ecocredit/base/keeper/msg_update_class_metadata_test.go similarity index 83% rename from x/ecocredit/server/core/msg_update_class_metadata_test.go rename to x/ecocredit/base/keeper/msg_update_class_metadata_test.go index fbebb1a614..e6d4b36562 100644 --- a/x/ecocredit/server/core/msg_update_class_metadata_test.go +++ b/x/ecocredit/base/keeper/msg_update_class_metadata_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "encoding/json" @@ -14,14 +14,15 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type updateClassMetadata struct { *baseSuite alice sdk.AccAddress bob sdk.AccAddress - res *core.MsgUpdateClassMetadataResponse + res *types.MsgUpdateClassMetadataResponse classId string err error } @@ -46,7 +47,7 @@ func (s *updateClassMetadata) ACreditTypeWithAbbreviation(a string) { } func (s *updateClassMetadata) ACreditClassWithClassIdAndAdminAlice(a string) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) s.classId = a err := s.k.stateStore.ClassTable().Insert(s.ctx, &api.Class{ Id: a, @@ -57,21 +58,21 @@ func (s *updateClassMetadata) ACreditClassWithClassIdAndAdminAlice(a string) { } func (s *updateClassMetadata) AliceAttemptsToUpdateClassMetadataWithClassId(a string) { - s.res, s.err = s.k.UpdateClassMetadata(s.ctx, &core.MsgUpdateClassMetadata{ + s.res, s.err = s.k.UpdateClassMetadata(s.ctx, &types.MsgUpdateClassMetadata{ Admin: s.alice.String(), ClassId: a, }) } func (s *updateClassMetadata) BobAttemptsToUpdateClassMetadataWithClassId(a string) { - s.res, s.err = s.k.UpdateClassMetadata(s.ctx, &core.MsgUpdateClassMetadata{ + s.res, s.err = s.k.UpdateClassMetadata(s.ctx, &types.MsgUpdateClassMetadata{ Admin: s.bob.String(), ClassId: a, }) } func (s *updateClassMetadata) AliceAttemptsToUpdateClassMetadataWithClassIdAndNewMetadata(a string, b gocuke.DocString) { - s.res, s.err = s.k.UpdateClassMetadata(s.ctx, &core.MsgUpdateClassMetadata{ + s.res, s.err = s.k.UpdateClassMetadata(s.ctx, &types.MsgUpdateClassMetadata{ Admin: s.alice.String(), ClassId: a, NewMetadata: b.Content, @@ -99,7 +100,7 @@ func (s *updateClassMetadata) ExpectCreditClassWithClassIdAndMetadata(a string, func (s *updateClassMetadata) AliceUpdatesTheClassMetadata() { newMetadata := rand.Str(5) - _, err := s.k.UpdateClassMetadata(s.ctx, &core.MsgUpdateClassMetadata{ + _, err := s.k.UpdateClassMetadata(s.ctx, &types.MsgUpdateClassMetadata{ Admin: s.alice.String(), ClassId: s.classId, NewMetadata: newMetadata, @@ -108,7 +109,7 @@ func (s *updateClassMetadata) AliceUpdatesTheClassMetadata() { } func (s *updateClassMetadata) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventUpdateClassMetadata + var event types.EventUpdateClassMetadata err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_update_project_admin.go b/x/ecocredit/base/keeper/msg_update_project_admin.go similarity index 75% rename from x/ecocredit/server/core/msg_update_project_admin.go rename to x/ecocredit/base/keeper/msg_update_project_admin.go index 0225596fee..9378daafe5 100644 --- a/x/ecocredit/server/core/msg_update_project_admin.go +++ b/x/ecocredit/base/keeper/msg_update_project_admin.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,11 +6,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // UpdateProjectAdmin updates the project admin. -func (k Keeper) UpdateProjectAdmin(ctx context.Context, req *core.MsgUpdateProjectAdmin) (*core.MsgUpdateProjectAdminResponse, error) { +func (k Keeper) UpdateProjectAdmin(ctx context.Context, req *types.MsgUpdateProjectAdmin) (*types.MsgUpdateProjectAdminResponse, error) { admin, err := sdk.AccAddressFromBech32(req.Admin) if err != nil { return nil, err @@ -37,11 +37,11 @@ func (k Keeper) UpdateProjectAdmin(ctx context.Context, req *core.MsgUpdateProje return nil, err } - if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&core.EventUpdateProjectAdmin{ + if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&types.EventUpdateProjectAdmin{ ProjectId: project.Id, }); err != nil { return nil, err } - return &core.MsgUpdateProjectAdminResponse{}, nil + return &types.MsgUpdateProjectAdminResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_update_project_admin_test.go b/x/ecocredit/base/keeper/msg_update_project_admin_test.go similarity index 84% rename from x/ecocredit/server/core/msg_update_project_admin_test.go rename to x/ecocredit/base/keeper/msg_update_project_admin_test.go index 8051873c4e..3d222dbe59 100644 --- a/x/ecocredit/server/core/msg_update_project_admin_test.go +++ b/x/ecocredit/base/keeper/msg_update_project_admin_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "encoding/json" @@ -12,14 +12,15 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type updateProjectAdmin struct { *baseSuite alice sdk.AccAddress bob sdk.AccAddress - res *core.MsgUpdateProjectAdminResponse + res *types.MsgUpdateProjectAdminResponse err error } @@ -43,7 +44,7 @@ func (s *updateProjectAdmin) ACreditTypeWithAbbreviation(a string) { } func (s *updateProjectAdmin) ACreditClassWithClassId(a string) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) err := s.k.stateStore.ClassTable().Insert(s.ctx, &api.Class{ Id: a, @@ -62,7 +63,7 @@ func (s *updateProjectAdmin) AProjectWithProjectIdAndAdminAlice(a string) { } func (s *updateProjectAdmin) AliceAttemptsToUpdateProjectAdminWithProjectId(a string) { - s.res, s.err = s.k.UpdateProjectAdmin(s.ctx, &core.MsgUpdateProjectAdmin{ + s.res, s.err = s.k.UpdateProjectAdmin(s.ctx, &types.MsgUpdateProjectAdmin{ Admin: s.alice.String(), ProjectId: a, NewAdmin: s.bob.String(), @@ -70,7 +71,7 @@ func (s *updateProjectAdmin) AliceAttemptsToUpdateProjectAdminWithProjectId(a st } func (s *updateProjectAdmin) BobAttemptsToUpdateProjectAdminWithProjectId(a string) { - s.res, s.err = s.k.UpdateProjectAdmin(s.ctx, &core.MsgUpdateProjectAdmin{ + s.res, s.err = s.k.UpdateProjectAdmin(s.ctx, &types.MsgUpdateProjectAdmin{ Admin: s.bob.String(), ProjectId: a, NewAdmin: s.bob.String(), @@ -78,7 +79,7 @@ func (s *updateProjectAdmin) BobAttemptsToUpdateProjectAdminWithProjectId(a stri } func (s *updateProjectAdmin) AliceAttemptsToUpdateProjectAdminWithProjectIdAndNewAdminBob(a string) { - s.res, s.err = s.k.UpdateProjectAdmin(s.ctx, &core.MsgUpdateProjectAdmin{ + s.res, s.err = s.k.UpdateProjectAdmin(s.ctx, &types.MsgUpdateProjectAdmin{ Admin: s.alice.String(), ProjectId: a, NewAdmin: s.bob.String(), @@ -105,7 +106,7 @@ func (s *updateProjectAdmin) ExpectProjectWithProjectIdAndAdminBob(a string) { } func (s *updateProjectAdmin) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventUpdateProjectAdmin + var event types.EventUpdateProjectAdmin err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/msg_update_project_metadata.go b/x/ecocredit/base/keeper/msg_update_project_metadata.go similarity index 78% rename from x/ecocredit/server/core/msg_update_project_metadata.go rename to x/ecocredit/base/keeper/msg_update_project_metadata.go index 2f62a19482..fc2c9a33ce 100644 --- a/x/ecocredit/server/core/msg_update_project_metadata.go +++ b/x/ecocredit/base/keeper/msg_update_project_metadata.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,11 +6,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // UpdateProjectMetadata updates the project metadata. -func (k Keeper) UpdateProjectMetadata(ctx context.Context, req *core.MsgUpdateProjectMetadata) (*core.MsgUpdateProjectMetadataResponse, error) { +func (k Keeper) UpdateProjectMetadata(ctx context.Context, req *types.MsgUpdateProjectMetadata) (*types.MsgUpdateProjectMetadataResponse, error) { admin, err := sdk.AccAddressFromBech32(req.Admin) if err != nil { return nil, err @@ -31,11 +31,11 @@ func (k Keeper) UpdateProjectMetadata(ctx context.Context, req *core.MsgUpdatePr return nil, err } - if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&core.EventUpdateProjectMetadata{ + if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&types.EventUpdateProjectMetadata{ ProjectId: project.Id, }); err != nil { return nil, err } - return &core.MsgUpdateProjectMetadataResponse{}, nil + return &types.MsgUpdateProjectMetadataResponse{}, nil } diff --git a/x/ecocredit/server/core/msg_update_project_metadata_test.go b/x/ecocredit/base/keeper/msg_update_project_metadata_test.go similarity index 83% rename from x/ecocredit/server/core/msg_update_project_metadata_test.go rename to x/ecocredit/base/keeper/msg_update_project_metadata_test.go index 397cc45828..166e84d25e 100644 --- a/x/ecocredit/server/core/msg_update_project_metadata_test.go +++ b/x/ecocredit/base/keeper/msg_update_project_metadata_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package keeper import ( "encoding/json" @@ -12,14 +12,15 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type updateProjectMetadata struct { *baseSuite alice sdk.AccAddress bob sdk.AccAddress - res *core.MsgUpdateProjectMetadataResponse + res *types.MsgUpdateProjectMetadataResponse err error } @@ -43,7 +44,7 @@ func (s *updateProjectMetadata) ACreditTypeWithAbbreviation(a string) { } func (s *updateProjectMetadata) ACreditClassWithClassId(a string) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) err := s.k.stateStore.ClassTable().Insert(s.ctx, &api.Class{ Id: a, @@ -62,21 +63,21 @@ func (s *updateProjectMetadata) AProjectWithProjectIdAndAdminAlice(a string) { } func (s *updateProjectMetadata) AliceAttemptsToUpdateProjectMetadataWithProjectId(a string) { - s.res, s.err = s.k.UpdateProjectMetadata(s.ctx, &core.MsgUpdateProjectMetadata{ + s.res, s.err = s.k.UpdateProjectMetadata(s.ctx, &types.MsgUpdateProjectMetadata{ Admin: s.alice.String(), ProjectId: a, }) } func (s *updateProjectMetadata) BobAttemptsToUpdateProjectMetadataWithProjectId(a string) { - s.res, s.err = s.k.UpdateProjectMetadata(s.ctx, &core.MsgUpdateProjectMetadata{ + s.res, s.err = s.k.UpdateProjectMetadata(s.ctx, &types.MsgUpdateProjectMetadata{ Admin: s.bob.String(), ProjectId: a, }) } func (s *updateProjectMetadata) AliceAttemptsToUpdateProjectMetadataWithProjectIdAndNewMetadata(a string, b gocuke.DocString) { - s.res, s.err = s.k.UpdateProjectMetadata(s.ctx, &core.MsgUpdateProjectMetadata{ + s.res, s.err = s.k.UpdateProjectMetadata(s.ctx, &types.MsgUpdateProjectMetadata{ Admin: s.alice.String(), ProjectId: a, NewMetadata: b.Content, @@ -103,7 +104,7 @@ func (s *updateProjectMetadata) ExpectProjectWithProjectIdAndMetadata(a string, } func (s *updateProjectMetadata) ExpectEventWithProperties(a gocuke.DocString) { - var event core.EventUpdateProjectMetadata + var event types.EventUpdateProjectMetadata err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/server/core/query_all_balances.go b/x/ecocredit/base/keeper/query_all_balances.go similarity index 81% rename from x/ecocredit/server/core/query_all_balances.go rename to x/ecocredit/base/keeper/query_all_balances.go index fc0edabf6d..9a3418851f 100644 --- a/x/ecocredit/server/core/query_all_balances.go +++ b/x/ecocredit/base/keeper/query_all_balances.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -9,12 +9,12 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // AllBalances queries all credit balances from state with optional pagination. // NOTE: If no pagination is given in the request, responses will be limited by the Cosmos SDK's default limit (100). -func (k Keeper) AllBalances(ctx context.Context, req *core.QueryAllBalancesRequest) (*core.QueryAllBalancesResponse, error) { +func (k Keeper) AllBalances(ctx context.Context, req *types.QueryAllBalancesRequest) (*types.QueryAllBalancesResponse, error) { if req.Pagination == nil { req.Pagination = &query.PageRequest{Limit: query.DefaultLimit} } @@ -28,7 +28,7 @@ func (k Keeper) AllBalances(ctx context.Context, req *core.QueryAllBalancesReque } defer it.Close() - var res core.QueryAllBalancesResponse + var res types.QueryAllBalancesResponse for it.Next() { balance, err := it.Value() if err != nil { @@ -40,7 +40,7 @@ func (k Keeper) AllBalances(ctx context.Context, req *core.QueryAllBalancesReque return nil, err } - res.Balances = append(res.Balances, &core.BatchBalanceInfo{ + res.Balances = append(res.Balances, &types.BatchBalanceInfo{ Address: sdk.AccAddress(balance.Address).String(), BatchDenom: batch.Denom, TradableAmount: balance.TradableAmount, diff --git a/x/ecocredit/server/core/query_all_balances_test.go b/x/ecocredit/base/keeper/query_all_balances_test.go similarity index 88% rename from x/ecocredit/server/core/query_all_balances_test.go rename to x/ecocredit/base/keeper/query_all_balances_test.go index 722ebdd915..99f98e5212 100644 --- a/x/ecocredit/server/core/query_all_balances_test.go +++ b/x/ecocredit/base/keeper/query_all_balances_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -8,7 +8,7 @@ import ( "gotest.tools/v3/assert" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQueryAllBalances(t *testing.T) { @@ -34,7 +34,7 @@ func TestQueryAllBalances(t *testing.T) { assert.NilError(t, s.stateStore.BatchBalanceTable().Insert(s.ctx, balance2)) assert.NilError(t, s.stateStore.BatchBalanceTable().Insert(s.ctx, balance3)) - res, err := s.k.AllBalances(s.ctx, &core.QueryAllBalancesRequest{Pagination: &query.PageRequest{Limit: 10, CountTotal: true}}) + res, err := s.k.AllBalances(s.ctx, &types.QueryAllBalancesRequest{Pagination: &query.PageRequest{Limit: 10, CountTotal: true}}) assert.NilError(t, err) assert.Equal(t, len(res.Balances), 3) assert.Equal(t, res.Pagination.Total, uint64(3)) diff --git a/x/ecocredit/server/core/query_allowed_class_creators.go b/x/ecocredit/base/keeper/query_allowed_class_creators.go similarity index 77% rename from x/ecocredit/server/core/query_allowed_class_creators.go rename to x/ecocredit/base/keeper/query_allowed_class_creators.go index 3c51c0108e..73d979656f 100644 --- a/x/ecocredit/server/core/query_allowed_class_creators.go +++ b/x/ecocredit/base/keeper/query_allowed_class_creators.go @@ -1,17 +1,18 @@ -package core +package keeper import ( "context" "github.com/cosmos/cosmos-sdk/orm/model/ormlist" sdk "github.com/cosmos/cosmos-sdk/types" + ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // AllowedClassCreators queries list of allowed class creators. -func (k Keeper) AllowedClassCreators(ctx context.Context, req *core.QueryAllowedClassCreatorsRequest) (*core.QueryAllowedClassCreatorsResponse, error) { +func (k Keeper) AllowedClassCreators(ctx context.Context, req *types.QueryAllowedClassCreatorsRequest) (*types.QueryAllowedClassCreatorsResponse, error) { pg, err := ormutil.GogoPageReqToPulsarPageReq(req.Pagination) if err != nil { return nil, err @@ -38,7 +39,7 @@ func (k Keeper) AllowedClassCreators(ctx context.Context, req *core.QueryAllowed return nil, err } - return &core.QueryAllowedClassCreatorsResponse{ + return &types.QueryAllowedClassCreatorsResponse{ ClassCreators: classCreators, Pagination: pr, }, nil diff --git a/x/ecocredit/server/core/query_allowed_class_creators_test.go b/x/ecocredit/base/keeper/query_allowed_class_creators_test.go similarity index 57% rename from x/ecocredit/server/core/query_allowed_class_creators_test.go rename to x/ecocredit/base/keeper/query_allowed_class_creators_test.go index 363c83a4fd..a2d4830fd1 100644 --- a/x/ecocredit/server/core/query_allowed_class_creators_test.go +++ b/x/ecocredit/base/keeper/query_allowed_class_creators_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -7,40 +7,41 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_AllowedClassCreators(t *testing.T) { t.Parallel() s := setupBase(t) - res, err := s.k.AllowedClassCreators(s.ctx, &core.QueryAllowedClassCreatorsRequest{}) + res, err := s.k.AllowedClassCreators(s.ctx, &types.QueryAllowedClassCreatorsRequest{}) assert.NilError(t, err) assert.Equal(t, len(res.ClassCreators), 0) // add one class creator - err = s.stateStore.AllowedClassCreatorTable().Insert(s.ctx, &ecocreditv1.AllowedClassCreator{ + err = s.stateStore.AllowedClassCreatorTable().Insert(s.ctx, &api.AllowedClassCreator{ Address: sdk.AccAddress("creator1"), }) assert.NilError(t, err) - res, err = s.k.AllowedClassCreators(s.ctx, &core.QueryAllowedClassCreatorsRequest{}) + res, err = s.k.AllowedClassCreators(s.ctx, &types.QueryAllowedClassCreatorsRequest{}) assert.NilError(t, err) assert.Equal(t, len(res.ClassCreators), 1) // add another class creator - err = s.stateStore.AllowedClassCreatorTable().Insert(s.ctx, &ecocreditv1.AllowedClassCreator{ + err = s.stateStore.AllowedClassCreatorTable().Insert(s.ctx, &api.AllowedClassCreator{ Address: sdk.AccAddress("creator2"), }) assert.NilError(t, err) - res, err = s.k.AllowedClassCreators(s.ctx, &core.QueryAllowedClassCreatorsRequest{}) + res, err = s.k.AllowedClassCreators(s.ctx, &types.QueryAllowedClassCreatorsRequest{}) assert.NilError(t, err) assert.Equal(t, len(res.ClassCreators), 2) // test pagination - res, err = s.k.AllowedClassCreators(s.ctx, &core.QueryAllowedClassCreatorsRequest{ + res, err = s.k.AllowedClassCreators(s.ctx, &types.QueryAllowedClassCreatorsRequest{ Pagination: &query.PageRequest{ Limit: 1, CountTotal: true, diff --git a/x/ecocredit/server/core/query_allowlist_enabled.go b/x/ecocredit/base/keeper/query_allowlist_enabled.go similarity index 53% rename from x/ecocredit/server/core/query_allowlist_enabled.go rename to x/ecocredit/base/keeper/query_allowlist_enabled.go index 2c7c2ea470..3b3301e993 100644 --- a/x/ecocredit/server/core/query_allowlist_enabled.go +++ b/x/ecocredit/base/keeper/query_allowlist_enabled.go @@ -1,19 +1,19 @@ -package core +package keeper import ( "context" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // AlloweClassCreators queries credit class allowlist setting. -func (k Keeper) CreditClassAllowlistEnabled(ctx context.Context, request *core.QueryCreditClassAllowlistEnabledRequest) (*core.QueryCreditClassAllowlistEnabledResponse, error) { +func (k Keeper) CreditClassAllowlistEnabled(ctx context.Context, request *types.QueryCreditClassAllowlistEnabledRequest) (*types.QueryCreditClassAllowlistEnabledResponse, error) { result, err := k.stateStore.AllowListEnabledTable().Get(ctx) if err != nil { return nil, err } - return &core.QueryCreditClassAllowlistEnabledResponse{ + return &types.QueryCreditClassAllowlistEnabledResponse{ AllowlistEnabled: result.Enabled, }, nil } diff --git a/x/ecocredit/base/keeper/query_allowlist_enabled_test.go b/x/ecocredit/base/keeper/query_allowlist_enabled_test.go new file mode 100644 index 0000000000..96e33cfef6 --- /dev/null +++ b/x/ecocredit/base/keeper/query_allowlist_enabled_test.go @@ -0,0 +1,28 @@ +package keeper + +import ( + "testing" + + "gotest.tools/v3/assert" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" +) + +func TestQuery_AllowlistEnabledTest(t *testing.T) { + t.Parallel() + s := setupBase(t) + + res, err := s.k.CreditClassAllowlistEnabled(s.ctx, &types.QueryCreditClassAllowlistEnabledRequest{}) + assert.NilError(t, err) + assert.Equal(t, res.AllowlistEnabled, false) + + err = s.stateStore.AllowListEnabledTable().Save(s.ctx, &api.AllowListEnabled{ + Enabled: true, + }) + assert.NilError(t, err) + + res, err = s.k.CreditClassAllowlistEnabled(s.ctx, &types.QueryCreditClassAllowlistEnabledRequest{}) + assert.NilError(t, err) + assert.Equal(t, res.AllowlistEnabled, true) +} diff --git a/x/ecocredit/server/core/query_balance.go b/x/ecocredit/base/keeper/query_balance.go similarity index 75% rename from x/ecocredit/server/core/query_balance.go rename to x/ecocredit/base/keeper/query_balance.go index 8ba1414d1d..b14154a34e 100644 --- a/x/ecocredit/server/core/query_balance.go +++ b/x/ecocredit/base/keeper/query_balance.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,13 +6,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) // Balance queries the balance (both tradable and retired) of a given credit // batch for a given account. -func (k Keeper) Balance(ctx context.Context, req *core.QueryBalanceRequest) (*core.QueryBalanceResponse, error) { +func (k Keeper) Balance(ctx context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error) { batch, err := k.stateStore.BatchTable().GetByDenom(ctx, req.BatchDenom) if err != nil { return nil, sdkerrors.ErrInvalidRequest.Wrapf("could not get batch with denom %s: %s", req.BatchDenom, err.Error()) @@ -28,7 +28,7 @@ func (k Keeper) Balance(ctx context.Context, req *core.QueryBalanceRequest) (*co return nil, err } - info := core.BatchBalanceInfo{ + info := types.BatchBalanceInfo{ Address: addr.String(), BatchDenom: batch.Denom, TradableAmount: balance.TradableAmount, @@ -36,5 +36,5 @@ func (k Keeper) Balance(ctx context.Context, req *core.QueryBalanceRequest) (*co EscrowedAmount: balance.EscrowedAmount, } - return &core.QueryBalanceResponse{Balance: &info}, nil + return &types.QueryBalanceResponse{Balance: &info}, nil } diff --git a/x/ecocredit/server/core/query_balance_test.go b/x/ecocredit/base/keeper/query_balance_test.go similarity index 86% rename from x/ecocredit/server/core/query_balance_test.go rename to x/ecocredit/base/keeper/query_balance_test.go index 54d4d5783b..b082622179 100644 --- a/x/ecocredit/server/core/query_balance_test.go +++ b/x/ecocredit/base/keeper/query_balance_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Balance(t *testing.T) { @@ -35,7 +35,7 @@ func TestQuery_Balance(t *testing.T) { assert.NilError(t, s.stateStore.BatchBalanceTable().Insert(s.ctx, balance)) // query balance for s.addr - res, err := s.k.Balance(s.ctx, &core.QueryBalanceRequest{ + res, err := s.k.Balance(s.ctx, &types.QueryBalanceRequest{ Address: s.addr.String(), BatchDenom: batchDenom, }) @@ -48,7 +48,7 @@ func TestQuery_Balance(t *testing.T) { _, _, noBalance := testdata.KeyTestPubAddr() // query balance for address with no balance - res, err = s.k.Balance(s.ctx, &core.QueryBalanceRequest{ + res, err = s.k.Balance(s.ctx, &types.QueryBalanceRequest{ Address: noBalance.String(), BatchDenom: batchDenom, }) @@ -59,7 +59,7 @@ func TestQuery_Balance(t *testing.T) { assert.Equal(t, "0", res.Balance.RetiredAmount) // query balance with unknown batch denom - _, err = s.k.Balance(s.ctx, &core.QueryBalanceRequest{ + _, err = s.k.Balance(s.ctx, &types.QueryBalanceRequest{ Address: s.addr.String(), BatchDenom: "A00-00000000-00000000-001", }) diff --git a/x/ecocredit/server/core/query_balances.go b/x/ecocredit/base/keeper/query_balances.go similarity index 74% rename from x/ecocredit/server/core/query_balances.go rename to x/ecocredit/base/keeper/query_balances.go index 7f1c99a0aa..9684faf106 100644 --- a/x/ecocredit/server/core/query_balances.go +++ b/x/ecocredit/base/keeper/query_balances.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,10 +8,10 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) -func (k Keeper) Balances(ctx context.Context, req *core.QueryBalancesRequest) (*core.QueryBalancesResponse, error) { +func (k Keeper) Balances(ctx context.Context, req *types.QueryBalancesRequest) (*types.QueryBalancesResponse, error) { addr, err := sdk.AccAddressFromBech32(req.Address) if err != nil { return nil, err @@ -28,7 +28,7 @@ func (k Keeper) Balances(ctx context.Context, req *core.QueryBalancesRequest) (* } defer it.Close() - balances := make([]*core.BatchBalanceInfo, 0, 8) // pre-allocate some cap space + balances := make([]*types.BatchBalanceInfo, 0, 8) // pre-allocate some cap space for it.Next() { balance, err := it.Value() if err != nil { @@ -40,7 +40,7 @@ func (k Keeper) Balances(ctx context.Context, req *core.QueryBalancesRequest) (* return nil, err } - info := core.BatchBalanceInfo{ + info := types.BatchBalanceInfo{ Address: addr.String(), BatchDenom: batch.Denom, TradableAmount: balance.TradableAmount, @@ -56,5 +56,5 @@ func (k Keeper) Balances(ctx context.Context, req *core.QueryBalancesRequest) (* return nil, err } - return &core.QueryBalancesResponse{Balances: balances, Pagination: pr}, nil + return &types.QueryBalancesResponse{Balances: balances, Pagination: pr}, nil } diff --git a/x/ecocredit/server/core/query_balances_test.go b/x/ecocredit/base/keeper/query_balances_test.go similarity index 86% rename from x/ecocredit/server/core/query_balances_test.go rename to x/ecocredit/base/keeper/query_balances_test.go index ed41523a40..4dda4417bf 100644 --- a/x/ecocredit/server/core/query_balances_test.go +++ b/x/ecocredit/base/keeper/query_balances_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Balances(t *testing.T) { @@ -30,7 +30,7 @@ func TestQuery_Balances(t *testing.T) { assert.NilError(t, s.stateStore.BatchBalanceTable().Insert(s.ctx, balance2)) // query balances for s.addr - res, err := s.k.Balances(s.ctx, &core.QueryBalancesRequest{ + res, err := s.k.Balances(s.ctx, &types.QueryBalancesRequest{ Address: s.addr.String(), Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) @@ -42,20 +42,20 @@ func TestQuery_Balances(t *testing.T) { _, _, noBalAddr := testdata.KeyTestPubAddr() // query balances for address with no balance - res, err = s.k.Balances(s.ctx, &core.QueryBalancesRequest{ + res, err = s.k.Balances(s.ctx, &types.QueryBalancesRequest{ Address: noBalAddr.String(), }) assert.NilError(t, err) assert.Equal(t, 0, len(res.Balances)) } -func assertBalanceEqual(ctx context.Context, t *testing.T, k Keeper, received *core.BatchBalanceInfo, balance *api.BatchBalance) { +func assertBalanceEqual(ctx context.Context, t *testing.T, k Keeper, received *types.BatchBalanceInfo, balance *api.BatchBalance) { addr := sdk.AccAddress(balance.Address) batch, err := k.stateStore.BatchTable().Get(ctx, balance.BatchKey) assert.NilError(t, err) - info := core.BatchBalanceInfo{ + info := types.BatchBalanceInfo{ Address: addr.String(), BatchDenom: batch.Denom, TradableAmount: balance.TradableAmount, diff --git a/x/ecocredit/server/core/query_batch_info.go b/x/ecocredit/base/keeper/query_batch_info.go similarity index 54% rename from x/ecocredit/server/core/query_batch_info.go rename to x/ecocredit/base/keeper/query_batch_info.go index 2805cf622b..d2c81b6ad1 100644 --- a/x/ecocredit/server/core/query_batch_info.go +++ b/x/ecocredit/base/keeper/query_batch_info.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,13 +6,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + regentypes "github.com/regen-network/regen-ledger/types" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // Batch queries for information on a credit batch. -func (k Keeper) Batch(ctx context.Context, request *core.QueryBatchRequest) (*core.QueryBatchResponse, error) { - if err := core.ValidateBatchDenom(request.BatchDenom); err != nil { +func (k Keeper) Batch(ctx context.Context, request *types.QueryBatchRequest) (*types.QueryBatchResponse, error) { + if err := base.ValidateBatchDenom(request.BatchDenom); err != nil { return nil, sdkerrors.ErrInvalidRequest.Wrapf("batch denom: %s", err) } @@ -28,16 +29,16 @@ func (k Keeper) Batch(ctx context.Context, request *core.QueryBatchRequest) (*co return nil, err } - info := core.BatchInfo{ + info := types.BatchInfo{ Issuer: issuer.String(), ProjectId: project.Id, Denom: batch.Denom, Metadata: batch.Metadata, - StartDate: types.ProtobufToGogoTimestamp(batch.StartDate), - EndDate: types.ProtobufToGogoTimestamp(batch.EndDate), - IssuanceDate: types.ProtobufToGogoTimestamp(batch.IssuanceDate), + StartDate: regentypes.ProtobufToGogoTimestamp(batch.StartDate), + EndDate: regentypes.ProtobufToGogoTimestamp(batch.EndDate), + IssuanceDate: regentypes.ProtobufToGogoTimestamp(batch.IssuanceDate), Open: batch.Open, } - return &core.QueryBatchResponse{Batch: &info}, nil + return &types.QueryBatchResponse{Batch: &info}, nil } diff --git a/x/ecocredit/server/core/query_batch_info_test.go b/x/ecocredit/base/keeper/query_batch_info_test.go similarity index 64% rename from x/ecocredit/server/core/query_batch_info_test.go rename to x/ecocredit/base/keeper/query_batch_info_test.go index 872042ccbc..8c79650965 100644 --- a/x/ecocredit/server/core/query_batch_info_test.go +++ b/x/ecocredit/base/keeper/query_batch_info_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -10,8 +10,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Batch(t *testing.T) { @@ -27,13 +27,13 @@ func TestQuery_Batch(t *testing.T) { issuer, err := sdk.AccAddressFromBech32(s.addr.String()) assert.NilError(t, err) - startTime, err := types.ParseDate("", "2020-01-01") + startTime, err := regentypes.ParseDate("", "2020-01-01") assert.NilError(t, err) - endTime, err := types.ParseDate("", "2021-01-01") + endTime, err := regentypes.ParseDate("", "2021-01-01") assert.NilError(t, err) - issuanceTime, err := types.ParseDate("", "2022-01-01") + issuanceTime, err := regentypes.ParseDate("", "2022-01-01") assert.NilError(t, err) batch := &api.Batch{ @@ -50,17 +50,17 @@ func TestQuery_Batch(t *testing.T) { assert.NilError(t, s.stateStore.BatchTable().Insert(s.ctx, batch)) // query batch by "C01-001-20200101-20220101-001" batch denom - res, err := s.k.Batch(s.ctx, &core.QueryBatchRequest{BatchDenom: batch.Denom}) + res, err := s.k.Batch(s.ctx, &types.QueryBatchRequest{BatchDenom: batch.Denom}) assert.NilError(t, err) assert.Equal(t, "C01-001", res.Batch.ProjectId) assert.Equal(t, batch.Denom, res.Batch.Denom) assert.Equal(t, batch.Metadata, res.Batch.Metadata) assert.Equal(t, issuer.String(), res.Batch.Issuer) - assert.DeepEqual(t, types.ProtobufToGogoTimestamp(batch.StartDate), res.Batch.StartDate) - assert.DeepEqual(t, types.ProtobufToGogoTimestamp(batch.EndDate), res.Batch.EndDate) - assert.DeepEqual(t, types.ProtobufToGogoTimestamp(batch.IssuanceDate), res.Batch.IssuanceDate) + assert.DeepEqual(t, regentypes.ProtobufToGogoTimestamp(batch.StartDate), res.Batch.StartDate) + assert.DeepEqual(t, regentypes.ProtobufToGogoTimestamp(batch.EndDate), res.Batch.EndDate) + assert.DeepEqual(t, regentypes.ProtobufToGogoTimestamp(batch.IssuanceDate), res.Batch.IssuanceDate) // query batch by unknown batch denom - _, err = s.k.Batch(s.ctx, &core.QueryBatchRequest{BatchDenom: "A00-000-00000000-00000000-000"}) + _, err = s.k.Batch(s.ctx, &types.QueryBatchRequest{BatchDenom: "A00-000-00000000-00000000-000"}) assert.ErrorContains(t, err, ormerrors.NotFound.Error()) } diff --git a/x/ecocredit/server/core/query_batches.go b/x/ecocredit/base/keeper/query_batches.go similarity index 66% rename from x/ecocredit/server/core/query_batches.go rename to x/ecocredit/base/keeper/query_batches.go index adccd31e93..eb531211c9 100644 --- a/x/ecocredit/server/core/query_batches.go +++ b/x/ecocredit/base/keeper/query_batches.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -7,13 +7,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" + regentypes "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // Batches queries for all batches in the given credit class. -func (k Keeper) Batches(ctx context.Context, request *core.QueryBatchesRequest) (*core.QueryBatchesResponse, error) { +func (k Keeper) Batches(ctx context.Context, request *types.QueryBatchesRequest) (*types.QueryBatchesResponse, error) { pg, err := ormutil.GogoPageReqToPulsarPageReq(request.Pagination) if err != nil { return nil, err @@ -25,7 +25,7 @@ func (k Keeper) Batches(ctx context.Context, request *core.QueryBatchesRequest) } defer it.Close() - batches := make([]*core.BatchInfo, 0) + batches := make([]*types.BatchInfo, 0) for it.Next() { batch, err := it.Value() if err != nil { @@ -39,14 +39,14 @@ func (k Keeper) Batches(ctx context.Context, request *core.QueryBatchesRequest) return nil, err } - info := core.BatchInfo{ + info := types.BatchInfo{ Issuer: issuer.String(), ProjectId: project.Id, Denom: batch.Denom, Metadata: batch.Metadata, - StartDate: types.ProtobufToGogoTimestamp(batch.StartDate), - EndDate: types.ProtobufToGogoTimestamp(batch.EndDate), - IssuanceDate: types.ProtobufToGogoTimestamp(batch.IssuanceDate), + StartDate: regentypes.ProtobufToGogoTimestamp(batch.StartDate), + EndDate: regentypes.ProtobufToGogoTimestamp(batch.EndDate), + IssuanceDate: regentypes.ProtobufToGogoTimestamp(batch.IssuanceDate), Open: batch.Open, } @@ -58,7 +58,7 @@ func (k Keeper) Batches(ctx context.Context, request *core.QueryBatchesRequest) return nil, err } - return &core.QueryBatchesResponse{ + return &types.QueryBatchesResponse{ Batches: batches, Pagination: pr, }, nil diff --git a/x/ecocredit/server/core/query_batches_by_class.go b/x/ecocredit/base/keeper/query_batches_by_class.go similarity index 72% rename from x/ecocredit/server/core/query_batches_by_class.go rename to x/ecocredit/base/keeper/query_batches_by_class.go index cf0702dc2c..8453c0fdb9 100644 --- a/x/ecocredit/server/core/query_batches_by_class.go +++ b/x/ecocredit/base/keeper/query_batches_by_class.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,13 +8,13 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" + regentypes "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // BatchesByClass queries all batches issued under a given credit class. -func (k Keeper) BatchesByClass(ctx context.Context, request *core.QueryBatchesByClassRequest) (*core.QueryBatchesByClassResponse, error) { +func (k Keeper) BatchesByClass(ctx context.Context, request *types.QueryBatchesByClassRequest) (*types.QueryBatchesByClassResponse, error) { pg, err := ormutil.GogoPageReqToPulsarPageReq(request.Pagination) if err != nil { return nil, err @@ -32,7 +32,7 @@ func (k Keeper) BatchesByClass(ctx context.Context, request *core.QueryBatchesBy } defer it.Close() - batches := make([]*core.BatchInfo, 0, 10) + batches := make([]*types.BatchInfo, 0, 10) for it.Next() { batch, err := it.Value() if err != nil { @@ -46,14 +46,14 @@ func (k Keeper) BatchesByClass(ctx context.Context, request *core.QueryBatchesBy return nil, err } - info := core.BatchInfo{ + info := types.BatchInfo{ Issuer: issuer.String(), ProjectId: project.Id, Denom: batch.Denom, Metadata: batch.Metadata, - StartDate: types.ProtobufToGogoTimestamp(batch.StartDate), - EndDate: types.ProtobufToGogoTimestamp(batch.EndDate), - IssuanceDate: types.ProtobufToGogoTimestamp(batch.IssuanceDate), + StartDate: regentypes.ProtobufToGogoTimestamp(batch.StartDate), + EndDate: regentypes.ProtobufToGogoTimestamp(batch.EndDate), + IssuanceDate: regentypes.ProtobufToGogoTimestamp(batch.IssuanceDate), Open: batch.Open, } @@ -65,7 +65,7 @@ func (k Keeper) BatchesByClass(ctx context.Context, request *core.QueryBatchesBy return nil, err } - return &core.QueryBatchesByClassResponse{ + return &types.QueryBatchesByClassResponse{ Batches: batches, Pagination: pr, }, nil diff --git a/x/ecocredit/server/core/query_batches_by_class_test.go b/x/ecocredit/base/keeper/query_batches_by_class_test.go similarity index 78% rename from x/ecocredit/server/core/query_batches_by_class_test.go rename to x/ecocredit/base/keeper/query_batches_by_class_test.go index eb8e4f227c..ba8f2672e7 100644 --- a/x/ecocredit/server/core/query_batches_by_class_test.go +++ b/x/ecocredit/base/keeper/query_batches_by_class_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -10,8 +10,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_BatchesByClass(t *testing.T) { @@ -29,13 +29,13 @@ func TestQuery_BatchesByClass(t *testing.T) { }) assert.NilError(t, err) - startTime, err := types.ParseDate("start date", "2020-01-01") + startTime, err := regentypes.ParseDate("start date", "2020-01-01") assert.NilError(t, err) - endTime, err := types.ParseDate("end date", "2021-01-01") + endTime, err := regentypes.ParseDate("end date", "2021-01-01") assert.NilError(t, err) - issuanceTime, err := types.ParseDate("issuance date", "2022-01-01") + issuanceTime, err := regentypes.ParseDate("issuance date", "2022-01-01") assert.NilError(t, err) batch1 := &api.Batch{ @@ -57,7 +57,7 @@ func TestQuery_BatchesByClass(t *testing.T) { assert.NilError(t, s.stateStore.BatchTable().Insert(s.ctx, &api.Batch{Denom: "BIO1-001-20200101-20210101-001"})) // query batches by "C01" credit class - res, err := s.k.BatchesByClass(s.ctx, &core.QueryBatchesByClassRequest{ + res, err := s.k.BatchesByClass(s.ctx, &types.QueryBatchesByClassRequest{ ClassId: "C01", Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) @@ -67,6 +67,6 @@ func TestQuery_BatchesByClass(t *testing.T) { assert.Equal(t, uint64(2), res.Pagination.Total) // query batches by unknown credit class - _, err = s.k.BatchesByClass(s.ctx, &core.QueryBatchesByClassRequest{ClassId: "A00"}) + _, err = s.k.BatchesByClass(s.ctx, &types.QueryBatchesByClassRequest{ClassId: "A00"}) assert.ErrorContains(t, err, ormerrors.NotFound.Error()) } diff --git a/x/ecocredit/server/core/query_batches_by_issuer.go b/x/ecocredit/base/keeper/query_batches_by_issuer.go similarity index 66% rename from x/ecocredit/server/core/query_batches_by_issuer.go rename to x/ecocredit/base/keeper/query_batches_by_issuer.go index 5037d06281..acce1772c0 100644 --- a/x/ecocredit/server/core/query_batches_by_issuer.go +++ b/x/ecocredit/base/keeper/query_batches_by_issuer.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,13 +8,13 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" + regentypes "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // BatchesByIssuer queries all batches issued from the given issuer address -func (k Keeper) BatchesByIssuer(ctx context.Context, req *core.QueryBatchesByIssuerRequest) (*core.QueryBatchesByIssuerResponse, error) { +func (k Keeper) BatchesByIssuer(ctx context.Context, req *types.QueryBatchesByIssuerRequest) (*types.QueryBatchesByIssuerResponse, error) { issuer, err := sdk.AccAddressFromBech32(req.Issuer) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrap(err.Error()) @@ -31,7 +31,7 @@ func (k Keeper) BatchesByIssuer(ctx context.Context, req *core.QueryBatchesByIss } defer it.Close() - batches := make([]*core.BatchInfo, 0, 8) + batches := make([]*types.BatchInfo, 0, 8) for it.Next() { batch, err := it.Value() @@ -44,14 +44,14 @@ func (k Keeper) BatchesByIssuer(ctx context.Context, req *core.QueryBatchesByIss return nil, err } - info := core.BatchInfo{ + info := types.BatchInfo{ Issuer: req.Issuer, ProjectId: project.Id, Denom: batch.Denom, Metadata: batch.Metadata, - StartDate: types.ProtobufToGogoTimestamp(batch.StartDate), - EndDate: types.ProtobufToGogoTimestamp(batch.EndDate), - IssuanceDate: types.ProtobufToGogoTimestamp(batch.IssuanceDate), + StartDate: regentypes.ProtobufToGogoTimestamp(batch.StartDate), + EndDate: regentypes.ProtobufToGogoTimestamp(batch.EndDate), + IssuanceDate: regentypes.ProtobufToGogoTimestamp(batch.IssuanceDate), Open: batch.Open, } @@ -63,5 +63,5 @@ func (k Keeper) BatchesByIssuer(ctx context.Context, req *core.QueryBatchesByIss return nil, err } - return &core.QueryBatchesByIssuerResponse{Batches: batches, Pagination: pr}, nil + return &types.QueryBatchesByIssuerResponse{Batches: batches, Pagination: pr}, nil } diff --git a/x/ecocredit/server/core/query_batches_by_issuer_test.go b/x/ecocredit/base/keeper/query_batches_by_issuer_test.go similarity index 73% rename from x/ecocredit/server/core/query_batches_by_issuer_test.go rename to x/ecocredit/base/keeper/query_batches_by_issuer_test.go index 7278a2153d..cc645857ea 100644 --- a/x/ecocredit/server/core/query_batches_by_issuer_test.go +++ b/x/ecocredit/base/keeper/query_batches_by_issuer_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -11,21 +11,21 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQueryBatchesByIssuer(t *testing.T) { t.Parallel() s := setupBase(t) - startTime, err := types.ParseDate("start date", "2020-01-01") + startTime, err := regentypes.ParseDate("start date", "2020-01-01") assert.NilError(t, err) - endTime, err := types.ParseDate("end date", "2021-01-01") + endTime, err := regentypes.ParseDate("end date", "2021-01-01") assert.NilError(t, err) - issuanceTime, err := types.ParseDate("issuance date", "2022-01-01") + issuanceTime, err := regentypes.ParseDate("issuance date", "2022-01-01") assert.NilError(t, err) // insert project @@ -52,7 +52,7 @@ func TestQueryBatchesByIssuer(t *testing.T) { })) // query batches by issuer s.addr - res, err := s.k.BatchesByIssuer(s.ctx, &core.QueryBatchesByIssuerRequest{ + res, err := s.k.BatchesByIssuer(s.ctx, &types.QueryBatchesByIssuerRequest{ Issuer: s.addr.String(), Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) @@ -64,11 +64,11 @@ func TestQueryBatchesByIssuer(t *testing.T) { _, _, notIssuer := testdata.KeyTestPubAddr() // query batches by an address that is not an issuer - res, err = s.k.BatchesByIssuer(s.ctx, &core.QueryBatchesByIssuerRequest{Issuer: notIssuer.String()}) + res, err = s.k.BatchesByIssuer(s.ctx, &types.QueryBatchesByIssuerRequest{Issuer: notIssuer.String()}) assert.NilError(t, err) assert.Equal(t, 0, len(res.Batches)) // query batches by an invalid address - _, err = s.k.BatchesByIssuer(s.ctx, &core.QueryBatchesByIssuerRequest{Issuer: "foobar"}) + _, err = s.k.BatchesByIssuer(s.ctx, &types.QueryBatchesByIssuerRequest{Issuer: "foobar"}) assert.ErrorContains(t, err, sdkerrors.ErrInvalidAddress.Error()) } diff --git a/x/ecocredit/server/core/query_batches_by_project.go b/x/ecocredit/base/keeper/query_batches_by_project.go similarity index 68% rename from x/ecocredit/server/core/query_batches_by_project.go rename to x/ecocredit/base/keeper/query_batches_by_project.go index 58f5f79e5f..77ef08686a 100644 --- a/x/ecocredit/server/core/query_batches_by_project.go +++ b/x/ecocredit/base/keeper/query_batches_by_project.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,13 +8,13 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" + regentypes "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // BatchesByProject queries for all batches in the given credit class. -func (k Keeper) BatchesByProject(ctx context.Context, request *core.QueryBatchesByProjectRequest) (*core.QueryBatchesByProjectResponse, error) { +func (k Keeper) BatchesByProject(ctx context.Context, request *types.QueryBatchesByProjectRequest) (*types.QueryBatchesByProjectResponse, error) { pg, err := ormutil.GogoPageReqToPulsarPageReq(request.Pagination) if err != nil { return nil, err @@ -31,7 +31,7 @@ func (k Keeper) BatchesByProject(ctx context.Context, request *core.QueryBatches } defer it.Close() - batches := make([]*core.BatchInfo, 0) + batches := make([]*types.BatchInfo, 0) for it.Next() { batch, err := it.Value() if err != nil { @@ -40,14 +40,14 @@ func (k Keeper) BatchesByProject(ctx context.Context, request *core.QueryBatches issuer := sdk.AccAddress(batch.Issuer) - info := core.BatchInfo{ + info := types.BatchInfo{ Issuer: issuer.String(), ProjectId: project.Id, Denom: batch.Denom, Metadata: batch.Metadata, - StartDate: types.ProtobufToGogoTimestamp(batch.StartDate), - EndDate: types.ProtobufToGogoTimestamp(batch.EndDate), - IssuanceDate: types.ProtobufToGogoTimestamp(batch.IssuanceDate), + StartDate: regentypes.ProtobufToGogoTimestamp(batch.StartDate), + EndDate: regentypes.ProtobufToGogoTimestamp(batch.EndDate), + IssuanceDate: regentypes.ProtobufToGogoTimestamp(batch.IssuanceDate), Open: batch.Open, } @@ -59,7 +59,7 @@ func (k Keeper) BatchesByProject(ctx context.Context, request *core.QueryBatches return nil, err } - return &core.QueryBatchesByProjectResponse{ + return &types.QueryBatchesByProjectResponse{ Batches: batches, Pagination: pr, }, nil diff --git a/x/ecocredit/server/core/query_batches_by_project_test.go b/x/ecocredit/base/keeper/query_batches_by_project_test.go similarity index 83% rename from x/ecocredit/server/core/query_batches_by_project_test.go rename to x/ecocredit/base/keeper/query_batches_by_project_test.go index 948c9f9455..4ce4aac051 100644 --- a/x/ecocredit/server/core/query_batches_by_project_test.go +++ b/x/ecocredit/base/keeper/query_batches_by_project_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_BatchesByProject(t *testing.T) { @@ -38,7 +38,7 @@ func TestQuery_BatchesByProject(t *testing.T) { })) // query batches by the "C01-001" project - res, err := s.k.BatchesByProject(s.ctx, &core.QueryBatchesByProjectRequest{ + res, err := s.k.BatchesByProject(s.ctx, &types.QueryBatchesByProjectRequest{ ProjectId: "C01-001", Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) @@ -48,6 +48,6 @@ func TestQuery_BatchesByProject(t *testing.T) { assert.Equal(t, uint64(2), res.Pagination.Total) // query batches by unknown project - _, err = s.k.BatchesByProject(s.ctx, &core.QueryBatchesByProjectRequest{ProjectId: "F01"}) + _, err = s.k.BatchesByProject(s.ctx, &types.QueryBatchesByProjectRequest{ProjectId: "F01"}) assert.ErrorContains(t, err, ormerrors.NotFound.Error()) } diff --git a/x/ecocredit/server/core/query_batches_test.go b/x/ecocredit/base/keeper/query_batches_test.go similarity index 72% rename from x/ecocredit/server/core/query_batches_test.go rename to x/ecocredit/base/keeper/query_batches_test.go index 2e809685a2..38afa54123 100644 --- a/x/ecocredit/server/core/query_batches_test.go +++ b/x/ecocredit/base/keeper/query_batches_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -11,8 +11,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Batches(t *testing.T) { @@ -25,13 +25,13 @@ func TestQuery_Batches(t *testing.T) { }) assert.NilError(t, err) - startTime, err := types.ParseDate("start date", "2020-01-01") + startTime, err := regentypes.ParseDate("start date", "2020-01-01") assert.NilError(t, err) - endTime, err := types.ParseDate("end date", "2021-01-01") + endTime, err := regentypes.ParseDate("end date", "2021-01-01") assert.NilError(t, err) - issuanceTime, err := types.ParseDate("issuance date", "2022-01-01") + issuanceTime, err := regentypes.ParseDate("issuance date", "2022-01-01") assert.NilError(t, err) batch := &api.Batch{ @@ -52,7 +52,7 @@ func TestQuery_Batches(t *testing.T) { })) // query all batches with pagination - res, err := s.k.Batches(s.ctx, &core.QueryBatchesRequest{ + res, err := s.k.Batches(s.ctx, &types.QueryBatchesRequest{ Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) assert.NilError(t, err) @@ -61,20 +61,20 @@ func TestQuery_Batches(t *testing.T) { assert.Equal(t, uint64(2), res.Pagination.Total) } -func assertBatchEqual(ctx context.Context, t *testing.T, k Keeper, received *core.BatchInfo, batch *api.Batch) { +func assertBatchEqual(ctx context.Context, t *testing.T, k Keeper, received *types.BatchInfo, batch *api.Batch) { issuer := sdk.AccAddress(batch.Issuer) project, err := k.stateStore.ProjectTable().Get(ctx, batch.ProjectKey) assert.NilError(t, err) - info := core.BatchInfo{ + info := types.BatchInfo{ Issuer: issuer.String(), ProjectId: project.Id, Denom: batch.Denom, Metadata: batch.Metadata, - StartDate: types.ProtobufToGogoTimestamp(batch.StartDate), - EndDate: types.ProtobufToGogoTimestamp(batch.EndDate), - IssuanceDate: types.ProtobufToGogoTimestamp(batch.IssuanceDate), + StartDate: regentypes.ProtobufToGogoTimestamp(batch.StartDate), + EndDate: regentypes.ProtobufToGogoTimestamp(batch.EndDate), + IssuanceDate: regentypes.ProtobufToGogoTimestamp(batch.IssuanceDate), Open: batch.Open, } diff --git a/x/ecocredit/server/core/query_class_info.go b/x/ecocredit/base/keeper/query_class_info.go similarity index 67% rename from x/ecocredit/server/core/query_class_info.go rename to x/ecocredit/base/keeper/query_class_info.go index ad859b7838..3188f10c3c 100644 --- a/x/ecocredit/server/core/query_class_info.go +++ b/x/ecocredit/base/keeper/query_class_info.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,11 +6,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // Class queries for information on a credit class. -func (k Keeper) Class(ctx context.Context, request *core.QueryClassRequest) (*core.QueryClassResponse, error) { +func (k Keeper) Class(ctx context.Context, request *types.QueryClassRequest) (*types.QueryClassResponse, error) { class, err := k.stateStore.ClassTable().GetById(ctx, request.ClassId) if err != nil { return nil, sdkerrors.ErrInvalidRequest.Wrapf("could not get class with id %s: %s", request.ClassId, err.Error()) @@ -18,12 +18,12 @@ func (k Keeper) Class(ctx context.Context, request *core.QueryClassRequest) (*co admin := sdk.AccAddress(class.Admin) - info := core.ClassInfo{ + info := types.ClassInfo{ Id: class.Id, Admin: admin.String(), Metadata: class.Metadata, CreditTypeAbbrev: class.CreditTypeAbbrev, } - return &core.QueryClassResponse{Class: &info}, nil + return &types.QueryClassResponse{Class: &info}, nil } diff --git a/x/ecocredit/server/core/query_class_info_test.go b/x/ecocredit/base/keeper/query_class_info_test.go similarity index 78% rename from x/ecocredit/server/core/query_class_info_test.go rename to x/ecocredit/base/keeper/query_class_info_test.go index 12f503eb9d..ca1fa5a272 100644 --- a/x/ecocredit/server/core/query_class_info_test.go +++ b/x/ecocredit/base/keeper/query_class_info_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_ClassInfo(t *testing.T) { @@ -26,7 +26,7 @@ func TestQuery_ClassInfo(t *testing.T) { assert.NilError(t, err) // query class by the "C01" class id - res, err := s.k.Class(s.ctx, &core.QueryClassRequest{ClassId: class.Id}) + res, err := s.k.Class(s.ctx, &types.QueryClassRequest{ClassId: class.Id}) assert.NilError(t, err) assert.Equal(t, class.Id, res.Class.Id) assert.Equal(t, s.addr.String(), res.Class.Admin) @@ -34,6 +34,6 @@ func TestQuery_ClassInfo(t *testing.T) { assert.Equal(t, class.CreditTypeAbbrev, res.Class.CreditTypeAbbrev) // query class by an unknown class id - _, err = s.k.Class(s.ctx, &core.QueryClassRequest{ClassId: "C02"}) + _, err = s.k.Class(s.ctx, &types.QueryClassRequest{ClassId: "C02"}) assert.ErrorContains(t, err, ormerrors.NotFound.Error()) } diff --git a/x/ecocredit/server/core/query_class_issuers.go b/x/ecocredit/base/keeper/query_class_issuers.go similarity index 82% rename from x/ecocredit/server/core/query_class_issuers.go rename to x/ecocredit/base/keeper/query_class_issuers.go index 55dfd2ed6a..43f35c1fed 100644 --- a/x/ecocredit/server/core/query_class_issuers.go +++ b/x/ecocredit/base/keeper/query_class_issuers.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -9,11 +9,11 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // ClassIssuers returns a list of addresses that are allowed to issue batches from the given class. -func (k Keeper) ClassIssuers(ctx context.Context, request *core.QueryClassIssuersRequest) (*core.QueryClassIssuersResponse, error) { +func (k Keeper) ClassIssuers(ctx context.Context, request *types.QueryClassIssuersRequest) (*types.QueryClassIssuersResponse, error) { pg, err := ormutil.GogoPageReqToPulsarPageReq(request.Pagination) if err != nil { return nil, err @@ -42,7 +42,7 @@ func (k Keeper) ClassIssuers(ctx context.Context, request *core.QueryClassIssuer if err != nil { return nil, err } - return &core.QueryClassIssuersResponse{ + return &types.QueryClassIssuersResponse{ Issuers: issuers, Pagination: pr, }, nil diff --git a/x/ecocredit/server/core/query_class_issuers_test.go b/x/ecocredit/base/keeper/query_class_issuers_test.go similarity index 66% rename from x/ecocredit/server/core/query_class_issuers_test.go rename to x/ecocredit/base/keeper/query_class_issuers_test.go index 9223418bae..b78fb446eb 100644 --- a/x/ecocredit/server/core/query_class_issuers_test.go +++ b/x/ecocredit/base/keeper/query_class_issuers_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -7,11 +7,11 @@ import ( "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" "github.com/cosmos/cosmos-sdk/testutil/testdata" - "github.com/cosmos/cosmos-sdk/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_ClassIssuers(t *testing.T) { @@ -21,37 +21,37 @@ func TestQuery_ClassIssuers(t *testing.T) { // make a class with 3 issuers. issuers := genAddrs(2) issuers = append(issuers, s.addr) - err := s.stateStore.ClassTable().Insert(s.ctx, &ecocreditv1.Class{ + err := s.stateStore.ClassTable().Insert(s.ctx, &api.Class{ Id: "C01", Admin: s.addr, Metadata: "", CreditTypeAbbrev: "C", }) assert.NilError(t, err) - assert.NilError(t, s.stateStore.ClassIssuerTable().Insert(s.ctx, &ecocreditv1.ClassIssuer{ + assert.NilError(t, s.stateStore.ClassIssuerTable().Insert(s.ctx, &api.ClassIssuer{ ClassKey: 1, Issuer: s.addr, })) - assert.NilError(t, s.stateStore.ClassIssuerTable().Insert(s.ctx, &ecocreditv1.ClassIssuer{ + assert.NilError(t, s.stateStore.ClassIssuerTable().Insert(s.ctx, &api.ClassIssuer{ ClassKey: 1, Issuer: issuers[0], })) - assert.NilError(t, s.stateStore.ClassIssuerTable().Insert(s.ctx, &ecocreditv1.ClassIssuer{ + assert.NilError(t, s.stateStore.ClassIssuerTable().Insert(s.ctx, &api.ClassIssuer{ ClassKey: 1, Issuer: issuers[1], })) // base request - res, err := s.k.ClassIssuers(s.ctx, &core.QueryClassIssuersRequest{ClassId: "C01"}) + res, err := s.k.ClassIssuers(s.ctx, &types.QueryClassIssuersRequest{ClassId: "C01"}) assert.NilError(t, err) assert.Equal(t, len(issuers), len(res.Issuers)) // bad request - _, err = s.k.ClassIssuers(s.ctx, &core.QueryClassIssuersRequest{ClassId: "F01"}) + _, err = s.k.ClassIssuers(s.ctx, &types.QueryClassIssuersRequest{ClassId: "F01"}) assert.ErrorContains(t, err, ormerrors.NotFound.Error()) // paginated request - res, err = s.k.ClassIssuers(s.ctx, &core.QueryClassIssuersRequest{ + res, err = s.k.ClassIssuers(s.ctx, &types.QueryClassIssuersRequest{ ClassId: "C01", Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) @@ -60,8 +60,8 @@ func TestQuery_ClassIssuers(t *testing.T) { assert.Equal(t, uint64(3), res.Pagination.Total) } -func genAddrs(x int) []types.AccAddress { - addrs := make([]types.AccAddress, x) +func genAddrs(x int) []sdk.AccAddress { + addrs := make([]sdk.AccAddress, x) for i := 0; i < x; i++ { _, _, addr := testdata.KeyTestPubAddr() addrs[i] = addr diff --git a/x/ecocredit/server/core/query_classes.go b/x/ecocredit/base/keeper/query_classes.go similarity index 76% rename from x/ecocredit/server/core/query_classes.go rename to x/ecocredit/base/keeper/query_classes.go index 750a45eedd..549b2ebefb 100644 --- a/x/ecocredit/server/core/query_classes.go +++ b/x/ecocredit/base/keeper/query_classes.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,11 +8,11 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // Classes queries for all credit classes with pagination. -func (k Keeper) Classes(ctx context.Context, request *core.QueryClassesRequest) (*core.QueryClassesResponse, error) { +func (k Keeper) Classes(ctx context.Context, request *types.QueryClassesRequest) (*types.QueryClassesResponse, error) { pg, err := ormutil.GogoPageReqToPulsarPageReq(request.Pagination) if err != nil { return nil, err @@ -24,7 +24,7 @@ func (k Keeper) Classes(ctx context.Context, request *core.QueryClassesRequest) } defer it.Close() - classes := make([]*core.ClassInfo, 0) + classes := make([]*types.ClassInfo, 0) for it.Next() { class, err := it.Value() if err != nil { @@ -33,7 +33,7 @@ func (k Keeper) Classes(ctx context.Context, request *core.QueryClassesRequest) admin := sdk.AccAddress(class.Admin) - info := core.ClassInfo{ + info := types.ClassInfo{ Id: class.Id, Admin: admin.String(), Metadata: class.Metadata, @@ -48,7 +48,7 @@ func (k Keeper) Classes(ctx context.Context, request *core.QueryClassesRequest) return nil, err } - return &core.QueryClassesResponse{ + return &types.QueryClassesResponse{ Classes: classes, Pagination: pr, }, err diff --git a/x/ecocredit/server/core/query_classes_by_admin.go b/x/ecocredit/base/keeper/query_classes_by_admin.go similarity index 76% rename from x/ecocredit/server/core/query_classes_by_admin.go rename to x/ecocredit/base/keeper/query_classes_by_admin.go index 38fbc4d007..3af1911175 100644 --- a/x/ecocredit/server/core/query_classes_by_admin.go +++ b/x/ecocredit/base/keeper/query_classes_by_admin.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -9,11 +9,11 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // ClassesByAdmin queries for all classes with a specific admin address. -func (k Keeper) ClassesByAdmin(ctx context.Context, req *core.QueryClassesByAdminRequest) (*core.QueryClassesByAdminResponse, error) { +func (k Keeper) ClassesByAdmin(ctx context.Context, req *types.QueryClassesByAdminRequest) (*types.QueryClassesByAdminResponse, error) { admin, err := sdk.AccAddressFromBech32(req.Admin) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrap(err.Error()) @@ -31,14 +31,14 @@ func (k Keeper) ClassesByAdmin(ctx context.Context, req *core.QueryClassesByAdmi defer it.Close() adminString := admin.String() - classes := make([]*core.ClassInfo, 0) + classes := make([]*types.ClassInfo, 0) for it.Next() { class, err := it.Value() if err != nil { return nil, err } - info := core.ClassInfo{ + info := types.ClassInfo{ Id: class.Id, Admin: adminString, Metadata: class.Metadata, @@ -53,5 +53,5 @@ func (k Keeper) ClassesByAdmin(ctx context.Context, req *core.QueryClassesByAdmi return nil, err } - return &core.QueryClassesByAdminResponse{Classes: classes, Pagination: pr}, nil + return &types.QueryClassesByAdminResponse{Classes: classes, Pagination: pr}, nil } diff --git a/x/ecocredit/server/core/query_classes_by_admin_test.go b/x/ecocredit/base/keeper/query_classes_by_admin_test.go similarity index 82% rename from x/ecocredit/server/core/query_classes_by_admin_test.go rename to x/ecocredit/base/keeper/query_classes_by_admin_test.go index c98f27a09e..1715a857cb 100644 --- a/x/ecocredit/server/core/query_classes_by_admin_test.go +++ b/x/ecocredit/base/keeper/query_classes_by_admin_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQueryClassesByAdmin(t *testing.T) { @@ -32,7 +32,7 @@ func TestQueryClassesByAdmin(t *testing.T) { })) // query classes by the admin s.addr - res, err := s.k.ClassesByAdmin(s.ctx, &core.QueryClassesByAdminRequest{ + res, err := s.k.ClassesByAdmin(s.ctx, &types.QueryClassesByAdminRequest{ Admin: s.addr.String(), Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) @@ -47,13 +47,13 @@ func TestQueryClassesByAdmin(t *testing.T) { _, _, notAdmin := testdata.KeyTestPubAddr() // query classes by an unknown admin address - res, err = s.k.ClassesByAdmin(s.ctx, &core.QueryClassesByAdminRequest{ + res, err = s.k.ClassesByAdmin(s.ctx, &types.QueryClassesByAdminRequest{ Admin: notAdmin.String(), }) assert.NilError(t, err) assert.Equal(t, 0, len(res.Classes)) // query classes by an invalid admin address - _, err = s.k.ClassesByAdmin(s.ctx, &core.QueryClassesByAdminRequest{Admin: "foobar"}) + _, err = s.k.ClassesByAdmin(s.ctx, &types.QueryClassesByAdminRequest{Admin: "foobar"}) assert.ErrorContains(t, err, sdkerrors.ErrInvalidAddress.Error()) } diff --git a/x/ecocredit/server/core/query_classes_test.go b/x/ecocredit/base/keeper/query_classes_test.go similarity index 87% rename from x/ecocredit/server/core/query_classes_test.go rename to x/ecocredit/base/keeper/query_classes_test.go index 3974f4a234..b022ad3390 100644 --- a/x/ecocredit/server/core/query_classes_test.go +++ b/x/ecocredit/base/keeper/query_classes_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Classes(t *testing.T) { @@ -29,7 +29,7 @@ func TestQuery_Classes(t *testing.T) { })) // query all credit classes - res, err := s.k.Classes(s.ctx, &core.QueryClassesRequest{ + res, err := s.k.Classes(s.ctx, &types.QueryClassesRequest{ Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) assert.NilError(t, err) diff --git a/x/ecocredit/base/keeper/query_credit_class_fees.go b/x/ecocredit/base/keeper/query_credit_class_fees.go new file mode 100644 index 0000000000..a0e43e53f9 --- /dev/null +++ b/x/ecocredit/base/keeper/query_credit_class_fees.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" +) + +// CreditClassFees queries credit class creation fees. +func (k Keeper) CreditClassFees(ctx context.Context, request *types.QueryCreditClassFeesRequest) (*types.QueryCreditClassFeesResponse, error) { + result, err := k.stateStore.ClassFeesTable().Get(ctx) + if err != nil { + return nil, err + } + + classFee, ok := regentypes.ProtoCoinsToCoins(result.Fees) + if !ok { + return nil, sdkerrors.ErrInvalidType.Wrap("credit class fee") + } + + return &types.QueryCreditClassFeesResponse{ + Fees: classFee, + }, nil +} diff --git a/x/ecocredit/server/core/query_credit_class_fees_test.go b/x/ecocredit/base/keeper/query_credit_class_fees_test.go similarity index 56% rename from x/ecocredit/server/core/query_credit_class_fees_test.go rename to x/ecocredit/base/keeper/query_credit_class_fees_test.go index 534cc161ce..66a991a2ac 100644 --- a/x/ecocredit/server/core/query_credit_class_fees_test.go +++ b/x/ecocredit/base/keeper/query_credit_class_fees_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -6,22 +6,23 @@ import ( "cosmossdk.io/math" "gotest.tools/v3/assert" - basev1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + sdkbase "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_CreditClassFees(t *testing.T) { t.Parallel() s := setupBase(t) - result, err := s.k.CreditClassFees(s.ctx, &core.QueryCreditClassFeesRequest{}) + result, err := s.k.CreditClassFees(s.ctx, &types.QueryCreditClassFeesRequest{}) assert.NilError(t, err) assert.Equal(t, result.Fees.Len(), 0) // initialize credit class fees - err = s.stateStore.ClassFeesTable().Save(s.ctx, &ecocreditv1.ClassFees{ - Fees: []*basev1beta1.Coin{ + err = s.stateStore.ClassFeesTable().Save(s.ctx, &api.ClassFees{ + Fees: []*sdkbase.Coin{ { Denom: "uatom", Amount: "20000000", @@ -30,14 +31,14 @@ func TestQuery_CreditClassFees(t *testing.T) { }) assert.NilError(t, err) - result, err = s.k.CreditClassFees(s.ctx, &core.QueryCreditClassFeesRequest{}) + result, err = s.k.CreditClassFees(s.ctx, &types.QueryCreditClassFeesRequest{}) assert.NilError(t, err) assert.Equal(t, result.Fees.Len(), 1) assert.Equal(t, result.Fees.AmountOf("uatom").Equal(math.NewInt(2e7)), true) // initialize credit class fees - err = s.stateStore.ClassFeesTable().Save(s.ctx, &ecocreditv1.ClassFees{ - Fees: []*basev1beta1.Coin{ + err = s.stateStore.ClassFeesTable().Save(s.ctx, &api.ClassFees{ + Fees: []*sdkbase.Coin{ { Denom: "uatom", Amount: "20000000", @@ -49,7 +50,7 @@ func TestQuery_CreditClassFees(t *testing.T) { }, }) assert.NilError(t, err) - result, err = s.k.CreditClassFees(s.ctx, &core.QueryCreditClassFeesRequest{}) + result, err = s.k.CreditClassFees(s.ctx, &types.QueryCreditClassFeesRequest{}) assert.NilError(t, err) assert.Equal(t, result.Fees.Len(), 2) diff --git a/x/ecocredit/server/core/query_credit_type.go b/x/ecocredit/base/keeper/query_credit_type.go similarity index 56% rename from x/ecocredit/server/core/query_credit_type.go rename to x/ecocredit/base/keeper/query_credit_type.go index 7f21094967..0ae22d5567 100644 --- a/x/ecocredit/server/core/query_credit_type.go +++ b/x/ecocredit/base/keeper/query_credit_type.go @@ -1,20 +1,20 @@ -package core +package keeper import ( "context" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // CreditType queries credit type information by abbreviation. -func (k Keeper) CreditType(ctx context.Context, request *core.QueryCreditTypeRequest) (*core.QueryCreditTypeResponse, error) { +func (k Keeper) CreditType(ctx context.Context, request *types.QueryCreditTypeRequest) (*types.QueryCreditTypeResponse, error) { creditType, err := k.stateStore.CreditTypeTable().Get(ctx, request.Abbreviation) if err != nil { return nil, err } - return &core.QueryCreditTypeResponse{ - CreditType: &core.CreditType{ + return &types.QueryCreditTypeResponse{ + CreditType: &types.CreditType{ Abbreviation: creditType.Abbreviation, Name: creditType.Name, Unit: creditType.Unit, diff --git a/x/ecocredit/server/core/query_credit_type_test.go b/x/ecocredit/base/keeper/query_credit_type_test.go similarity index 79% rename from x/ecocredit/server/core/query_credit_type_test.go rename to x/ecocredit/base/keeper/query_credit_type_test.go index a8be824843..0db7a4b07d 100644 --- a/x/ecocredit/server/core/query_credit_type_test.go +++ b/x/ecocredit/base/keeper/query_credit_type_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -6,8 +6,9 @@ import ( "gotest.tools/v3/assert" "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_CreditType(t *testing.T) { @@ -20,7 +21,7 @@ func TestQuery_CreditType(t *testing.T) { Precision: 6, })) - res, err := s.k.CreditType(s.ctx, &core.QueryCreditTypeRequest{ + res, err := s.k.CreditType(s.ctx, &types.QueryCreditTypeRequest{ Abbreviation: "BIO", }) assert.NilError(t, err) @@ -29,7 +30,7 @@ func TestQuery_CreditType(t *testing.T) { assert.Equal(t, res.CreditType.Name, "biodiversity") // query credit type by unknown abbreviation - _, err = s.k.CreditType(s.ctx, &core.QueryCreditTypeRequest{ + _, err = s.k.CreditType(s.ctx, &types.QueryCreditTypeRequest{ Abbreviation: "D", }) assert.ErrorIs(t, err, ormerrors.NotFound) diff --git a/x/ecocredit/server/core/query_credit_types.go b/x/ecocredit/base/keeper/query_credit_types.go similarity index 61% rename from x/ecocredit/server/core/query_credit_types.go rename to x/ecocredit/base/keeper/query_credit_types.go index 0dcd9af2ce..4206e68678 100644 --- a/x/ecocredit/server/core/query_credit_types.go +++ b/x/ecocredit/base/keeper/query_credit_types.go @@ -1,32 +1,32 @@ -package core +package keeper import ( "context" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // CreditTypes queries the list of allowed types that credit classes can have. -func (k Keeper) CreditTypes(ctx context.Context, _ *core.QueryCreditTypesRequest) (*core.QueryCreditTypesResponse, error) { +func (k Keeper) CreditTypes(ctx context.Context, _ *types.QueryCreditTypesRequest) (*types.QueryCreditTypesResponse, error) { it, err := k.stateStore.CreditTypeTable().List(ctx, &api.CreditTypePrimaryKey{}) if err != nil { return nil, err } defer it.Close() - creditTypes := make([]*core.CreditType, 0) + creditTypes := make([]*types.CreditType, 0) for it.Next() { ct, err := it.Value() if err != nil { return nil, err } - var creditType core.CreditType + var creditType types.CreditType if err := ormutil.PulsarToGogoSlow(ct, &creditType); err != nil { return nil, err } creditTypes = append(creditTypes, &creditType) } - return &core.QueryCreditTypesResponse{CreditTypes: creditTypes}, nil + return &types.QueryCreditTypesResponse{CreditTypes: creditTypes}, nil } diff --git a/x/ecocredit/server/core/query_credit_types_test.go b/x/ecocredit/base/keeper/query_credit_types_test.go similarity index 86% rename from x/ecocredit/server/core/query_credit_types_test.go rename to x/ecocredit/base/keeper/query_credit_types_test.go index 7316cf2a6c..2f6b564902 100644 --- a/x/ecocredit/server/core/query_credit_types_test.go +++ b/x/ecocredit/base/keeper/query_credit_types_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -6,7 +6,7 @@ import ( "gotest.tools/v3/assert" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_CreditTypes(t *testing.T) { @@ -25,7 +25,7 @@ func TestQuery_CreditTypes(t *testing.T) { Precision: 6, })) // base query should return all types - res, err := s.k.CreditTypes(s.ctx, &core.QueryCreditTypesRequest{}) + res, err := s.k.CreditTypes(s.ctx, &types.QueryCreditTypesRequest{}) assert.NilError(t, err) assert.Equal(t, 2, len(res.CreditTypes)) assert.Equal(t, uint32(6), res.CreditTypes[1].Precision) diff --git a/x/ecocredit/server/core/query_params.go b/x/ecocredit/base/keeper/query_params.go similarity index 69% rename from x/ecocredit/server/core/query_params.go rename to x/ecocredit/base/keeper/query_params.go index 2bfa03be2f..6c110e6eff 100644 --- a/x/ecocredit/server/core/query_params.go +++ b/x/ecocredit/base/keeper/query_params.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -7,22 +7,22 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" marketplacev1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + regentypes "github.com/regen-network/regen-ledger/types" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // Params queries the ecocredit module parameters. // Deprecated: This rpc method is deprecated and will be removed in next version. // Use individual param query instead. -func (k Keeper) Params(ctx context.Context, _ *core.QueryParamsRequest) (*core.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { allowlistEnabled, err := k.stateStore.AllowListEnabledTable().Get(ctx) if err != nil { return nil, err } - itr, err := k.stateStore.AllowedClassCreatorTable().List(ctx, ecocreditv1.AllowedClassCreatorPrimaryKey{}) + itr, err := k.stateStore.AllowedClassCreatorTable().List(ctx, api.AllowedClassCreatorPrimaryKey{}) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func (k Keeper) Params(ctx context.Context, _ *core.QueryParamsRequest) (*core.Q return nil, err } - classFees1, ok := types.ProtoCoinsToCoins(classFees.Fees) + classFees1, ok := regentypes.ProtoCoinsToCoins(classFees.Fees) if !ok { return nil, sdkerrors.ErrInvalidCoins.Wrap("class fees") } @@ -54,7 +54,7 @@ func (k Keeper) Params(ctx context.Context, _ *core.QueryParamsRequest) (*core.Q return nil, err } - basketFees1, ok := types.ProtoCoinsToCoins(basketFees.Fees) + basketFees1, ok := regentypes.ProtoCoinsToCoins(basketFees.Fees) if !ok { return nil, sdkerrors.ErrInvalidCoins.Wrap("basket fees") } @@ -65,22 +65,22 @@ func (k Keeper) Params(ctx context.Context, _ *core.QueryParamsRequest) (*core.Q } defer allowedDenomsItr.Close() - var allowedDenoms []*core.AllowedDenomInfo + var allowedDenoms []*types.AllowedDenomInfo for allowedDenomsItr.Next() { val, err := allowedDenomsItr.Value() if err != nil { return nil, err } - allowedDenoms = append(allowedDenoms, &core.AllowedDenomInfo{ + allowedDenoms = append(allowedDenoms, &types.AllowedDenomInfo{ BankDenom: val.BankDenom, DisplayDenom: val.DisplayDenom, Exponent: val.Exponent, }) } - return &core.QueryParamsResponse{ - Params: &core.Params{ + return &types.QueryParamsResponse{ + Params: &types.Params{ AllowedClassCreators: creators, AllowlistEnabled: allowlistEnabled.Enabled, CreditClassFee: classFees1, diff --git a/x/ecocredit/server/core/query_params_test.go b/x/ecocredit/base/keeper/query_params_test.go similarity index 57% rename from x/ecocredit/server/core/query_params_test.go rename to x/ecocredit/base/keeper/query_params_test.go index 90193f7646..66a366fc4f 100644 --- a/x/ecocredit/server/core/query_params_test.go +++ b/x/ecocredit/base/keeper/query_params_test.go @@ -1,35 +1,35 @@ -package core +package keeper import ( "testing" "gotest.tools/v3/assert" - basev1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" + sdkbase "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" sdk "github.com/cosmos/cosmos-sdk/types" - basketv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" - marketplacev1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + baskettypes "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" + markettypes "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Params(t *testing.T) { t.Parallel() s := setupBase(t) - err := s.stateStore.AllowedClassCreatorTable().Insert(s.ctx, &ecocreditv1.AllowedClassCreator{ + err := s.stateStore.AllowedClassCreatorTable().Insert(s.ctx, &api.AllowedClassCreator{ Address: s.addr, }) assert.NilError(t, err) - err = s.stateStore.AllowListEnabledTable().Save(s.ctx, &ecocreditv1.AllowListEnabled{ + err = s.stateStore.AllowListEnabledTable().Save(s.ctx, &api.AllowListEnabled{ Enabled: true, }) assert.NilError(t, err) - err = s.stateStore.ClassFeesTable().Save(s.ctx, &ecocreditv1.ClassFees{ - Fees: []*basev1beta1.Coin{ + err = s.stateStore.ClassFeesTable().Save(s.ctx, &api.ClassFees{ + Fees: []*sdkbase.Coin{ { Denom: sdk.DefaultBondDenom, Amount: "100", @@ -38,8 +38,8 @@ func TestQuery_Params(t *testing.T) { }) assert.NilError(t, err) - err = s.k.basketStore.BasketFeesTable().Save(s.ctx, &basketv1.BasketFees{ - Fees: []*basev1beta1.Coin{ + err = s.k.basketStore.BasketFeesTable().Save(s.ctx, &baskettypes.BasketFees{ + Fees: []*sdkbase.Coin{ { Denom: sdk.DefaultBondDenom, Amount: "1000", @@ -48,14 +48,14 @@ func TestQuery_Params(t *testing.T) { }) assert.NilError(t, err) - err = s.k.marketStore.AllowedDenomTable().Insert(s.ctx, &marketplacev1.AllowedDenom{ + err = s.k.marketStore.AllowedDenomTable().Insert(s.ctx, &markettypes.AllowedDenom{ BankDenom: "uregen", DisplayDenom: "REGEN", Exponent: 6, }) assert.NilError(t, err) - result, err := s.k.Params(s.ctx, &core.QueryParamsRequest{}) + result, err := s.k.Params(s.ctx, &types.QueryParamsRequest{}) assert.NilError(t, err) assert.Equal(t, result.Params.AllowlistEnabled, true) diff --git a/x/ecocredit/server/core/query_project_info.go b/x/ecocredit/base/keeper/query_project_info.go similarity index 71% rename from x/ecocredit/server/core/query_project_info.go rename to x/ecocredit/base/keeper/query_project_info.go index 5a2837ca15..b5db04add6 100644 --- a/x/ecocredit/server/core/query_project_info.go +++ b/x/ecocredit/base/keeper/query_project_info.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,11 +6,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // Project queries project info from the given project name. -func (k Keeper) Project(ctx context.Context, request *core.QueryProjectRequest) (*core.QueryProjectResponse, error) { +func (k Keeper) Project(ctx context.Context, request *types.QueryProjectRequest) (*types.QueryProjectResponse, error) { project, err := k.stateStore.ProjectTable().GetById(ctx, request.ProjectId) if err != nil { return nil, sdkerrors.ErrInvalidRequest.Wrapf("could not get project with id %s: %s", request.ProjectId, err.Error()) @@ -23,7 +23,7 @@ func (k Keeper) Project(ctx context.Context, request *core.QueryProjectRequest) return nil, err } - info := core.ProjectInfo{ + info := types.ProjectInfo{ Id: project.Id, Admin: admin.String(), ClassId: class.Id, @@ -32,5 +32,5 @@ func (k Keeper) Project(ctx context.Context, request *core.QueryProjectRequest) ReferenceId: project.ReferenceId, } - return &core.QueryProjectResponse{Project: &info}, nil + return &types.QueryProjectResponse{Project: &info}, nil } diff --git a/x/ecocredit/server/core/query_project_info_test.go b/x/ecocredit/base/keeper/query_project_info_test.go similarity index 81% rename from x/ecocredit/server/core/query_project_info_test.go rename to x/ecocredit/base/keeper/query_project_info_test.go index 1828553eee..e42aa6d94d 100644 --- a/x/ecocredit/server/core/query_project_info_test.go +++ b/x/ecocredit/base/keeper/query_project_info_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Project(t *testing.T) { @@ -34,7 +34,7 @@ func TestQuery_Project(t *testing.T) { assert.NilError(t, err) // query project by "C01-001" project id - res, err := s.k.Project(s.ctx, &core.QueryProjectRequest{ProjectId: "C01-001"}) + res, err := s.k.Project(s.ctx, &types.QueryProjectRequest{ProjectId: "C01-001"}) assert.NilError(t, err) assert.Equal(t, project.Id, res.Project.Id) assert.Equal(t, "C01", res.Project.ClassId) @@ -43,6 +43,6 @@ func TestQuery_Project(t *testing.T) { assert.Equal(t, project.ReferenceId, res.Project.ReferenceId) // query project by unknown project id - _, err = s.k.Project(s.ctx, &core.QueryProjectRequest{ProjectId: "F01"}) + _, err = s.k.Project(s.ctx, &types.QueryProjectRequest{ProjectId: "F01"}) assert.ErrorContains(t, err, ormerrors.NotFound.Error()) } diff --git a/x/ecocredit/server/core/query_projects.go b/x/ecocredit/base/keeper/query_projects.go similarity index 78% rename from x/ecocredit/server/core/query_projects.go rename to x/ecocredit/base/keeper/query_projects.go index 5c4e82f26b..5f5e15b722 100644 --- a/x/ecocredit/server/core/query_projects.go +++ b/x/ecocredit/base/keeper/query_projects.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -8,11 +8,11 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // Projects queries all projects. -func (k Keeper) Projects(ctx context.Context, request *core.QueryProjectsRequest) (*core.QueryProjectsResponse, error) { +func (k Keeper) Projects(ctx context.Context, request *types.QueryProjectsRequest) (*types.QueryProjectsResponse, error) { pg, err := ormutil.GogoPageReqToPulsarPageReq(request.Pagination) if err != nil { return nil, err @@ -24,7 +24,7 @@ func (k Keeper) Projects(ctx context.Context, request *core.QueryProjectsRequest } defer it.Close() - projects := make([]*core.ProjectInfo, 0) + projects := make([]*types.ProjectInfo, 0) for it.Next() { project, err := it.Value() if err != nil { @@ -38,7 +38,7 @@ func (k Keeper) Projects(ctx context.Context, request *core.QueryProjectsRequest return nil, err } - info := core.ProjectInfo{ + info := types.ProjectInfo{ Id: project.Id, Admin: admin.String(), ClassId: class.Id, @@ -55,7 +55,7 @@ func (k Keeper) Projects(ctx context.Context, request *core.QueryProjectsRequest return nil, err } - return &core.QueryProjectsResponse{ + return &types.QueryProjectsResponse{ Projects: projects, Pagination: pr, }, nil diff --git a/x/ecocredit/server/core/query_projects_by_admin.go b/x/ecocredit/base/keeper/query_projects_by_admin.go similarity index 74% rename from x/ecocredit/server/core/query_projects_by_admin.go rename to x/ecocredit/base/keeper/query_projects_by_admin.go index b53afdb42c..c96ed4f99f 100644 --- a/x/ecocredit/server/core/query_projects_by_admin.go +++ b/x/ecocredit/base/keeper/query_projects_by_admin.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -6,12 +6,13 @@ import ( "github.com/cosmos/cosmos-sdk/orm/model/ormlist" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) -func (k Keeper) ProjectsByAdmin(ctx context.Context, req *core.QueryProjectsByAdminRequest) (*core.QueryProjectsByAdminResponse, error) { +func (k Keeper) ProjectsByAdmin(ctx context.Context, req *types.QueryProjectsByAdminRequest) (*types.QueryProjectsByAdminResponse, error) { admin, err := sdk.AccAddressFromBech32(req.Admin) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrap(err.Error()) @@ -28,7 +29,7 @@ func (k Keeper) ProjectsByAdmin(ctx context.Context, req *core.QueryProjectsByAd } defer it.Close() - projects := make([]*core.ProjectInfo, 0) + projects := make([]*types.ProjectInfo, 0) for it.Next() { project, err := it.Value() if err != nil { @@ -40,7 +41,7 @@ func (k Keeper) ProjectsByAdmin(ctx context.Context, req *core.QueryProjectsByAd return nil, err } - projects = append(projects, &core.ProjectInfo{ + projects = append(projects, &types.ProjectInfo{ Id: project.Id, Admin: req.Admin, ClassId: class.Id, @@ -55,5 +56,5 @@ func (k Keeper) ProjectsByAdmin(ctx context.Context, req *core.QueryProjectsByAd return nil, err } - return &core.QueryProjectsByAdminResponse{Projects: projects, Pagination: pr}, nil + return &types.QueryProjectsByAdminResponse{Projects: projects, Pagination: pr}, nil } diff --git a/x/ecocredit/server/core/query_projects_by_admin_test.go b/x/ecocredit/base/keeper/query_projects_by_admin_test.go similarity index 84% rename from x/ecocredit/server/core/query_projects_by_admin_test.go rename to x/ecocredit/base/keeper/query_projects_by_admin_test.go index 44e1bd4147..40388a4dab 100644 --- a/x/ecocredit/server/core/query_projects_by_admin_test.go +++ b/x/ecocredit/base/keeper/query_projects_by_admin_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Projects_By_Admin(t *testing.T) { @@ -60,12 +60,12 @@ func TestQuery_Projects_By_Admin(t *testing.T) { assert.NilError(t, err) // query project by admin1 expect 2 projects - res, err := s.k.ProjectsByAdmin(s.ctx, &core.QueryProjectsByAdminRequest{Admin: s.addr.String()}) + res, err := s.k.ProjectsByAdmin(s.ctx, &types.QueryProjectsByAdminRequest{Admin: s.addr.String()}) assert.NilError(t, err) assert.Equal(t, len(res.Projects), 2) // query project by admin1 with page limit 1 expect 1 project - res, err = s.k.ProjectsByAdmin(s.ctx, &core.QueryProjectsByAdminRequest{Admin: s.addr.String(), + res, err = s.k.ProjectsByAdmin(s.ctx, &types.QueryProjectsByAdminRequest{Admin: s.addr.String(), Pagination: &query.PageRequest{ Limit: 1, CountTotal: true, @@ -79,7 +79,7 @@ func TestQuery_Projects_By_Admin(t *testing.T) { assert.Equal(t, res.Pagination.Total, uint64(2)) // query project by admin2 expect 1 project - res, err = s.k.ProjectsByAdmin(s.ctx, &core.QueryProjectsByAdminRequest{Admin: admin2.String()}) + res, err = s.k.ProjectsByAdmin(s.ctx, &types.QueryProjectsByAdminRequest{Admin: admin2.String()}) assert.NilError(t, err) assert.Equal(t, len(res.Projects), 1) } diff --git a/x/ecocredit/server/core/query_projects_by_class.go b/x/ecocredit/base/keeper/query_projects_by_class.go similarity index 81% rename from x/ecocredit/server/core/query_projects_by_class.go rename to x/ecocredit/base/keeper/query_projects_by_class.go index f7bae32791..d9d7904040 100644 --- a/x/ecocredit/server/core/query_projects_by_class.go +++ b/x/ecocredit/base/keeper/query_projects_by_class.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -9,11 +9,11 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // ProjectsByClass queries all projects from a given credit class. -func (k Keeper) ProjectsByClass(ctx context.Context, request *core.QueryProjectsByClassRequest) (*core.QueryProjectsByClassResponse, error) { +func (k Keeper) ProjectsByClass(ctx context.Context, request *types.QueryProjectsByClassRequest) (*types.QueryProjectsByClassResponse, error) { pg, err := ormutil.GogoPageReqToPulsarPageReq(request.Pagination) if err != nil { return nil, err @@ -30,7 +30,7 @@ func (k Keeper) ProjectsByClass(ctx context.Context, request *core.QueryProjects } defer it.Close() - projects := make([]*core.ProjectInfo, 0) + projects := make([]*types.ProjectInfo, 0) for it.Next() { project, err := it.Value() if err != nil { @@ -44,7 +44,7 @@ func (k Keeper) ProjectsByClass(ctx context.Context, request *core.QueryProjects return nil, err } - info := core.ProjectInfo{ + info := types.ProjectInfo{ Id: project.Id, Admin: admin.String(), ClassId: class.Id, @@ -61,7 +61,7 @@ func (k Keeper) ProjectsByClass(ctx context.Context, request *core.QueryProjects return nil, err } - return &core.QueryProjectsByClassResponse{ + return &types.QueryProjectsByClassResponse{ Projects: projects, Pagination: pr, }, nil diff --git a/x/ecocredit/server/core/query_projects_by_class_test.go b/x/ecocredit/base/keeper/query_projects_by_class_test.go similarity index 85% rename from x/ecocredit/server/core/query_projects_by_class_test.go rename to x/ecocredit/base/keeper/query_projects_by_class_test.go index 0641002bfe..7cee6c2f2d 100644 --- a/x/ecocredit/server/core/query_projects_by_class_test.go +++ b/x/ecocredit/base/keeper/query_projects_by_class_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_ProjectsByClass(t *testing.T) { @@ -37,7 +37,7 @@ func TestQuery_ProjectsByClass(t *testing.T) { })) // query projects by "C01" credit class - res, err := s.k.ProjectsByClass(s.ctx, &core.QueryProjectsByClassRequest{ + res, err := s.k.ProjectsByClass(s.ctx, &types.QueryProjectsByClassRequest{ ClassId: "C01", Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) @@ -54,6 +54,6 @@ func TestQuery_ProjectsByClass(t *testing.T) { assert.Equal(t, project.Metadata, res.Projects[0].Metadata) // query projects by unknown credit class - _, err = s.k.ProjectsByClass(s.ctx, &core.QueryProjectsByClassRequest{ClassId: "F01"}) + _, err = s.k.ProjectsByClass(s.ctx, &types.QueryProjectsByClassRequest{ClassId: "F01"}) assert.ErrorContains(t, err, ormerrors.NotFound.Error()) } diff --git a/x/ecocredit/server/core/query_projects_by_reference_id.go b/x/ecocredit/base/keeper/query_projects_by_reference_id.go similarity index 82% rename from x/ecocredit/server/core/query_projects_by_reference_id.go rename to x/ecocredit/base/keeper/query_projects_by_reference_id.go index 95e16dd130..081e97e5b5 100644 --- a/x/ecocredit/server/core/query_projects_by_reference_id.go +++ b/x/ecocredit/base/keeper/query_projects_by_reference_id.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "context" @@ -11,12 +11,12 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // ProjectsByReferenceId queries projects by reference id. //nolint:revive,stylecheck -func (k Keeper) ProjectsByReferenceId(ctx context.Context, req *core.QueryProjectsByReferenceIdRequest) (*core.QueryProjectsByReferenceIdResponse, error) { +func (k Keeper) ProjectsByReferenceId(ctx context.Context, req *types.QueryProjectsByReferenceIdRequest) (*types.QueryProjectsByReferenceIdResponse, error) { if req.ReferenceId == "" { return nil, status.Errorf(codes.InvalidArgument, "reference-id is empty") } @@ -32,7 +32,7 @@ func (k Keeper) ProjectsByReferenceId(ctx context.Context, req *core.QueryProjec } defer it.Close() - projects := make([]*core.ProjectInfo, 0) + projects := make([]*types.ProjectInfo, 0) for it.Next() { project, err := it.Value() if err != nil { @@ -44,7 +44,7 @@ func (k Keeper) ProjectsByReferenceId(ctx context.Context, req *core.QueryProjec return nil, err } - info := &core.ProjectInfo{ + info := &types.ProjectInfo{ Id: project.Id, Admin: sdk.AccAddress(project.Admin).String(), ClassId: class.Id, @@ -61,7 +61,7 @@ func (k Keeper) ProjectsByReferenceId(ctx context.Context, req *core.QueryProjec return nil, err } - return &core.QueryProjectsByReferenceIdResponse{ + return &types.QueryProjectsByReferenceIdResponse{ Projects: projects, Pagination: pr, }, nil diff --git a/x/ecocredit/server/core/query_projects_by_reference_id_test.go b/x/ecocredit/base/keeper/query_projects_by_reference_id_test.go similarity index 85% rename from x/ecocredit/server/core/query_projects_by_reference_id_test.go rename to x/ecocredit/base/keeper/query_projects_by_reference_id_test.go index 0fe5aa69bc..68fcfce6b3 100644 --- a/x/ecocredit/server/core/query_projects_by_reference_id_test.go +++ b/x/ecocredit/base/keeper/query_projects_by_reference_id_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_ProjectsByReferenceId(t *testing.T) { @@ -44,7 +44,7 @@ func TestQuery_ProjectsByReferenceId(t *testing.T) { })) // query projects by "VCS-001" reference id - res, err := s.k.ProjectsByReferenceId(s.ctx, &core.QueryProjectsByReferenceIdRequest{ + res, err := s.k.ProjectsByReferenceId(s.ctx, &types.QueryProjectsByReferenceIdRequest{ ReferenceId: "VCS-001", Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) @@ -61,7 +61,7 @@ func TestQuery_ProjectsByReferenceId(t *testing.T) { assert.Equal(t, project.Jurisdiction, res.Projects[0].Jurisdiction) // query projects by unknown reference id - res, err = s.k.ProjectsByReferenceId(s.ctx, &core.QueryProjectsByReferenceIdRequest{ReferenceId: "RR2"}) + res, err = s.k.ProjectsByReferenceId(s.ctx, &types.QueryProjectsByReferenceIdRequest{ReferenceId: "RR2"}) assert.Equal(t, len(res.Projects), 0) assert.NilError(t, err) } diff --git a/x/ecocredit/server/core/query_projects_test.go b/x/ecocredit/base/keeper/query_projects_test.go similarity index 89% rename from x/ecocredit/server/core/query_projects_test.go rename to x/ecocredit/base/keeper/query_projects_test.go index 7d949b776e..1b4ca16227 100644 --- a/x/ecocredit/server/core/query_projects_test.go +++ b/x/ecocredit/base/keeper/query_projects_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Projects(t *testing.T) { @@ -36,7 +36,7 @@ func TestQuery_Projects(t *testing.T) { })) // query projects with pagination - res, err := s.k.Projects(s.ctx, &core.QueryProjectsRequest{ + res, err := s.k.Projects(s.ctx, &types.QueryProjectsRequest{ Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, }) assert.NilError(t, err) diff --git a/x/ecocredit/server/core/query_supply.go b/x/ecocredit/base/keeper/query_supply.go similarity index 72% rename from x/ecocredit/server/core/query_supply.go rename to x/ecocredit/base/keeper/query_supply.go index a1c1554a2b..3ef5355b8d 100644 --- a/x/ecocredit/server/core/query_supply.go +++ b/x/ecocredit/base/keeper/query_supply.go @@ -1,15 +1,15 @@ -package core +package keeper import ( "context" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // Supply queries the supply (tradable, retired, cancelled) of a given credit batch. -func (k Keeper) Supply(ctx context.Context, request *core.QuerySupplyRequest) (*core.QuerySupplyResponse, error) { +func (k Keeper) Supply(ctx context.Context, request *types.QuerySupplyRequest) (*types.QuerySupplyResponse, error) { batch, err := k.stateStore.BatchTable().GetByDenom(ctx, request.BatchDenom) if err != nil { return nil, sdkerrors.ErrInvalidRequest.Wrapf("could not get batch with denom %s: %s", request.BatchDenom, err.Error()) @@ -20,7 +20,7 @@ func (k Keeper) Supply(ctx context.Context, request *core.QuerySupplyRequest) (* return nil, err } - return &core.QuerySupplyResponse{ + return &types.QuerySupplyResponse{ TradableAmount: supply.TradableAmount, RetiredAmount: supply.RetiredAmount, CancelledAmount: supply.CancelledAmount, diff --git a/x/ecocredit/server/core/query_supply_test.go b/x/ecocredit/base/keeper/query_supply_test.go similarity index 79% rename from x/ecocredit/server/core/query_supply_test.go rename to x/ecocredit/base/keeper/query_supply_test.go index 0f0526d16e..6adc8f81d8 100644 --- a/x/ecocredit/server/core/query_supply_test.go +++ b/x/ecocredit/base/keeper/query_supply_test.go @@ -1,4 +1,4 @@ -package core +package keeper import ( "testing" @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestQuery_Supply(t *testing.T) { @@ -35,13 +35,13 @@ func TestQuery_Supply(t *testing.T) { })) // valid query - res, err := s.k.Supply(s.ctx, &core.QuerySupplyRequest{BatchDenom: batchDenom}) + res, err := s.k.Supply(s.ctx, &types.QuerySupplyRequest{BatchDenom: batchDenom}) assert.NilError(t, err) assert.Equal(t, tradable, res.TradableAmount) assert.Equal(t, retired, res.RetiredAmount) assert.Equal(t, cancelled, res.CancelledAmount) // bad denom query - _, err = s.k.Supply(s.ctx, &core.QuerySupplyRequest{BatchDenom: "A00-00000000-00000000-001"}) + _, err = s.k.Supply(s.ctx, &types.QuerySupplyRequest{BatchDenom: "A00-00000000-00000000-001"}) assert.ErrorContains(t, err, ormerrors.NotFound.Error()) } diff --git a/x/ecocredit/server/core/utils.go b/x/ecocredit/base/keeper/utils.go similarity index 82% rename from x/ecocredit/server/core/utils.go rename to x/ecocredit/base/keeper/utils.go index f00751e470..bdc76c120b 100644 --- a/x/ecocredit/server/core/utils.go +++ b/x/ecocredit/base/keeper/utils.go @@ -1,15 +1,15 @@ -package core +package keeper import ( "context" - ecoApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" - "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) // assertClassIssuer makes sure that the issuer is part of issuers of given class key. @@ -26,7 +26,7 @@ func (k Keeper) assertClassIssuer(goCtx context.Context, classKey uint64, addr s } // AddAndSaveBalance adds 'amt' to the addr's tradable balance. -func AddAndSaveBalance(ctx context.Context, table ecoApi.BatchBalanceTable, addr sdk.AccAddress, batchKey uint64, amt math.Dec) error { +func AddAndSaveBalance(ctx context.Context, table api.BatchBalanceTable, addr sdk.AccAddress, batchKey uint64, amt math.Dec) error { bal, err := utils.GetBalance(ctx, table, addr, batchKey) if err != nil { return err @@ -44,11 +44,11 @@ func AddAndSaveBalance(ctx context.Context, table ecoApi.BatchBalanceTable, addr } // RetireAndSaveBalance adds 'amt' to the addr's retired balance. -func RetireAndSaveBalance(ctx context.Context, table ecoApi.BatchBalanceTable, addr sdk.AccAddress, batchKey uint64, amount math.Dec) error { +func RetireAndSaveBalance(ctx context.Context, table api.BatchBalanceTable, addr sdk.AccAddress, batchKey uint64, amount math.Dec) error { bal, err := table.Get(ctx, addr, batchKey) if err != nil { if ormerrors.IsNotFound(err) { - bal = &ecoApi.BatchBalance{ + bal = &api.BatchBalance{ BatchKey: batchKey, Address: addr, TradableAmount: "0", @@ -72,7 +72,7 @@ func RetireAndSaveBalance(ctx context.Context, table ecoApi.BatchBalanceTable, a } // RetireSupply moves `amount` of credits from the supply's tradable amount to its retired amount. -func RetireSupply(ctx context.Context, table ecoApi.BatchSupplyTable, batchKey uint64, amount math.Dec) error { +func RetireSupply(ctx context.Context, table api.BatchSupplyTable, batchKey uint64, amount math.Dec) error { supply, err := table.Get(ctx, batchKey) if err != nil { return err diff --git a/x/ecocredit/simulation/operations.go b/x/ecocredit/base/simulation/operations.go similarity index 90% rename from x/ecocredit/simulation/operations.go rename to x/ecocredit/base/simulation/operations.go index e752725c10..cc8ceec447 100644 --- a/x/ecocredit/simulation/operations.go +++ b/x/ecocredit/base/simulation/operations.go @@ -18,8 +18,9 @@ import ( "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" marketsims "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/simulation" markettypes "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/simulation/utils" @@ -61,27 +62,27 @@ const ( // ecocredit message types var ( - TypeMsgCreateClass = sdk.MsgTypeURL(&core.MsgCreateClass{}) - TypeMsgCreateProject = sdk.MsgTypeURL(&core.MsgCreateProject{}) - TypeMsgCreateBatch = sdk.MsgTypeURL(&core.MsgCreateBatch{}) - TypeMsgSend = sdk.MsgTypeURL(&core.MsgSend{}) - TypeMsgRetire = sdk.MsgTypeURL(&core.MsgRetire{}) - TypeMsgCancel = sdk.MsgTypeURL(&core.MsgCancel{}) - TypeMsgUpdateClassAdmin = sdk.MsgTypeURL(&core.MsgUpdateClassAdmin{}) - TypeMsgUpdateClassIssuers = sdk.MsgTypeURL(&core.MsgUpdateClassIssuers{}) - TypeMsgUpdateClassMetadata = sdk.MsgTypeURL(&core.MsgUpdateClassMetadata{}) - TypeMsgUpdateProjectMetadata = sdk.MsgTypeURL(&core.MsgUpdateProjectMetadata{}) - TypeMsgUpdateProjectAdmin = sdk.MsgTypeURL(&core.MsgUpdateProjectAdmin{}) - TypeMsgBridge = sdk.MsgTypeURL(&core.MsgBridge{}) - TypeMsgMintBatchCredits = sdk.MsgTypeURL(&core.MsgMintBatchCredits{}) - TypeMsgSealBatch = sdk.MsgTypeURL(&core.MsgSealBatch{}) + TypeMsgCreateClass = sdk.MsgTypeURL(&types.MsgCreateClass{}) + TypeMsgCreateProject = sdk.MsgTypeURL(&types.MsgCreateProject{}) + TypeMsgCreateBatch = sdk.MsgTypeURL(&types.MsgCreateBatch{}) + TypeMsgSend = sdk.MsgTypeURL(&types.MsgSend{}) + TypeMsgRetire = sdk.MsgTypeURL(&types.MsgRetire{}) + TypeMsgCancel = sdk.MsgTypeURL(&types.MsgCancel{}) + TypeMsgUpdateClassAdmin = sdk.MsgTypeURL(&types.MsgUpdateClassAdmin{}) + TypeMsgUpdateClassIssuers = sdk.MsgTypeURL(&types.MsgUpdateClassIssuers{}) + TypeMsgUpdateClassMetadata = sdk.MsgTypeURL(&types.MsgUpdateClassMetadata{}) + TypeMsgUpdateProjectMetadata = sdk.MsgTypeURL(&types.MsgUpdateProjectMetadata{}) + TypeMsgUpdateProjectAdmin = sdk.MsgTypeURL(&types.MsgUpdateProjectAdmin{}) + TypeMsgBridge = sdk.MsgTypeURL(&types.MsgBridge{}) + TypeMsgMintBatchCredits = sdk.MsgTypeURL(&types.MsgMintBatchCredits{}) + TypeMsgSealBatch = sdk.MsgTypeURL(&types.MsgSealBatch{}) ) // WeightedOperations returns all the operations from the module with their respective weights func WeightedOperations( appParams simtypes.AppParams, cdc codec.JSONCodec, ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer, basketQryClient baskettypes.QueryServer, + qryClient types.QueryServer, basketQryClient baskettypes.QueryServer, mktQryClient markettypes.QueryServer) simulation.WeightedOperations { var ( @@ -254,7 +255,7 @@ func WeightedOperations( } // SimulateMsgUpdateProjectMetadata generates a MsgUpdateProjectMetadata with random values. -func SimulateMsgUpdateProjectMetadata(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient core.QueryServer) simtypes.Operation { +func SimulateMsgUpdateProjectMetadata(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -274,10 +275,10 @@ func SimulateMsgUpdateProjectMetadata(ak ecocredit.AccountKeeper, bk ecocredit.B return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgUpdateProjectMetadata, err.Error()), nil, err } - msg := &core.MsgUpdateProjectMetadata{ + msg := &types.MsgUpdateProjectMetadata{ Admin: admin.String(), ProjectId: project.Id, - NewMetadata: simtypes.RandStringOfLength(r, simtypes.RandIntBetween(r, 10, core.MaxMetadataLength)), + NewMetadata: simtypes.RandStringOfLength(r, simtypes.RandIntBetween(r, 10, base.MaxMetadataLength)), } spendable, account, op, err := utils.GetAccountAndSpendableCoins(sdkCtx, bk, accs, admin.String(), TypeMsgUpdateProjectMetadata) @@ -305,7 +306,7 @@ func SimulateMsgUpdateProjectMetadata(ak ecocredit.AccountKeeper, bk ecocredit.B } // SimulateMsgUpdateProjectAdmin generates a MsgUpdateProjectAdmin with random values. -func SimulateMsgUpdateProjectAdmin(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient core.QueryServer) simtypes.Operation { +func SimulateMsgUpdateProjectAdmin(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -325,7 +326,7 @@ func SimulateMsgUpdateProjectAdmin(ak ecocredit.AccountKeeper, bk ecocredit.Bank return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgUpdateProjectAdmin, "old and new admin are same"), nil, nil } - msg := &core.MsgUpdateProjectAdmin{ + msg := &types.MsgUpdateProjectAdmin{ Admin: project.Admin, NewAdmin: newAdmin.Address.String(), ProjectId: project.Id, @@ -357,7 +358,7 @@ func SimulateMsgUpdateProjectAdmin(ak ecocredit.AccountKeeper, bk ecocredit.Bank // SimulateMsgCreateClass generates a MsgCreateClass with random values. func SimulateMsgCreateClass(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -365,7 +366,7 @@ func SimulateMsgCreateClass(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, issuers := randomIssuers(r, accs) ctx := sdk.WrapSDKContext(sdkCtx) - res, err := qryClient.Params(ctx, &core.QueryParamsRequest{}) + res, err := qryClient.Params(ctx, &types.QueryParamsRequest{}) if err != nil { return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgCreateClass, err.Error()), nil, err } @@ -381,7 +382,7 @@ func SimulateMsgCreateClass(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, } creditTypes := []string{"C", "BIO"} - msg := &core.MsgCreateClass{ + msg := &types.MsgCreateClass{ Admin: admin.Address.String(), Issuers: issuers, Metadata: simtypes.RandStringOfLength(r, 10), @@ -410,7 +411,7 @@ func SimulateMsgCreateClass(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, // SimulateMsgCreateProject generates a MsgCreateProject with random values. func SimulateMsgCreateProject(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -437,7 +438,7 @@ func SimulateMsgCreateProject(ak ecocredit.AccountKeeper, bk ecocredit.BankKeepe spendable := bk.SpendableCoins(sdkCtx, adminAddr) - msg := &core.MsgCreateProject{ + msg := &types.MsgCreateProject{ Admin: admin, ClassId: class.Id, Metadata: simtypes.RandStringOfLength(r, 100), @@ -464,7 +465,7 @@ func SimulateMsgCreateProject(ak ecocredit.AccountKeeper, bk ecocredit.BankKeepe // SimulateMsgCreateBatch generates a MsgCreateBatch with random values. func SimulateMsgCreateBatch(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -476,7 +477,7 @@ func SimulateMsgCreateBatch(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, return op, nil, err } - result, err := qryClient.ClassIssuers(ctx, &core.QueryClassIssuersRequest{ClassId: class.Id}) + result, err := qryClient.ClassIssuers(ctx, &types.QueryClassIssuersRequest{ClassId: class.Id}) if err != nil { return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgCreateBatch, err.Error()), nil, err } @@ -501,7 +502,7 @@ func SimulateMsgCreateBatch(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, now := sdkCtx.BlockTime() tenHours := now.Add(10 * time.Hour) - msg := &core.MsgCreateBatch{ + msg := &types.MsgCreateBatch{ Issuer: issuer.Address.String(), ProjectId: project.Id, Issuance: generateBatchIssuance(r, accs), @@ -532,7 +533,7 @@ func SimulateMsgCreateBatch(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, // SimulateMsgSend generates a MsgSend with random values. func SimulateMsgSend(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -554,7 +555,7 @@ func SimulateMsgSend(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, } admin := sdk.AccAddress(project.Admin).String() - balres, err := qryClient.Balance(ctx, &core.QueryBalanceRequest{ + balres, err := qryClient.Balance(ctx, &types.QueryBalanceRequest{ Address: admin, BatchDenom: batch.Denom, }) @@ -613,10 +614,10 @@ func SimulateMsgSend(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgSend, "insufficient credit balance"), nil, nil } - msg := &core.MsgSend{ + msg := &types.MsgSend{ Sender: admin, Recipient: recipient.Address.String(), - Credits: []*core.MsgSend_SendCredits{ + Credits: []*types.MsgSend_SendCredits{ { BatchDenom: batch.Denom, TradableAmount: fmt.Sprintf("%d", tradable), @@ -647,7 +648,7 @@ func SimulateMsgSend(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, // SimulateMsgRetire generates a MsgRetire with random values. func SimulateMsgRetire(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -669,7 +670,7 @@ func SimulateMsgRetire(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, } admin := sdk.AccAddress(project.Admin).String() - balanceRes, err := qryClient.Balance(ctx, &core.QueryBalanceRequest{ + balanceRes, err := qryClient.Balance(ctx, &types.QueryBalanceRequest{ Address: admin, BatchDenom: batch.Denom, }) @@ -700,9 +701,9 @@ func SimulateMsgRetire(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgRetire, "insufficient funds"), nil, nil } - msg := &core.MsgRetire{ + msg := &types.MsgRetire{ Owner: account.Address.String(), - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: batch.Denom, Amount: randSub.String(), @@ -732,7 +733,7 @@ func SimulateMsgRetire(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, // SimulateMsgCancel generates a MsgCancel with random values. func SimulateMsgCancel(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -754,7 +755,7 @@ func SimulateMsgCancel(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, } admin := sdk.AccAddress(project.Admin).String() - balanceRes, err := qryClient.Balance(ctx, &core.QueryBalanceRequest{ + balanceRes, err := qryClient.Balance(ctx, &types.QueryBalanceRequest{ Address: admin, BatchDenom: batch.Denom, }) @@ -771,9 +772,9 @@ func SimulateMsgCancel(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgCancel, "balance is zero"), nil, nil } - msg := &core.MsgCancel{ + msg := &types.MsgCancel{ Owner: admin, - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: batch.Denom, Amount: balanceRes.Balance.TradableAmount, @@ -808,7 +809,7 @@ func SimulateMsgCancel(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, // SimulateMsgUpdateClassAdmin generates a MsgUpdateClassAdmin with random values func SimulateMsgUpdateClassAdmin(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -828,7 +829,7 @@ func SimulateMsgUpdateClassAdmin(ak ecocredit.AccountKeeper, bk ecocredit.BankKe return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgUpdateClassAdmin, "old and new account is same"), nil, nil // skip } - msg := &core.MsgUpdateClassAdmin{ + msg := &types.MsgUpdateClassAdmin{ Admin: admin.String(), ClassId: class.Id, NewAdmin: newAdmin.Address.String(), @@ -855,7 +856,7 @@ func SimulateMsgUpdateClassAdmin(ak ecocredit.AccountKeeper, bk ecocredit.BankKe // SimulateMsgUpdateClassMetadata generates a MsgUpdateClassMetadata with random metadata func SimulateMsgUpdateClassMetadata(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -870,7 +871,7 @@ func SimulateMsgUpdateClassMetadata(ak ecocredit.AccountKeeper, bk ecocredit.Ban return op, nil, err } - msg := &core.MsgUpdateClassMetadata{ + msg := &types.MsgUpdateClassMetadata{ Admin: admin.String(), ClassId: class.Id, NewMetadata: simtypes.RandStringOfLength(r, simtypes.RandIntBetween(r, 10, 256)), @@ -897,7 +898,7 @@ func SimulateMsgUpdateClassMetadata(ak ecocredit.AccountKeeper, bk ecocredit.Ban // SimulateMsgUpdateClassIssuers generates a MsgUpdateClassMetaData with random values func SimulateMsgUpdateClassIssuers(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -912,7 +913,7 @@ func SimulateMsgUpdateClassIssuers(ak ecocredit.AccountKeeper, bk ecocredit.Bank return op, nil, err } - issuersRes, err := qryClient.ClassIssuers(sdk.WrapSDKContext(sdkCtx), &core.QueryClassIssuersRequest{ClassId: class.Id}) + issuersRes, err := qryClient.ClassIssuers(sdk.WrapSDKContext(sdkCtx), &types.QueryClassIssuersRequest{ClassId: class.Id}) if err != nil { return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgUpdateClassIssuers, err.Error()), nil, err } @@ -934,7 +935,7 @@ func SimulateMsgUpdateClassIssuers(ak ecocredit.AccountKeeper, bk ecocredit.Bank } } - msg := &core.MsgUpdateClassIssuers{ + msg := &types.MsgUpdateClassIssuers{ Admin: admin.String(), ClassId: class.Id, AddIssuers: addIssuers, @@ -961,7 +962,7 @@ func SimulateMsgUpdateClassIssuers(ak ecocredit.AccountKeeper, bk ecocredit.Bank } // SimulateMsgMintBatchCredits generates a MsgMintBatchCredits with random values. -func SimulateMsgMintBatchCredits(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient core.QueryServer) simtypes.Operation { +func SimulateMsgMintBatchCredits(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -992,11 +993,11 @@ func SimulateMsgMintBatchCredits(ak ecocredit.AccountKeeper, bk ecocredit.BankKe return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgMintBatchCredits, "only batch issuer can mint additional credits"), nil, nil } - msg := &core.MsgMintBatchCredits{ + msg := &types.MsgMintBatchCredits{ Issuer: issuerAddr, BatchDenom: batch.Denom, Issuance: generateBatchIssuance(r, accs), - OriginTx: &core.OriginTx{ + OriginTx: &types.OriginTx{ Source: simtypes.RandStringOfLength(r, simtypes.RandIntBetween(r, 2, 64)), Id: simtypes.RandStringOfLength(r, simtypes.RandIntBetween(r, 2, 64)), }, @@ -1026,7 +1027,7 @@ func SimulateMsgMintBatchCredits(ak ecocredit.AccountKeeper, bk ecocredit.BankKe } // SimulateMsgSealBatch generates a MsgSealBatch with random values. -func SimulateMsgSealBatch(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient core.QueryServer) simtypes.Operation { +func SimulateMsgSealBatch(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -1057,7 +1058,7 @@ func SimulateMsgSealBatch(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, q return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgSealBatch, "batch is closed"), nil, nil } - msg := &core.MsgSealBatch{ + msg := &types.MsgSealBatch{ Issuer: issuerAddr, BatchDenom: batch.Denom, } @@ -1086,7 +1087,7 @@ func SimulateMsgSealBatch(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, q } // SimulateMsgBridge generates a MsgBridge with random values. -func SimulateMsgBridge(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient core.QueryServer) simtypes.Operation { +func SimulateMsgBridge(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -1106,7 +1107,7 @@ func SimulateMsgBridge(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryC return op, nil, err } - issuersRes, err := qryClient.ClassIssuers(ctx, &core.QueryClassIssuersRequest{ + issuersRes, err := qryClient.ClassIssuers(ctx, &types.QueryClassIssuersRequest{ ClassId: class.Id, }) if err != nil { @@ -1125,7 +1126,7 @@ func SimulateMsgBridge(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryC return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgBridge, "not a simulation account"), nil, nil } - balanceRes, err := qryClient.Balance(ctx, &core.QueryBalanceRequest{ + balanceRes, err := qryClient.Balance(ctx, &types.QueryBalanceRequest{ Address: owner, BatchDenom: batch.Denom, }) @@ -1152,11 +1153,11 @@ func SimulateMsgBridge(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryC amount = simtypes.RandIntBetween(r, 1, int(tradable)) } - msg := &core.MsgBridge{ + msg := &types.MsgBridge{ Target: "polygon", Recipient: "0x323b5d4c32345ced77393b3530b1eed0f346429d", Owner: owner, - Credits: []*core.Credits{ + Credits: []*types.Credits{ { BatchDenom: batch.Denom, Amount: fmt.Sprintf("%d", amount), @@ -1217,8 +1218,8 @@ func SimulateMsgBridge(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, qryC } } -func getClassIssuers(ctx sdk.Context, qryClient core.QueryServer, className string, msgType string) ([]string, simtypes.OperationMsg, error) { - classIssuers, err := qryClient.ClassIssuers(sdk.WrapSDKContext(ctx), &core.QueryClassIssuersRequest{ClassId: className}) +func getClassIssuers(ctx sdk.Context, qryClient types.QueryServer, className string, msgType string) ([]string, simtypes.OperationMsg, error) { + classIssuers, err := qryClient.ClassIssuers(sdk.WrapSDKContext(ctx), &types.QueryClassIssuersRequest{ClassId: className}) if err != nil { if ormerrors.IsNotFound(err) { return []string{}, simtypes.NoOpMsg(ecocredit.ModuleName, msgType, "no credit classes"), nil @@ -1230,8 +1231,8 @@ func getClassIssuers(ctx sdk.Context, qryClient core.QueryServer, className stri return classIssuers.Issuers, simtypes.NoOpMsg(ecocredit.ModuleName, msgType, ""), nil } -func getRandomProjectFromClass(ctx context.Context, r *rand.Rand, qryClient core.QueryServer, msgType, classID string) (*core.ProjectInfo, simtypes.OperationMsg, error) { - res, err := qryClient.ProjectsByClass(ctx, &core.QueryProjectsByClassRequest{ +func getRandomProjectFromClass(ctx context.Context, r *rand.Rand, qryClient types.QueryServer, msgType, classID string) (*types.ProjectInfo, simtypes.OperationMsg, error) { + res, err := qryClient.ProjectsByClass(ctx, &types.QueryProjectsByClassRequest{ ClassId: classID, }) if err != nil { @@ -1246,8 +1247,8 @@ func getRandomProjectFromClass(ctx context.Context, r *rand.Rand, qryClient core return projects[r.Intn(len(projects))], simtypes.NoOpMsg(ecocredit.ModuleName, msgType, ""), nil } -func getRandomBatchFromProject(ctx context.Context, r *rand.Rand, qryClient core.QueryServer, msgType, projectID string) (*core.BatchInfo, simtypes.OperationMsg, error) { - res, err := qryClient.BatchesByProject(ctx, &core.QueryBatchesByProjectRequest{ +func getRandomBatchFromProject(ctx context.Context, r *rand.Rand, qryClient types.QueryServer, msgType, projectID string) (*types.BatchInfo, simtypes.OperationMsg, error) { + res, err := qryClient.BatchesByProject(ctx, &types.QueryBatchesByProjectRequest{ ProjectId: projectID, }) if err != nil { @@ -1282,9 +1283,9 @@ func randomIssuers(r *rand.Rand, accounts []simtypes.Account) []string { return issuers } -func generateBatchIssuance(r *rand.Rand, accs []simtypes.Account) []*core.BatchIssuance { +func generateBatchIssuance(r *rand.Rand, accs []simtypes.Account) []*types.BatchIssuance { numIssuances := simtypes.RandIntBetween(r, 3, 10) - res := make([]*core.BatchIssuance, numIssuances) + res := make([]*types.BatchIssuance, numIssuances) for i := 0; i < numIssuances; i++ { recipient := accs[i] @@ -1293,7 +1294,7 @@ func generateBatchIssuance(r *rand.Rand, accs []simtypes.Account) []*core.BatchI if retiredAmount > 0 { retirementJurisdiction = "AD" } - res[i] = &core.BatchIssuance{ + res[i] = &types.BatchIssuance{ Recipient: recipient.Address.String(), TradableAmount: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 10, 1000)), RetiredAmount: fmt.Sprintf("%d", retiredAmount), diff --git a/x/ecocredit/core/codec.go b/x/ecocredit/base/types/v1/codec.go similarity index 99% rename from x/ecocredit/core/codec.go rename to x/ecocredit/base/types/v1/codec.go index 3967ebecaa..34b1550f01 100644 --- a/x/ecocredit/core/codec.go +++ b/x/ecocredit/base/types/v1/codec.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/ecocredit/core/events.pb.go b/x/ecocredit/base/types/v1/events.pb.go similarity index 96% rename from x/ecocredit/core/events.pb.go rename to x/ecocredit/base/types/v1/events.pb.go index 0b172cf7be..66c5e0e85f 100644 --- a/x/ecocredit/core/events.pb.go +++ b/x/ecocredit/base/types/v1/events.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: regen/ecocredit/v1/events.proto -package core +package v1 import ( fmt "fmt" @@ -1021,46 +1021,46 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1/events.proto", fileDescriptor_e32415575ff8b4b2) } var fileDescriptor_e32415575ff8b4b2 = []byte{ - // 615 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcf, 0x4f, 0x14, 0x31, - 0x14, 0x66, 0xf8, 0xb1, 0x32, 0x0f, 0x41, 0xd3, 0x28, 0x22, 0xc1, 0x81, 0x4c, 0x62, 0xe4, 0xc2, - 0x6c, 0x00, 0x35, 0x18, 0x4f, 0xb0, 0x7a, 0xe0, 0x40, 0x24, 0xeb, 0x7a, 0xf1, 0xb2, 0xe9, 0xb4, - 0xcf, 0xa1, 0xb8, 0xdb, 0x4e, 0x3a, 0xdd, 0x05, 0x12, 0x0f, 0xfe, 0x09, 0xfe, 0x35, 0xfe, 0x0d, - 0x1e, 0x39, 0x7a, 0x34, 0xf0, 0x8f, 0x98, 0xe9, 0x74, 0x87, 0xdd, 0x85, 0x30, 0x1c, 0xf4, 0xd6, - 0xf7, 0xe5, 0x7d, 0xf3, 0x7d, 0xed, 0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xac, 0x20, 0x6f, 0xc2, 0x82, 0x25, 0x7f, 0x44, 0xda, 0xb9, 0xdb, 0x53, - 0x11, 0xee, 0xb8, 0x47, 0x69, 0x97, 0xf3, 0x22, 0x6b, 0xad, 0xb3, 0x14, 0xf3, 0xd1, 0xd3, 0x38, - 0xd6, 0xd8, 0x17, 0xd4, 0x8e, 0xbe, 0xe0, 0x8d, 0x60, 0xe1, 0x89, 0x1b, 0xfd, 0x9e, 0x16, 0x3c, - 0xc1, 0x7c, 0x56, 0x86, 0xea, 0x04, 0xcd, 0x20, 0x33, 0x45, 0x55, 0x91, 0x99, 0x65, 0x98, 0x65, - 0x4a, 0x1a, 0x4d, 0xd9, 0x60, 0xf6, 0x65, 0x3d, 0x74, 0x2b, 0xa6, 0x87, 0x6f, 0x45, 0xd8, 0x72, - 0x96, 0x0b, 0xe1, 0x26, 0x32, 0x14, 0x7d, 0xac, 0x38, 0x9a, 0xca, 0x3b, 0xb8, 0x77, 0xf8, 0xeb, - 0x22, 0xf0, 0xce, 0x2f, 0x02, 0xef, 0xcf, 0x45, 0xe0, 0xfd, 0xb8, 0x0c, 0x26, 0xce, 0x2f, 0x83, - 0x89, 0xdf, 0x97, 0xc1, 0xc4, 0xe7, 0xd7, 0x89, 0x30, 0x47, 0xbd, 0x38, 0x62, 0xaa, 0x5b, 0xb7, - 0x2f, 0xca, 0x86, 0x44, 0x73, 0xa2, 0xf4, 0x57, 0x57, 0x75, 0x90, 0x27, 0xa8, 0xeb, 0xa7, 0x43, - 0x3f, 0x0a, 0xa6, 0x34, 0xc6, 0x35, 0xfb, 0x97, 0xd8, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xf6, - 0xea, 0xa1, 0x44, 0x7c, 0x06, 0x00, 0x00, + // 622 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcf, 0x4f, 0x13, 0x41, + 0x14, 0x66, 0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xfa, 0x7d, 0x19, 0x4e, 0x7d, 0x7e, 0xdd, 0x16, 0xf6, 0xa8, 0x1f, 0x57, 0x98, 0xea, + 0x56, 0xdd, 0x1f, 0x65, 0x4b, 0xa2, 0x3d, 0x51, 0xfa, 0xab, 0xaf, 0x3a, 0xc8, 0xdb, 0xa8, 0xab, + 0xa7, 0x43, 0x0f, 0x45, 0x4c, 0x0d, 0x66, 0x4f, 0x45, 0x35, 0xa9, 0xc5, 0x25, 0xf7, 0x5c, 0xec, + 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xb0, 0x7f, 0x2c, 0x85, 0x06, 0x00, 0x00, } func (m *EventCreateClass) Marshal() (dAtA []byte, err error) { diff --git a/x/ecocredit/core/features/msg_add_class_creator.feature b/x/ecocredit/base/types/v1/features/msg_add_class_creator.feature similarity index 100% rename from x/ecocredit/core/features/msg_add_class_creator.feature rename to x/ecocredit/base/types/v1/features/msg_add_class_creator.feature diff --git a/x/ecocredit/core/features/msg_add_credit_type.feature b/x/ecocredit/base/types/v1/features/msg_add_credit_type.feature similarity index 100% rename from x/ecocredit/core/features/msg_add_credit_type.feature rename to x/ecocredit/base/types/v1/features/msg_add_credit_type.feature diff --git a/x/ecocredit/core/features/msg_bridge.feature b/x/ecocredit/base/types/v1/features/msg_bridge.feature similarity index 100% rename from x/ecocredit/core/features/msg_bridge.feature rename to x/ecocredit/base/types/v1/features/msg_bridge.feature diff --git a/x/ecocredit/core/features/msg_bridge_receive.feature b/x/ecocredit/base/types/v1/features/msg_bridge_receive.feature similarity index 100% rename from x/ecocredit/core/features/msg_bridge_receive.feature rename to x/ecocredit/base/types/v1/features/msg_bridge_receive.feature diff --git a/x/ecocredit/core/features/msg_cancel.feature b/x/ecocredit/base/types/v1/features/msg_cancel.feature similarity index 100% rename from x/ecocredit/core/features/msg_cancel.feature rename to x/ecocredit/base/types/v1/features/msg_cancel.feature diff --git a/x/ecocredit/core/features/msg_create_batch.feature b/x/ecocredit/base/types/v1/features/msg_create_batch.feature similarity index 100% rename from x/ecocredit/core/features/msg_create_batch.feature rename to x/ecocredit/base/types/v1/features/msg_create_batch.feature diff --git a/x/ecocredit/core/features/msg_create_class.feature b/x/ecocredit/base/types/v1/features/msg_create_class.feature similarity index 100% rename from x/ecocredit/core/features/msg_create_class.feature rename to x/ecocredit/base/types/v1/features/msg_create_class.feature diff --git a/x/ecocredit/core/features/msg_create_project.feature b/x/ecocredit/base/types/v1/features/msg_create_project.feature similarity index 100% rename from x/ecocredit/core/features/msg_create_project.feature rename to x/ecocredit/base/types/v1/features/msg_create_project.feature diff --git a/x/ecocredit/core/features/msg_mint_batch_credits.feature b/x/ecocredit/base/types/v1/features/msg_mint_batch_credits.feature similarity index 100% rename from x/ecocredit/core/features/msg_mint_batch_credits.feature rename to x/ecocredit/base/types/v1/features/msg_mint_batch_credits.feature diff --git a/x/ecocredit/core/features/msg_remove_class_creator.feature b/x/ecocredit/base/types/v1/features/msg_remove_class_creator.feature similarity index 100% rename from x/ecocredit/core/features/msg_remove_class_creator.feature rename to x/ecocredit/base/types/v1/features/msg_remove_class_creator.feature diff --git a/x/ecocredit/core/features/msg_retire.feature b/x/ecocredit/base/types/v1/features/msg_retire.feature similarity index 100% rename from x/ecocredit/core/features/msg_retire.feature rename to x/ecocredit/base/types/v1/features/msg_retire.feature diff --git a/x/ecocredit/core/features/msg_seal_batch.feature b/x/ecocredit/base/types/v1/features/msg_seal_batch.feature similarity index 100% rename from x/ecocredit/core/features/msg_seal_batch.feature rename to x/ecocredit/base/types/v1/features/msg_seal_batch.feature diff --git a/x/ecocredit/core/features/msg_send.feature b/x/ecocredit/base/types/v1/features/msg_send.feature similarity index 100% rename from x/ecocredit/core/features/msg_send.feature rename to x/ecocredit/base/types/v1/features/msg_send.feature diff --git a/x/ecocredit/core/features/msg_toggle_class_allowlist.feature b/x/ecocredit/base/types/v1/features/msg_toggle_class_allowlist.feature similarity index 100% rename from x/ecocredit/core/features/msg_toggle_class_allowlist.feature rename to x/ecocredit/base/types/v1/features/msg_toggle_class_allowlist.feature diff --git a/x/ecocredit/core/features/msg_update_class_admin.feature b/x/ecocredit/base/types/v1/features/msg_update_class_admin.feature similarity index 100% rename from x/ecocredit/core/features/msg_update_class_admin.feature rename to x/ecocredit/base/types/v1/features/msg_update_class_admin.feature diff --git a/x/ecocredit/core/features/msg_update_class_fees.feature b/x/ecocredit/base/types/v1/features/msg_update_class_fees.feature similarity index 100% rename from x/ecocredit/core/features/msg_update_class_fees.feature rename to x/ecocredit/base/types/v1/features/msg_update_class_fees.feature diff --git a/x/ecocredit/core/features/msg_update_class_issuers.feature b/x/ecocredit/base/types/v1/features/msg_update_class_issuers.feature similarity index 100% rename from x/ecocredit/core/features/msg_update_class_issuers.feature rename to x/ecocredit/base/types/v1/features/msg_update_class_issuers.feature diff --git a/x/ecocredit/core/features/msg_update_class_metadata.feature b/x/ecocredit/base/types/v1/features/msg_update_class_metadata.feature similarity index 100% rename from x/ecocredit/core/features/msg_update_class_metadata.feature rename to x/ecocredit/base/types/v1/features/msg_update_class_metadata.feature diff --git a/x/ecocredit/core/features/msg_update_project_admin.feature b/x/ecocredit/base/types/v1/features/msg_update_project_admin.feature similarity index 100% rename from x/ecocredit/core/features/msg_update_project_admin.feature rename to x/ecocredit/base/types/v1/features/msg_update_project_admin.feature diff --git a/x/ecocredit/core/features/msg_update_project_metadata.feature b/x/ecocredit/base/types/v1/features/msg_update_project_metadata.feature similarity index 100% rename from x/ecocredit/core/features/msg_update_project_metadata.feature rename to x/ecocredit/base/types/v1/features/msg_update_project_metadata.feature diff --git a/x/ecocredit/core/features/state_batch.feature b/x/ecocredit/base/types/v1/features/state_batch.feature similarity index 100% rename from x/ecocredit/core/features/state_batch.feature rename to x/ecocredit/base/types/v1/features/state_batch.feature diff --git a/x/ecocredit/core/features/state_batch_balance.feature b/x/ecocredit/base/types/v1/features/state_batch_balance.feature similarity index 100% rename from x/ecocredit/core/features/state_batch_balance.feature rename to x/ecocredit/base/types/v1/features/state_batch_balance.feature diff --git a/x/ecocredit/core/features/state_batch_contract.feature b/x/ecocredit/base/types/v1/features/state_batch_contract.feature similarity index 100% rename from x/ecocredit/core/features/state_batch_contract.feature rename to x/ecocredit/base/types/v1/features/state_batch_contract.feature diff --git a/x/ecocredit/core/features/state_batch_sequence.feature b/x/ecocredit/base/types/v1/features/state_batch_sequence.feature similarity index 100% rename from x/ecocredit/core/features/state_batch_sequence.feature rename to x/ecocredit/base/types/v1/features/state_batch_sequence.feature diff --git a/x/ecocredit/core/features/state_batch_supply.feature b/x/ecocredit/base/types/v1/features/state_batch_supply.feature similarity index 100% rename from x/ecocredit/core/features/state_batch_supply.feature rename to x/ecocredit/base/types/v1/features/state_batch_supply.feature diff --git a/x/ecocredit/core/features/state_class.feature b/x/ecocredit/base/types/v1/features/state_class.feature similarity index 100% rename from x/ecocredit/core/features/state_class.feature rename to x/ecocredit/base/types/v1/features/state_class.feature diff --git a/x/ecocredit/core/features/state_class_issuer.feature b/x/ecocredit/base/types/v1/features/state_class_issuer.feature similarity index 100% rename from x/ecocredit/core/features/state_class_issuer.feature rename to x/ecocredit/base/types/v1/features/state_class_issuer.feature diff --git a/x/ecocredit/core/features/state_class_sequence.feature b/x/ecocredit/base/types/v1/features/state_class_sequence.feature similarity index 100% rename from x/ecocredit/core/features/state_class_sequence.feature rename to x/ecocredit/base/types/v1/features/state_class_sequence.feature diff --git a/x/ecocredit/core/features/state_credit_type.feature b/x/ecocredit/base/types/v1/features/state_credit_type.feature similarity index 100% rename from x/ecocredit/core/features/state_credit_type.feature rename to x/ecocredit/base/types/v1/features/state_credit_type.feature diff --git a/x/ecocredit/core/features/state_origin_tx_index.feature b/x/ecocredit/base/types/v1/features/state_origin_tx_index.feature similarity index 100% rename from x/ecocredit/core/features/state_origin_tx_index.feature rename to x/ecocredit/base/types/v1/features/state_origin_tx_index.feature diff --git a/x/ecocredit/core/features/state_project.feature b/x/ecocredit/base/types/v1/features/state_project.feature similarity index 100% rename from x/ecocredit/core/features/state_project.feature rename to x/ecocredit/base/types/v1/features/state_project.feature diff --git a/x/ecocredit/core/features/state_project_sequence.feature b/x/ecocredit/base/types/v1/features/state_project_sequence.feature similarity index 100% rename from x/ecocredit/core/features/state_project_sequence.feature rename to x/ecocredit/base/types/v1/features/state_project_sequence.feature diff --git a/x/ecocredit/core/features/types_batch_issuance.feature b/x/ecocredit/base/types/v1/features/types_batch_issuance.feature similarity index 100% rename from x/ecocredit/core/features/types_batch_issuance.feature rename to x/ecocredit/base/types/v1/features/types_batch_issuance.feature diff --git a/x/ecocredit/core/features/types_credits.feature b/x/ecocredit/base/types/v1/features/types_credits.feature similarity index 100% rename from x/ecocredit/core/features/types_credits.feature rename to x/ecocredit/base/types/v1/features/types_credits.feature diff --git a/x/ecocredit/core/msg_add_class_creator.go b/x/ecocredit/base/types/v1/msg_add_class_creator.go similarity index 98% rename from x/ecocredit/core/msg_add_class_creator.go rename to x/ecocredit/base/types/v1/msg_add_class_creator.go index 59ecc3f7a2..e4b280f905 100644 --- a/x/ecocredit/core/msg_add_class_creator.go +++ b/x/ecocredit/base/types/v1/msg_add_class_creator.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" diff --git a/x/ecocredit/core/msg_add_class_creator_test.go b/x/ecocredit/base/types/v1/msg_add_class_creator_test.go similarity index 98% rename from x/ecocredit/core/msg_add_class_creator_test.go rename to x/ecocredit/base/types/v1/msg_add_class_creator_test.go index c2bbccb7be..6809d81883 100644 --- a/x/ecocredit/core/msg_add_class_creator_test.go +++ b/x/ecocredit/base/types/v1/msg_add_class_creator_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_add_credit_type.go b/x/ecocredit/base/types/v1/msg_add_credit_type.go similarity index 99% rename from x/ecocredit/core/msg_add_credit_type.go rename to x/ecocredit/base/types/v1/msg_add_credit_type.go index 9ad9559be3..7f4d44543f 100644 --- a/x/ecocredit/core/msg_add_credit_type.go +++ b/x/ecocredit/base/types/v1/msg_add_credit_type.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" diff --git a/x/ecocredit/core/msg_add_credit_type_test.go b/x/ecocredit/base/types/v1/msg_add_credit_type_test.go similarity index 98% rename from x/ecocredit/core/msg_add_credit_type_test.go rename to x/ecocredit/base/types/v1/msg_add_credit_type_test.go index 740acd98c9..38ad725208 100644 --- a/x/ecocredit/core/msg_add_credit_type_test.go +++ b/x/ecocredit/base/types/v1/msg_add_credit_type_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_bridge.go b/x/ecocredit/base/types/v1/msg_bridge.go similarity index 91% rename from x/ecocredit/core/msg_bridge.go rename to x/ecocredit/base/types/v1/msg_bridge.go index 2a32de2b6c..03218740c6 100644 --- a/x/ecocredit/core/msg_bridge.go +++ b/x/ecocredit/base/types/v1/msg_bridge.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "fmt" @@ -12,6 +12,7 @@ import ( "github.com/regen-network/regen-ledger/types/eth" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgBridge{} @@ -37,8 +38,8 @@ func (m *MsgBridge) ValidateBasic() error { return sdkerrors.ErrInvalidRequest.Wrap("target cannot be empty") } - if m.Target != BridgePolygon { - return sdkerrors.ErrInvalidRequest.Wrapf("target must be %s", BridgePolygon) + if m.Target != base.BridgePolygon { + return sdkerrors.ErrInvalidRequest.Wrapf("target must be %s", base.BridgePolygon) } if m.Recipient == "" { @@ -56,7 +57,7 @@ func (m *MsgBridge) ValidateBasic() error { for i, credit := range m.Credits { creditIndex := fmt.Sprintf("credits[%d]", i) - if err := ValidateBatchDenom(credit.BatchDenom); err != nil { + if err := base.ValidateBatchDenom(credit.BatchDenom); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("%s: batch denom: %s", creditIndex, err) } diff --git a/x/ecocredit/core/msg_bridge_receive.go b/x/ecocredit/base/types/v1/msg_bridge_receive.go similarity index 89% rename from x/ecocredit/core/msg_bridge_receive.go rename to x/ecocredit/base/types/v1/msg_bridge_receive.go index 0ccbf04320..2918f06f82 100644 --- a/x/ecocredit/core/msg_bridge_receive.go +++ b/x/ecocredit/base/types/v1/msg_bridge_receive.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" @@ -10,6 +10,7 @@ import ( "github.com/regen-network/regen-ledger/types/eth" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgBridgeReceive{} @@ -31,7 +32,7 @@ func (m *MsgBridgeReceive) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("issuer: %s", err) } - if err := ValidateClassID(m.ClassId); err != nil { + if err := base.ValidateClassID(m.ClassId); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("class id: %s", err) } @@ -49,7 +50,7 @@ func (m *MsgBridgeReceive) ValidateBasic() error { return ecocredit.ErrMaxLimit.Wrapf("project reference id: max length %d", MaxReferenceIDLength) } - if err := ValidateJurisdiction(m.Project.Jurisdiction); err != nil { + if err := base.ValidateJurisdiction(m.Project.Jurisdiction); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("project jurisdiction: %s", err) } @@ -57,8 +58,8 @@ func (m *MsgBridgeReceive) ValidateBasic() error { return sdkerrors.ErrInvalidRequest.Wrap("project metadata cannot be empty") } - if len(m.Project.Metadata) > MaxMetadataLength { - return ecocredit.ErrMaxLimit.Wrapf("project metadata: max length %d", MaxMetadataLength) + if len(m.Project.Metadata) > base.MaxMetadataLength { + return ecocredit.ErrMaxLimit.Wrapf("project metadata: max length %d", base.MaxMetadataLength) } // batch validation @@ -95,8 +96,8 @@ func (m *MsgBridgeReceive) ValidateBasic() error { return sdkerrors.ErrInvalidRequest.Wrap("batch metadata cannot be empty") } - if len(m.Batch.Metadata) > MaxMetadataLength { - return ecocredit.ErrMaxLimit.Wrapf("batch metadata: max length %d", MaxMetadataLength) + if len(m.Batch.Metadata) > base.MaxMetadataLength { + return ecocredit.ErrMaxLimit.Wrapf("batch metadata: max length %d", base.MaxMetadataLength) } // origin tx validation @@ -111,7 +112,7 @@ func (m *MsgBridgeReceive) ValidateBasic() error { } // specific to MsgBridgeReceive - if m.OriginTx.Source != BridgePolygon { + if m.OriginTx.Source != base.BridgePolygon { return sdkerrors.ErrInvalidRequest.Wrap("origin tx source must be polygon") } diff --git a/x/ecocredit/core/msg_bridge_receive_test.go b/x/ecocredit/base/types/v1/msg_bridge_receive_test.go similarity index 99% rename from x/ecocredit/core/msg_bridge_receive_test.go rename to x/ecocredit/base/types/v1/msg_bridge_receive_test.go index d46887c14f..4d8b05227a 100644 --- a/x/ecocredit/core/msg_bridge_receive_test.go +++ b/x/ecocredit/base/types/v1/msg_bridge_receive_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/msg_bridge_test.go b/x/ecocredit/base/types/v1/msg_bridge_test.go similarity index 98% rename from x/ecocredit/core/msg_bridge_test.go rename to x/ecocredit/base/types/v1/msg_bridge_test.go index 16ecda915c..54691c7b51 100644 --- a/x/ecocredit/core/msg_bridge_test.go +++ b/x/ecocredit/base/types/v1/msg_bridge_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_cancel.go b/x/ecocredit/base/types/v1/msg_cancel.go similarity index 88% rename from x/ecocredit/core/msg_cancel.go rename to x/ecocredit/base/types/v1/msg_cancel.go index 5619539536..0d5f8f7e0e 100644 --- a/x/ecocredit/core/msg_cancel.go +++ b/x/ecocredit/base/types/v1/msg_cancel.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgCancel{} @@ -43,8 +44,8 @@ func (m *MsgCancel) ValidateBasic() error { return sdkerrors.ErrInvalidRequest.Wrap("reason cannot be empty") } - if len(m.Reason) > MaxNoteLength { - return ecocredit.ErrMaxLimit.Wrapf("reason: max length %d", MaxNoteLength) + if len(m.Reason) > base.MaxNoteLength { + return ecocredit.ErrMaxLimit.Wrapf("reason: max length %d", base.MaxNoteLength) } return nil diff --git a/x/ecocredit/core/msg_cancel_test.go b/x/ecocredit/base/types/v1/msg_cancel_test.go similarity index 98% rename from x/ecocredit/core/msg_cancel_test.go rename to x/ecocredit/base/types/v1/msg_cancel_test.go index 5badc794da..22d23c0acb 100644 --- a/x/ecocredit/core/msg_cancel_test.go +++ b/x/ecocredit/base/types/v1/msg_cancel_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/msg_create_batch.go b/x/ecocredit/base/types/v1/msg_create_batch.go similarity index 90% rename from x/ecocredit/core/msg_create_batch.go rename to x/ecocredit/base/types/v1/msg_create_batch.go index ffaec2c4e9..66a818327d 100644 --- a/x/ecocredit/core/msg_create_batch.go +++ b/x/ecocredit/base/types/v1/msg_create_batch.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgCreateBatch{} @@ -29,7 +30,7 @@ func (m *MsgCreateBatch) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("issuer: %s", err) } - if err := ValidateProjectID(m.ProjectId); err != nil { + if err := base.ValidateProjectID(m.ProjectId); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("project id: %s", err) } @@ -43,8 +44,8 @@ func (m *MsgCreateBatch) ValidateBasic() error { } } - if len(m.Metadata) > MaxMetadataLength { - return ecocredit.ErrMaxLimit.Wrapf("metadata: max length %d", MaxMetadataLength) + if len(m.Metadata) > base.MaxMetadataLength { + return ecocredit.ErrMaxLimit.Wrapf("metadata: max length %d", base.MaxMetadataLength) } if m.StartDate == nil { diff --git a/x/ecocredit/core/msg_create_batch_test.go b/x/ecocredit/base/types/v1/msg_create_batch_test.go similarity index 98% rename from x/ecocredit/core/msg_create_batch_test.go rename to x/ecocredit/base/types/v1/msg_create_batch_test.go index ded3195e18..33c947c844 100644 --- a/x/ecocredit/core/msg_create_batch_test.go +++ b/x/ecocredit/base/types/v1/msg_create_batch_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/msg_create_class.go b/x/ecocredit/base/types/v1/msg_create_class.go similarity index 91% rename from x/ecocredit/core/msg_create_class.go rename to x/ecocredit/base/types/v1/msg_create_class.go index 6cc90d146a..40c16e00fd 100644 --- a/x/ecocredit/core/msg_create_class.go +++ b/x/ecocredit/base/types/v1/msg_create_class.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "fmt" @@ -6,8 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" - "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgCreateClass{} @@ -48,11 +48,11 @@ func (m *MsgCreateClass) ValidateBasic() error { duplicateMap[issuer] = true } - if len(m.Metadata) > MaxMetadataLength { - return ecocredit.ErrMaxLimit.Wrapf("metadata: max length %d", MaxMetadataLength) + if len(m.Metadata) > base.MaxMetadataLength { + return ecocredit.ErrMaxLimit.Wrapf("metadata: max length %d", base.MaxMetadataLength) } - if err := ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { + if err := base.ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("credit type abbrev: %s", err) } diff --git a/x/ecocredit/core/msg_create_class_test.go b/x/ecocredit/base/types/v1/msg_create_class_test.go similarity index 98% rename from x/ecocredit/core/msg_create_class_test.go rename to x/ecocredit/base/types/v1/msg_create_class_test.go index d5c7772792..c80e2a6441 100644 --- a/x/ecocredit/core/msg_create_class_test.go +++ b/x/ecocredit/base/types/v1/msg_create_class_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/msg_create_project.go b/x/ecocredit/base/types/v1/msg_create_project.go similarity index 85% rename from x/ecocredit/core/msg_create_project.go rename to x/ecocredit/base/types/v1/msg_create_project.go index 6c3451eb52..2aa3d46db2 100644 --- a/x/ecocredit/core/msg_create_project.go +++ b/x/ecocredit/base/types/v1/msg_create_project.go @@ -1,4 +1,4 @@ -package core +package v1 import ( sdk "github.com/cosmos/cosmos-sdk/types" @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) const MaxReferenceIDLength = 32 @@ -29,15 +30,15 @@ func (m *MsgCreateProject) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("admin: %s", err) } - if err := ValidateClassID(m.ClassId); err != nil { + if err := base.ValidateClassID(m.ClassId); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("class id: %s", err) } - if len(m.Metadata) > MaxMetadataLength { - return ecocredit.ErrMaxLimit.Wrapf("metadata: max length %d", MaxMetadataLength) + if len(m.Metadata) > base.MaxMetadataLength { + return ecocredit.ErrMaxLimit.Wrapf("metadata: max length %d", base.MaxMetadataLength) } - if err := ValidateJurisdiction(m.Jurisdiction); err != nil { + if err := base.ValidateJurisdiction(m.Jurisdiction); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("jurisdiction: %s", err) } diff --git a/x/ecocredit/core/msg_create_project_test.go b/x/ecocredit/base/types/v1/msg_create_project_test.go similarity index 98% rename from x/ecocredit/core/msg_create_project_test.go rename to x/ecocredit/base/types/v1/msg_create_project_test.go index b9c5b83056..7090a78dee 100644 --- a/x/ecocredit/core/msg_create_project_test.go +++ b/x/ecocredit/base/types/v1/msg_create_project_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/msg_credit_type_proposal.go b/x/ecocredit/base/types/v1/msg_credit_type_proposal.go similarity index 98% rename from x/ecocredit/core/msg_credit_type_proposal.go rename to x/ecocredit/base/types/v1/msg_credit_type_proposal.go index 88da60b0d8..69db6655ca 100644 --- a/x/ecocredit/core/msg_credit_type_proposal.go +++ b/x/ecocredit/base/types/v1/msg_credit_type_proposal.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "fmt" diff --git a/x/ecocredit/core/msg_credit_type_proposal_test.go b/x/ecocredit/base/types/v1/msg_credit_type_proposal_test.go similarity index 98% rename from x/ecocredit/core/msg_credit_type_proposal_test.go rename to x/ecocredit/base/types/v1/msg_credit_type_proposal_test.go index 9c3299e84d..ca43151034 100644 --- a/x/ecocredit/core/msg_credit_type_proposal_test.go +++ b/x/ecocredit/base/types/v1/msg_credit_type_proposal_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_mint_batch_credits.go b/x/ecocredit/base/types/v1/msg_mint_batch_credits.go similarity index 92% rename from x/ecocredit/core/msg_mint_batch_credits.go rename to x/ecocredit/base/types/v1/msg_mint_batch_credits.go index 0af73bd85f..c72f94bab1 100644 --- a/x/ecocredit/core/msg_mint_batch_credits.go +++ b/x/ecocredit/base/types/v1/msg_mint_batch_credits.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgMintBatchCredits{} @@ -29,7 +30,7 @@ func (m *MsgMintBatchCredits) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("issuer: %s", err) } - if err := ValidateBatchDenom(m.BatchDenom); err != nil { + if err := base.ValidateBatchDenom(m.BatchDenom); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("batch denom: %s", err) } diff --git a/x/ecocredit/core/msg_mint_batch_credits_test.go b/x/ecocredit/base/types/v1/msg_mint_batch_credits_test.go similarity index 98% rename from x/ecocredit/core/msg_mint_batch_credits_test.go rename to x/ecocredit/base/types/v1/msg_mint_batch_credits_test.go index 334147b4ba..db7b4d6076 100644 --- a/x/ecocredit/core/msg_mint_batch_credits_test.go +++ b/x/ecocredit/base/types/v1/msg_mint_batch_credits_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_remove_class_creator.go b/x/ecocredit/base/types/v1/msg_remove_class_creator.go similarity index 98% rename from x/ecocredit/core/msg_remove_class_creator.go rename to x/ecocredit/base/types/v1/msg_remove_class_creator.go index 093293aac2..af05132462 100644 --- a/x/ecocredit/core/msg_remove_class_creator.go +++ b/x/ecocredit/base/types/v1/msg_remove_class_creator.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" diff --git a/x/ecocredit/core/msg_remove_class_creator_test.go b/x/ecocredit/base/types/v1/msg_remove_class_creator_test.go similarity index 98% rename from x/ecocredit/core/msg_remove_class_creator_test.go rename to x/ecocredit/base/types/v1/msg_remove_class_creator_test.go index cbe571d444..0c90b42653 100644 --- a/x/ecocredit/core/msg_remove_class_creator_test.go +++ b/x/ecocredit/base/types/v1/msg_remove_class_creator_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_retire.go b/x/ecocredit/base/types/v1/msg_retire.go similarity index 91% rename from x/ecocredit/core/msg_retire.go rename to x/ecocredit/base/types/v1/msg_retire.go index 7457be7780..441a58eec2 100644 --- a/x/ecocredit/core/msg_retire.go +++ b/x/ecocredit/base/types/v1/msg_retire.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgRetire{} @@ -39,7 +40,7 @@ func (m *MsgRetire) ValidateBasic() error { } } - if err := ValidateJurisdiction(m.Jurisdiction); err != nil { + if err := base.ValidateJurisdiction(m.Jurisdiction); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("jurisdiction: %s", err) } diff --git a/x/ecocredit/core/msg_retire_test.go b/x/ecocredit/base/types/v1/msg_retire_test.go similarity index 98% rename from x/ecocredit/core/msg_retire_test.go rename to x/ecocredit/base/types/v1/msg_retire_test.go index 8114cc2603..9b5a0eb06c 100644 --- a/x/ecocredit/core/msg_retire_test.go +++ b/x/ecocredit/base/types/v1/msg_retire_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_seal_batch.go b/x/ecocredit/base/types/v1/msg_seal_batch.go similarity index 89% rename from x/ecocredit/core/msg_seal_batch.go rename to x/ecocredit/base/types/v1/msg_seal_batch.go index 63e7bc7aac..449904c79e 100644 --- a/x/ecocredit/core/msg_seal_batch.go +++ b/x/ecocredit/base/types/v1/msg_seal_batch.go @@ -1,11 +1,12 @@ -package core +package v1 import ( sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgSealBatch{} @@ -27,7 +28,7 @@ func (m *MsgSealBatch) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("issuer: %s", err) } - if err := ValidateBatchDenom(m.BatchDenom); err != nil { + if err := base.ValidateBatchDenom(m.BatchDenom); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("batch denom: %s", err) } diff --git a/x/ecocredit/core/msg_seal_batch_test.go b/x/ecocredit/base/types/v1/msg_seal_batch_test.go similarity index 98% rename from x/ecocredit/core/msg_seal_batch_test.go rename to x/ecocredit/base/types/v1/msg_seal_batch_test.go index fe4458177f..29385124aa 100644 --- a/x/ecocredit/core/msg_seal_batch_test.go +++ b/x/ecocredit/base/types/v1/msg_seal_batch_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_send.go b/x/ecocredit/base/types/v1/msg_send.go similarity index 90% rename from x/ecocredit/core/msg_send.go rename to x/ecocredit/base/types/v1/msg_send.go index 7213edb333..b56035c4bb 100644 --- a/x/ecocredit/core/msg_send.go +++ b/x/ecocredit/base/types/v1/msg_send.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "fmt" @@ -9,6 +9,7 @@ import ( "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgSend{} @@ -41,7 +42,7 @@ func (m *MsgSend) ValidateBasic() error { for i, credits := range m.Credits { creditIndex := fmt.Sprintf("credits[%d]", i) - if err := ValidateBatchDenom(credits.BatchDenom); err != nil { + if err := base.ValidateBatchDenom(credits.BatchDenom); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("%s: batch denom: %s", creditIndex, err) } @@ -59,7 +60,7 @@ func (m *MsgSend) ValidateBasic() error { } if !retiredAmount.IsZero() { - if err = ValidateJurisdiction(credits.RetirementJurisdiction); err != nil { + if err = base.ValidateJurisdiction(credits.RetirementJurisdiction); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("retirement jurisdiction: %s", err) } } diff --git a/x/ecocredit/core/msg_send_test.go b/x/ecocredit/base/types/v1/msg_send_test.go similarity index 98% rename from x/ecocredit/core/msg_send_test.go rename to x/ecocredit/base/types/v1/msg_send_test.go index 066ae11e08..03d0bde472 100644 --- a/x/ecocredit/core/msg_send_test.go +++ b/x/ecocredit/base/types/v1/msg_send_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_toggle_class_allowlist.go b/x/ecocredit/base/types/v1/msg_toggle_class_allowlist.go similarity index 98% rename from x/ecocredit/core/msg_toggle_class_allowlist.go rename to x/ecocredit/base/types/v1/msg_toggle_class_allowlist.go index b0ce7019d6..21c80612d8 100644 --- a/x/ecocredit/core/msg_toggle_class_allowlist.go +++ b/x/ecocredit/base/types/v1/msg_toggle_class_allowlist.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" diff --git a/x/ecocredit/core/msg_toggle_class_allowlist_test.go b/x/ecocredit/base/types/v1/msg_toggle_class_allowlist_test.go similarity index 98% rename from x/ecocredit/core/msg_toggle_class_allowlist_test.go rename to x/ecocredit/base/types/v1/msg_toggle_class_allowlist_test.go index fddaa18084..dd2960179c 100644 --- a/x/ecocredit/core/msg_toggle_class_allowlist_test.go +++ b/x/ecocredit/base/types/v1/msg_toggle_class_allowlist_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_update_class_admin.go b/x/ecocredit/base/types/v1/msg_update_class_admin.go similarity index 90% rename from x/ecocredit/core/msg_update_class_admin.go rename to x/ecocredit/base/types/v1/msg_update_class_admin.go index 321e89f44e..e3dc41e994 100644 --- a/x/ecocredit/core/msg_update_class_admin.go +++ b/x/ecocredit/base/types/v1/msg_update_class_admin.go @@ -1,4 +1,4 @@ -package core +package v1 import ( sdk "github.com/cosmos/cosmos-sdk/types" @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgUpdateClassAdmin{} @@ -23,7 +24,7 @@ func (m *MsgUpdateClassAdmin) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("admin: %s", err) } - if err := ValidateClassID(m.ClassId); err != nil { + if err := base.ValidateClassID(m.ClassId); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("class id: %s", err) } diff --git a/x/ecocredit/core/msg_update_class_admin_test.go b/x/ecocredit/base/types/v1/msg_update_class_admin_test.go similarity index 98% rename from x/ecocredit/core/msg_update_class_admin_test.go rename to x/ecocredit/base/types/v1/msg_update_class_admin_test.go index 208799042f..29255f8540 100644 --- a/x/ecocredit/core/msg_update_class_admin_test.go +++ b/x/ecocredit/base/types/v1/msg_update_class_admin_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_update_class_fees.go b/x/ecocredit/base/types/v1/msg_update_class_fees.go similarity index 98% rename from x/ecocredit/core/msg_update_class_fees.go rename to x/ecocredit/base/types/v1/msg_update_class_fees.go index e079a1804c..1c84cdbe4d 100644 --- a/x/ecocredit/core/msg_update_class_fees.go +++ b/x/ecocredit/base/types/v1/msg_update_class_fees.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" diff --git a/x/ecocredit/core/msg_update_class_fees_test.go b/x/ecocredit/base/types/v1/msg_update_class_fees_test.go similarity index 98% rename from x/ecocredit/core/msg_update_class_fees_test.go rename to x/ecocredit/base/types/v1/msg_update_class_fees_test.go index b0f3e72320..c857824c5f 100644 --- a/x/ecocredit/core/msg_update_class_fees_test.go +++ b/x/ecocredit/base/types/v1/msg_update_class_fees_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_update_class_issuers.go b/x/ecocredit/base/types/v1/msg_update_class_issuers.go similarity index 94% rename from x/ecocredit/core/msg_update_class_issuers.go rename to x/ecocredit/base/types/v1/msg_update_class_issuers.go index 880e2849e2..512c698c38 100644 --- a/x/ecocredit/core/msg_update_class_issuers.go +++ b/x/ecocredit/base/types/v1/msg_update_class_issuers.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "fmt" @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgUpdateClassIssuers{} @@ -25,7 +26,7 @@ func (m *MsgUpdateClassIssuers) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("admin: %s", err) } - if err := ValidateClassID(m.ClassId); err != nil { + if err := base.ValidateClassID(m.ClassId); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("class id: %s", err) } diff --git a/x/ecocredit/core/msg_update_class_issuers_test.go b/x/ecocredit/base/types/v1/msg_update_class_issuers_test.go similarity index 98% rename from x/ecocredit/core/msg_update_class_issuers_test.go rename to x/ecocredit/base/types/v1/msg_update_class_issuers_test.go index d51bb86b91..d082b240b4 100644 --- a/x/ecocredit/core/msg_update_class_issuers_test.go +++ b/x/ecocredit/base/types/v1/msg_update_class_issuers_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_update_class_metadata.go b/x/ecocredit/base/types/v1/msg_update_class_metadata.go similarity index 83% rename from x/ecocredit/core/msg_update_class_metadata.go rename to x/ecocredit/base/types/v1/msg_update_class_metadata.go index 5124b1546d..4e4f45b3ae 100644 --- a/x/ecocredit/core/msg_update_class_metadata.go +++ b/x/ecocredit/base/types/v1/msg_update_class_metadata.go @@ -1,4 +1,4 @@ -package core +package v1 import ( sdk "github.com/cosmos/cosmos-sdk/types" @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgUpdateClassMetadata{} @@ -23,12 +24,12 @@ func (m *MsgUpdateClassMetadata) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("admin: %s", err) } - if err := ValidateClassID(m.ClassId); err != nil { + if err := base.ValidateClassID(m.ClassId); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("class id: %s", err) } - if len(m.NewMetadata) > MaxMetadataLength { - return ecocredit.ErrMaxLimit.Wrapf("metadata: max length %d", MaxMetadataLength) + if len(m.NewMetadata) > base.MaxMetadataLength { + return ecocredit.ErrMaxLimit.Wrapf("metadata: max length %d", base.MaxMetadataLength) } return nil diff --git a/x/ecocredit/core/msg_update_class_metadata_test.go b/x/ecocredit/base/types/v1/msg_update_class_metadata_test.go similarity index 98% rename from x/ecocredit/core/msg_update_class_metadata_test.go rename to x/ecocredit/base/types/v1/msg_update_class_metadata_test.go index 28b944b2a2..255abc8911 100644 --- a/x/ecocredit/core/msg_update_class_metadata_test.go +++ b/x/ecocredit/base/types/v1/msg_update_class_metadata_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/msg_update_project_admin.go b/x/ecocredit/base/types/v1/msg_update_project_admin.go similarity index 90% rename from x/ecocredit/core/msg_update_project_admin.go rename to x/ecocredit/base/types/v1/msg_update_project_admin.go index 1dbd2b5cfa..46e30f5b75 100644 --- a/x/ecocredit/core/msg_update_project_admin.go +++ b/x/ecocredit/base/types/v1/msg_update_project_admin.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "github.com/cosmos/cosmos-sdk/types" @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgUpdateProjectAdmin{} @@ -23,7 +24,7 @@ func (m MsgUpdateProjectAdmin) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("admin: %s", err) } - if err := ValidateProjectID(m.ProjectId); err != nil { + if err := base.ValidateProjectID(m.ProjectId); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("project id: %s", err) } diff --git a/x/ecocredit/core/msg_update_project_admin_test.go b/x/ecocredit/base/types/v1/msg_update_project_admin_test.go similarity index 98% rename from x/ecocredit/core/msg_update_project_admin_test.go rename to x/ecocredit/base/types/v1/msg_update_project_admin_test.go index 4909321e49..af26f34cc0 100644 --- a/x/ecocredit/core/msg_update_project_admin_test.go +++ b/x/ecocredit/base/types/v1/msg_update_project_admin_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/msg_update_project_metadata.go b/x/ecocredit/base/types/v1/msg_update_project_metadata.go similarity index 83% rename from x/ecocredit/core/msg_update_project_metadata.go rename to x/ecocredit/base/types/v1/msg_update_project_metadata.go index b7ce003dcb..34e2900862 100644 --- a/x/ecocredit/core/msg_update_project_metadata.go +++ b/x/ecocredit/base/types/v1/msg_update_project_metadata.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "github.com/cosmos/cosmos-sdk/types" @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgUpdateProjectMetadata{} @@ -23,12 +24,12 @@ func (m MsgUpdateProjectMetadata) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("admin: %s", err) } - if err := ValidateProjectID(m.ProjectId); err != nil { + if err := base.ValidateProjectID(m.ProjectId); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("project id: %s", err) } - if len(m.NewMetadata) > MaxMetadataLength { - return ecocredit.ErrMaxLimit.Wrapf("metadata: max length is %d", MaxMetadataLength) + if len(m.NewMetadata) > base.MaxMetadataLength { + return ecocredit.ErrMaxLimit.Wrapf("metadata: max length is %d", base.MaxMetadataLength) } return nil diff --git a/x/ecocredit/core/msg_update_project_metadata_test.go b/x/ecocredit/base/types/v1/msg_update_project_metadata_test.go similarity index 98% rename from x/ecocredit/core/msg_update_project_metadata_test.go rename to x/ecocredit/base/types/v1/msg_update_project_metadata_test.go index feb9b155de..5562b4c7b9 100644 --- a/x/ecocredit/core/msg_update_project_metadata_test.go +++ b/x/ecocredit/base/types/v1/msg_update_project_metadata_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/params.go b/x/ecocredit/base/types/v1/params.go similarity index 99% rename from x/ecocredit/core/params.go rename to x/ecocredit/base/types/v1/params.go index 629e6dfe27..9bd173d481 100644 --- a/x/ecocredit/core/params.go +++ b/x/ecocredit/base/types/v1/params.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/math" diff --git a/x/ecocredit/core/query.pb.go b/x/ecocredit/base/types/v1/query.pb.go similarity index 95% rename from x/ecocredit/core/query.pb.go rename to x/ecocredit/base/types/v1/query.pb.go index 859674d525..ec4b6b4124 100644 --- a/x/ecocredit/core/query.pb.go +++ b/x/ecocredit/base/types/v1/query.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: regen/ecocredit/v1/query.proto -package core +package v1 import ( context "context" @@ -2976,159 +2976,159 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1/query.proto", fileDescriptor_c85efa417eafb74b) } var fileDescriptor_c85efa417eafb74b = []byte{ - // 2421 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0xdd, 0x6f, 0x1c, 0x57, - 0x15, 0xcf, 0xdd, 0xf8, 0x63, 0x7d, 0xfc, 0xd9, 0x8b, 0x5b, 0x9c, 0x4d, 0xbc, 0x76, 0xa7, 0x71, - 0xbc, 0x89, 0xbd, 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4, 0xc5, 0xdc, 0x8b, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x7f, 0x8b, - 0x77, 0x8b, 0x2c, 0x00, 0x00, + // 2427 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xdd, 0x6f, 0x1c, 0x57, + 0x15, 0xcf, 0xdd, 0xc4, 0xf6, 0xfa, 0xf8, 0xb3, 0x17, 0xb7, 0x38, 0xdb, 0x78, 0xed, 0x4e, 0xe3, + 0x78, 0x13, 0x7b, 0x77, 0x6c, 0x27, 0x01, 0x9a, 0x04, 0x82, 0x9d, 0x52, 0xb0, 0x78, 0x71, 0x97, + 0x2a, 0x15, 0x86, 0xd4, 0xcc, 0xee, 0x5c, 0x6f, 0x27, 0x59, 0xcf, 0x6c, 0x67, 0xc6, 0x6e, 0x8c, + 0x65, 0x52, 0x90, 0x2a, 0x78, 0x82, 0x8a, 0xa2, 0xaa, 0x2f, 0x15, 0xdf, 0x2f, 0x7d, 0x40, 0xa2, + 0x42, 0x42, 0xa8, 0x0f, 0xbc, 0xa1, 0x3e, 0x46, 0x0a, 0x0f, 0x7c, 0x48, 0x80, 0x12, 0x1e, 0xf8, + 0x33, 0xd0, 0xdc, 0x7b, 0xee, 0x7c, 0xed, 0xcc, 0xec, 0xa4, 0x2c, 0x95, 0x9f, 0xbc, 0x73, 0xe7, + 0x9c, 0xb9, 0xbf, 0xdf, 0x39, 0xe7, 0xde, 0x7b, 0xe6, 0x37, 0x86, 0xb2, 0xcd, 0x5a, 0xcc, 0x54, + 0x59, 0xd3, 0x6a, 0xda, 0x4c, 0x37, 0x5c, 0x75, 0x7f, 0x45, 0x7d, 0x6d, 0x8f, 0xd9, 0x07, 0xb5, + 0x8e, 0x6d, 0xb9, 0x16, 0xa5, 0xfc, 0x7e, 0xcd, 0xbf, 0x5f, 0xdb, 0x5f, 0x29, 0x5d, 0x68, 0x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, 0x88, 0x32, + 0xac, 0x7c, 0x93, 0x33, 0xb9, 0x49, 0x17, 0x52, 0x21, 0xa9, 0x87, 0xa1, 0x57, 0xb2, 0xd4, 0x05, + 0x2e, 0xd1, 0x47, 0x8c, 0xe9, 0xbb, 0x05, 0x6f, 0x81, 0xf3, 0x37, 0xbf, 0xcc, 0x05, 0x1e, 0x16, + 0x98, 0x33, 0x17, 0x78, 0x44, 0x37, 0x56, 0xfe, 0x20, 0xce, 0xe0, 0x0f, 0x48, 0x5a, 0x22, 0xb8, + 0x79, 0x14, 0x93, 0xb7, 0x75, 0xf2, 0x97, 0xcd, 0xa3, 0xad, 0xcf, 0x27, 0x9f, 0x49, 0x89, 0x54, + 0x82, 0x87, 0xf9, 0xee, 0xd7, 0xe8, 0x95, 0x8c, 0x59, 0x9d, 0xc0, 0x32, 0x29, 0x8e, 0xf4, 0x47, + 0x04, 0x8a, 0x52, 0x29, 0xa5, 0x3d, 0x29, 0xe7, 0x68, 0x9f, 0xe2, 0xb2, 0xab, 0x52, 0xe3, 0xc1, + 0x49, 0x69, 0x53, 0xbb, 0x51, 0xd2, 0x0f, 0x08, 0x8c, 0x84, 0xe4, 0x5b, 0xba, 0x98, 0x3a, 0x55, + 0xb7, 0x90, 0x5c, 0x5a, 0xca, 0x67, 0x8c, 0xd0, 0xbe, 0xc2, 0xa1, 0xad, 0xd3, 0xb9, 0x24, 0x68, + 0x5a, 0xbb, 0x5d, 0x95, 0xf0, 0xb6, 0x52, 0xba, 0x3f, 0x5f, 0x19, 0xfe, 0x23, 0x81, 0x41, 0x21, + 0xca, 0xd2, 0xf4, 0x92, 0x8f, 0xa8, 0xbd, 0xa5, 0x85, 0x9e, 0x76, 0x88, 0x52, 0xe7, 0x28, 0x5f, + 0x49, 0x3e, 0xfd, 0x1c, 0x6e, 0x1b, 0x5b, 0x1c, 0x3d, 0x96, 0x76, 0xb4, 0xa2, 0xc4, 0x13, 0xe8, + 0x8f, 0x09, 0x8c, 0x84, 0x94, 0xda, 0x8c, 0xb0, 0x77, 0x4b, 0xbd, 0x19, 0x61, 0x4f, 0x10, 0x7f, + 0x95, 0x0a, 0x27, 0xa4, 0x24, 0x87, 0x5d, 0xfc, 0xaa, 0xf2, 0x17, 0x6b, 0xfa, 0x06, 0x81, 0x41, + 0x21, 0x90, 0x66, 0x84, 0x35, 0x22, 0x00, 0x67, 0x84, 0x35, 0xaa, 0xce, 0x2a, 0xf3, 0x1c, 0xc5, + 0x19, 0x5a, 0x4a, 0x6c, 0x14, 0xb8, 0xed, 0x0f, 0x0a, 0x84, 0xde, 0x27, 0x00, 0x01, 0x09, 0x7a, + 0x21, 0x07, 0x53, 0x09, 0x65, 0x31, 0x97, 0x2d, 0xc2, 0x31, 0x38, 0x9c, 0x66, 0xca, 0xfb, 0x4f, + 0x10, 0x14, 0xf5, 0x30, 0x2c, 0xd2, 0xa6, 0xf7, 0xe4, 0xa1, 0x30, 0xc6, 0x5c, 0xe8, 0xef, 0x09, + 0x4c, 0x25, 0x69, 0x3a, 0xf4, 0x52, 0xd6, 0xea, 0x49, 0xd3, 0x9b, 0x4a, 0x97, 0x1f, 0xd3, 0x0b, + 0x09, 0xaf, 0x72, 0xc2, 0x29, 0x7d, 0x26, 0xea, 0xd8, 0xe2, 0x70, 0xae, 0x4a, 0x69, 0x89, 0xfe, + 0x92, 0xc0, 0x44, 0x4c, 0xd9, 0xc9, 0xe8, 0x92, 0x92, 0x25, 0xa2, 0x8c, 0x2e, 0x29, 0x45, 0x34, + 0x52, 0xaa, 0x1c, 0xea, 0x02, 0x9d, 0xcf, 0x88, 0xb4, 0x40, 0xba, 0xc3, 0x84, 0xe0, 0xf1, 0x74, + 0x86, 0xa6, 0x43, 0xaf, 0xe6, 0x01, 0x90, 0x22, 0x1a, 0x95, 0xae, 0x7d, 0x3c, 0x67, 0x64, 0x72, + 0x85, 0x33, 0xb9, 0x44, 0x57, 0x7b, 0x32, 0xf1, 0x45, 0xa5, 0x2a, 0xaa, 0x4d, 0xeb, 0x5f, 0xff, + 0xe8, 0x61, 0x99, 0xdc, 0x7f, 0x58, 0x26, 0xff, 0x7a, 0x58, 0x26, 0x6f, 0x3d, 0x2a, 0x9f, 0xb8, + 0xff, 0xa8, 0x7c, 0xe2, 0x2f, 0x8f, 0xca, 0x27, 0xb6, 0xae, 0x87, 0x34, 0x32, 0xfe, 0xdc, 0xaa, + 0xc9, 0xdc, 0xd7, 0x2d, 0xfb, 0x0e, 0x5e, 0xb5, 0x99, 0xde, 0x62, 0xb6, 0x7a, 0x37, 0x34, 0x1d, + 0xff, 0xaf, 0x60, 0x51, 0x9d, 0xfb, 0x2b, 0x8d, 0x41, 0xae, 0xea, 0x5e, 0xfc, 0x6f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x16, 0x3d, 0xd0, 0xa3, 0x94, 0x2c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/ecocredit/core/query.pb.gw.go b/x/ecocredit/base/types/v1/query.pb.gw.go similarity index 99% rename from x/ecocredit/core/query.pb.gw.go rename to x/ecocredit/base/types/v1/query.pb.gw.go index c132188d48..395031b053 100644 --- a/x/ecocredit/core/query.pb.gw.go +++ b/x/ecocredit/base/types/v1/query.pb.gw.go @@ -2,11 +2,11 @@ // source: regen/ecocredit/v1/query.proto /* -Package core is a reverse proxy. +Package v1 is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package core +package v1 import ( "context" diff --git a/x/ecocredit/core/state.pb.go b/x/ecocredit/base/types/v1/state.pb.go similarity index 93% rename from x/ecocredit/core/state.pb.go rename to x/ecocredit/base/types/v1/state.pb.go index eeffe2fac6..d306d90ee4 100644 --- a/x/ecocredit/core/state.pb.go +++ b/x/ecocredit/base/types/v1/state.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: regen/ecocredit/v1/state.proto -package core +package v1 import ( fmt "fmt" @@ -1124,79 +1124,79 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1/state.proto", fileDescriptor_6cfdca0a4aaabb36) } var fileDescriptor_6cfdca0a4aaabb36 = []byte{ - // 1142 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6e, 0xe3, 0xd4, - 0x17, 0x1f, 0xe7, 0xa3, 0x49, 0x4e, 0xbe, 0xdc, 0xdb, 0x8f, 0xbf, 0x27, 0xff, 0x21, 0x2d, 0x06, - 0x34, 0x1d, 0xa9, 0x63, 0x2b, 0x03, 0x8c, 0x20, 0x0b, 0x50, 0x3f, 0x06, 0xa9, 0x1a, 0x24, 0x46, - 0xa1, 0x2b, 0x36, 0xe1, 0xc6, 0x3e, 0x4d, 0xdd, 0x49, 0xec, 0x70, 0x7d, 0xd3, 0x69, 0xb7, 0x3c, - 0x00, 0x62, 0x85, 0x58, 0x20, 0x5e, 0x80, 0x57, 0xe0, 0x01, 0x60, 0x37, 0x12, 0x1b, 0x96, 0xa8, - 0x7d, 0x03, 0xc4, 0x8a, 0x15, 0xf2, 0xf1, 0xb5, 0x13, 0x87, 0x4c, 0xa7, 0x62, 0x77, 0xcf, 0xf7, - 0xef, 0xfc, 0xee, 0x39, 0xf6, 0x85, 0xb6, 0xc0, 0x21, 0xfa, 0x36, 0x3a, 0x81, 0x23, 0xd0, 0xf5, - 0xa4, 0x7d, 0xde, 0xb1, 0x43, 0xc9, 0x25, 0x5a, 0x13, 0x11, 0xc8, 0x80, 0x31, 0xb2, 0x5b, 0xa9, - 0xdd, 0x3a, 0xef, 0xb4, 0xda, 0x4e, 0x10, 0x8e, 0x83, 0xd0, 0x1e, 0xf0, 0x10, 0xed, 0xf3, 0xce, - 0x00, 0x25, 0xef, 0xd8, 0x4e, 0xe0, 0xf9, 0x71, 0x4c, 0xeb, 0x0d, 0x65, 0x0f, 0xc4, 0xd8, 0x3e, - 0xef, 0xf0, 0xd1, 0xe4, 0x94, 0x77, 0x22, 0x41, 0x99, 0xb7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0x5d, 0x63, 0xe5, 0x08, 0x40, 0x04, 0x94, 0x55, 0x54, 0x69, 0x3d, 0xc7, 0x36, 0x97, 0xe5, - 0xd4, 0xf3, 0x46, 0xce, 0xfc, 0x12, 0xaa, 0xd4, 0xca, 0x51, 0x18, 0x4e, 0x51, 0xb0, 0xff, 0x43, - 0xc5, 0x89, 0xc4, 0xfe, 0xac, 0xad, 0x32, 0x29, 0x9e, 0xe2, 0x25, 0xdb, 0x84, 0x15, 0x8f, 0xdc, - 0xa8, 0xbf, 0x5a, 0x4f, 0x49, 0xdd, 0x7b, 0x84, 0x61, 0x13, 0x18, 0xe8, 0x69, 0xf0, 0xae, 0xf2, - 0xcc, 0x9b, 0x3f, 0xe5, 0xa0, 0xf4, 0x4c, 0x04, 0x67, 0xe8, 0xc8, 0xff, 0xcc, 0x57, 0x06, 0x56, - 0x61, 0x01, 0x96, 0x09, 0xb5, 0xb3, 0xa9, 0xf0, 0x42, 0xd7, 0x73, 0x68, 0x3c, 0x62, 0xaa, 0x32, - 0xba, 0x0c, 0xe1, 0x2b, 0x0b, 0x84, 0xbf, 0x09, 0x35, 0x81, 0x27, 0x28, 0xd0, 0x77, 0xb0, 0xef, - 0xb9, 0x46, 0x89, 0xec, 0xd5, 0x54, 0x77, 0xe4, 0x76, 0x4f, 0xa9, 0xc3, 0xc1, 0x32, 0x96, 0x19, - 0xd4, 0xe6, 0x9a, 0x76, 0xf5, 0xdc, 0x3c, 0xf3, 0x79, 0xa6, 0x67, 0x93, 0xeb, 0x05, 0xd6, 0x82, - 0xcd, 0x59, 0x40, 0xc6, 0x56, 0x34, 0x0a, 0xe6, 0xf7, 0x79, 0x28, 0xee, 0x73, 0xe9, 0x9c, 0x2e, - 0xe1, 0xea, 0x15, 0xfc, 0xb3, 0x2d, 0xa8, 0x4e, 0x62, 0x82, 0x89, 0x9f, 0x3c, 0x45, 0x80, 0x52, - 0x45, 0x0c, 0xad, 0x43, 0xd1, 0x45, 0x3f, 0x18, 0xab, 0x59,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f, 0xaf, 0xdb, - 0x77, 0xbe, 0x78, 0x3c, 0xf4, 0xe4, 0xe9, 0x74, 0x60, 0x39, 0xc1, 0xd8, 0xa6, 0x97, 0xe1, 0x43, - 0x1f, 0xe5, 0x8b, 0x40, 0x3c, 0x57, 0xd2, 0x08, 0xdd, 0x21, 0x0a, 0xfb, 0x62, 0xee, 0x41, 0xe9, - 0x04, 0x02, 0x07, 0x2b, 0xf4, 0xfd, 0x7e, 0xf7, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x1b, - 0xe1, 0x86, 0x6f, 0x0a, 0x00, 0x00, + // 1150 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x8e, 0x1b, 0xc5, + 0x13, 0xcf, 0xf8, 0x63, 0x6d, 0x97, 0xbf, 0x26, 0xbd, 0xc9, 0xfe, 0x27, 0xfe, 0x07, 0x27, 0x0c, + 0xa0, 0x6c, 0xa4, 0xcd, 0x8c, 0x1c, 0x3e, 0x04, 0x3e, 0x10, 0x25, 0x9b, 0x20, 0xad, 0x82, 0x04, + 0x32, 0x7b, 0x81, 0x8b, 0x69, 0xcf, 0xd4, 0x7a, 0x67, 0x63, 0xcf, 0x98, 0x9e, 0xf6, 0x66, 0xf7, + 0xca, 0x03, 0x20, 0x4e, 0x88, 0x03, 0xe2, 0x05, 0x78, 0x05, 0x1e, 0x00, 0x6e, 0x91, 0xb8, 0x70, + 0x44, 0xbb, 0x6f, 0x80, 0x38, 0x71, 0x42, 0x5d, 0xd3, 0x33, 0xf6, 0x18, 0x67, 0xb3, 0xe2, 0x36, + 0x55, 0x5d, 0x1f, 0xbf, 0xfa, 0x75, 0x55, 0x4f, 0x41, 0x57, 0xe0, 0x18, 0x43, 0x17, 0xbd, 0xc8, + 0x13, 0xe8, 0x07, 0xd2, 0x3d, 0xee, 0xb9, 0xb1, 0xe4, 0x12, 0x9d, 0x99, 0x88, 0x64, 0xc4, 0x18, + 0x9d, 0x3b, 0xd9, 0xb9, 0x73, 0xdc, 0xeb, 0x74, 0xbd, 0x28, 0x9e, 0x46, 0xb1, 0x3b, 0xe2, 0x31, + 0xba, 0xc7, 0xbd, 0x11, 0x4a, 0xde, 0x73, 0xbd, 0x28, 0x08, 0x13, 0x9f, 0xce, 0x6b, 0xfa, 0x3c, + 0x12, 0x53, 0xf7, 0xb8, 0xc7, 0x27, 0xb3, 0x43, 0xde, 0x53, 0x82, 0x3e, 0xbe, 0x35, 0x8e, 0xa2, + 0xf1, 0x04, 0x5d, 0x92, 0x46, 0xf3, 0x03, 0x57, 0x06, 0x53, 0x8c, 0x25, 0x9f, 0xce, 0x12, 0x03, + 0xfb, 0x07, 0x03, 0x60, 0x97, 0xb2, 0xed, 0x9f, 0xce, 0x90, 0xd9, 0xd0, 0xe0, 0xa3, 0x91, 0xc0, + 0xe3, 0x80, 0xcb, 0x20, 0x0a, 0x2d, 0xe3, 0xb6, 0xb1, 0x5d, 0x1b, 0xe4, 0x74, 0x8c, 0x41, 0x29, + 0xe4, 0x53, 0xb4, 0x0a, 0x74, 0x46, 0xdf, 0x4a, 0x37, 0x0f, 0x03, 0x69, 0x15, 0x13, 0x9d, 0xfa, + 0x66, 0x37, 0xa1, 0x36, 0x13, 0xe8, 0x05, 0xb1, 0x0a, 0x54, 0xba, 0x6d, 0x6c, 0x37, 0x07, 0x0b, + 0x45, 0xff, 0xcd, 0x3f, 0x7f, 0xfc, 0xed, 0x9b, 0x62, 0x17, 0x5a, 0xf9, 0x8c, 0x0c, 0x92, 0xe8, + 0xa6, 0x61, 0x19, 0x96, 0x61, 0xff, 0x6a, 0x40, 0x79, 0x77, 0xc2, 0xe3, 0x98, 0x99, 0x50, 0x7c, + 0x86, 0xa7, 0x04, 0xa8, 0x34, 0x50, 0x9f, 0xac, 0x05, 0x85, 0xc0, 0xd7, 0x28, 0x0a, 0x81, 0xcf, + 0xae, 0x41, 0x99, 0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x7b, 0x50, 0x3a, + 0x40, 0x54, 0x09, 0x8b, 0xdb, 0xf5, 0xfb, 0x37, 0x9c, 0x64, 0x2d, 0x73, 0xd4, 0xda, 0xe6, 0xe8, + 0xb5, 0xcd, 0xd9, 0x8d, 0x82, 0x70, 0x40, 0x66, 0x59, 0x94, 0xf6, 0xa3, 0xcf, 0x7f, 0x39, 0xeb, + 0x1a, 0x2f, 0xce, 0xba, 0xc6, 0x1f, 0x67, 0x5d, 0xe3, 0xdb, 0xf3, 0xee, 0x95, 0x17, 0xe7, 0xdd, + 0x2b, 0xbf, 0x9f, 0x77, 0xaf, 0x7c, 0xf1, 0x60, 0x1c, 0xc8, 0xc3, 0xf9, 0xc8, 0xf1, 0xa2, 0xa9, + 0x4b, 0x9b, 0xe1, 0xbd, 0x10, 0xe5, 0xf3, 0x48, 0x3c, 0xd3, 0xd2, 0x04, 0xfd, 0x31, 0x0a, 0xf7, + 0x64, 0x69, 0xa1, 0xa4, 0x2d, 0x51, 0xbd, 0x62, 0xb1, 0xda, 0x15, 0x37, 0xe8, 0x21, 0x7f, 0xfb, + 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xab, 0xcb, 0x4f, 0x3c, 0x78, 0x0a, 0x00, 0x00, } func (m *CreditType) Marshal() (dAtA []byte, err error) { diff --git a/x/ecocredit/core/state_batch.go b/x/ecocredit/base/types/v1/state_batch.go similarity index 88% rename from x/ecocredit/core/state_batch.go rename to x/ecocredit/base/types/v1/state_batch.go index 4845693b78..a02d83a60b 100644 --- a/x/ecocredit/core/state_batch.go +++ b/x/ecocredit/base/types/v1/state_batch.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate performs basic validation of the Batch state type @@ -22,11 +23,11 @@ func (m *Batch) Validate() error { return ecocredit.ErrParseFailure.Wrapf("project key cannot be zero") } - if err := ValidateBatchDenom(m.Denom); err != nil { + if err := base.ValidateBatchDenom(m.Denom); err != nil { return errors.Wrap(err, "denom") // returns parse error } - if len(m.Metadata) > MaxMetadataLength { + if len(m.Metadata) > base.MaxMetadataLength { return ecocredit.ErrParseFailure.Wrap("metadata cannot be more than 256 characters") } diff --git a/x/ecocredit/core/state_batch_balance.go b/x/ecocredit/base/types/v1/state_batch_balance.go similarity index 98% rename from x/ecocredit/core/state_batch_balance.go rename to x/ecocredit/base/types/v1/state_batch_balance.go index 7441e7bba8..a4b596a26f 100644 --- a/x/ecocredit/core/state_batch_balance.go +++ b/x/ecocredit/base/types/v1/state_batch_balance.go @@ -1,4 +1,4 @@ -package core +package v1 import ( sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/ecocredit/core/state_batch_balance_test.go b/x/ecocredit/base/types/v1/state_batch_balance_test.go similarity index 98% rename from x/ecocredit/core/state_batch_balance_test.go rename to x/ecocredit/base/types/v1/state_batch_balance_test.go index 0b1611bbd4..f161466361 100644 --- a/x/ecocredit/core/state_batch_balance_test.go +++ b/x/ecocredit/base/types/v1/state_batch_balance_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/state_batch_contract.go b/x/ecocredit/base/types/v1/state_batch_contract.go similarity index 97% rename from x/ecocredit/core/state_batch_contract.go rename to x/ecocredit/base/types/v1/state_batch_contract.go index 48d7b8577a..37b23f9b7f 100644 --- a/x/ecocredit/core/state_batch_contract.go +++ b/x/ecocredit/base/types/v1/state_batch_contract.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "github.com/regen-network/regen-ledger/types/eth" diff --git a/x/ecocredit/core/state_batch_contract_test.go b/x/ecocredit/base/types/v1/state_batch_contract_test.go similarity index 98% rename from x/ecocredit/core/state_batch_contract_test.go rename to x/ecocredit/base/types/v1/state_batch_contract_test.go index 69b582cff5..5cdc8488d7 100644 --- a/x/ecocredit/core/state_batch_contract_test.go +++ b/x/ecocredit/base/types/v1/state_batch_contract_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/state_batch_sequence.go b/x/ecocredit/base/types/v1/state_batch_sequence.go similarity index 96% rename from x/ecocredit/core/state_batch_sequence.go rename to x/ecocredit/base/types/v1/state_batch_sequence.go index 293b3113de..619dba1db6 100644 --- a/x/ecocredit/core/state_batch_sequence.go +++ b/x/ecocredit/base/types/v1/state_batch_sequence.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "github.com/regen-network/regen-ledger/x/ecocredit" diff --git a/x/ecocredit/core/state_batch_sequence_test.go b/x/ecocredit/base/types/v1/state_batch_sequence_test.go similarity index 98% rename from x/ecocredit/core/state_batch_sequence_test.go rename to x/ecocredit/base/types/v1/state_batch_sequence_test.go index da203c4c90..839deb2e1e 100644 --- a/x/ecocredit/core/state_batch_sequence_test.go +++ b/x/ecocredit/base/types/v1/state_batch_sequence_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/state_batch_supply.go b/x/ecocredit/base/types/v1/state_batch_supply.go similarity index 98% rename from x/ecocredit/core/state_batch_supply.go rename to x/ecocredit/base/types/v1/state_batch_supply.go index c7d3e4471d..8f1042821c 100644 --- a/x/ecocredit/core/state_batch_supply.go +++ b/x/ecocredit/base/types/v1/state_batch_supply.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "github.com/regen-network/regen-ledger/types/math" diff --git a/x/ecocredit/core/state_batch_supply_test.go b/x/ecocredit/base/types/v1/state_batch_supply_test.go similarity index 98% rename from x/ecocredit/core/state_batch_supply_test.go rename to x/ecocredit/base/types/v1/state_batch_supply_test.go index d9085bdd94..d8014a8d50 100644 --- a/x/ecocredit/core/state_batch_supply_test.go +++ b/x/ecocredit/base/types/v1/state_batch_supply_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/state_batch_test.go b/x/ecocredit/base/types/v1/state_batch_test.go similarity index 98% rename from x/ecocredit/core/state_batch_test.go rename to x/ecocredit/base/types/v1/state_batch_test.go index f3d908b6b9..498d817d4e 100644 --- a/x/ecocredit/core/state_batch_test.go +++ b/x/ecocredit/base/types/v1/state_batch_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/state_class.go b/x/ecocredit/base/types/v1/state_class.go similarity index 74% rename from x/ecocredit/core/state_class.go rename to x/ecocredit/base/types/v1/state_class.go index c42147f467..b9383b48c8 100644 --- a/x/ecocredit/core/state_class.go +++ b/x/ecocredit/base/types/v1/state_class.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate performs basic validation of the CreditClass state type @@ -14,7 +15,7 @@ func (m *Class) Validate() error { return ecocredit.ErrParseFailure.Wrapf("key cannot be zero") } - if err := ValidateClassID(m.Id); err != nil { + if err := base.ValidateClassID(m.Id); err != nil { return errors.Wrap(err, "class id") // returns parse error } @@ -22,11 +23,11 @@ func (m *Class) Validate() error { return ecocredit.ErrParseFailure.Wrapf("admin: %s", err) } - if len(m.Metadata) > MaxMetadataLength { + if len(m.Metadata) > base.MaxMetadataLength { return ecocredit.ErrParseFailure.Wrap("credit class metadata cannot be more than 256 characters") } - if err := ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { + if err := base.ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { return errors.Wrap(err, "credit type abbrev") // returns parse error } diff --git a/x/ecocredit/core/state_class_issuer.go b/x/ecocredit/base/types/v1/state_class_issuer.go similarity index 97% rename from x/ecocredit/core/state_class_issuer.go rename to x/ecocredit/base/types/v1/state_class_issuer.go index 813fca2047..2c9495f87e 100644 --- a/x/ecocredit/core/state_class_issuer.go +++ b/x/ecocredit/base/types/v1/state_class_issuer.go @@ -1,4 +1,4 @@ -package core +package v1 import ( sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/ecocredit/core/state_class_issuer_test.go b/x/ecocredit/base/types/v1/state_class_issuer_test.go similarity index 98% rename from x/ecocredit/core/state_class_issuer_test.go rename to x/ecocredit/base/types/v1/state_class_issuer_test.go index 2e166d30ce..ded0372ee8 100644 --- a/x/ecocredit/core/state_class_issuer_test.go +++ b/x/ecocredit/base/types/v1/state_class_issuer_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/state_class_sequence.go b/x/ecocredit/base/types/v1/state_class_sequence.go similarity index 72% rename from x/ecocredit/core/state_class_sequence.go rename to x/ecocredit/base/types/v1/state_class_sequence.go index 0f4ba53f94..be4719ef0e 100644 --- a/x/ecocredit/core/state_class_sequence.go +++ b/x/ecocredit/base/types/v1/state_class_sequence.go @@ -1,14 +1,15 @@ -package core +package v1 import ( "cosmossdk.io/errors" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate performs basic validation of the ClassSequence state type func (m *ClassSequence) Validate() error { - if err := ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { + if err := base.ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { return errors.Wrap(err, "credit type abbrev") // returns parse error } diff --git a/x/ecocredit/core/state_class_sequence_test.go b/x/ecocredit/base/types/v1/state_class_sequence_test.go similarity index 98% rename from x/ecocredit/core/state_class_sequence_test.go rename to x/ecocredit/base/types/v1/state_class_sequence_test.go index dedcbecd91..59e19df613 100644 --- a/x/ecocredit/core/state_class_sequence_test.go +++ b/x/ecocredit/base/types/v1/state_class_sequence_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/state_class_test.go b/x/ecocredit/base/types/v1/state_class_test.go similarity index 98% rename from x/ecocredit/core/state_class_test.go rename to x/ecocredit/base/types/v1/state_class_test.go index 9e84331e3a..35c04dd66a 100644 --- a/x/ecocredit/core/state_class_test.go +++ b/x/ecocredit/base/types/v1/state_class_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/state_credit_type.go b/x/ecocredit/base/types/v1/state_credit_type.go similarity index 84% rename from x/ecocredit/core/state_credit_type.go rename to x/ecocredit/base/types/v1/state_credit_type.go index 5f8fea81fa..b6b295115e 100644 --- a/x/ecocredit/core/state_credit_type.go +++ b/x/ecocredit/base/types/v1/state_credit_type.go @@ -1,9 +1,10 @@ -package core +package v1 import ( "cosmossdk.io/errors" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) const ( @@ -12,7 +13,7 @@ const ( // Validate performs basic validation of the ClassIssuer state type func (m *CreditType) Validate() error { - if err := ValidateCreditTypeAbbreviation(m.Abbreviation); err != nil { + if err := base.ValidateCreditTypeAbbreviation(m.Abbreviation); err != nil { return errors.Wrapf(err, "abbreviation") // returns parse error } diff --git a/x/ecocredit/core/state_credit_type_test.go b/x/ecocredit/base/types/v1/state_credit_type_test.go similarity index 98% rename from x/ecocredit/core/state_credit_type_test.go rename to x/ecocredit/base/types/v1/state_credit_type_test.go index 59017d79af..0dd46c2fdb 100644 --- a/x/ecocredit/core/state_credit_type_test.go +++ b/x/ecocredit/base/types/v1/state_credit_type_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/state_origin_tx_index.go b/x/ecocredit/base/types/v1/state_origin_tx_index.go similarity index 98% rename from x/ecocredit/core/state_origin_tx_index.go rename to x/ecocredit/base/types/v1/state_origin_tx_index.go index c0d6a5c4b1..ab628ab4df 100644 --- a/x/ecocredit/core/state_origin_tx_index.go +++ b/x/ecocredit/base/types/v1/state_origin_tx_index.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "github.com/regen-network/regen-ledger/x/ecocredit" diff --git a/x/ecocredit/core/state_origin_tx_index_test.go b/x/ecocredit/base/types/v1/state_origin_tx_index_test.go similarity index 99% rename from x/ecocredit/core/state_origin_tx_index_test.go rename to x/ecocredit/base/types/v1/state_origin_tx_index_test.go index 1257bd9449..ee726d7d70 100644 --- a/x/ecocredit/core/state_origin_tx_index_test.go +++ b/x/ecocredit/base/types/v1/state_origin_tx_index_test.go @@ -1,5 +1,5 @@ //nolint:revive,stylecheck -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/state_project.go b/x/ecocredit/base/types/v1/state_project.go similarity index 76% rename from x/ecocredit/core/state_project.go rename to x/ecocredit/base/types/v1/state_project.go index 5005330021..278be2b560 100644 --- a/x/ecocredit/core/state_project.go +++ b/x/ecocredit/base/types/v1/state_project.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate performs a basic validation of project @@ -14,7 +15,7 @@ func (m *Project) Validate() error { return ecocredit.ErrParseFailure.Wrap("key cannot be zero") } - if err := ValidateProjectID(m.Id); err != nil { + if err := base.ValidateProjectID(m.Id); err != nil { return errors.Wrap(err, "project id") // returns parse error } @@ -26,11 +27,11 @@ func (m *Project) Validate() error { return ecocredit.ErrParseFailure.Wrap("class key cannot be zero") } - if err := ValidateJurisdiction(m.Jurisdiction); err != nil { + if err := base.ValidateJurisdiction(m.Jurisdiction); err != nil { return errors.Wrap(err, "jurisdiction") // returns parse error } - if len(m.Metadata) > MaxMetadataLength { + if len(m.Metadata) > base.MaxMetadataLength { return ecocredit.ErrParseFailure.Wrapf("metadata exceeds 256 characters") } diff --git a/x/ecocredit/core/state_project_sequence.go b/x/ecocredit/base/types/v1/state_project_sequence.go similarity index 96% rename from x/ecocredit/core/state_project_sequence.go rename to x/ecocredit/base/types/v1/state_project_sequence.go index 6166a4ed0e..14c93a1cf4 100644 --- a/x/ecocredit/core/state_project_sequence.go +++ b/x/ecocredit/base/types/v1/state_project_sequence.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "github.com/regen-network/regen-ledger/x/ecocredit" diff --git a/x/ecocredit/core/state_project_sequence_test.go b/x/ecocredit/base/types/v1/state_project_sequence_test.go similarity index 98% rename from x/ecocredit/core/state_project_sequence_test.go rename to x/ecocredit/base/types/v1/state_project_sequence_test.go index ac07e00dcb..6edabcb62a 100644 --- a/x/ecocredit/core/state_project_sequence_test.go +++ b/x/ecocredit/base/types/v1/state_project_sequence_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/state_project_test.go b/x/ecocredit/base/types/v1/state_project_test.go similarity index 98% rename from x/ecocredit/core/state_project_test.go rename to x/ecocredit/base/types/v1/state_project_test.go index 0ab2316117..6e02f4f164 100644 --- a/x/ecocredit/core/state_project_test.go +++ b/x/ecocredit/base/types/v1/state_project_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "strconv" diff --git a/x/ecocredit/core/tx.pb.go b/x/ecocredit/base/types/v1/tx.pb.go similarity index 96% rename from x/ecocredit/core/tx.pb.go rename to x/ecocredit/base/types/v1/tx.pb.go index cd7f415e8f..3595ace603 100644 --- a/x/ecocredit/core/tx.pb.go +++ b/x/ecocredit/base/types/v1/tx.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: regen/ecocredit/v1/tx.proto -package core +package v1 import ( context "context" @@ -2532,118 +2532,118 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1/tx.proto", fileDescriptor_2b8ae49f50a3ddbd) } var fileDescriptor_2b8ae49f50a3ddbd = []byte{ - // 1770 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcb, 0x6f, 0xdb, 0x46, - 0x1a, 0x37, 0x25, 0xd9, 0x92, 0x3e, 0x39, 0x8e, 0xc3, 0x24, 0x8e, 0x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 0x5e, 0xaa, 0x55, 0x9e, 0x6a, 0x75, 0xcf, 0xb1, 0xec, 0xb6, - 0x87, 0xba, 0x0d, 0x9e, 0x97, 0xcc, 0xb8, 0xc6, 0x2d, 0x58, 0x0a, 0x3b, 0xe1, 0xfb, 0x27, 0x5f, - 0x84, 0x92, 0xee, 0x4d, 0x74, 0x2c, 0x83, 0xfb, 0x53, 0xa4, 0xe3, 0x7d, 0xa3, 0xf1, 0x15, 0x4b, - 0x0d, 0xdb, 0x75, 0xdf, 0x75, 0x1e, 0x21, 0x9d, 0x24, 0x38, 0x1f, 0x94, 0x92, 0x0b, 0x49, 0x49, - 0xf5, 0xbe, 0x01, 0xf3, 0x8f, 0x86, 0xae, 0x85, 0x0d, 0x4b, 0x27, 0x96, 0x63, 0x73, 0xbf, 0x43, - 0x73, 0xf2, 0x65, 0x98, 0x77, 0xd1, 0x21, 0x72, 0x91, 0xad, 0x23, 0x4f, 0xfc, 0x2c, 0xc5, 0x54, - 0xc4, 0xdc, 0xbe, 0x11, 0xf2, 0x74, 0x9b, 0xe6, 0x32, 0x64, 0xb3, 0xf0, 0x75, 0x05, 0x60, 0xc0, - 0xa6, 0x46, 0xde, 0x96, 0xf9, 0xcc, 0xbe, 0xd1, 0xf8, 0x25, 0x17, 0x48, 0xf5, 0xae, 0x46, 0xf4, - 0x87, 0xf2, 0x12, 0xcc, 0xb1, 0x2c, 0x72, 0x34, 0x1f, 0x45, 0x24, 0xe5, 0x22, 0x92, 0xe4, 0x7f, - 0x41, 0xc9, 0x03, 0x6a, 0xb6, 0x8e, 0xaa, 0xf9, 0x7a, 0x7e, 0xad, 0xb2, 0x75, 0x39, 0xee, 0x78, - 0x52, 0x1d, 0xfb, 0x1c, 0xd8, 0x16, 0x5b, 0x42, 0x21, 0x2b, 0x44, 0x42, 0x76, 0x07, 0x00, 0x13, - 0xcd, 0x25, 0x1d, 0x43, 0x23, 0xfe, 0x49, 0x50, 0x54, 0x76, 0x4b, 0x55, 0xff, 0x96, 0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26, 0xbf, 0xf1, 0x31, 0x37, 0x9b, - 0xd9, 0x26, 0x2c, 0x7e, 0x51, 0xa0, 0xd4, 0xd3, 0x9f, 0xd5, 0x91, 0x75, 0x84, 0x12, 0xdb, 0x5b, - 0xca, 0x31, 0xbc, 0x07, 0x45, 0x1e, 0x59, 0x6a, 0x7b, 0x65, 0x6b, 0x23, 0xa1, 0xe3, 0x84, 0x34, - 0xa9, 0x3e, 0x71, 0xf4, 0x37, 0xcb, 0xff, 0x86, 0x59, 0xda, 0x53, 0x78, 0x33, 0x5f, 0x9f, 0x48, - 0x0a, 0x6b, 0x9f, 0x6c, 0x63, 0x98, 0x12, 0xcc, 0x4e, 0x43, 0x09, 0x94, 0xef, 0x25, 0x98, 0x65, - 0x0d, 0x3e, 0x94, 0x0c, 0x29, 0x9a, 0x8c, 0x25, 0x98, 0x0b, 0x75, 0x38, 0x3e, 0x8a, 0x50, 0xc6, - 0xfc, 0xeb, 0x51, 0xc6, 0xc2, 0xb4, 0x94, 0x31, 0x48, 0x66, 0x67, 0xc3, 0x64, 0x56, 0xe9, 0x41, - 0xd1, 0x7f, 0x57, 0x44, 0x69, 0xbe, 0x34, 0x46, 0xf3, 0xc7, 0xda, 0x58, 0x2e, 0xe6, 0xb5, 0x90, - 0xf2, 0xda, 0x08, 0xb3, 0x9c, 0x07, 0xf4, 0xde, 0x86, 0x12, 0x36, 0x31, 0xdf, 0xcc, 0xb8, 0xc2, - 0x8d, 0xb7, 0x41, 0xe6, 0xef, 0x49, 0xef, 0x18, 0x52, 0x46, 0xeb, 0xb8, 0x19, 0x8f, 0xda, 0x2a, - 0xbd, 0x49, 0x1e, 0x50, 0x9c, 0x61, 0x36, 0x1c, 0x7b, 0xad, 0x5e, 0x02, 0x65, 0x5c, 0xba, 0xb8, - 0x39, 0x1d, 0x5a, 0x27, 0xdb, 0xb4, 0x09, 0xfc, 0x21, 0xea, 0x59, 0x45, 0x1c, 0x57, 0x20, 0x2c, - 0x30, 0x29, 0xe0, 0xc0, 0x31, 0xcd, 0x1e, 0x62, 0x37, 0x9f, 0xb5, 0xca, 0x5e, 0xcf, 0x39, 0xee, - 0x59, 0x98, 0x64, 0x5b, 0x82, 0x6c, 0x8f, 0x97, 0xb1, 0xc0, 0x96, 0xda, 0xfe, 0x70, 0xcc, 0x92, - 0xeb, 0x70, 0x35, 0x55, 0x91, 0xb0, 0xe8, 0x73, 0x89, 0x26, 0x24, 0xd0, 0x5e, 0xee, 0x21, 0x84, - 0x33, 0xec, 0xe8, 0x40, 0xe1, 0x10, 0x21, 0x9f, 0xc9, 0x24, 0x3f, 0xb6, 0x77, 0xff, 0xf2, 0xec, - 0xc7, 0xd5, 0x99, 0x2f, 0x5e, 0xac, 0xae, 0x99, 0x16, 0x79, 0x38, 0xec, 0xaa, 0xba, 0xd3, 0x6f, - 0xf2, 0x8f, 0x2c, 0xec, 0xbf, 0x9b, 0xd8, 0x78, 0xcc, 0xbf, 0x79, 0x78, 0x1b, 0x70, 0x9b, 0x0a, - 0x4e, 0xc8, 0x6b, 0xc4, 0x48, 0xdf, 0x87, 0xad, 0x4f, 0x16, 0x21, 0xdf, 0xc2, 0xa6, 0xfc, 0x0e, - 0x54, 0x82, 0xdf, 0x22, 0x1a, 0x09, 0x95, 0x28, 0x80, 0x51, 0xd6, 0xb3, 0x31, 0xe2, 0xe8, 0xeb, - 0x70, 0x2a, 0xfc, 0xde, 0xbf, 0x92, 0xba, 0x99, 0xa3, 0x94, 0x8d, 0x49, 0x50, 0x42, 0x89, 0xf0, - 0x81, 0x55, 0xb5, 0x74, 0x1f, 0x28, 0x26, 0xc3, 0x87, 0xf0, 0x73, 0xb1, 0x07, 0x8b, 0x63, 0x2f, - 0xc1, 0xa4, 0x97, 0x46, 0x14, 0xa8, 0x34, 0x27, 0x04, 0x0a, 0x6d, 0x6f, 0x41, 0x79, 0xf4, 0x02, - 0xab, 0x27, 0x3e, 0x68, 0x38, 0x42, 0x59, 0xcb, 0x42, 0x08, 0xc1, 0xff, 0x81, 0x02, 0x7d, 0x6b, - 0x2d, 0xa7, 0x3c, 0x92, 0x94, 0x3f, 0xa5, 0x2c, 0x0a, 0x49, 0xff, 0x83, 0x39, 0xfe, 0xac, 0x58, - 0x49, 0x80, 0xb3, 0x65, 0xe5, 0x6a, 0xea, 0x72, 0x50, 0x1e, 0x7f, 0x07, 0x24, 0xc9, 0x63, 0xcb, - 0x89, 0xf2, 0xc2, 0x3c, 0xde, 0x4b, 0xd8, 0x18, 0x89, 0x4f, 0x4a, 0x58, 0x14, 0x98, 0x98, 0xb0, - 0x24, 0x96, 0x2e, 0xbb, 0x20, 0xc7, 0x30, 0xf4, 0x1b, 0xd9, 0x62, 0x38, 0x54, 0xd9, 0x9c, 0x18, - 0x2a, 0x74, 0x0e, 0xe1, 0x6c, 0x1c, 0xad, 0x5e, 0xcf, 0x96, 0xe4, 0x63, 0x95, 0xad, 0xc9, 0xb1, - 0xe3, 0xae, 0x86, 0x18, 0x73, 0xba, 0xab, 0x41, 0x68, 0x86, 0xab, 0x71, 0x84, 0x58, 0x7e, 0x17, - 0xce, 0xc7, 0xb3, 0xe1, 0x8d, 0x49, 0x64, 0x09, 0x77, 0xff, 0x3a, 0x0d, 0x3a, 0x78, 0x32, 0x39, - 0xcb, 0x5d, 0x49, 0xa5, 0x68, 0x89, 0x27, 0x33, 0xcc, 0x43, 0xbd, 0x72, 0x18, 0xe6, 0xa0, 0x57, - 0x26, 0x61, 0x7e, 0xca, 0x44, 0x2c, 0x33, 0xa8, 0x24, 0xfc, 0xf9, 0x3b, 0x49, 0x49, 0x08, 0x95, - 0xa8, 0x24, 0xf6, 0x3b, 0xb6, 0x6c, 0xc1, 0xe9, 0x28, 0x21, 0xb9, 0x96, 0x22, 0x20, 0x80, 0x53, - 0xd4, 0xc9, 0x70, 0xc1, 0x53, 0x17, 0xc3, 0x3f, 0x6e, 0x24, 0xd6, 0x96, 0x28, 0x34, 0xf1, 0xd4, - 0x25, 0x93, 0x0e, 0xf9, 0x63, 0x09, 0x94, 0x14, 0xca, 0x91, 0x24, 0x31, 0x79, 0x8b, 0xb2, 0x3d, - 0xf5, 0x96, 0x60, 0xac, 0xa3, 0x5c, 0xe3, 0x5a, 0xf6, 0xed, 0xf5, 0x70, 0x89, 0xb1, 0x4e, 0xa0, - 0x05, 0xbb, 0xf7, 0x9f, 0xbd, 0xac, 0x49, 0xcf, 0x5f, 0xd6, 0xa4, 0x9f, 0x5e, 0xd6, 0xa4, 0xa7, - 0xaf, 0x6a, 0x33, 0xcf, 0x5f, 0xd5, 0x66, 0x7e, 0x78, 0x55, 0x9b, 0x79, 0xf0, 0xf7, 0x00, 0x1d, - 0xa1, 0x32, 0x6f, 0xda, 0x88, 0x1c, 0x3b, 0xee, 0x63, 0x3e, 0xea, 0x21, 0xc3, 0x44, 0x6e, 0xf3, - 0x24, 0xf0, 0xa7, 0x19, 0xdd, 0x71, 0x51, 0x77, 0x8e, 0x52, 0xfa, 0x5b, 0xbf, 0x06, 0x00, 0x00, - 0xff, 0xff, 0x09, 0xac, 0x50, 0x17, 0x7a, 0x1a, 0x00, 0x00, + // 1775 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcd, 0x6f, 0xdb, 0x46, + 0x16, 0x37, 0x25, 0xd9, 0x92, 0x9e, 0x1c, 0xc7, 0x61, 0x12, 0x47, 0xa1, 0x63, 0x59, 0xd1, 0xe6, + 0xc3, 0xf1, 0x3a, 0xd4, 0xda, 0xd9, 0xc5, 0xc2, 0x59, 0x2c, 0xb2, 0xb6, 0x83, 0x60, 0xbd, 0x80, + 0xb6, 0x85, 0xea, 0xa2, 0x68, 0xd0, 0x42, 0xa0, 0xc8, 0x31, 0xc3, 0x44, 0x22, 0x05, 0xce, 0xc8, + 0x76, 0xd0, 0xa2, 0x40, 0x7b, 0x2a, 0x7a, 0xca, 0xa1, 0xa7, 0xa2, 0xb7, 0xde, 0x7a, 0x2a, 0x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 0xf6, 0xb2, 0x36, 0xf3, 0xe3, 0xcb, 0xda, 0xcc, 0xfd, 0x3b, 0x01, 0x3a, + 0x42, 0x65, 0xde, 0xb4, 0x11, 0x39, 0x76, 0xdc, 0x47, 0x7c, 0xd4, 0x43, 0x86, 0x89, 0xdc, 0xe6, + 0x49, 0xe0, 0x4f, 0x33, 0xf4, 0x6f, 0x46, 0x94, 0xa8, 0x34, 0x8f, 0x36, 0xbb, 0x73, 0x94, 0xdb, + 0xdf, 0xfa, 0x2d, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x3c, 0xd1, 0xc2, 0x83, 0x1a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/ecocredit/core/types.pb.go b/x/ecocredit/base/types/v1/types.pb.go similarity index 91% rename from x/ecocredit/core/types.pb.go rename to x/ecocredit/base/types/v1/types.pb.go index 02a6c9ade9..f4995047f3 100644 --- a/x/ecocredit/core/types.pb.go +++ b/x/ecocredit/base/types/v1/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: regen/ecocredit/v1/types.proto -package core +package v1 import ( fmt "fmt" @@ -405,45 +405,45 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1/types.proto", fileDescriptor_7b044b6b740b984f) } var fileDescriptor_7b044b6b740b984f = []byte{ - // 598 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xcd, 0x6e, 0x13, 0x31, - 0x10, 0xc7, 0xb3, 0x49, 0x29, 0xcd, 0x44, 0x0d, 0xc5, 0xaa, 0x4a, 0xa8, 0xd0, 0x26, 0x8a, 0x84, - 0x88, 0x84, 0xba, 0x4b, 0x0a, 0x02, 0x89, 0x0b, 0x22, 0x01, 0x24, 0xb8, 0x50, 0x45, 0x3d, 0x71, - 0x89, 0xbc, 0xf6, 0x90, 0xba, 0xdd, 0xd8, 0x91, 0x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 0x58, 0x7b, 0xab, 0xc5, 0x48, 0xc8, 0xfd, 0x53, 0x52, 0x87, 0xb2, - 0xe0, 0x61, 0xd6, 0xb2, 0xe0, 0xc5, 0xb2, 0x46, 0x4d, 0x35, 0xc3, 0xd9, 0xb2, 0x3e, 0x23, 0xdb, - 0xb0, 0xc6, 0x94, 0xb4, 0x9a, 0xb2, 0xd9, 0x34, 0xf3, 0x9c, 0x10, 0x58, 0x91, 0xca, 0x62, 0xa0, - 0xba, 0xb8, 0xfd, 0x31, 0x02, 0xe2, 0xff, 0xf0, 0xfe, 0xd9, 0x04, 0xf7, 0xb4, 0x9a, 0x28, 0x43, - 0x73, 0xb2, 0x09, 0xd7, 0xac, 0xb0, 0x39, 0x06, 0xa2, 0x4f, 0x48, 0x0b, 0x6a, 0x1c, 0x0d, 0xd3, - 0x62, 0xe2, 0xa6, 0xf7, 0xe4, 0x65, 0x89, 0x3c, 0x83, 0x5a, 0xb8, 0xf5, 0xc5, 0x9d, 0x71, 0x13, - 0xd4, 0x76, 0xe3, 0xe4, 0xef, 0x07, 0x98, 0x2c, 0xa0, 0x03, 0x60, 0xf3, 0xf8, 0xe9, 0xca, 0xa7, - 0xcf, 0xcd, 0x52, 0x6f, 0xef, 0xfc, 0x32, 0x8e, 0x2e, 0x2e, 0xe3, 0xe8, 0xd7, 0x65, 0x1c, 0x7d, - 0xb8, 0x8a, 0x4b, 0x17, 0x57, 0x71, 0xe9, 0xfb, 0x55, 0x5c, 0x7a, 0xf7, 0x78, 0xe9, 0xa2, 0xba, - 0xae, 0x3b, 0x12, 0xed, 0x89, 0xd2, 0x47, 0x21, 0xcb, 0x91, 0x8f, 0x50, 0xa7, 0xa7, 0x4b, 0x6f, - 0x94, 0x29, 0x8d, 0xd9, 0xaa, 0x7b, 0xa0, 0x0f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x73, 0x04, - 0x34, 0x3d, 0x2c, 0x04, 0x00, 0x00, + // 603 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcf, 0x6e, 0x13, 0x3f, + 0x10, 0xce, 0x26, 0xfd, 0xf5, 0xd7, 0x4c, 0xd4, 0x50, 0xac, 0xaa, 0x84, 0x0a, 0x6d, 0xa2, 0x48, + 0x88, 0x48, 0xa8, 0xbb, 0xa4, 0x20, 0x21, 0x71, 0xa9, 0x48, 0x00, 0x09, 0x2e, 0x54, 0x51, 0x2f, + 0x70, 0x89, 0xbc, 0xf6, 0x90, 0xba, 0xdd, 0xd8, 0x91, 0xed, 0xf4, 0xcf, 0x5b, 0x20, 0x71, 0xe1, + 0xc8, 0x99, 0x07, 0xe0, 0x19, 0x7a, 0x42, 0x3d, 0x72, 0x02, 0xd4, 0xbe, 0x08, 0x5a, 0xdb, 0xf9, + 0x83, 0xe0, 0xc8, 0x69, 0x67, 0xbe, 0x6f, 0x3c, 0xdf, 0x37, 0xab, 0x19, 0x88, 0x35, 0x8e, 0x50, + 0xa6, 0xc8, 0x14, 0xd3, 0xc8, 0x85, 0x4d, 0x4f, 0xba, 0xa9, 0x3d, 0x9f, 0xa0, 0x49, 0x26, 0x5a, + 0x59, 0x45, 0x88, 0xe3, 0x93, 0x39, 0x9f, 0x9c, 0x74, 0xb7, 0x63, 0xa6, 0xcc, 0x58, 0x99, 0x34, + 0xa3, 0x06, 0xd3, 0x93, 0x6e, 0x86, 0x96, 0x76, 0x53, 0xa6, 0x84, 0xf4, 0x6f, 0xb6, 0x37, 0x47, + 0x6a, 0xa4, 0x5c, 0x98, 0x16, 0x51, 0x40, 0xff, 0xa6, 0x64, 0x2c, 0xb5, 0xe8, 0xf9, 0xf6, 0xd7, + 0x32, 0xac, 0xee, 0x53, 0x4d, 0xc7, 0x86, 0x4c, 0x61, 0xc3, 0xd7, 0x0c, 0x59, 0x4e, 0x8d, 0x19, + 0xbe, 0x43, 0x6c, 0x44, 0xad, 0x4a, 0xa7, 0xb6, 0x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xd7, 0x71, 0xe9, 0xdb, 0x75, 0x5c, 0x7a, 0xbb, 0xb7, 0xb4, + 0xa8, 0xae, 0xeb, 0x8e, 0x44, 0x7b, 0xaa, 0xf4, 0x71, 0xc8, 0x72, 0xe4, 0x23, 0xd4, 0xe9, 0xd9, + 0xd2, 0x8d, 0xba, 0x13, 0x77, 0x2b, 0x5c, 0x1c, 0xfa, 0xaa, 0xbb, 0xd4, 0x87, 0xbf, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x11, 0xc7, 0x3a, 0x07, 0x35, 0x04, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/ecocredit/core/types_batch_issuance.go b/x/ecocredit/base/types/v1/types_batch_issuance.go similarity index 87% rename from x/ecocredit/core/types_batch_issuance.go rename to x/ecocredit/base/types/v1/types_batch_issuance.go index c8dc62dacb..ddedbd7ad6 100644 --- a/x/ecocredit/core/types_batch_issuance.go +++ b/x/ecocredit/base/types/v1/types_batch_issuance.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "cosmossdk.io/errors" @@ -7,6 +7,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate checks if a BatchIssuance is valid. @@ -32,7 +33,7 @@ func (i *BatchIssuance) Validate() error { } if !retiredAmount.IsZero() { - if err = ValidateJurisdiction(i.RetirementJurisdiction); err != nil { + if err = base.ValidateJurisdiction(i.RetirementJurisdiction); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("retirement jurisdiction: %s", err) } } diff --git a/x/ecocredit/core/types_batch_issuance_test.go b/x/ecocredit/base/types/v1/types_batch_issuance_test.go similarity index 98% rename from x/ecocredit/core/types_batch_issuance_test.go rename to x/ecocredit/base/types/v1/types_batch_issuance_test.go index 4d6805a28c..75f433cc11 100644 --- a/x/ecocredit/core/types_batch_issuance_test.go +++ b/x/ecocredit/base/types/v1/types_batch_issuance_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/types_credits.go b/x/ecocredit/base/types/v1/types_credits.go similarity index 77% rename from x/ecocredit/core/types_credits.go rename to x/ecocredit/base/types/v1/types_credits.go index 179f79594b..784726f93f 100644 --- a/x/ecocredit/core/types_credits.go +++ b/x/ecocredit/base/types/v1/types_credits.go @@ -1,13 +1,15 @@ -package core +package v1 import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate checks if Credits is valid. func (c *Credits) Validate() error { - if err := ValidateBatchDenom(c.BatchDenom); err != nil { + if err := base.ValidateBatchDenom(c.BatchDenom); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("batch denom: %s", err) } diff --git a/x/ecocredit/core/types_credits_test.go b/x/ecocredit/base/types/v1/types_credits_test.go similarity index 98% rename from x/ecocredit/core/types_credits_test.go rename to x/ecocredit/base/types/v1/types_credits_test.go index 6ab63d63b4..787ca67e4a 100644 --- a/x/ecocredit/core/types_credits_test.go +++ b/x/ecocredit/base/types/v1/types_credits_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/types_origin_tx.go b/x/ecocredit/base/types/v1/types_origin_tx.go similarity index 87% rename from x/ecocredit/core/types_origin_tx.go rename to x/ecocredit/base/types/v1/types_origin_tx.go index c57d63d914..a4662d7b0d 100644 --- a/x/ecocredit/core/types_origin_tx.go +++ b/x/ecocredit/base/types/v1/types_origin_tx.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "regexp" @@ -6,6 +6,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/regen-network/regen-ledger/types/eth" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var reOriginTxID = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9 _\-]{0,127}$`) @@ -32,8 +33,8 @@ func (o *OriginTx) Validate() error { return sdkerrors.ErrInvalidAddress.Wrapf("origin_tx.contract must be a valid ethereum address") } - if len(o.Note) > MaxNoteLength { - return sdkerrors.ErrInvalidRequest.Wrapf("origin_tx.note must be at most %d characters long", MaxNoteLength) + if len(o.Note) > base.MaxNoteLength { + return sdkerrors.ErrInvalidRequest.Wrapf("origin_tx.note must be at most %d characters long", base.MaxNoteLength) } return nil diff --git a/x/ecocredit/core/types_origin_tx_test.go b/x/ecocredit/base/types/v1/types_origin_tx_test.go similarity index 99% rename from x/ecocredit/core/types_origin_tx_test.go rename to x/ecocredit/base/types/v1/types_origin_tx_test.go index 0791857365..30951077da 100644 --- a/x/ecocredit/core/types_origin_tx_test.go +++ b/x/ecocredit/base/types/v1/types_origin_tx_test.go @@ -1,4 +1,4 @@ -package core +package v1 import ( "testing" diff --git a/x/ecocredit/core/v1alpha1/codec.go b/x/ecocredit/base/types/v1alpha1/codec.go similarity index 100% rename from x/ecocredit/core/v1alpha1/codec.go rename to x/ecocredit/base/types/v1alpha1/codec.go diff --git a/x/ecocredit/core/v1alpha1/events.pb.go b/x/ecocredit/base/types/v1alpha1/events.pb.go similarity index 94% rename from x/ecocredit/core/v1alpha1/events.pb.go rename to x/ecocredit/base/types/v1alpha1/events.pb.go index b6d5cff984..955fa28890 100644 --- a/x/ecocredit/core/v1alpha1/events.pb.go +++ b/x/ecocredit/base/types/v1alpha1/events.pb.go @@ -440,37 +440,37 @@ func init() { } var fileDescriptor_5b6a013b00aef3af = []byte{ - // 469 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0x63, 0x4a, 0x93, 0x66, 0x12, 0xda, 0xca, 0x42, 0xc8, 0x20, 0x30, 0xd4, 0x52, 0x05, - 0x1c, 0x88, 0x55, 0xf1, 0x00, 0x88, 0xa6, 0x1c, 0x90, 0x38, 0xf5, 0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0x9b, 0xf6, 0x2e, 0xb7, 0x69, 0xef, 0x6a, 0x9b, - 0xf6, 0x3e, 0xbc, 0x9a, 0x69, 0x9a, 0xaf, 0xca, 0x89, 0xb4, 0x8b, 0x9c, 0x77, 0xe6, 0x85, 0x41, - 0xfa, 0x64, 0xdd, 0x45, 0x50, 0x15, 0xaa, 0x19, 0xba, 0xfc, 0xf3, 0x2f, 0x1b, 0x27, 0xad, 0xc3, - 0x6e, 0xed, 0xca, 0x3e, 0x2f, 0xdc, 0xcb, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xc6, 0xe2, - 0xb8, 0x99, 0x03, 0x00, 0x00, + // 472 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xc1, 0x6e, 0x13, 0x31, + 0x10, 0x86, 0xb3, 0x94, 0x26, 0xcd, 0x24, 0xb4, 0x95, 0x85, 0xd0, 0x82, 0x60, 0xa1, 0x91, 0x2a, + 0xe0, 0x40, 0x56, 0x15, 0x4f, 0x40, 0xd3, 0x1e, 0x90, 0x38, 0xf5, 0xc8, 0x65, 0xe5, 0xb5, 0x47, + 0x89, 0xe9, 0xc6, 0x5e, 0xd9, 0x93, 0x00, 0x12, 0x0f, 0xc1, 0x63, 0x71, 0xec, 0xb1, 0x47, 0x94, + 0xdc, 0x79, 0x06, 0xb4, 0xb6, 0x77, 0x4b, 0x41, 0x42, 0x88, 0xdb, 0xfe, 0x9f, 0xff, 0xf5, 0xcc, + 0x3f, 0xd6, 0xc0, 0xb1, 0xc5, 0x39, 0xea, 0x1c, 0x85, 0x11, 0x16, 0xa5, 0xa2, 0x7c, 0x7d, 0xc2, + 0xab, 0x7a, 0xc1, 0x4f, 0x72, 0x5c, 0xa3, 0x26, 0x37, 0xad, 0xad, 0x21, 0xc3, 0x52, 0x6f, 0x9b, + 0x76, 0xb6, 0x69, 0x6b, 0x9b, 0xcc, 0x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e, 0xcf, 0xe1, 0x80, + 0x2c, 0x97, 0xbc, 0xac, 0xf0, 0x76, 0xe4, 0xfd, 0x16, 0xc7, 0xd4, 0xc7, 0xb0, 0x6f, 0x91, 0x94, + 0x45, 0xd9, 0xfa, 0x42, 0xf2, 0x7b, 0x91, 0x46, 0xdb, 0x11, 0x8c, 0x4b, 0xee, 0x2e, 0x91, 0x62, + 0xc5, 0x30, 0x81, 0x51, 0x60, 0xbe, 0xe4, 0xe4, 0x0b, 0x8c, 0x62, 0xb2, 0xe6, 0x47, 0x96, 0xc2, + 0x20, 0x5c, 0xd1, 0x26, 0x6b, 0xe5, 0x3f, 0x3d, 0x62, 0xec, 0x25, 0x3e, 0x62, 0x50, 0xec, 0x11, + 0xec, 0x75, 0xf3, 0x0d, 0x69, 0x3a, 0x3d, 0x91, 0xb1, 0xfa, 0x8c, 0x6b, 0x81, 0x55, 0x33, 0x3e, + 0xe1, 0xbf, 0xaa, 0xae, 0xfe, 0x0d, 0xf8, 0xef, 0x0e, 0x4e, 0x8b, 0x6f, 0x9b, 0x2c, 0xb9, 0xda, + 0x64, 0xc9, 0xf7, 0x4d, 0x96, 0x7c, 0xdd, 0x66, 0xbd, 0xab, 0x6d, 0xd6, 0xbb, 0xde, 0x66, 0xbd, + 0xf7, 0xe7, 0x73, 0x45, 0x8b, 0x55, 0x39, 0x15, 0x66, 0x99, 0xfb, 0x9d, 0x79, 0xa5, 0x91, 0x3e, + 0x1a, 0x7b, 0x19, 0x55, 0x85, 0x72, 0x8e, 0x36, 0xff, 0xf4, 0xcb, 0xc6, 0x95, 0xdc, 0x61, 0x4e, + 0x9f, 0x6b, 0x74, 0xdd, 0xf2, 0x95, 0x7d, 0xbf, 0x76, 0xaf, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, + 0x69, 0x5a, 0xd9, 0x68, 0x9f, 0x03, 0x00, 0x00, } func (m *EventCreateClass) Marshal() (dAtA []byte, err error) { diff --git a/x/ecocredit/core/v1alpha1/genesis.pb.go b/x/ecocredit/base/types/v1alpha1/genesis.pb.go similarity index 91% rename from x/ecocredit/core/v1alpha1/genesis.pb.go rename to x/ecocredit/base/types/v1alpha1/genesis.pb.go index fe57355e11..74c0fdecc2 100644 --- a/x/ecocredit/core/v1alpha1/genesis.pb.go +++ b/x/ecocredit/base/types/v1alpha1/genesis.pb.go @@ -264,36 +264,36 @@ func init() { } var fileDescriptor_2f9cb84fe1853321 = []byte{ - // 460 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xe3, 0x26, 0xa4, 0xcd, 0x04, 0x5a, 0xb4, 0xe2, 0x60, 0xf5, 0xe0, 0x86, 0xf0, 0x91, - 0x72, 0xc0, 0x56, 0xcb, 0x95, 0x0f, 0xc9, 0x80, 0x10, 0x37, 0xe4, 0x70, 0x81, 0x4b, 0xb4, 0xb6, - 0xa7, 0x8e, 0x85, 0xe3, 0x75, 0x77, 0x37, 0x80, 0xdf, 0x82, 0x23, 0xe2, 0x89, 0x7a, 0xcc, 0x91, - 0x13, 0x42, 0xc9, 0x8b, 0x20, 0xef, 0x87, 0x41, 0xa0, 0x84, 0xdb, 0xee, 0xe4, 0x37, 0xbf, 0xff, - 0x64, 0xac, 0x85, 0xfb, 0x1c, 0x33, 0x2c, 0x03, 0x4c, 0x58, 0xc2, 0x31, 0xcd, 0x65, 0xf0, 0xf1, - 0x8c, 0x16, 0xd5, 0x9c, 0x9e, 0x05, 0x19, 0x96, 0x28, 0x72, 0xe1, 0x57, 0x9c, 0x49, 0x46, 0x5c, - 0xc5, 0xf9, 0x2d, 0xe7, 0x5b, 0xee, 0xf8, 0x56, 0xc6, 0x32, 0xa6, 0xa0, 0xa0, 0x39, 0x69, 0xfe, - 0xf8, 0xee, 0x56, 0xaf, 0xac, 0x2b, 0x34, 0xd6, 0xf1, 0xb7, 0x2e, 0x5c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7, 0x29, 0x8d, 0x0b, 0x9c, 0x99, 0xc9, 0xdc, 0xae, 0xa2, 0x8e, 0x6c, 0xdd, 0xa6, - 0x4c, 0xe0, 0x88, 0xa3, 0xcc, 0x39, 0xa6, 0x2d, 0xd9, 0x53, 0xe4, 0xa1, 0x29, 0x1b, 0x70, 0x5c, - 0x43, 0x5f, 0x8f, 0xfb, 0x77, 0xbc, 0xf3, 0x4f, 0xfc, 0x04, 0xda, 0x98, 0x99, 0xfa, 0x6b, 0xb5, - 0x99, 0xf1, 0xd0, 0x96, 0x8d, 0xe9, 0x1e, 0xd8, 0x14, 0xcb, 0xe9, 0x29, 0x6f, 0x98, 0xaa, 0xc6, - 0xc2, 0x77, 0x57, 0x6b, 0xcf, 0x59, 0xad, 0x3d, 0xe7, 0xe7, 0xda, 0x73, 0xbe, 0x6c, 0xbc, 0xce, - 0x6a, 0xe3, 0x75, 0xbe, 0x6f, 0xbc, 0xce, 0xfb, 0x67, 0x59, 0x2e, 0xe7, 0xcb, 0xd8, 0x4f, 0xd8, - 0x22, 0x50, 0x5b, 0x7e, 0x58, 0xa2, 0xfc, 0xc4, 0xf8, 0x07, 0x73, 0x2b, 0x30, 0xcd, 0x90, 0x07, - 0x9f, 0xff, 0x78, 0x14, 0x09, 0xe3, 0xd8, 0xbe, 0x8c, 0xb8, 0xaf, 0x1e, 0xc5, 0xa3, 0x5f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x48, 0x3b, 0x85, 0x55, 0x94, 0x03, 0x00, 0x00, + // 461 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xe3, 0x26, 0xa4, 0xcd, 0x04, 0x5a, 0xb4, 0xe2, 0x60, 0xf5, 0xe0, 0x86, 0xf0, 0x27, + 0xe5, 0x80, 0xad, 0x96, 0x2b, 0x70, 0x08, 0x54, 0x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x5e, 0xe7, 0xc3, 0x45, 0x96, 0xcb, 0xf9, 0x32, 0xf6, 0x13, 0xb6, + 0x08, 0xd4, 0x96, 0x9f, 0x96, 0x28, 0x3f, 0x33, 0xfe, 0xd1, 0x54, 0x05, 0xa6, 0x19, 0xf2, 0xe0, + 0xcb, 0x5f, 0x47, 0x11, 0x53, 0x81, 0xfa, 0x20, 0xda, 0xfb, 0x88, 0xfb, 0xea, 0x34, 0x9e, 0xfd, + 0x0e, 0x00, 0x00, 0xff, 0xff, 0x95, 0x38, 0xac, 0x55, 0x9a, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/ecocredit/core/v1alpha1/query.pb.go b/x/ecocredit/base/types/v1alpha1/query.pb.go similarity index 94% rename from x/ecocredit/core/v1alpha1/query.pb.go rename to x/ecocredit/base/types/v1alpha1/query.pb.go index 5714d3dbb0..5e690f9fdd 100644 --- a/x/ecocredit/core/v1alpha1/query.pb.go +++ b/x/ecocredit/base/types/v1alpha1/query.pb.go @@ -828,61 +828,61 @@ func init() { var fileDescriptor_6a16cc4c1db940dc = []byte{ // 876 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4d, 0x4f, 0xdb, 0x48, - 0x18, 0xc7, 0x71, 0x76, 0x37, 0x59, 0x26, 0xbb, 0xac, 0x34, 0xcb, 0xee, 0x86, 0x68, 0x95, 0xa6, - 0x86, 0x42, 0x5a, 0x11, 0x4f, 0x93, 0x52, 0xe0, 0xd0, 0x17, 0x01, 0x55, 0x11, 0xa7, 0x42, 0xda, - 0x4b, 0x2b, 0x55, 0xd1, 0xc4, 0x19, 0x82, 0xd5, 0xc4, 0x63, 0x6c, 0x87, 0x82, 0x10, 0x97, 0x7e, - 0x81, 0x56, 0xe2, 0xde, 0x53, 0x5f, 0x6e, 0xbd, 0xf4, 0x4b, 0xf4, 0x88, 0xd4, 0x4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0x6e, 0xf3, 0x9a, 0x97, 0x83, 0xd7, 0x43, 0x7c, 0x29, 0xc1, + 0x37, 0x17, 0xcb, 0x27, 0x7b, 0x87, 0x00, 0xab, 0xe8, 0xbf, 0x3e, 0x9f, 0xe8, 0x01, 0x0a, 0x4c, + 0xa1, 0x3f, 0x45, 0xb3, 0xba, 0xd1, 0x14, 0xe7, 0x1f, 0x87, 0xe6, 0x1b, 0x4d, 0x75, 0x0b, 0xfd, + 0x3f, 0x98, 0x03, 0xa7, 0x5a, 0x42, 0xbf, 0x1b, 0xe6, 0x36, 0x07, 0xc1, 0x12, 0x1d, 0x49, 0x24, + 0xa8, 0xfb, 0x30, 0x86, 0x55, 0xea, 0xea, 0x3b, 0xfd, 0x31, 0x44, 0x43, 0x0c, 0x4c, 0x28, 0xf5, + 0xf3, 0x13, 0xf2, 0x5b, 0xf7, 0x27, 0xd4, 0x90, 0x4b, 0xf1, 0x13, 0x12, 0xb9, 0x72, 0x42, 0x90, + 0xf3, 0xeb, 0x26, 0xb4, 0x0c, 0x13, 0xea, 0xf7, 0x00, 0x71, 0xae, 0xa0, 0xac, 0x68, 0x56, 0x6f, + 0x32, 0x93, 0x77, 0x40, 0x1f, 0x24, 0x96, 0xee, 0xf7, 0x56, 0xfc, 0x39, 0x05, 0x32, 0x47, 0x9d, + 0x53, 0x3f, 0x55, 0xce, 0x69, 0xd3, 0x9f, 0x53, 0x9b, 0x9a, 0xba, 0x27, 0x28, 0xce, 0xa1, 0x0c, + 0xd5, 0x75, 0xde, 0x35, 0x5d, 0x6f, 0x4c, 0xf0, 0x39, 0x08, 0x99, 0x1a, 0x82, 0xdc, 0xf6, 0xe5, + 0x87, 0x8a, 0x80, 0x38, 0x87, 0xfe, 0x71, 0x6d, 0xda, 0xa4, 0x8d, 0x36, 0xab, 0xd3, 0x4e, 0xa0, + 0xf4, 0x84, 0xb7, 0xbc, 0x22, 0x56, 0xf1, 0x35, 0x34, 0x61, 0x33, 0xd7, 0xb0, 0x59, 0xd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0, 0xf5, 0xc4, 0xea, 0x39, 0xe4, 0x38, 0xea, 0x92, 0xc0, 0xad, + 0x60, 0x12, 0x8d, 0x0b, 0x6c, 0xe4, 0x30, 0x70, 0x23, 0x8f, 0xf0, 0x27, 0x21, 0xa9, 0xf0, 0x86, + 0x04, 0x92, 0x06, 0x5d, 0x29, 0x81, 0xa4, 0x21, 0xcb, 0x51, 0x37, 0x04, 0xe3, 0x1a, 0x5e, 0x19, + 0x91, 0x91, 0x34, 0x64, 0x21, 0x72, 0x08, 0xae, 0x77, 0x84, 0xdf, 0x29, 0x28, 0x0d, 0x0e, 0x30, + 0x1f, 0x43, 0x11, 0x32, 0xa4, 0x7c, 0x39, 0x61, 0x34, 0x20, 0xdf, 0x13, 0xc8, 0xcb, 0x78, 0x71, + 0x54, 0x64, 0x69, 0x46, 0xbd, 0x7b, 0x95, 0x0d, 0x18, 0x0b, 0xae, 0xc4, 0x5d, 0x94, 0x21, 0x7f, + 0xca, 0x57, 0x47, 0x49, 0x01, 0x6c, 0x4d, 0x60, 0x97, 0xf0, 0xec, 0x05, 0x3f, 0x5e, 0xf1, 0x5d, + 0x16, 0xbe, 0x86, 0x5f, 0x29, 0x28, 0x2d, 0x1f, 0x6e, 0xb1, 0x72, 0x86, 0xde, 0x8b, 0xb1, 0x72, + 0x86, 0xdf, 0x91, 0x6a, 0x49, 0x70, 0xa9, 0xb8, 0x18, 0xcd, 0x25, 0xdf, 0x8d, 0xab, 0xf5, 0xcf, + 0xa7, 0x05, 0xe5, 0xe4, 0xb4, 0xa0, 0x7c, 0x3b, 0x2d, 0x28, 0xaf, 0xcf, 0x0a, 0x63, 0x27, 0x67, + 0x85, 0xb1, 0xaf, 0x67, 0x85, 0xb1, 0xa7, 0x0f, 0x5a, 0x86, 0xbb, 0xd3, 0x6d, 0x68, 0x3a, 0xef, + 0xc8, 0x2a, 0x65, 0x93, 0xb9, 0x2f, 0xb8, 0xfd, 0x1c, 0xbe, 0xda, 0xac, 0xd9, 0x62, 0x36, 0xd9, + 0x0f, 0x14, 0x17, 0x6f, 0x6a, 0x71, 0x52, 0xbf, 0x4f, 0x23, 0x2d, 0x9e, 0xc1, 0xb7, 0x7e, 0x04, + 0x00, 0x00, 0xff, 0xff, 0x0b, 0x76, 0xd2, 0xfb, 0xb8, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/ecocredit/core/v1alpha1/query.pb.gw.go b/x/ecocredit/base/types/v1alpha1/query.pb.gw.go similarity index 100% rename from x/ecocredit/core/v1alpha1/query.pb.gw.go rename to x/ecocredit/base/types/v1alpha1/query.pb.gw.go diff --git a/x/ecocredit/core/v1alpha1/tx.go b/x/ecocredit/base/types/v1alpha1/tx.go similarity index 100% rename from x/ecocredit/core/v1alpha1/tx.go rename to x/ecocredit/base/types/v1alpha1/tx.go diff --git a/x/ecocredit/core/v1alpha1/tx.pb.go b/x/ecocredit/base/types/v1alpha1/tx.pb.go similarity index 95% rename from x/ecocredit/core/v1alpha1/tx.pb.go rename to x/ecocredit/base/types/v1alpha1/tx.pb.go index 09df6bd461..1169231850 100644 --- a/x/ecocredit/core/v1alpha1/tx.pb.go +++ b/x/ecocredit/base/types/v1alpha1/tx.pb.go @@ -1213,66 +1213,67 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1alpha1/tx.proto", fileDescriptor_96891bdd11ac56ed) } var fileDescriptor_96891bdd11ac56ed = []byte{ - // 944 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4f, 0x6f, 0xdc, 0x54, - 0x10, 0x8f, 0x77, 0xb7, 0xbb, 0xd9, 0x59, 0xf2, 0xa7, 0x4e, 0x89, 0x8c, 0x4b, 0x37, 0x5b, 0x57, - 0x88, 0xad, 0x50, 0xed, 0x26, 0x15, 0xff, 0xc4, 0xa1, 0x6a, 0x52, 0x89, 0x46, 0xb0, 0x1c, 0x4c, - 0x38, 0xd0, 0xcb, 0xea, 0xad, 0x3d, 0x38, 0x86, 0xb5, 0x9f, 0x65, 0xbf, 0x90, 0xf4, 0x82, 0xc4, - 0x85, 0x1b, 0x52, 0x3f, 0x09, 0xdc, 0xfb, 0x09, 0x38, 0xf6, 0x84, 0xb8, 0x81, 0x92, 0x03, 0x5f, - 0x03, 0xf9, 0xbd, 0xe7, 0x17, 0x3b, 0x5d, 0x76, 0xbd, 0x02, 0xa9, 0x97, 0xf5, 0xce, 0xf8, 0x37, - 0x33, 0xbf, 0x99, 0x37, 0x6f, 0xc6, 0x70, 0x3b, 0xc5, 0x00, 0x63, 0x07, 0x3d, 0xea, 0xa5, 0xe8, - 0x87, 0xcc, 0xf9, 0x7e, 0x97, 0x4c, 0x93, 0x63, 0xb2, 0xeb, 0xb0, 0x33, 0x3b, 0x49, 0x29, 0xa3, - 0xba, 0xc1, 0x21, 0xb6, 0x82, 0xd8, 0x05, 0xc4, 0xbc, 0x11, 0xd0, 0x80, 0x72, 0x90, 0x93, 0xff, - 0x13, 0x78, 0x73, 0x27, 0xa0, 0x34, 0x98, 0xa2, 0xc3, 0xa5, 0xc9, 0xc9, 0x37, 0x0e, 0x0b, 0x23, - 0xcc, 0x18, 0x89, 0x12, 0x01, 0xb0, 0x7e, 0xd2, 0x60, 0x7d, 0x94, 0x05, 0x07, 0x29, 0x12, 0x86, - 0x07, 0x53, 0x92, 0x65, 0xfa, 0x0d, 0xb8, 0x46, 0xfc, 0x28, 0x8c, 0x0d, 0x6d, 0xa0, 0x0d, 0xbb, - 0xae, 0x10, 0x74, 0x03, 0x3a, 0x61, 0x96, 0x9d, 0x60, 0x9a, 0x19, 0x8d, 0x41, 0x73, 0xd8, 0x75, - 0x0b, 0x51, 0x37, 0x61, 0x35, 0x42, 0x46, 0x7c, 0xc2, 0x88, 0xd1, 0x1c, 0x68, 0xc3, 0x37, 0x5c, - 0x25, 0xeb, 0x43, 0xd8, 0x14, 0x44, 0xc7, 0xec, 0x59, 0x82, 0xe3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a6, 0x79, - 0x77, 0x21, 0x44, 0x79, 0x7d, 0x0a, 0x6d, 0x39, 0x81, 0xee, 0xd4, 0x18, 0x2c, 0xe6, 0x7b, 0x35, - 0x40, 0x65, 0xdf, 0xf2, 0xbe, 0xdf, 0xa9, 0x71, 0x8d, 0x17, 0xf8, 0xae, 0xde, 0x3e, 0xfd, 0x0c, - 0x36, 0x5f, 0xb9, 0x7a, 0xf3, 0xd7, 0xc9, 0x55, 0xb8, 0xf9, 0xfe, 0x52, 0x70, 0x15, 0xf9, 0x07, - 0xd0, 0x67, 0x5c, 0x38, 0xa7, 0xae, 0x33, 0x69, 0x60, 0x7e, 0xb8, 0xa4, 0x81, 0x8a, 0xff, 0xa3, - 0x06, 0x5b, 0xb3, 0x2e, 0xdb, 0xfd, 0xba, 0x0e, 0x0b, 0x0b, 0xf3, 0xa3, 0x65, 0x2d, 0x0a, 0x0e, - 0xfb, 0x5f, 0xff, 0x76, 0xde, 0xd7, 0x5e, 0x9e, 0xf7, 0xb5, 0xbf, 0xce, 0xfb, 0xda, 0xf3, 0x8b, - 0xfe, 0xca, 0xcb, 0x8b, 0xfe, 0xca, 0x1f, 0x17, 0xfd, 0x95, 0xa7, 0x0f, 0x83, 0x90, 0x1d, 0x9f, - 0x4c, 0x6c, 0x8f, 0x46, 0x0e, 0xf7, 0x7e, 0x2f, 0x46, 0x76, 0x4a, 0xd3, 0xef, 0xa4, 0x34, 0x45, - 0x3f, 0xc0, 0xd4, 0x39, 0x2b, 0x7d, 0xc4, 0x7b, 0x34, 0x45, 0xf5, 0x25, 0x3f, 0x69, 0xf3, 0x0f, - 0xb4, 0x07, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x0b, 0x42, 0x7d, 0xec, 0x0b, 0x00, 0x00, + // 947 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4f, 0x6f, 0xe3, 0x54, + 0x10, 0xaf, 0x93, 0x6c, 0xd2, 0x4c, 0xe8, 0x9f, 0x75, 0x97, 0x2a, 0x78, 0xd9, 0x34, 0xeb, 0x15, + 0x22, 0x2b, 0xb4, 0xf6, 0xb6, 0x2b, 0xfe, 0x89, 0x03, 0xda, 0x76, 0x11, 0x5b, 0x41, 0x38, 0x98, + 0x72, 0xd9, 0x8b, 0xf5, 0x62, 0x0f, 0xae, 0x21, 0xfe, 0x23, 0xbf, 0x57, 0xda, 0xbd, 0x20, 0x71, + 0xe1, 0x86, 0xb4, 0x9f, 0x04, 0xee, 0xfb, 0x09, 0x38, 0xee, 0x09, 0x71, 0x03, 0xb5, 0x07, 0xbe, + 0x06, 0xf2, 0x7b, 0xcf, 0xaf, 0x76, 0x1b, 0x12, 0x47, 0x20, 0x71, 0x89, 0x33, 0xe3, 0xdf, 0xcc, + 0xfc, 0x66, 0x3c, 0x6f, 0xe6, 0xc1, 0xdd, 0x0c, 0x03, 0x8c, 0x6d, 0xf4, 0x12, 0x2f, 0x43, 0x3f, + 0x64, 0xf6, 0x77, 0xbb, 0x64, 0x9a, 0x1e, 0x93, 0x5d, 0x9b, 0x9d, 0x59, 0x69, 0x96, 0xb0, 0x44, + 0xef, 0x73, 0x88, 0xa5, 0x20, 0x56, 0x01, 0x31, 0x6e, 0x05, 0x49, 0x90, 0x70, 0x90, 0x9d, 0xff, + 0x13, 0x78, 0x63, 0x27, 0x48, 0x92, 0x60, 0x8a, 0x36, 0x97, 0x26, 0x27, 0x5f, 0xdb, 0x2c, 0x8c, + 0x90, 0x32, 0x12, 0xa5, 0x02, 0x60, 0xfe, 0xa8, 0xc1, 0xfa, 0x98, 0x06, 0x07, 0x19, 0x12, 0x86, + 0x07, 0x53, 0x42, 0xa9, 0x7e, 0x0b, 0x6e, 0x10, 0x3f, 0x0a, 0xe3, 0xbe, 0x36, 0xd4, 0x46, 0x5d, + 0x47, 0x08, 0x7a, 0x1f, 0x3a, 0x21, 0xa5, 0x27, 0x98, 0xd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4, 0xcd, 0xaf, 0x69, 0x8f, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xd8, 0x5e, 0xd3, 0xf2, + 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/ecocredit/core/v1alpha1/types.pb.go b/x/ecocredit/base/types/v1alpha1/types.pb.go similarity index 91% rename from x/ecocredit/core/v1alpha1/types.pb.go rename to x/ecocredit/base/types/v1alpha1/types.pb.go index f4e34f1052..fa6bd90813 100644 --- a/x/ecocredit/core/v1alpha1/types.pb.go +++ b/x/ecocredit/base/types/v1alpha1/types.pb.go @@ -478,55 +478,55 @@ func init() { } var fileDescriptor_5342f4dcaeff1a84 = []byte{ - // 760 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xeb, 0x44, - 0x14, 0x8e, 0x9b, 0x5f, 0x9f, 0xe4, 0x42, 0xee, 0x50, 0x5d, 0xf9, 0x46, 0x90, 0x84, 0xa8, 0x8b, - 0x54, 0xa8, 0x36, 0x29, 0xec, 0x58, 0x54, 0x24, 0x6d, 0x51, 0x25, 0x84, 0x90, 0xe9, 0x06, 0x36, - 0xd6, 0xd8, 0x3e, 0x4d, 0x4d, 0xed, 0x99, 0xd4, 0x33, 0x4e, 0xa9, 0x78, 0x89, 0x3e, 0x06, 0xe2, - 0x49, 0xba, 0xec, 0x12, 0xb1, 0xa0, 0xa8, 0x7d, 0x03, 0x9e, 0x00, 0x79, 0x66, 0x92, 0xb4, 0xfc, - 0x88, 0x2e, 0x58, 0xe5, 0x9c, 0x6f, 0xe6, 0xcb, 0x99, 0xef, 0x9c, 0xef, 0x18, 0x76, 0x72, 0x9c, - 0x23, 0xf3, 0x30, 0xe2, 0x51, 0x8e, 0x71, 0x22, 0xbd, 0xe5, 0x84, 0xa6, 0x8b, 0x73, 0x3a, 0xf1, - 0xe4, 0xf5,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e0, 0xe5, 0xdf, 0xca, 0x58, 0xff, 0x50, 0xe6, 0x03, 0x00, 0x81, - 0x97, 0x01, 0x2b, 0xb2, 0x10, 0x73, 0xf5, 0x90, 0x9a, 0x6f, 0x0b, 0xbc, 0xfc, 0x4a, 0x01, 0xd3, - 0x6f, 0x6f, 0x1f, 0xfa, 0xd6, 0xdd, 0x43, 0xdf, 0xfa, 0xfd, 0xa1, 0x6f, 0xdd, 0x3c, 0xf6, 0x2b, - 0x77, 0x8f, 0xfd, 0xca, 0x2f, 0x8f, 0xfd, 0xca, 0x77, 0x07, 0x4f, 0x5a, 0xa4, 0xe6, 0xb3, 0xc7, - 0x50, 0x5e, 0xf1, 0xfc, 0xc2, 0x64, 0x29, 0xc6, 0x73, 0xcc, 0xbd, 0x1f, 0x9e, 0x7c, 0x9b, 0x23, - 0x9e, 0xe3, 0xfa, 0x03, 0x1d, 0x36, 0xd4, 0x7e, 0x7c, 0xf2, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x12, 0x1e, 0xb7, 0x4c, 0xc3, 0x05, 0x00, 0x00, + // 759 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcf, 0x6e, 0xfb, 0x44, + 0x10, 0x8e, 0x9b, 0xbf, 0x9e, 0xe4, 0x07, 0xf9, 0x2d, 0x55, 0xe5, 0x46, 0x90, 0x84, 0xa8, 0x87, + 0x54, 0xa8, 0x36, 0x29, 0xdc, 0x38, 0x20, 0x92, 0xb6, 0xa8, 0x12, 0x42, 0xc8, 0xf4, 0xc4, 0xc5, + 0x5a, 0xdb, 0xd3, 0xd4, 0xd4, 0xde, 0x4d, 0xbd, 0xeb, 0x94, 0x8a, 0x97, 0xe8, 0x63, 0x20, 0x9e, + 0xa4, 0xc7, 0x1e, 0x11, 0x07, 0x8a, 0xda, 0x37, 0xe0, 0x09, 0x90, 0x77, 0x37, 0x49, 0xcb, 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bb, 0x33, 0xe5, 0x9f, 0xdd, 0x2c, 0xd0, 0x87, 0x68, 0x6d, 0x93, + 0x01, 0xb4, 0x59, 0x91, 0x05, 0x21, 0x95, 0xd1, 0x05, 0x0a, 0xa7, 0x31, 0xb4, 0xc6, 0x35, 0x1f, + 0x58, 0x91, 0x4d, 0x35, 0x32, 0xfa, 0x63, 0x0b, 0x6c, 0x65, 0xff, 0x57, 0x71, 0x03, 0x68, 0xab, + 0xbf, 0x04, 0x31, 0x32, 0x9e, 0x99, 0x12, 0x41, 0x41, 0x47, 0x25, 0x42, 0x76, 0xa0, 0xa1, 0x0b, + 0x73, 0xaa, 0xea, 0xcc, 0x78, 0xe4, 0x43, 0xe8, 0x48, 0x2e, 0x69, 0x1a, 0xd0, 0x8c, 0x17, 0x4c, + 0xaa, 0x4a, 0x6d, 0xbf, 0xad, 0xb0, 0x2f, 0x14, 0xf4, 0xa2, 0x11, 0xf5, 0xbf, 0x34, 0x62, 0x1f, + 0xba, 0x9a, 0x18, 0x44, 0x94, 0x45, 0x98, 0xa6, 0x18, 0xab, 0x32, 0x6c, 0xff, 0x5d, 0x8d, 0xcf, + 0x56, 0x30, 0xf9, 0x1c, 0x40, 0x48, 0x9a, 0xcb, 0x20, 0xa6, 0x12, 0x9d, 0xa6, 0x6a, 0x59, 0xcf, + 0xd5, 0xe3, 0x75, 0x57, 0xe3, 0x75, 0xcf, 0x56, 0xe3, 0x9d, 0xd6, 0x6e, 0x1f, 0x06, 0x96, 0x6f, + 0x2b, 0xce, 0x11, 0x95, 0x48, 0x3e, 0x83, 0x16, 0xb2, 0x58, 0xd3, 0x5b, 0xaf, 0xa4, 0x37, 0x91, + 0xc5, 0x8a, 0xbc, 0x0f, 0xdd, 0x45, 0xce, 0xbf, 0xc7, 0x48, 0x06, 0x29, 0x8f, 0xa8, 0x4c, 0x38, + 0x73, 0x6c, 0x7d, 0x51, 0x83, 0x7f, 0x65, 0xe0, 0xd1, 0x4f, 0x55, 0x68, 0x7c, 0x43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x19, 0x2f, 0xb0, 0x92, 0x57, 0xb0, 0x44, 0x9a, 0xcd, 0x50, 0x36, 0x79, + 0x1f, 0xec, 0x45, 0x8e, 0x51, 0x22, 0x4a, 0x52, 0xb9, 0x14, 0x6f, 0xfc, 0x0d, 0x30, 0xf2, 0xe1, + 0xcd, 0x26, 0xef, 0xb7, 0x78, 0xf5, 0xb7, 0x34, 0xd6, 0x3f, 0xa4, 0xf9, 0x00, 0x40, 0xe0, 0x55, + 0xc0, 0x8a, 0x2c, 0xc4, 0x5c, 0x5d, 0xa4, 0xe6, 0xdb, 0x02, 0xaf, 0xbe, 0x56, 0xc0, 0x34, 0xb8, + 0x7b, 0xec, 0x5b, 0xf7, 0x8f, 0x7d, 0xeb, 0xf7, 0xc7, 0xbe, 0x75, 0xfb, 0xd4, 0xaf, 0xdc, 0x3f, + 0xf5, 0x2b, 0xbf, 0x3c, 0xf5, 0x2b, 0xdf, 0x1d, 0x3f, 0x6b, 0x91, 0x9a, 0xcf, 0x01, 0x43, 0x79, + 0xcd, 0xf3, 0x4b, 0xe3, 0xa5, 0x18, 0xcf, 0x31, 0xf7, 0x7e, 0x78, 0xf6, 0x36, 0xab, 0x47, 0x56, + 0x35, 0x6f, 0xfd, 0x4c, 0x87, 0x0d, 0xb5, 0x25, 0x9f, 0xfc, 0x19, 0x00, 0x00, 0xff, 0xff, 0xa5, + 0x1b, 0x4d, 0xb8, 0xc9, 0x05, 0x00, 0x00, } func (m *ClassInfo) Marshal() (dAtA []byte, err error) { diff --git a/x/ecocredit/core/utils.go b/x/ecocredit/base/utils.go similarity index 99% rename from x/ecocredit/core/utils.go rename to x/ecocredit/base/utils.go index ea212977a9..9bc1d6fde5 100644 --- a/x/ecocredit/core/utils.go +++ b/x/ecocredit/base/utils.go @@ -1,4 +1,4 @@ -package core +package base import ( "fmt" diff --git a/x/ecocredit/core/utils_test.go b/x/ecocredit/base/utils_test.go similarity index 80% rename from x/ecocredit/core/utils_test.go rename to x/ecocredit/base/utils_test.go index e1cc13410e..a521cfefc6 100644 --- a/x/ecocredit/core/utils_test.go +++ b/x/ecocredit/base/utils_test.go @@ -1,4 +1,4 @@ -package core +package base import ( "testing" @@ -22,10 +22,10 @@ func TestUtils(t *testing.T) { } func testFormatClassID(t *rapid.T) { - creditType := genCreditType.Draw(t, "creditType").(*CreditType) + creditTypeAbbrev := genCreditTypeAbbrev.Draw(t, "creditTypeAbbrev").(string) classSeq := rapid.Uint64().Draw(t, "classSeq").(uint64) - classID := FormatClassID(creditType.Abbreviation, classSeq) + classID := FormatClassID(creditTypeAbbrev, classSeq) t.Log(classID) @@ -39,11 +39,11 @@ func testInvalidClassID(t *rapid.T) { } func testFormatProjectID(t *rapid.T) { - creditType := genCreditType.Draw(t, "creditType").(*CreditType) + creditTypeAbbrev := genCreditTypeAbbrev.Draw(t, "creditTypeAbbrev").(string) classSeq := rapid.Uint64().Draw(t, "classSeq").(uint64) projectSeq := rapid.Uint64().Draw(t, "projectSeq").(uint64) - classID := FormatClassID(creditType.Abbreviation, classSeq) + classID := FormatClassID(creditTypeAbbrev, classSeq) projectID := FormatProjectID(classID, projectSeq) t.Log(projectID) @@ -58,14 +58,14 @@ func testInvalidProjectID(t *rapid.T) { } func testFormatBatchDenom(t *rapid.T) { - creditType := genCreditType.Draw(t, "creditType").(*CreditType) + creditTypeAbbrev := genCreditTypeAbbrev.Draw(t, "creditTypeAbbrev").(string) classSeq := rapid.Uint64().Draw(t, "classSeq").(uint64) projectSeq := rapid.Uint64().Draw(t, "projectSeq").(uint64) batchSeq := rapid.Uint64().Draw(t, "batchSeq").(uint64) startDate := genTime.Draw(t, "startDate").(*time.Time) endDate := genTime.Draw(t, "endDate").(*time.Time) - classID := FormatClassID(creditType.Abbreviation, classSeq) + classID := FormatClassID(creditTypeAbbrev, classSeq) projectID := FormatProjectID(classID, projectSeq) denom, err := FormatBatchDenom(projectID, batchSeq, startDate, endDate) require.NoError(t, err) @@ -82,11 +82,11 @@ func testInvalidBatchDenom(t *rapid.T) { } func testGetClassIDFromProjectID(t *rapid.T) { - creditType := genCreditType.Draw(t, "creditType").(*CreditType) + creditTypeAbbrev := genCreditTypeAbbrev.Draw(t, "creditTypeAbbrev").(string) classSeq := rapid.Uint64().Draw(t, "classSeq").(uint64) projectSeq := rapid.Uint64().Draw(t, "projectSeq").(uint64) - classID := FormatClassID(creditType.Abbreviation, classSeq) + classID := FormatClassID(creditTypeAbbrev, classSeq) projectID := FormatProjectID(classID, projectSeq) result := GetClassIDFromProjectID(projectID) @@ -94,14 +94,14 @@ func testGetClassIDFromProjectID(t *rapid.T) { } func testGetClassIDFromBatchDenom(t *rapid.T) { - creditType := genCreditType.Draw(t, "creditType").(*CreditType) + creditTypeAbbrev := genCreditTypeAbbrev.Draw(t, "creditTypeAbbrev").(string) classSeq := rapid.Uint64().Draw(t, "classSeq").(uint64) projectSeq := rapid.Uint64().Draw(t, "projectSeq").(uint64) batchSeq := rapid.Uint64().Draw(t, "batchSeq").(uint64) startDate := genTime.Draw(t, "startDate").(*time.Time) endDate := genTime.Draw(t, "endDate").(*time.Time) - classID := FormatClassID(creditType.Abbreviation, classSeq) + classID := FormatClassID(creditTypeAbbrev, classSeq) projectID := FormatProjectID(classID, projectSeq) denom, err := FormatBatchDenom(projectID, batchSeq, startDate, endDate) require.NoError(t, err) @@ -111,14 +111,14 @@ func testGetClassIDFromBatchDenom(t *rapid.T) { } func testGetProjectIDFromBatchDenom(t *rapid.T) { - creditType := genCreditType.Draw(t, "creditType").(*CreditType) + creditTypeAbbrev := genCreditTypeAbbrev.Draw(t, "creditTypeAbbrev").(string) classSeq := rapid.Uint64().Draw(t, "classSeq").(uint64) projectSeq := rapid.Uint64().Draw(t, "projectSeq").(uint64) batchSeq := rapid.Uint64().Draw(t, "batchSeq").(uint64) startDate := genTime.Draw(t, "startDate").(*time.Time) endDate := genTime.Draw(t, "endDate").(*time.Time) - classID := FormatClassID(creditType.Abbreviation, classSeq) + classID := FormatClassID(creditTypeAbbrev, classSeq) projectID := FormatProjectID(classID, projectSeq) denom, err := FormatBatchDenom(projectID, batchSeq, startDate, endDate) require.NoError(t, err) @@ -128,21 +128,16 @@ func testGetProjectIDFromBatchDenom(t *rapid.T) { } func testGetCreditTypeAbbrevFromClassID(t *rapid.T) { - creditType := genCreditType.Draw(t, "creditType").(*CreditType) + creditTypeAbbrev := genCreditTypeAbbrev.Draw(t, "creditTypeAbbrev").(string) classSeq := rapid.Uint64().Draw(t, "classSeq").(uint64) - classID := FormatClassID(creditType.Abbreviation, classSeq) + classID := FormatClassID(creditTypeAbbrev, classSeq) result := GetCreditTypeAbbrevFromClassID(classID) - require.Equal(t, creditType.Abbreviation, result) + require.Equal(t, creditTypeAbbrev, result) } -// genCreditType generates an empty credit type with a random valid abbreviation -var genCreditType = rapid.Custom(func(t *rapid.T) *CreditType { - abbr := rapid.StringMatching(`[A-Z]{1,3}`).Draw(t, "abbr").(string) - return &CreditType{ - Abbreviation: abbr, - } -}) +// genCreditTypeAbbrev generates an empty credit type with a random valid abbreviation +var genCreditTypeAbbrev = rapid.StringMatching(RegexCreditTypeAbbrev) // genInvalidClassID generates strings that don't conform to the class id format var genInvalidClassID = rapid.OneOf( diff --git a/x/ecocredit/basket/keeper/msg_create_test.go b/x/ecocredit/basket/keeper/msg_create_test.go index 9004e39873..33df1bc6ee 100644 --- a/x/ecocredit/basket/keeper/msg_create_test.go +++ b/x/ecocredit/basket/keeper/msg_create_test.go @@ -14,11 +14,11 @@ import ( bank "github.com/cosmos/cosmos-sdk/x/bank/types" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" - coreapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" + "github.com/regen-network/regen-ledger/x/ecocredit/base" "github.com/regen-network/regen-ledger/x/ecocredit/basket" types "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" ) type createSuite struct { @@ -59,7 +59,7 @@ func (s *createSuite) AllowedBasketFee(a string) { } func (s *createSuite) ACreditType() { - err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: s.creditTypeAbbrev, Precision: s.creditTypePrecision, }) @@ -67,7 +67,7 @@ func (s *createSuite) ACreditType() { } func (s *createSuite) ACreditTypeWithAbbreviation(a string) { - err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: a, Precision: s.creditTypePrecision, }) @@ -80,7 +80,7 @@ func (s *createSuite) ACreditTypeWithPrecision(b string) { s.creditTypePrecision = uint32(precision) - err = s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err = s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: s.creditTypeAbbrev, Precision: s.creditTypePrecision, }) @@ -93,7 +93,7 @@ func (s *createSuite) ACreditTypeWithAbbreviationAndPrecision(a string, b string s.creditTypePrecision = uint32(precision) - err = s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err = s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: a, Precision: s.creditTypePrecision, }) @@ -107,9 +107,9 @@ func (s *createSuite) AlicesAddress(a string) { } func (s *createSuite) ACreditClassWithId(a string) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) - err := s.coreStore.ClassTable().Insert(s.ctx, &coreapi.Class{ + err := s.coreStore.ClassTable().Insert(s.ctx, &baseapi.Class{ Id: a, CreditTypeAbbrev: creditTypeAbbrev, }) diff --git a/x/ecocredit/basket/keeper/msg_put.go b/x/ecocredit/basket/keeper/msg_put.go index 1590766684..1688ff05c0 100644 --- a/x/ecocredit/basket/keeper/msg_put.go +++ b/x/ecocredit/basket/keeper/msg_put.go @@ -9,12 +9,13 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" - ecoApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" regenmath "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" basketsub "github.com/regen-network/regen-ledger/x/ecocredit/basket" types "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" ) // Put deposits ecocredits into a basket, returning fungible coins to the depositor. @@ -76,7 +77,7 @@ func (k Keeper) Put(ctx context.Context, req *types.MsgPut) (*types.MsgPutRespon // update the total amount received so far amountReceived = amountReceived.Add(tokens[0].Amount) - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventTransfer{ + if err = sdkCtx.EventManager().EmitTypedEvent(&basetypes.EventTransfer{ Sender: ownerString, Recipient: moduleAddrString, // basket submodule BatchDenom: credit.BatchDenom, @@ -115,7 +116,7 @@ func (k Keeper) Put(ctx context.Context, req *types.MsgPut) (*types.MsgPutRespon // - batch's start time is within the basket's specified time window or min start date // - class is in the basket's allowed class store // - type matches the baskets specified credit type. -func (k Keeper) canBasketAcceptCredit(ctx context.Context, basket *api.Basket, batch *ecoApi.Batch) error { +func (k Keeper) canBasketAcceptCredit(ctx context.Context, basket *api.Basket, batch *baseapi.Batch) error { sdkCtx := sdk.UnwrapSDKContext(ctx) blockTime := sdkCtx.BlockTime() errInvalidReq := sdkerrors.ErrInvalidRequest @@ -143,7 +144,7 @@ func (k Keeper) canBasketAcceptCredit(ctx context.Context, basket *api.Basket, b } - classID := core.GetClassIDFromBatchDenom(batch.Denom) + classID := base.GetClassIDFromBatchDenom(batch.Denom) // check credit class match found, err := k.stateStore.BasketClassTable().Has(ctx, basket.Id, classID) @@ -167,7 +168,7 @@ func (k Keeper) canBasketAcceptCredit(ctx context.Context, basket *api.Basket, b } // transferToBasket moves credits from the user's tradable balance, into the basket's balance -func (k Keeper) transferToBasket(ctx context.Context, sender sdk.AccAddress, amt regenmath.Dec, basketID uint64, batch *ecoApi.Batch, exponent uint32) error { +func (k Keeper) transferToBasket(ctx context.Context, sender sdk.AccAddress, amt regenmath.Dec, basketID uint64, batch *baseapi.Batch, exponent uint32) error { // update user balance, subtracting from their tradable balance userBal, err := k.coreStore.BatchBalanceTable().Get(ctx, sender, batch.Key) if err != nil { diff --git a/x/ecocredit/basket/keeper/msg_put_test.go b/x/ecocredit/basket/keeper/msg_put_test.go index cfbbbc3807..23d5bc7c52 100644 --- a/x/ecocredit/basket/keeper/msg_put_test.go +++ b/x/ecocredit/basket/keeper/msg_put_test.go @@ -16,13 +16,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" - coreapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" regentypes "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/types/testutil" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/basket" types "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" ) type putSuite struct { @@ -64,7 +65,7 @@ func (s *putSuite) Before(t gocuke.TestingT) { } func (s *putSuite) ACreditType() { - err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: s.creditTypeAbbrev, Precision: s.creditTypePrecision, }) @@ -74,7 +75,7 @@ func (s *putSuite) ACreditType() { func (s *putSuite) ACreditTypeWithAbbreviation(a string) { s.creditTypeAbbrev = a - err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: s.creditTypeAbbrev, Precision: s.creditTypePrecision, }) @@ -88,7 +89,7 @@ func (s *putSuite) ACreditTypeWithAbbreviationAndPrecision(a string, b string) { s.creditTypeAbbrev = a s.creditTypePrecision = uint32(precision) - err = s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err = s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: s.creditTypeAbbrev, Precision: s.creditTypePrecision, }) @@ -140,7 +141,7 @@ func (s *putSuite) ABasketWithDenom(a string) { } func (s *putSuite) ABasketWithAllowedCreditClass(a string) { - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(a) basketID, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ BasketDenom: s.basketDenom, @@ -218,21 +219,21 @@ func (s *putSuite) ABasketWithYearsInThePast(a string) { } func (s *putSuite) ACreditBatchWithDenom(a string) { - classID := core.GetClassIDFromBatchDenom(a) - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(classID) + classID := base.GetClassIDFromBatchDenom(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(classID) - classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &coreapi.Class{ + classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &baseapi.Class{ Id: classID, CreditTypeAbbrev: creditTypeAbbrev, }) require.NoError(s.t, err) - projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &coreapi.Project{ + projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &baseapi.Project{ ClassKey: classKey, }) require.NoError(s.t, err) - err = s.coreStore.BatchTable().Insert(s.ctx, &coreapi.Batch{ + err = s.coreStore.BatchTable().Insert(s.ctx, &baseapi.Batch{ ProjectKey: projectKey, Denom: s.batchDenom, }) @@ -252,27 +253,27 @@ func (s *putSuite) EcocreditModulesAddress(a string) { } func (s *putSuite) AliceOwnsCredits() { - classID := core.GetClassIDFromBatchDenom(s.batchDenom) - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(classID) + classID := base.GetClassIDFromBatchDenom(s.batchDenom) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(classID) - classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &coreapi.Class{ + classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &baseapi.Class{ Id: classID, CreditTypeAbbrev: creditTypeAbbrev, }) require.NoError(s.t, err) - projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &coreapi.Project{ + projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &baseapi.Project{ ClassKey: classKey, }) require.NoError(s.t, err) - batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &coreapi.Batch{ + batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &baseapi.Batch{ ProjectKey: projectKey, Denom: s.batchDenom, }) require.NoError(s.t, err) - err = s.coreStore.BatchBalanceTable().Insert(s.ctx, &coreapi.BatchBalance{ + err = s.coreStore.BatchBalanceTable().Insert(s.ctx, &baseapi.BatchBalance{ BatchKey: batchKey, Address: s.alice, TradableAmount: s.tradableCredits, @@ -281,27 +282,27 @@ func (s *putSuite) AliceOwnsCredits() { } func (s *putSuite) AliceOwnsCreditAmount(a string) { - classID := core.GetClassIDFromBatchDenom(s.batchDenom) - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(classID) + classID := base.GetClassIDFromBatchDenom(s.batchDenom) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(classID) - classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &coreapi.Class{ + classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &baseapi.Class{ Id: classID, CreditTypeAbbrev: creditTypeAbbrev, }) require.NoError(s.t, err) - projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &coreapi.Project{ + projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &baseapi.Project{ ClassKey: classKey, }) require.NoError(s.t, err) - batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &coreapi.Batch{ + batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &baseapi.Batch{ ProjectKey: projectKey, Denom: s.batchDenom, }) require.NoError(s.t, err) - err = s.coreStore.BatchBalanceTable().Insert(s.ctx, &coreapi.BatchBalance{ + err = s.coreStore.BatchBalanceTable().Insert(s.ctx, &baseapi.BatchBalance{ BatchKey: batchKey, Address: s.alice, TradableAmount: a, @@ -310,27 +311,27 @@ func (s *putSuite) AliceOwnsCreditAmount(a string) { } func (s *putSuite) AliceOwnsCreditsFromCreditBatch(a string) { - classID := core.GetClassIDFromBatchDenom(a) - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(classID) + classID := base.GetClassIDFromBatchDenom(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(classID) - classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &coreapi.Class{ + classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &baseapi.Class{ Id: classID, CreditTypeAbbrev: creditTypeAbbrev, }) require.NoError(s.t, err) - projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &coreapi.Project{ + projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &baseapi.Project{ ClassKey: classKey, }) require.NoError(s.t, err) - batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &coreapi.Batch{ + batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &baseapi.Batch{ ProjectKey: projectKey, Denom: a, }) require.NoError(s.t, err) - err = s.coreStore.BatchBalanceTable().Insert(s.ctx, &coreapi.BatchBalance{ + err = s.coreStore.BatchBalanceTable().Insert(s.ctx, &baseapi.BatchBalance{ BatchKey: batchKey, Address: s.alice, TradableAmount: s.tradableCredits, @@ -342,25 +343,25 @@ func (s *putSuite) AliceOwnsCreditsWithStartDate(a string) { startDate, err := regentypes.ParseDate("start-date", a) require.NoError(s.t, err) - classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &coreapi.Class{ + classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &baseapi.Class{ Id: s.classID, CreditTypeAbbrev: s.creditTypeAbbrev, }) require.NoError(s.t, err) - pKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &coreapi.Project{ + pKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &baseapi.Project{ ClassKey: classKey, }) require.NoError(s.t, err) - batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &coreapi.Batch{ + batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &baseapi.Batch{ ProjectKey: pKey, Denom: s.batchDenom, StartDate: timestamppb.New(startDate), }) require.NoError(s.t, err) - err = s.coreStore.BatchBalanceTable().Insert(s.ctx, &coreapi.BatchBalance{ + err = s.coreStore.BatchBalanceTable().Insert(s.ctx, &baseapi.BatchBalance{ BatchKey: batchKey, Address: s.alice, TradableAmount: s.tradableCredits, @@ -520,7 +521,7 @@ func (s *putSuite) ExpectTheResponse(a gocuke.DocString) { } func (s *putSuite) ExpectEventTransferWithProperties(a gocuke.DocString) { - var event core.EventTransfer + var event basetypes.EventTransfer err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) diff --git a/x/ecocredit/basket/keeper/msg_take.go b/x/ecocredit/basket/keeper/msg_take.go index 3c411c3196..562cc4d59e 100644 --- a/x/ecocredit/basket/keeper/msg_take.go +++ b/x/ecocredit/basket/keeper/msg_take.go @@ -5,6 +5,7 @@ import ( "fmt" sdkMath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -12,10 +13,10 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" + basekeeper "github.com/regen-network/regen-ledger/x/ecocredit/base/keeper" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" basketsub "github.com/regen-network/regen-ledger/x/ecocredit/basket" types "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - coretypes "github.com/regen-network/regen-ledger/x/ecocredit/core" - "github.com/regen-network/regen-ledger/x/ecocredit/server/core" ) func (k Keeper) Take(ctx context.Context, msg *types.MsgTake) (*types.MsgTakeResponse, error) { @@ -194,10 +195,10 @@ func (k Keeper) addCreditBalance(ctx context.Context, owner sdk.AccAddress, batc return err } if !retire { - if err = core.AddAndSaveBalance(ctx, k.coreStore.BatchBalanceTable(), owner, batch.Key, amount); err != nil { + if err = basekeeper.AddAndSaveBalance(ctx, k.coreStore.BatchBalanceTable(), owner, batch.Key, amount); err != nil { return err } - return sdkCtx.EventManager().EmitTypedEvent(&coretypes.EventTransfer{ + return sdkCtx.EventManager().EmitTypedEvent(&basetypes.EventTransfer{ Sender: k.moduleAddress.String(), // basket submodule Recipient: owner.String(), BatchDenom: batchDenom, @@ -205,13 +206,13 @@ func (k Keeper) addCreditBalance(ctx context.Context, owner sdk.AccAddress, batc }) } - if err = core.RetireAndSaveBalance(ctx, k.coreStore.BatchBalanceTable(), owner, batch.Key, amount); err != nil { + if err = basekeeper.RetireAndSaveBalance(ctx, k.coreStore.BatchBalanceTable(), owner, batch.Key, amount); err != nil { return err } - if err = core.RetireSupply(ctx, k.coreStore.BatchSupplyTable(), batch.Key, amount); err != nil { + if err = basekeeper.RetireSupply(ctx, k.coreStore.BatchSupplyTable(), batch.Key, amount); err != nil { return err } - err = sdkCtx.EventManager().EmitTypedEvent(&coretypes.EventTransfer{ + err = sdkCtx.EventManager().EmitTypedEvent(&basetypes.EventTransfer{ Sender: k.moduleAddress.String(), // basket submodule Recipient: owner.String(), BatchDenom: batchDenom, @@ -220,7 +221,7 @@ func (k Keeper) addCreditBalance(ctx context.Context, owner sdk.AccAddress, batc if err != nil { return err } - return sdkCtx.EventManager().EmitTypedEvent(&coretypes.EventRetire{ + return sdkCtx.EventManager().EmitTypedEvent(&basetypes.EventRetire{ Owner: owner.String(), BatchDenom: batchDenom, Amount: amount.String(), diff --git a/x/ecocredit/basket/keeper/msg_take_test.go b/x/ecocredit/basket/keeper/msg_take_test.go index 464cdab21d..a8c2c8c793 100644 --- a/x/ecocredit/basket/keeper/msg_take_test.go +++ b/x/ecocredit/basket/keeper/msg_take_test.go @@ -12,11 +12,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" - coreapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" + "github.com/regen-network/regen-ledger/x/ecocredit/base" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/basket" types "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" ) type takeSuite struct { @@ -60,7 +61,7 @@ func (s *takeSuite) Before(t gocuke.TestingT) { } func (s *takeSuite) ACreditType() { - err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: s.creditTypeAbbrev, Precision: s.creditTypePrecision, }) @@ -70,7 +71,7 @@ func (s *takeSuite) ACreditType() { func (s *takeSuite) ACreditTypeWithAbbreviation(a string) { s.creditTypeAbbrev = a - err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: s.creditTypeAbbrev, Precision: s.creditTypePrecision, }) @@ -84,7 +85,7 @@ func (s *takeSuite) ACreditTypeWithAbbreviationAndPrecision(a string, b string) s.creditTypeAbbrev = a s.creditTypePrecision = uint32(precision) - err = s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + err = s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: s.creditTypeAbbrev, Precision: s.creditTypePrecision, }) @@ -366,7 +367,7 @@ func (s *takeSuite) AliceAttemptsToTakeCreditsWithBasketTokenAmountAndRetireOnTa } func (s *takeSuite) ExpectEventRetireWithProperties(a gocuke.DocString) { - var event core.EventRetire + var event basetypes.EventRetire err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) @@ -378,7 +379,7 @@ func (s *takeSuite) ExpectEventRetireWithProperties(a gocuke.DocString) { } func (s *takeSuite) ExpectEventTransferWithProperties(a gocuke.DocString) { - var event core.EventTransfer + var event basetypes.EventTransfer err := json.Unmarshal([]byte(a.Content), &event) require.NoError(s.t, err) @@ -396,27 +397,27 @@ func (s *takeSuite) addBasketClassAndBalance(basketID uint64, creditAmount strin }) require.NoError(s.t, err) - classID := core.GetClassIDFromBatchDenom(s.batchDenom) - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(classID) + classID := base.GetClassIDFromBatchDenom(s.batchDenom) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(classID) - classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &coreapi.Class{ + classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &baseapi.Class{ Id: classID, CreditTypeAbbrev: creditTypeAbbrev, }) require.NoError(s.t, err) - projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &coreapi.Project{ + projectKey, err := s.coreStore.ProjectTable().InsertReturningID(s.ctx, &baseapi.Project{ ClassKey: classKey, }) require.NoError(s.t, err) - batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &coreapi.Batch{ + batchKey, err := s.coreStore.BatchTable().InsertReturningID(s.ctx, &baseapi.Batch{ ProjectKey: projectKey, Denom: s.batchDenom, }) require.NoError(s.t, err) - err = s.coreStore.BatchSupplyTable().Insert(s.ctx, &coreapi.BatchSupply{ + err = s.coreStore.BatchSupplyTable().Insert(s.ctx, &baseapi.BatchSupply{ BatchKey: batchKey, TradableAmount: creditAmount, }) diff --git a/x/ecocredit/basket/simulation/operations.go b/x/ecocredit/basket/simulation/operations.go index 6796c1dd31..d0e64e7a4d 100644 --- a/x/ecocredit/basket/simulation/operations.go +++ b/x/ecocredit/basket/simulation/operations.go @@ -19,8 +19,8 @@ import ( "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" types "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" "github.com/regen-network/regen-ledger/x/ecocredit/simulation/utils" ) @@ -48,7 +48,7 @@ var ( func WeightedOperations( appParams simtypes.AppParams, cdc codec.JSONCodec, ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer, basketQryClient types.QueryServer) simulation.WeightedOperations { + qryClient basetypes.QueryServer, basketQryClient types.QueryServer) simulation.WeightedOperations { var ( weightMsgCreate int @@ -92,14 +92,14 @@ func WeightedOperations( // SimulateMsgCreate generates a Basket/MsgCreate with random values. func SimulateMsgCreate(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient basetypes.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { curator, _ := simtypes.RandomAcc(r, accs) ctx := sdk.WrapSDKContext(sdkCtx) - res, err := qryClient.Params(ctx, &core.QueryParamsRequest{}) + res, err := qryClient.Params(ctx, &basetypes.QueryParamsRequest{}) if err != nil { return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgCreate, err.Error()), nil, err } @@ -198,7 +198,7 @@ func randomDateCriteria(r *rand.Rand, ctx sdk.Context) *types.DateCriteria { // SimulateMsgPut generates a Basket/MsgPut with random values. func SimulateMsgPut(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer, bsktQryClient types.QueryServer) simtypes.Operation { + qryClient basetypes.QueryServer, bsktQryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -219,14 +219,14 @@ func SimulateMsgPut(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, } rBasket := baskets[r.Intn(len(baskets))] - var classInfoList []core.ClassInfo + var classInfoList []basetypes.ClassInfo max := 0 var ownerAddr string var owner simtypes.Account for _, class := range classes { if class.CreditTypeAbbrev == rBasket.CreditTypeAbbrev { - issuersRes, err := qryClient.ClassIssuers(sdk.WrapSDKContext(sdkCtx), &core.QueryClassIssuersRequest{ + issuersRes, err := qryClient.ClassIssuers(sdk.WrapSDKContext(sdkCtx), &basetypes.QueryClassIssuersRequest{ ClassId: class.Id, }) if err != nil { @@ -267,14 +267,14 @@ func SimulateMsgPut(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, var credits []*types.BasketCredit for _, classInfo := range classInfoList { - resProjects, err := qryClient.ProjectsByClass(ctx, &core.QueryProjectsByClassRequest{ClassId: classInfo.Id}) + resProjects, err := qryClient.ProjectsByClass(ctx, &basetypes.QueryProjectsByClassRequest{ClassId: classInfo.Id}) if err != nil { return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgPut, err.Error()), nil, err } for _, projectInfo := range resProjects.GetProjects() { - batchesRes, err := qryClient.BatchesByProject(ctx, &core.QueryBatchesByProjectRequest{ + batchesRes, err := qryClient.BatchesByProject(ctx, &basetypes.QueryBatchesByProjectRequest{ ProjectId: projectInfo.Id, }) if err != nil { @@ -285,7 +285,7 @@ func SimulateMsgPut(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, if len(batches) != 0 { count := 0 for _, batch := range batches { - balanceRes, err := qryClient.Balance(ctx, &core.QueryBalanceRequest{ + balanceRes, err := qryClient.Balance(ctx, &basetypes.QueryBalanceRequest{ Address: ownerAddr, BatchDenom: batch.Denom, }) if err != nil { @@ -374,7 +374,7 @@ func SimulateMsgPut(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, // SimulateMsgTake generates a Basket/MsgTake with random values. func SimulateMsgTake(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer, bsktQryClient types.QueryServer) simtypes.Operation { + qryClient basetypes.QueryServer, bsktQryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -460,7 +460,7 @@ func SimulateMsgTake(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, } } -func randomClassIds(r *rand.Rand, ctx sdk.Context, qryClient core.QueryServer, +func randomClassIds(r *rand.Rand, ctx sdk.Context, qryClient basetypes.QueryServer, creditTypeAbbrev string, msgType string) ([]string, simtypes.OperationMsg, error) { classes, op, err := utils.GetClasses(ctx, r, qryClient, msgType) if len(classes) == 0 { @@ -490,8 +490,8 @@ func min(x, y int) int { return x } -func randomCreditType(ctx context.Context, r *rand.Rand, qryClient core.QueryServer) (*core.CreditType, error) { - res, err := qryClient.CreditTypes(ctx, &core.QueryCreditTypesRequest{}) +func randomCreditType(ctx context.Context, r *rand.Rand, qryClient basetypes.QueryServer) (*basetypes.CreditType, error) { + res, err := qryClient.CreditTypes(ctx, &basetypes.QueryCreditTypesRequest{}) if err != nil { return nil, err } diff --git a/x/ecocredit/basket/types/v1/msg_create.go b/x/ecocredit/basket/types/v1/msg_create.go index fa5353a3df..b1b0241ade 100644 --- a/x/ecocredit/basket/types/v1/msg_create.go +++ b/x/ecocredit/basket/types/v1/msg_create.go @@ -7,7 +7,7 @@ import ( "github.com/regen-network/regen-ledger/x/ecocredit/basket" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) const descrMaxLen = 256 @@ -39,7 +39,7 @@ func (m MsgCreate) ValidateBasic() error { return sdkerrors.ErrInvalidRequest.Wrapf("description length cannot be greater than %d characters", descrMaxLen) } - if err := core.ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { + if err := base.ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("credit type abbrev: %s", err) } @@ -48,7 +48,7 @@ func (m MsgCreate) ValidateBasic() error { } for i := range m.AllowedClasses { - if err := core.ValidateClassID(m.AllowedClasses[i]); err != nil { + if err := base.ValidateClassID(m.AllowedClasses[i]); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("allowed classes [%d]: %s", i, err) } } diff --git a/x/ecocredit/basket/types/v1/msg_put.go b/x/ecocredit/basket/types/v1/msg_put.go index 784fc9d9cc..af90c51c7a 100644 --- a/x/ecocredit/basket/types/v1/msg_put.go +++ b/x/ecocredit/basket/types/v1/msg_put.go @@ -10,7 +10,7 @@ import ( "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgPut{} @@ -40,7 +40,7 @@ func (m MsgPut) ValidateBasic() error { for i, credit := range m.Credits { creditIndex := fmt.Sprintf("credits[%d]", i) - if err := core.ValidateBatchDenom(credit.BatchDenom); err != nil { + if err := base.ValidateBatchDenom(credit.BatchDenom); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("%s: batch denom: %s", creditIndex, err) } diff --git a/x/ecocredit/basket/types/v1/msg_take.go b/x/ecocredit/basket/types/v1/msg_take.go index 7a1b80a276..4bac8c7921 100644 --- a/x/ecocredit/basket/types/v1/msg_take.go +++ b/x/ecocredit/basket/types/v1/msg_take.go @@ -7,7 +7,7 @@ import ( "github.com/regen-network/regen-ledger/x/ecocredit/basket" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgTake{} @@ -54,13 +54,13 @@ func (m MsgTake) ValidateBasic() error { // retirement_location is deprecated but still supported if len(m.RetirementLocation) != 0 { - if err := core.ValidateJurisdiction(m.RetirementLocation); err != nil { + if err := base.ValidateJurisdiction(m.RetirementLocation); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("retirement location: %s", err) } } if len(m.RetirementJurisdiction) != 0 { - if err := core.ValidateJurisdiction(m.RetirementJurisdiction); err != nil { + if err := base.ValidateJurisdiction(m.RetirementJurisdiction); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("retirement jurisdiction: %s", err) } } diff --git a/x/ecocredit/basket/types/v1/state_basket.go b/x/ecocredit/basket/types/v1/state_basket.go index 5640f6bdeb..2707e0a2e3 100644 --- a/x/ecocredit/basket/types/v1/state_basket.go +++ b/x/ecocredit/basket/types/v1/state_basket.go @@ -6,8 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" "github.com/regen-network/regen-ledger/x/ecocredit/basket" - "github.com/regen-network/regen-ledger/x/ecocredit/core" ) // Validate performs basic validation of the Basket state type @@ -24,7 +24,7 @@ func (m *Basket) Validate() error { return errors.Wrap(err, "name") // returns parse error } - if err := core.ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { + if err := base.ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { return errors.Wrap(err, "credit type abbrev") // returns parse error } diff --git a/x/ecocredit/basket/types/v1/state_basket_balance.go b/x/ecocredit/basket/types/v1/state_basket_balance.go index 25998db0f6..fa19a308e5 100644 --- a/x/ecocredit/basket/types/v1/state_basket_balance.go +++ b/x/ecocredit/basket/types/v1/state_basket_balance.go @@ -5,7 +5,7 @@ import ( "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate performs basic validation of the BasketBalance state type @@ -14,7 +14,7 @@ func (m *BasketBalance) Validate() error { return ecocredit.ErrParseFailure.Wrapf("basket id cannot be zero") } - if err := core.ValidateBatchDenom(m.BatchDenom); err != nil { + if err := base.ValidateBatchDenom(m.BatchDenom); err != nil { return errors.Wrap(err, "batch denom") // returns parse error } diff --git a/x/ecocredit/basket/types/v1/state_basket_class.go b/x/ecocredit/basket/types/v1/state_basket_class.go index 98dad93c0f..e21b01c7c1 100644 --- a/x/ecocredit/basket/types/v1/state_basket_class.go +++ b/x/ecocredit/basket/types/v1/state_basket_class.go @@ -4,7 +4,7 @@ import ( "cosmossdk.io/errors" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate performs basic validation of the BasketClass state type @@ -13,7 +13,7 @@ func (m *BasketClass) Validate() error { return ecocredit.ErrParseFailure.Wrapf("basket id cannot be zero") } - if err := core.ValidateClassID(m.ClassId); err != nil { + if err := base.ValidateClassID(m.ClassId); err != nil { return errors.Wrap(err, "class id") // returns parse error } diff --git a/x/ecocredit/basket/utils.go b/x/ecocredit/basket/utils.go index 74359d4eef..5338e49b4d 100644 --- a/x/ecocredit/basket/utils.go +++ b/x/ecocredit/basket/utils.go @@ -5,7 +5,7 @@ import ( "regexp" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) const ( @@ -31,7 +31,7 @@ var ( // - denom: eco.. // - display denom: eco.. func FormatBasketDenom(name, creditTypeAbbrev string, exponent uint32) (string, string, error) { - exponentPrefix, err := core.ExponentToPrefix(exponent) + exponentPrefix, err := base.ExponentToPrefix(exponent) if err != nil { return "", "", err } diff --git a/x/ecocredit/client/query.go b/x/ecocredit/client/query.go index 85f72adbe6..744a0ce059 100644 --- a/x/ecocredit/client/query.go +++ b/x/ecocredit/client/query.go @@ -4,10 +4,9 @@ import ( "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" + baseclient "github.com/regen-network/regen-ledger/x/ecocredit/base/client" basketclient "github.com/regen-network/regen-ledger/x/ecocredit/basket/client" - "github.com/regen-network/regen-ledger/x/ecocredit/core" marketclient "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/client" ) @@ -22,27 +21,27 @@ func QueryCmd(name string) *cobra.Command { RunE: client.ValidateCmd, } cmd.AddCommand( - QueryClassesCmd(), - QueryClassCmd(), - QueryClassIssuersCmd(), - QueryBatchesCmd(), - QueryBatchesByIssuerCmd(), - QueryBatchesByClassCmd(), - QueryBatchesByProjectCmd(), - QueryBatchCmd(), - QueryBatchBalanceCmd(), - QueryBatchSupplyCmd(), - QueryCreditTypesCmd(), - QueryProjectsCmd(), - QueryProjectsByClassCmd(), - QueryProjectsByReferenceIDCmd(), - QueryProjectsByAdminCmd(), - QueryProjectCmd(), - QueryParamsCmd(), - QueryCreditTypeCmd(), - QueryAllowedClassCreatorsCmd(), - QueryCreditClassAllowlistEnabledCmd(), - QueryCreditClassFeesCmd(), + baseclient.QueryClassesCmd(), + baseclient.QueryClassCmd(), + baseclient.QueryClassIssuersCmd(), + baseclient.QueryBatchesCmd(), + baseclient.QueryBatchesByIssuerCmd(), + baseclient.QueryBatchesByClassCmd(), + baseclient.QueryBatchesByProjectCmd(), + baseclient.QueryBatchCmd(), + baseclient.QueryBatchBalanceCmd(), + baseclient.QueryBatchSupplyCmd(), + baseclient.QueryCreditTypesCmd(), + baseclient.QueryProjectsCmd(), + baseclient.QueryProjectsByClassCmd(), + baseclient.QueryProjectsByReferenceIDCmd(), + baseclient.QueryProjectsByAdminCmd(), + baseclient.QueryProjectCmd(), + baseclient.QueryParamsCmd(), + baseclient.QueryCreditTypeCmd(), + baseclient.QueryAllowedClassCreatorsCmd(), + baseclient.QueryCreditClassAllowlistEnabledCmd(), + baseclient.QueryCreditClassFeesCmd(), basketclient.QueryBasketCmd(), basketclient.QueryBasketsCmd(), basketclient.QueryBasketBalanceCmd(), @@ -56,581 +55,3 @@ func QueryCmd(name string) *cobra.Command { ) return cmd } - -// QueryClassesCmd returns a query command that lists all credit classes. -func QueryClassesCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "classes", - Short: "List all credit classes", - Long: "List all credit classes with optional pagination flags.", - Example: `regen q ecocredit classes -regen q ecocredit classes --limit 10 --offset 10`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.Classes(cmd.Context(), &core.QueryClassesRequest{ - Pagination: pagination, - }) - return printQueryResponse(ctx, res, err) - }, - } - flags.AddPaginationFlagsToCmd(cmd, "classes") - return qflags(cmd) -} - -// QueryClassCmd returns a query command that retrieves information for a -// given credit class. -func QueryClassCmd() *cobra.Command { - return qflags(&cobra.Command{ - Use: "class [class-id]", - Short: "Retrieve credit class information", - Long: "Retrieve credit class information.", - Example: "regen q ecocredit class C01", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - res, err := c.Class(cmd.Context(), &core.QueryClassRequest{ - ClassId: args[0], - }) - return printQueryResponse(ctx, res, err) - }, - }) -} - -// QueryClassIssuersCmd returns a query command that retrieves addresses of the -// credit class issuers. -func QueryClassIssuersCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "class-issuers [class-id]", - Short: "Retrieve issuer addresses for a credit class", - Long: "Retrieve issuer addresses for a credit class with optional pagination flags.", - Example: `regen q ecocredit class-issuers C01 -regen q ecocredit class-issuers C01 --limit 10 --offset 10`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.ClassIssuers(cmd.Context(), &core.QueryClassIssuersRequest{ - ClassId: args[0], - Pagination: pagination, - }) - if err != nil { - return err - } - - return printQueryResponse(ctx, res, err) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, "class-issuers") - return qflags(cmd) -} - -// QueryProjectsCmd returns a query command that retrieves all projects. -func QueryProjectsCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "projects", - Short: "List all projects", - Long: "List all projects with optional pagination flags.", - Example: `regen q ecocredit projects -regen q ecocredit projects --limit 10 --offset 10`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.Projects(cmd.Context(), &core.QueryProjectsRequest{ - Pagination: pagination, - }) - - return printQueryResponse(ctx, res, err) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, "projects") - - return qflags(cmd) -} - -// QueryProjectsByClassCmd returns a query command that retrieves projects by credit class. -func QueryProjectsByClassCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "projects-by-class [class-id]", - Short: "List projects by credit class", - Long: "List projects by credit class with optional pagination flags.", - Example: `regen q ecocredit projects-by-class C01 -regen q ecocredit projects-by-class C01 --limit 10 --offset 10`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.ProjectsByClass(cmd.Context(), &core.QueryProjectsByClassRequest{ - ClassId: args[0], - Pagination: pagination, - }) - return printQueryResponse(ctx, res, err) - }, - } - flags.AddPaginationFlagsToCmd(cmd, "projects-by-class") - return qflags(cmd) -} - -// QueryProjectCmd returns a query command that retrieves project information. -func QueryProjectCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "project [project-id]", - Short: "Retrieve project information", - Long: "Retrieve project information.", - Example: `regen q ecocredit project C01-001`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - res, err := c.Project(cmd.Context(), &core.QueryProjectRequest{ - ProjectId: args[0], - }) - return printQueryResponse(ctx, res, err) - }, - } - - return qflags(cmd) -} - -// QueryBatchesCmd returns a query command that retrieves credit batches for a -// given project. -func QueryBatchesCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "batches", - Short: "List all credit batches", - Long: "List all credit batches with optional pagination flags.", - Example: `regen q ecocredit batches -regen q ecocredit batches --limit 10 --offset 10`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.Batches(cmd.Context(), &core.QueryBatchesRequest{ - Pagination: pagination, - }) - - return printQueryResponse(ctx, res, err) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, "batches") - - return qflags(cmd) -} - -// QueryBatchesByIssuerCmd returns a query command that retrieves credit batches by issuer. -func QueryBatchesByIssuerCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "batches-by-issuer [issuer]", - Short: "List all credit batches by issuer", - Long: "List all credit batches by issuer with optional pagination flags.", - Example: `regen q ecocredit batches-by-issuer regen1r9pl9gvr56kmclgkpjg3ynh4rm5am66f2a6y38 -regen q ecocredit batches-by-issuer regen1r9pl9gvr56kmclgkpjg3ynh4rm5am66f2a6y38 --limit 10 --offset 10`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.BatchesByIssuer(cmd.Context(), &core.QueryBatchesByIssuerRequest{ - Issuer: args[0], - Pagination: pagination, - }) - - return printQueryResponse(ctx, res, err) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, "batches-by-issuer") - - return qflags(cmd) -} - -// QueryBatchesByClassCmd returns a query command that retrieves credit batches for a -// given credit class. -func QueryBatchesByClassCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "batches-by-class [class-id]", - Short: "List all credit batches by credit class", - Long: "List all credit batches by credit class with pagination flags.", - Example: `regen q ecocredit batches-by-class C01 -regen q ecocredit batches-by-class C01 --limit 10 --offset 10`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.BatchesByClass(cmd.Context(), &core.QueryBatchesByClassRequest{ - ClassId: args[0], - Pagination: pagination, - }) - - return printQueryResponse(ctx, res, err) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, "batches-by-class") - - return qflags(cmd) -} - -// QueryBatchesByProjectCmd returns a query command that retrieves credit batches for a -// given project. -func QueryBatchesByProjectCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "batches-by-project [project-id]", - Short: "List all credit batches by project", - Long: "List all credit batches by project with optional pagination flags.", - Example: `regen q ecocredit batches-by-project C01-001 -regen q ecocredit batches-by-project C01-001 --limit 10 --offset 10`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.BatchesByProject(cmd.Context(), &core.QueryBatchesByProjectRequest{ - ProjectId: args[0], - Pagination: pagination, - }) - - return printQueryResponse(ctx, res, err) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, "batches-by-project") - - return qflags(cmd) -} - -// QueryBatchCmd returns a query command that retrieves information for a -// given credit batch. -func QueryBatchCmd() *cobra.Command { - return qflags(&cobra.Command{ - Use: "batch [batch-denom]", - Short: "Retrieve credit batch information", - Long: "Retrieve credit batch information.", - Example: "regen q ecocredit batch C01-001-20200101-20210101-001", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - res, err := c.Batch(cmd.Context(), &core.QueryBatchRequest{ - BatchDenom: args[0], - }) - return printQueryResponse(ctx, res, err) - }, - }) -} - -// QueryBatchBalanceCmd returns a query command that retrieves the tradable and -// retired balances for a given credit batch and account address. -func QueryBatchBalanceCmd() *cobra.Command { - return qflags(&cobra.Command{ - Use: "batch-balance [batch-denom] [account]", - Short: "Retrieve the batch balance of an account", - Long: "Retrieve the batch balance of an account.", - Example: "regen q ecocredit batch-balance C01-001-20200101-20210101-001 regen1r9pl9gvr56kmclgkpjg3ynh4rm5am66f2a6y38", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - res, err := c.Balance(cmd.Context(), &core.QueryBalanceRequest{ - BatchDenom: args[0], Address: args[1], - }) - return printQueryResponse(ctx, res, err) - }, - }) -} - -// QueryBatchSupplyCmd returns a query command that retrieves the tradable and -// retired supply of credits for a given credit batch. -func QueryBatchSupplyCmd() *cobra.Command { - return qflags(&cobra.Command{ - Use: "batch-supply [batch-denom]", - Short: "Retrieve the supply of a credit batch", - Long: "Retrieve the supply of a credit batch.", - Example: "regen q ecocredit batch-supply C01-001-20200101-20210101-001", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - res, err := c.Supply(cmd.Context(), &core.QuerySupplyRequest{ - BatchDenom: args[0], - }) - return printQueryResponse(ctx, res, err) - }, - }) -} - -// QueryCreditTypesCmd returns a query command that retrieves the list of -// approved credit types. -func QueryCreditTypesCmd() *cobra.Command { - return qflags(&cobra.Command{ - Use: "credit-types", - Short: "List all credit types", - Long: "List all credit types.", - Example: "regen q ecocredit types", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - res, err := c.CreditTypes(cmd.Context(), &core.QueryCreditTypesRequest{}) - return printQueryResponse(ctx, res, err) - }, - }) -} - -// QueryParamsCmd returns ecocredit module parameters. -func QueryParamsCmd() *cobra.Command { - return qflags(&cobra.Command{ - Use: "params", - Short: "List the current ecocredit module parameters", - Long: "List the current ecocredit module parameters.", - Example: "regen q ecocredit params", - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - res, err := c.Params(cmd.Context(), &core.QueryParamsRequest{}) - return printQueryResponse(ctx, res, err) - }, - }) -} - -// QueryProjectsByReferenceIDCmd returns command that retrieves list of projects by reference id with pagination. -func QueryProjectsByReferenceIDCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "projects-by-reference-id [reference-id]", - Short: "List all projects by reference ID", - Long: "List all projects by reference ID with optional pagination flags.", - Example: `regen q ecocredit projects-by-reference-id VCS-001 -regen q ecocredit projects-by-reference-id VCS-001 --limit 10 --offset 10`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.ProjectsByReferenceId(cmd.Context(), &core.QueryProjectsByReferenceIdRequest{ - ReferenceId: args[0], - Pagination: pagination, - }) - return printQueryResponse(ctx, res, err) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, "projects-by-reference-id") - - return qflags(cmd) -} - -// QueryProjectsByAdminCmd returns command that retrieves list of projects by admin with pagination. -func QueryProjectsByAdminCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "projects-by-admin [admin]", - Short: "List projects by admin", - Long: "List projects by admin with optional pagination flags.", - Example: `regen q ecocredit projects-by-admin regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw -regen q ecocredit projects-by-admin regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw --limit 10 --offset 10`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.ProjectsByAdmin(cmd.Context(), &core.QueryProjectsByAdminRequest{ - Admin: args[0], - Pagination: pagination, - }) - return printQueryResponse(ctx, res, err) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, "projects-by-admin") - - return qflags(cmd) -} - -// QueryCreditTypeCmd returns a query command that retrieves credit type -// information by abbreviation. -func QueryCreditTypeCmd() *cobra.Command { - return qflags(&cobra.Command{ - Use: "credit-type [abbreviation]", - Short: "Retrieve credit type information", - Long: "Retrieve credit type information.", - Example: "regen q ecocredit credit-type C", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - res, err := c.CreditType(cmd.Context(), &core.QueryCreditTypeRequest{ - Abbreviation: args[0], - }) - return printQueryResponse(ctx, res, err) - }, - }) -} - -// QueryCreditClassFeesCmd returns a query command that retrives the credit class fees. -func QueryCreditClassFeesCmd() *cobra.Command { - return qflags(&cobra.Command{ - Use: "credit-class-fees", - Short: "Retrieve the credit class fees", - Long: "Retrieve the credit class fess", - Example: "regen q ecocredit credit-class-fees", - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - res, err := c.CreditClassFees(cmd.Context(), &core.QueryCreditClassFeesRequest{}) - return printQueryResponse(ctx, res, err) - }, - }) -} - -// QueryCreditClassAllowlistEnabledCmd returns a query command that retrives the -// class allow-list enable/disable flag. -func QueryCreditClassAllowlistEnabledCmd() *cobra.Command { - return qflags(&cobra.Command{ - Use: "credit-class-allowlist-enabled", - Short: "Retrieve the credit class allow-list setting", - Long: "Retrieve the credit class allow-list setting", - Example: "regen q ecocredit credit-class-allowlist-enabled", - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - res, err := c.CreditClassAllowlistEnabled(cmd.Context(), &core.QueryCreditClassAllowlistEnabledRequest{}) - return printQueryResponse(ctx, res, err) - }, - }) -} - -// QueryAllowedClassCreatorsCmd returns a query command that retrives the list of allowed -// credit class creators with pagination. -func QueryAllowedClassCreatorsCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "allowed-class-creators", - Short: "Retrieve the allowed credit class creators", - Long: "Retrieve the list of allowed credit class creators with pagination", - Example: ` - regen q ecocredit allowed-class-creators - regen q ecocredit allowed-class-creators --limit 10`, - RunE: func(cmd *cobra.Command, args []string) error { - c, ctx, err := mkQueryClient(cmd) - if err != nil { - return err - } - - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - res, err := c.AllowedClassCreators(cmd.Context(), &core.QueryAllowedClassCreatorsRequest{ - Pagination: pagination, - }) - return printQueryResponse(ctx, res, err) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, "batches-by-project") - - return qflags(cmd) -} diff --git a/x/ecocredit/client/testsuite/grpc.go b/x/ecocredit/client/testsuite/grpc.go index d639dd6e90..fae079cd9d 100644 --- a/x/ecocredit/client/testsuite/grpc.go +++ b/x/ecocredit/client/testsuite/grpc.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/rest" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) const coreRoute = "regen/ecocredit/v1" @@ -36,7 +36,7 @@ func (s *IntegrationTestSuite) TestQueryClasses() { resp, err := rest.GetRequest(tc.url) require.NoError(err) - var res core.QueryClassesResponse + var res types.QueryClassesResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotNil(res.Classes) @@ -70,7 +70,7 @@ func (s *IntegrationTestSuite) TestQueryClass() { resp, err := rest.GetRequest(tc.url) require.NoError(err) - var res core.QueryClassResponse + var res types.QueryClassResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotNil(res.Class) @@ -103,7 +103,7 @@ func (s *IntegrationTestSuite) TestQueryProject() { require.NoError(err) require.NotContains(string(bz), "code") - var res core.QueryProjectResponse + var res types.QueryProjectResponse require.NoError(s.val.ClientCtx.Codec.UnmarshalJSON(bz, &res)) require.NotEmpty(res.Project) }) @@ -138,7 +138,7 @@ func (s *IntegrationTestSuite) TestQueryProjects() { require.NoError(err) require.NotContains(string(bz), "code") - var res core.QueryProjectsResponse + var res types.QueryProjectsResponse require.NoError(s.val.ClientCtx.Codec.UnmarshalJSON(bz, &res)) require.NotEmpty(res.Projects) @@ -188,7 +188,7 @@ func (s *IntegrationTestSuite) TestQueryProjectsByClass() { require.NoError(err) require.NotContains(string(bz), "code") - var res core.QueryProjectsByClassResponse + var res types.QueryProjectsByClassResponse require.NoError(s.val.ClientCtx.Codec.UnmarshalJSON(bz, &res)) require.NotEmpty(res.Projects) @@ -243,7 +243,7 @@ func (s *IntegrationTestSuite) TestQueryProjectsByReferenceID() { require.NoError(err) require.NotContains(string(bz), "code") - var res core.QueryProjectsByReferenceIdResponse + var res types.QueryProjectsByReferenceIdResponse require.NoError(s.val.ClientCtx.Codec.UnmarshalJSON(bz, &res)) require.NotEmpty(res.Projects) @@ -281,7 +281,7 @@ func (s *IntegrationTestSuite) TestQueryBatches() { resp, err := rest.GetRequest(tc.url) require.NoError(err) - var res core.QueryBatchesResponse + var res types.QueryBatchesResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotNil(res.Batches) @@ -323,7 +323,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesByIssuer() { resp, err := rest.GetRequest(tc.url) require.NoError(err) - var res core.QueryBatchesByIssuerResponse + var res types.QueryBatchesByIssuerResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotNil(res.Batches) @@ -365,7 +365,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesByClass() { resp, err := rest.GetRequest(tc.url) require.NoError(err) - var res core.QueryBatchesByClassResponse + var res types.QueryBatchesByClassResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotNil(res.Batches) @@ -407,7 +407,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesByProject() { resp, err := rest.GetRequest(tc.url) require.NoError(err) - var res core.QueryBatchesResponse + var res types.QueryBatchesResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotNil(res.Batches) @@ -441,7 +441,7 @@ func (s *IntegrationTestSuite) TestQueryBatch() { resp, err := rest.GetRequest(tc.url) require.NoError(err) - var res core.QueryBatchResponse + var res types.QueryBatchResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotNil(res.Batch) @@ -457,7 +457,7 @@ func (s *IntegrationTestSuite) TestCreditTypes() { resp, err := rest.GetRequest(url) require.NoError(err) - var res core.QueryCreditTypesResponse + var res types.QueryCreditTypesResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.Greater(len(res.CreditTypes), 0) @@ -489,7 +489,7 @@ func (s *IntegrationTestSuite) TestQueryBalance() { resp, err := rest.GetRequest(tc.url) require.NoError(err) - var res core.QueryBalanceResponse + var res types.QueryBalanceResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotNil(res) @@ -521,7 +521,7 @@ func (s *IntegrationTestSuite) TestQuerySupply() { resp, err := rest.GetRequest(tc.url) require.NoError(err) - var res core.QuerySupplyResponse + var res types.QuerySupplyResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotNil(res) @@ -538,9 +538,9 @@ func (s *IntegrationTestSuite) TestQuerySupply() { // resp, err := rest.GetRequest(fmt.Sprintf("%s/%s/params", s.val.APIAddress, coreRoute)) // require.NoError(err) -// var res core.QueryParamsResponse +// var res types.QueryParamsResponse // require.NoError(s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res)) -// s.Require().Equal(core.DefaultParams(), *res.Params) +// s.Require().Equal(types.DefaultParams(), *res.Params) // } func (s *IntegrationTestSuite) TestCreditType() { @@ -550,7 +550,7 @@ func (s *IntegrationTestSuite) TestCreditType() { resp, err := rest.GetRequest(url) require.NoError(err) - var res core.QueryCreditTypeResponse + var res types.QueryCreditTypeResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.Equal(res.CreditType.Abbreviation, "C") @@ -564,7 +564,7 @@ func (s *IntegrationTestSuite) TestAllBalances() { resp, err := rest.GetRequest(url) require.NoError(err) - var res core.QueryAllBalancesResponse + var res types.QueryAllBalancesResponse err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotEmpty(res.Balances) @@ -574,7 +574,7 @@ func (s *IntegrationTestSuite) TestAllBalances() { resp, err = rest.GetRequest(url) require.NoError(err) - res = core.QueryAllBalancesResponse{} + res = types.QueryAllBalancesResponse{} err = s.val.ClientCtx.Codec.UnmarshalJSON(resp, &res) require.NoError(err) require.NotEmpty(res.Balances) diff --git a/x/ecocredit/client/testsuite/query.go b/x/ecocredit/client/testsuite/query.go index 286a58517a..043d116e86 100644 --- a/x/ecocredit/client/testsuite/query.go +++ b/x/ecocredit/client/testsuite/query.go @@ -8,8 +8,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/regen-ledger/types/testutil/cli" - coreclient "github.com/regen-network/regen-ledger/x/ecocredit/client" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base/client" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" + "github.com/regen-network/regen-ledger/x/ecocredit/genesis" ) const outputFormat = "JSON" @@ -19,20 +20,20 @@ func (s *IntegrationTestSuite) TestQueryClassesCmd() { val2 := s.network.Validators[1] clientCtx := val.ClientCtx clientCtx.OutputFormat = outputFormat - classID := s.createClass(clientCtx, &core.MsgCreateClass{ + classID := s.createClass(clientCtx, &types.MsgCreateClass{ Admin: val.Address.String(), Issuers: []string{val.Address.String()}, Metadata: "metadata", CreditTypeAbbrev: s.creditTypeAbbrev, - Fee: &core.DefaultParams().CreditClassFee[0], + Fee: &genesis.DefaultParams().CreditClassFee[0], }) - classID2 := s.createClass(clientCtx, &core.MsgCreateClass{ + classID2 := s.createClass(clientCtx, &types.MsgCreateClass{ Admin: val.Address.String(), Issuers: []string{val.Address.String(), val2.Address.String()}, Metadata: "metadata2", CreditTypeAbbrev: s.creditTypeAbbrev, - Fee: &core.DefaultParams().CreditClassFee[0], + Fee: &genesis.DefaultParams().CreditClassFee[0], }) classIDs := [2]string{classID, classID2} @@ -68,7 +69,7 @@ func (s *IntegrationTestSuite) TestQueryClassesCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryClassesCmd() + cmd := client.QueryClassesCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -76,7 +77,7 @@ func (s *IntegrationTestSuite) TestQueryClassesCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryClassesResponse + var res types.QueryClassesResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) if tc.expectedAmtClasses > 0 { @@ -99,12 +100,12 @@ func (s *IntegrationTestSuite) TestQueryClassCmd() { val := s.network.Validators[0] clientCtx := val.ClientCtx clientCtx.OutputFormat = outputFormat - class := &core.MsgCreateClass{ + class := &types.MsgCreateClass{ Admin: val.Address.String(), Issuers: []string{val.Address.String()}, Metadata: "hi", CreditTypeAbbrev: s.creditTypeAbbrev, - Fee: &core.DefaultParams().CreditClassFee[0], + Fee: &genesis.DefaultParams().CreditClassFee[0], } classID := s.createClass(clientCtx, class) @@ -114,7 +115,7 @@ func (s *IntegrationTestSuite) TestQueryClassCmd() { args []string expectErr bool expectedErrMsg string - expectedClass *core.ClassInfo + expectedClass *types.ClassInfo }{ { name: "missing args", @@ -132,7 +133,7 @@ func (s *IntegrationTestSuite) TestQueryClassCmd() { name: "valid credit class", args: []string{classID}, expectErr: false, - expectedClass: &core.ClassInfo{ + expectedClass: &types.ClassInfo{ Id: classID, Admin: val.Address.String(), Metadata: class.Metadata, @@ -143,7 +144,7 @@ func (s *IntegrationTestSuite) TestQueryClassCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryClassCmd() + cmd := client.QueryClassCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -151,7 +152,7 @@ func (s *IntegrationTestSuite) TestQueryClassCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryClassResponse + var res types.QueryClassResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().Equal(tc.expectedClass, res.Class) } @@ -186,7 +187,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryBatchesCmd() + cmd := client.QueryBatchesCmd() out, err := cli.ExecTestCLICmd(ctx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -194,7 +195,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryBatchesResponse + var res types.QueryBatchesResponse s.Require().NoError(ctx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().True(len(res.Batches) > 0) s.Require().NotNil(res.Pagination) @@ -243,7 +244,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesByIssuerCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryBatchesByIssuerCmd() + cmd := client.QueryBatchesByIssuerCmd() out, err := cli.ExecTestCLICmd(ctx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -251,7 +252,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesByIssuerCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryBatchesByIssuerResponse + var res types.QueryBatchesByIssuerResponse s.Require().NoError(ctx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().True(len(res.Batches) > 0) s.Require().NotNil(res.Pagination) @@ -300,7 +301,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesByClassCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryBatchesByClassCmd() + cmd := client.QueryBatchesByClassCmd() out, err := cli.ExecTestCLICmd(ctx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -308,7 +309,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesByClassCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryBatchesByClassResponse + var res types.QueryBatchesByClassResponse s.Require().NoError(ctx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().True(len(res.Batches) > 0) s.Require().NotNil(res.Pagination) @@ -357,7 +358,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesByProjectCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryBatchesByProjectCmd() + cmd := client.QueryBatchesByProjectCmd() out, err := cli.ExecTestCLICmd(ctx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -365,7 +366,7 @@ func (s *IntegrationTestSuite) TestQueryBatchesByProjectCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryBatchesByProjectResponse + var res types.QueryBatchesByProjectResponse s.Require().NoError(ctx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().True(len(res.Batches) > 0) s.Require().NotNil(res.Pagination) @@ -411,7 +412,7 @@ func (s *IntegrationTestSuite) TestQueryBatchCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryBatchCmd() + cmd := client.QueryBatchCmd() out, err := cli.ExecTestCLICmd(ctx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -419,7 +420,7 @@ func (s *IntegrationTestSuite) TestQueryBatchCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryBatchResponse + var res types.QueryBatchResponse s.Require().NoError(ctx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().Equal(res.Batch.Denom, s.batchDenom) } @@ -463,7 +464,7 @@ func (s *IntegrationTestSuite) TestQueryBalanceCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryBatchBalanceCmd() + cmd := client.QueryBatchBalanceCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -471,7 +472,7 @@ func (s *IntegrationTestSuite) TestQueryBalanceCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryBalanceResponse + var res types.QueryBalanceResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().Equal(res.Balance.Address, val.Address.String()) s.Require().NotEmpty(res.Balance.TradableAmount) @@ -513,7 +514,7 @@ func (s *IntegrationTestSuite) TestQuerySupplyCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryBatchSupplyCmd() + cmd := client.QueryBatchSupplyCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -521,7 +522,7 @@ func (s *IntegrationTestSuite) TestQuerySupplyCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QuerySupplyResponse + var res types.QuerySupplyResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().NotEmpty(res.TradableAmount) s.Require().NotEmpty(res.RetiredAmount) @@ -550,7 +551,7 @@ func (s *IntegrationTestSuite) TestQueryCreditTypesCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryCreditTypesCmd() + cmd := client.QueryCreditTypesCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -558,7 +559,7 @@ func (s *IntegrationTestSuite) TestQueryCreditTypesCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryCreditTypesResponse + var res types.QueryCreditTypesResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().Greater(len(res.CreditTypes), 0) } @@ -572,16 +573,16 @@ func (s *IntegrationTestSuite) TestQueryParamsCmd() { clientCtx.OutputFormat = "JSON" require := s.Require() - cmd := coreclient.QueryParamsCmd() + cmd := client.QueryParamsCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, []string{}) require.NoError(err) - var params core.QueryParamsResponse + var params types.QueryParamsResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), ¶ms)) require.NoError(err) - require.Equal(core.DefaultParams().BasketFee, params.Params.BasketFee) - require.Equal(core.DefaultParams().CreditClassFee, params.Params.CreditClassFee) + require.Equal(genesis.DefaultParams().BasketFee, params.Params.BasketFee) + require.Equal(genesis.DefaultParams().CreditClassFee, params.Params.CreditClassFee) require.False(params.Params.AllowlistEnabled) require.Equal([]string{sdk.AccAddress("issuer1").String(), sdk.AccAddress("issuer2").String()}, params.Params.AllowedClassCreators) } @@ -618,7 +619,7 @@ func (s *IntegrationTestSuite) TestQueryProjectsCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryProjectsCmd() + cmd := client.QueryProjectsCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expErr { require.Error(err) @@ -626,7 +627,7 @@ func (s *IntegrationTestSuite) TestQueryProjectsCmd() { } else { require.NoError(err) - var res core.QueryProjectsResponse + var res types.QueryProjectsResponse require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) require.NotEmpty(res.Projects) @@ -679,7 +680,7 @@ func (s *IntegrationTestSuite) TestQueryProjectsByClassCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryProjectsByClassCmd() + cmd := client.QueryProjectsByClassCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expErr { require.Error(err) @@ -687,7 +688,7 @@ func (s *IntegrationTestSuite) TestQueryProjectsByClassCmd() { } else { require.NoError(err) - var res core.QueryProjectsByClassResponse + var res types.QueryProjectsByClassResponse require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) require.NotEmpty(res.Projects) @@ -732,7 +733,7 @@ func (s *IntegrationTestSuite) TestQueryProjectCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryProjectCmd() + cmd := client.QueryProjectCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expErr { require.Error(err) @@ -740,7 +741,7 @@ func (s *IntegrationTestSuite) TestQueryProjectCmd() { } else { require.NoError(err) - var res core.QueryProjectResponse + var res types.QueryProjectResponse require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) require.NotEmpty(res.Project) } @@ -755,12 +756,12 @@ func (s *IntegrationTestSuite) TestQueryClassIssuersCmd() { clientCtx.OutputFormat = outputFormat require := s.Require() - classID := s.createClass(clientCtx, &core.MsgCreateClass{ + classID := s.createClass(clientCtx, &types.MsgCreateClass{ Admin: val.Address.String(), Issuers: []string{val.Address.String(), val2.Address.String()}, Metadata: "metadata", CreditTypeAbbrev: s.creditTypeAbbrev, - Fee: &core.DefaultParams().CreditClassFee[0], + Fee: &genesis.DefaultParams().CreditClassFee[0], }) testCases := []struct { @@ -794,7 +795,7 @@ func (s *IntegrationTestSuite) TestQueryClassIssuersCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryClassIssuersCmd() + cmd := client.QueryClassIssuersCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { require.Error(err) @@ -802,7 +803,7 @@ func (s *IntegrationTestSuite) TestQueryClassIssuersCmd() { } else { require.NoError(err, out.String()) - var res core.QueryClassIssuersResponse + var res types.QueryClassIssuersResponse require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) if tc.numItems > 0 { require.Len(res.Issuers, tc.numItems) @@ -852,7 +853,7 @@ func (s *IntegrationTestSuite) TestQueryCreditTypeCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - cmd := coreclient.QueryCreditTypeCmd() + cmd := client.QueryCreditTypeCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Error(err) @@ -860,7 +861,7 @@ func (s *IntegrationTestSuite) TestQueryCreditTypeCmd() { } else { s.Require().NoError(err, out.String()) - var res core.QueryCreditTypeResponse + var res types.QueryCreditTypeResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().Equal(res.CreditType.Abbreviation, "C") s.Require().Equal(res.CreditType.Precision, uint32(6)) @@ -875,12 +876,12 @@ func (s *IntegrationTestSuite) TestQueryAllowedClassCreators() { clientCtx := val.ClientCtx clientCtx.OutputFormat = outputFormat - cmd := coreclient.QueryAllowedClassCreatorsCmd() + cmd := client.QueryAllowedClassCreatorsCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, []string{}) s.Require().NoError(err, out.String()) - var res core.QueryAllowedClassCreatorsResponse + var res types.QueryAllowedClassCreatorsResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().Len(res.ClassCreators, 2) s.Require().Equal(res.ClassCreators[0], sdk.AccAddress("issuer1").String()) @@ -892,12 +893,12 @@ func (s *IntegrationTestSuite) TestQueryCreditClassAllowlistEnableCmd() { clientCtx := val.ClientCtx clientCtx.OutputFormat = outputFormat - cmd := coreclient.QueryCreditClassAllowlistEnabledCmd() + cmd := client.QueryCreditClassAllowlistEnabledCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, []string{}) s.Require().NoError(err, out.String()) - var res core.QueryCreditClassAllowlistEnabledResponse + var res types.QueryCreditClassAllowlistEnabledResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().False(res.AllowlistEnabled) } @@ -907,13 +908,13 @@ func (s *IntegrationTestSuite) TestQueryCreditClassFeesCmd() { clientCtx := val.ClientCtx clientCtx.OutputFormat = outputFormat - cmd := coreclient.QueryCreditClassFeesCmd() + cmd := client.QueryCreditClassFeesCmd() out, err := cli.ExecTestCLICmd(clientCtx, cmd, []string{}) s.Require().NoError(err, out.String()) - var res core.QueryCreditClassFeesResponse + var res types.QueryCreditClassFeesResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) s.Require().Equal(res.Fees.Len(), 1) - s.Require().Equal(res.Fees.AmountOf(sdk.DefaultBondDenom), core.DefaultCreditClassFee) + s.Require().Equal(res.Fees.AmountOf(sdk.DefaultBondDenom), types.DefaultCreditClassFee) } diff --git a/x/ecocredit/client/testsuite/query_basket.go b/x/ecocredit/client/testsuite/query_basket.go index 6b94bd5668..c922d79fe7 100644 --- a/x/ecocredit/client/testsuite/query_basket.go +++ b/x/ecocredit/client/testsuite/query_basket.go @@ -8,9 +8,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/regen-ledger/types/testutil/cli" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/basket/client" types "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" ) func (s *IntegrationTestSuite) TestQueryBasketCmd() { @@ -244,5 +244,5 @@ func (s *IntegrationTestSuite) TestQueryBasketFees() { var res types.QueryBasketFeesResponse require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) require.NotEmpty(res.Fees) - require.Equal(res.Fees.AmountOf(sdk.DefaultBondDenom), core.DefaultBasketFee) + require.Equal(res.Fees.AmountOf(sdk.DefaultBondDenom), basetypes.DefaultBasketFee) } diff --git a/x/ecocredit/client/testsuite/suite.go b/x/ecocredit/client/testsuite/suite.go index c7f05c36e0..2b32f2c6cf 100644 --- a/x/ecocredit/client/testsuite/suite.go +++ b/x/ecocredit/client/testsuite/suite.go @@ -24,15 +24,15 @@ import ( basketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" marketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/testutil/cli" "github.com/regen-network/regen-ledger/types/testutil/network" "github.com/regen-network/regen-ledger/x/ecocredit" + baseclient "github.com/regen-network/regen-ledger/x/ecocredit/base/client" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" basketclient "github.com/regen-network/regen-ledger/x/ecocredit/basket/client" baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - coreclient "github.com/regen-network/regen-ledger/x/ecocredit/client" - "github.com/regen-network/regen-ledger/x/ecocredit/core" "github.com/regen-network/regen-ledger/x/ecocredit/genesis" marketclient "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/client" markettypes "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" @@ -87,7 +87,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.setupTestAccounts() // create test credit class - s.classID = s.createClass(s.val.ClientCtx, &core.MsgCreateClass{ + s.classID = s.createClass(s.val.ClientCtx, &basetypes.MsgCreateClass{ Admin: s.addr1.String(), Issuers: []string{s.addr1.String()}, Metadata: "metadata", @@ -99,7 +99,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.projectReferenceID = "VCS-001" // create test project - s.projectID = s.createProject(s.val.ClientCtx, &core.MsgCreateProject{ + s.projectID = s.createProject(s.val.ClientCtx, &basetypes.MsgCreateProject{ Admin: s.addr1.String(), ClassId: s.classID, Metadata: "metadata", @@ -114,10 +114,10 @@ func (s *IntegrationTestSuite) SetupSuite() { require.NoError(err) // create test credit batch - s.batchDenom = s.createBatch(s.val.ClientCtx, &core.MsgCreateBatch{ + s.batchDenom = s.createBatch(s.val.ClientCtx, &basetypes.MsgCreateBatch{ Issuer: s.addr1.String(), ProjectId: s.projectID, - Issuance: []*core.BatchIssuance{ + Issuance: []*basetypes.BatchIssuance{ { Recipient: s.addr1.String(), TradableAmount: "10000", @@ -183,7 +183,7 @@ func (s *IntegrationTestSuite) setupGenesis() { mdb, err := ormdb.NewModuleDB(&ecocredit.ModuleSchema, ormdb.ModuleDBOptions{}) require.NoError(err) - coreStore, err := api.NewStateStore(mdb) + coreStore, err := baseapi.NewStateStore(mdb) require.NoError(err) marketStore, err := marketapi.NewStateStore(mdb) @@ -204,7 +204,7 @@ func (s *IntegrationTestSuite) setupGenesis() { Fees: []*sdkbase.Coin{ { Denom: sdk.DefaultBondDenom, - Amount: core.DefaultBasketFee.String(), + Amount: basetypes.DefaultBasketFee.String(), }, }, }) @@ -224,7 +224,7 @@ func (s *IntegrationTestSuite) setupGenesis() { s.creditTypeAbbrev = "C" // insert credit type - err = coreStore.CreditTypeTable().Insert(ctx, &api.CreditType{ + err = coreStore.CreditTypeTable().Insert(ctx, &baseapi.CreditType{ Abbreviation: s.creditTypeAbbrev, Name: "carbon", Unit: "metric ton CO2 equivalent", @@ -233,28 +233,28 @@ func (s *IntegrationTestSuite) setupGenesis() { require.NoError(err) // set credit class fees - err = coreStore.ClassFeesTable().Save(ctx, &api.ClassFees{ + err = coreStore.ClassFeesTable().Save(ctx, &baseapi.ClassFees{ Fees: []*sdkbase.Coin{ { Denom: sdk.DefaultBondDenom, - Amount: core.DefaultCreditClassFee.String(), + Amount: basetypes.DefaultCreditClassFee.String(), }, }, }) require.NoError(err) // set credit class allow list - err = coreStore.AllowListEnabledTable().Save(ctx, &api.AllowListEnabled{ + err = coreStore.AllowListEnabledTable().Save(ctx, &baseapi.AllowListEnabled{ Enabled: false, }) require.NoError(err) // set allowed credit class creators - err = coreStore.AllowedClassCreatorTable().Insert(ctx, &api.AllowedClassCreator{ + err = coreStore.AllowedClassCreatorTable().Insert(ctx, &baseapi.AllowedClassCreator{ Address: sdk.AccAddress("issuer1"), }) require.NoError(err) - err = coreStore.AllowedClassCreatorTable().Insert(ctx, &api.AllowedClassCreator{ + err = coreStore.AllowedClassCreatorTable().Insert(ctx, &baseapi.AllowedClassCreator{ Address: sdk.AccAddress("issuer2"), }) require.NoError(err) @@ -264,7 +264,7 @@ func (s *IntegrationTestSuite) setupGenesis() { err = mdb.ExportJSON(ctx, target) require.NoError(err) - params := core.DefaultParams() + params := genesis.DefaultParams() // set credit class and basket fees s.creditClassFee = params.CreditClassFee @@ -332,10 +332,10 @@ func (s *IntegrationTestSuite) fundAccount(clientCtx client.Context, from, to sd require.Zero(res.Code, res.RawLog) } -func (s *IntegrationTestSuite) createClass(clientCtx client.Context, msg *core.MsgCreateClass) (classID string) { +func (s *IntegrationTestSuite) createClass(clientCtx client.Context, msg *basetypes.MsgCreateClass) (classID string) { require := s.Require() - cmd := coreclient.TxCreateClassCmd() + cmd := baseclient.TxCreateClassCmd() args := []string{ strings.Join(msg.Issuers, ","), msg.CreditTypeAbbrev, @@ -352,7 +352,7 @@ func (s *IntegrationTestSuite) createClass(clientCtx client.Context, msg *core.M require.Zero(res.Code, res.RawLog) for _, e := range res.Logs[0].Events { - if e.Type == proto.MessageName(&core.EventCreateClass{}) { + if e.Type == proto.MessageName(&basetypes.EventCreateClass{}) { for _, attr := range e.Attributes { if attr.Key == "class_id" { return strings.Trim(attr.Value, "\"") @@ -366,10 +366,10 @@ func (s *IntegrationTestSuite) createClass(clientCtx client.Context, msg *core.M return "" } -func (s *IntegrationTestSuite) createProject(clientCtx client.Context, msg *core.MsgCreateProject) (projectID string) { +func (s *IntegrationTestSuite) createProject(clientCtx client.Context, msg *basetypes.MsgCreateProject) (projectID string) { require := s.Require() - cmd := coreclient.TxCreateProjectCmd() + cmd := baseclient.TxCreateProjectCmd() args := []string{ msg.ClassId, msg.Jurisdiction, @@ -386,7 +386,7 @@ func (s *IntegrationTestSuite) createProject(clientCtx client.Context, msg *core require.Zero(res.Code, res.RawLog) for _, e := range res.Logs[0].Events { - if e.Type == proto.MessageName(&core.EventCreateProject{}) { + if e.Type == proto.MessageName(&basetypes.EventCreateProject{}) { for _, attr := range e.Attributes { if attr.Key == "project_id" { return strings.Trim(attr.Value, "\"") @@ -400,7 +400,7 @@ func (s *IntegrationTestSuite) createProject(clientCtx client.Context, msg *core return "" } -func (s *IntegrationTestSuite) createBatch(clientCtx client.Context, msg *core.MsgCreateBatch) (batchDenom string) { +func (s *IntegrationTestSuite) createBatch(clientCtx client.Context, msg *basetypes.MsgCreateBatch) (batchDenom string) { require := s.Require() bz, err := clientCtx.Codec.MarshalJSON(msg) @@ -408,7 +408,7 @@ func (s *IntegrationTestSuite) createBatch(clientCtx client.Context, msg *core.M jsonFile := testutil.WriteToNewTempFile(s.T(), string(bz)).Name() - cmd := coreclient.TxCreateBatchCmd() + cmd := baseclient.TxCreateBatchCmd() args := []string{ jsonFile, fmt.Sprintf("--%s=%s", flags.FlagFrom, msg.Issuer), @@ -422,7 +422,7 @@ func (s *IntegrationTestSuite) createBatch(clientCtx client.Context, msg *core.M require.Zero(res.Code, res.RawLog) for _, e := range res.Logs[0].Events { - if e.Type == proto.MessageName(&core.EventCreateBatch{}) { + if e.Type == proto.MessageName(&basetypes.EventCreateBatch{}) { for _, attr := range e.Attributes { if attr.Key == "batch_denom" { return strings.Trim(attr.Value, "\"") diff --git a/x/ecocredit/client/testsuite/tx.go b/x/ecocredit/client/testsuite/tx.go index 572746b147..c87deb2db7 100644 --- a/x/ecocredit/client/testsuite/tx.go +++ b/x/ecocredit/client/testsuite/tx.go @@ -8,10 +8,10 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/regen-network/regen-ledger/types" + regentypes "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/testutil/cli" - coreclient "github.com/regen-network/regen-ledger/x/ecocredit/client" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base/client" + types "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func (s *IntegrationTestSuite) TestTxCreateClassCmd() { @@ -97,7 +97,7 @@ func (s *IntegrationTestSuite) TestTxCreateClassCmd() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxCreateClassCmd() + cmd := client.TxCreateClassCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -180,7 +180,7 @@ func (s *IntegrationTestSuite) TestTxCreateProjectCmd() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxCreateProjectCmd() + cmd := client.TxCreateProjectCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -203,16 +203,16 @@ func (s *IntegrationTestSuite) TestTxCreateBatchCmd() { issuer := s.addr1.String() recipient := s.addr2.String() - startDate, err := types.ParseDate("start date", "2020-01-01") + startDate, err := regentypes.ParseDate("start date", "2020-01-01") require.NoError(err) - endDate, err := types.ParseDate("end date", "2021-01-01") + endDate, err := regentypes.ParseDate("end date", "2021-01-01") require.NoError(err) - bz, err := s.val.ClientCtx.Codec.MarshalJSON(&core.MsgCreateBatch{ + bz, err := s.val.ClientCtx.Codec.MarshalJSON(&types.MsgCreateBatch{ Issuer: issuer, ProjectId: s.projectID, - Issuance: []*core.BatchIssuance{ + Issuance: []*types.BatchIssuance{ { Recipient: recipient, TradableAmount: "10", @@ -314,7 +314,7 @@ func (s *IntegrationTestSuite) TestTxCreateBatchCmd() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxCreateBatchCmd() + cmd := client.TxCreateBatchCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -384,14 +384,14 @@ func (s *IntegrationTestSuite) TestTxSendCmd() { s.batchDenom, recipient, fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), - fmt.Sprintf("--%s=%s", coreclient.FlagRetirementJurisdiction, retirementJurisdiction), + fmt.Sprintf("--%s=%s", client.FlagRetirementJurisdiction, retirementJurisdiction), }, }, } for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxSendCmd() + cmd := client.TxSendCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -415,7 +415,7 @@ func (s *IntegrationTestSuite) TestTxSendBulkCmd() { recipient := s.addr2.String() // using json package because array is not a proto message - bz, err := json.Marshal([]core.MsgSend_SendCredits{ + bz, err := json.Marshal([]types.MsgSend_SendCredits{ { BatchDenom: s.batchDenom, TradableAmount: "10", @@ -522,7 +522,7 @@ func (s *IntegrationTestSuite) TestTxSendBulkCmd() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxSendBulkCmd() + cmd := client.TxSendBulkCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -545,7 +545,7 @@ func (s *IntegrationTestSuite) TestTxRetire() { owner := s.addr1.String() // using json package because array is not a proto message - bz, err := json.Marshal([]core.Credits{ + bz, err := json.Marshal([]types.Credits{ { BatchDenom: s.batchDenom, Amount: "10", @@ -645,7 +645,7 @@ func (s *IntegrationTestSuite) TestTxRetire() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxRetireCmd() + cmd := client.TxRetireCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -668,7 +668,7 @@ func (s *IntegrationTestSuite) TestTxCancel() { owner := s.addr1.String() // using json package because array is not a proto message - bz, err := json.Marshal([]core.Credits{ + bz, err := json.Marshal([]types.Credits{ { BatchDenom: s.batchDenom, Amount: "10", @@ -768,7 +768,7 @@ func (s *IntegrationTestSuite) TestTxCancel() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxCancelCmd() + cmd := client.TxCancelCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -792,7 +792,7 @@ func (s *IntegrationTestSuite) TestTxUpdateClassAdmin() { newAdmin := s.addr2.String() // create new credit class to not interfere with other tests - classID1 := s.createClass(s.val.ClientCtx, &core.MsgCreateClass{ + classID1 := s.createClass(s.val.ClientCtx, &types.MsgCreateClass{ Admin: admin, Issuers: []string{admin}, Metadata: "metadata", @@ -801,7 +801,7 @@ func (s *IntegrationTestSuite) TestTxUpdateClassAdmin() { }) // create new credit class to not interfere with other tests - classID2 := s.createClass(s.val.ClientCtx, &core.MsgCreateClass{ + classID2 := s.createClass(s.val.ClientCtx, &types.MsgCreateClass{ Admin: admin, Issuers: []string{admin}, Metadata: "metadata", @@ -810,7 +810,7 @@ func (s *IntegrationTestSuite) TestTxUpdateClassAdmin() { }) // create new credit class to not interfere with other tests - classID3 := s.createClass(s.val.ClientCtx, &core.MsgCreateClass{ + classID3 := s.createClass(s.val.ClientCtx, &types.MsgCreateClass{ Admin: admin, Issuers: []string{admin}, Metadata: "metadata", @@ -875,7 +875,7 @@ func (s *IntegrationTestSuite) TestTxUpdateClassAdmin() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxUpdateClassAdminCmd() + cmd := client.TxUpdateClassAdminCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -935,7 +935,7 @@ func (s *IntegrationTestSuite) TestTxUpdateIssuers() { name: "valid add issuer", args: []string{ s.classID, - fmt.Sprintf("--%s=%s", coreclient.FlagAddIssuers, issuer), + fmt.Sprintf("--%s=%s", client.FlagAddIssuers, issuer), fmt.Sprintf("--%s=%s", flags.FlagFrom, admin), }, }, @@ -943,7 +943,7 @@ func (s *IntegrationTestSuite) TestTxUpdateIssuers() { name: "valid remove issuer", args: []string{ s.classID, - fmt.Sprintf("--%s=%s", coreclient.FlagRemoveIssuers, issuer), + fmt.Sprintf("--%s=%s", client.FlagRemoveIssuers, issuer), fmt.Sprintf("--%s=%s", flags.FlagFrom, admin), }, }, @@ -951,7 +951,7 @@ func (s *IntegrationTestSuite) TestTxUpdateIssuers() { name: "valid from key-name", args: []string{ s.classID, - fmt.Sprintf("--%s=%s", coreclient.FlagAddIssuers, issuer), + fmt.Sprintf("--%s=%s", client.FlagAddIssuers, issuer), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.val.Moniker), }, }, @@ -959,7 +959,7 @@ func (s *IntegrationTestSuite) TestTxUpdateIssuers() { name: "valid with amino-json", args: []string{ s.classID, - fmt.Sprintf("--%s=%s", coreclient.FlagRemoveIssuers, issuer), + fmt.Sprintf("--%s=%s", client.FlagRemoveIssuers, issuer), fmt.Sprintf("--%s=%s", flags.FlagFrom, admin), fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), }, @@ -969,7 +969,7 @@ func (s *IntegrationTestSuite) TestTxUpdateIssuers() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxUpdateClassIssuersCmd() + cmd := client.TxUpdateClassIssuersCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -1048,7 +1048,7 @@ func (s *IntegrationTestSuite) TestTxUpdateClassMetadata() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxUpdateClassMetadataCmd() + cmd := client.TxUpdateClassMetadataCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -1072,7 +1072,7 @@ func (s *IntegrationTestSuite) TestUpdateProjectAdmin() { newAdmin := s.addr2.String() // create new project in order to not interfere with other tests - projectID1 := s.createProject(s.val.ClientCtx, &core.MsgCreateProject{ + projectID1 := s.createProject(s.val.ClientCtx, &types.MsgCreateProject{ Admin: admin, ClassId: s.classID, Metadata: "metadata", @@ -1081,7 +1081,7 @@ func (s *IntegrationTestSuite) TestUpdateProjectAdmin() { }) // create new project in order to not interfere with other tests - projectID2 := s.createProject(s.val.ClientCtx, &core.MsgCreateProject{ + projectID2 := s.createProject(s.val.ClientCtx, &types.MsgCreateProject{ Admin: admin, ClassId: s.classID, Metadata: "metadata", @@ -1090,7 +1090,7 @@ func (s *IntegrationTestSuite) TestUpdateProjectAdmin() { }) // create new project in order to not interfere with other tests - projectID3 := s.createProject(s.val.ClientCtx, &core.MsgCreateProject{ + projectID3 := s.createProject(s.val.ClientCtx, &types.MsgCreateProject{ Admin: admin, ClassId: s.classID, Metadata: "metadata", @@ -1155,7 +1155,7 @@ func (s *IntegrationTestSuite) TestUpdateProjectAdmin() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxUpdateProjectAdminCmd() + cmd := client.TxUpdateProjectAdminCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { @@ -1234,7 +1234,7 @@ func (s *IntegrationTestSuite) TestUpdateProjectMetadata() { for _, tc := range testCases { args := tc.args s.Run(tc.name, func() { - cmd := coreclient.TxUpdateProjectMetadataCmd() + cmd := client.TxUpdateProjectMetadataCmd() args = append(args, s.commonTxFlags()...) out, err := cli.ExecTestCLICmd(s.val.ClientCtx, cmd, args) if tc.expErr { diff --git a/x/ecocredit/client/tx.go b/x/ecocredit/client/tx.go index 1e6492f90b..fc2a80715c 100644 --- a/x/ecocredit/client/tx.go +++ b/x/ecocredit/client/tx.go @@ -1,23 +1,13 @@ package client import ( - "bytes" - "encoding/json" - "fmt" - "strconv" - "strings" - "github.com/spf13/cobra" sdkclient "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/types" - basketclient "github.com/regen-network/regen-ledger/x/ecocredit/basket/client" + baseclient "github.com/regen-network/regen-ledger/x/ecocredit/base/client" + basketcli "github.com/regen-network/regen-ledger/x/ecocredit/basket/client" marketclient "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/client" - "github.com/regen-network/regen-ledger/x/ecocredit/core" ) const ( @@ -38,22 +28,22 @@ func TxCmd(name string) *cobra.Command { RunE: sdkclient.ValidateCmd, } cmd.AddCommand( - TxCreateClassCmd(), - TxCreateProjectCmd(), - TxGenBatchJSONCmd(), - TxCreateBatchCmd(), - TxSendCmd(), - TxSendBulkCmd(), - TxRetireCmd(), - TxCancelCmd(), - TxUpdateClassMetadataCmd(), - TxUpdateClassIssuersCmd(), - TxUpdateClassAdminCmd(), - TxUpdateProjectAdminCmd(), - TxUpdateProjectMetadataCmd(), - basketclient.TxCreateBasketCmd(), - basketclient.TxPutInBasketCmd(), - basketclient.TxTakeFromBasketCmd(), + baseclient.TxCreateClassCmd(), + baseclient.TxCreateProjectCmd(), + baseclient.TxGenBatchJSONCmd(), + baseclient.TxCreateBatchCmd(), + baseclient.TxSendCmd(), + baseclient.TxSendBulkCmd(), + baseclient.TxRetireCmd(), + baseclient.TxCancelCmd(), + baseclient.TxUpdateClassMetadataCmd(), + baseclient.TxUpdateClassIssuersCmd(), + baseclient.TxUpdateClassAdminCmd(), + baseclient.TxUpdateProjectAdminCmd(), + baseclient.TxUpdateProjectMetadataCmd(), + basketcli.TxCreateBasketCmd(), + basketcli.TxPutInBasketCmd(), + basketcli.TxTakeFromBasketCmd(), marketclient.TxSellCmd(), marketclient.TxUpdateSellOrdersCmd(), marketclient.TxBuyDirectCmd(), @@ -62,639 +52,3 @@ func TxCmd(name string) *cobra.Command { ) return cmd } - -// TxCreateClassCmd returns a transaction command that creates a credit class. -func TxCreateClassCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-class [issuers] [credit-type-abbrev] [metadata] [fee] [flags]", - Short: "Creates a new credit class with transaction author (--from) as admin", - Long: fmt.Sprintf(`Creates a new credit class with transaction author (--from) as admin. - -The transaction author must have permission to create a new credit class by -being on the list of %s. This is a governance parameter, which -can be queried via the command line. - -They must also pay a fee (separate from the transaction fee) to create a credit -class. The list of accepted fees is defined by the %s parameter. - -Parameters: - -- issuers: comma separated (no spaces) list of issuer account addresses -- credit-type-abbrev: the abbreviation of a credit type -- metadata: arbitrary data attached to the credit class info -- fee: fee to pay for the creation of the credit class`, - core.KeyAllowedClassCreators, - core.KeyCreditClassFee, - ), - Example: `regen tx ecocredit create-class regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw C regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf 20000000uregen -regen tx ecocredit create-class regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw,regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6 C regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf 20000000uregen`, - Args: cobra.ExactArgs(4), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - // Get the class admin from the --from flag - admin := clientCtx.GetFromAddress() - - // Parse the comma-separated list of issuers - issuers := strings.Split(args[0], ",") - for i := range issuers { - issuers[i] = strings.TrimSpace(issuers[i]) - } - - // Parse and normalize credit class fee - fee, err := sdk.ParseCoinNormalized(args[3]) - if err != nil { - return err - } - - msg := core.MsgCreateClass{ - Admin: admin.String(), - Issuers: issuers, - Metadata: args[2], - CreditTypeAbbrev: args[1], - Fee: &fee, - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - return txFlags(cmd) -} - -// TxCreateProjectCmd returns a transaction command that creates a new project. -func TxCreateProjectCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-project [class-id] [jurisdiction] [metadata] [flags]", - Short: "Create a new project within a credit class", - Long: `Create a new project within a credit class. - -Parameters: - -- class-id: the ID of the credit class -- jurisdiction: the jurisdiction of the project -- metadata: any arbitrary metadata to attach to the project - -Optional Flags: - -- reference-id: a reference ID for the project`, - Example: `regen tx ecocredit create-project C01 "US-WA 98225" regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf -regen tx ecocredit create-project C01 "US-WA 98225" regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf --reference-id VCS-001`, - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - referenceID, err := cmd.Flags().GetString(FlagReferenceID) - if err != nil { - return err - } - - msg := core.MsgCreateProject{ - Admin: clientCtx.GetFromAddress().String(), - ClassId: args[0], - Jurisdiction: args[1], - Metadata: args[2], - ReferenceId: referenceID, - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - - }, - } - - cmd.Flags().String(FlagReferenceID, "", "a reference ID for the project") - - return txFlags(cmd) -} - -// TxGenBatchJSONCmd returns a transaction command that generates JSON to -// represent a new credit batch. -func TxGenBatchJSONCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: `gen-batch-json [issuer] [project-id] [issuance-count] [metadata] [start-date] [end-date]`, - Short: "Generates JSON to represent a new credit batch for use with create-batch command", - Long: `Generates JSON to represent a new credit batch for use with create-batch command. - -Parameters: - -- issuer: the account address of the credit batch issuer -- project-id: the ID of the project -- issuance-count: the number of issuance items to generate -- metadata: any arbitrary metadata to attach to the credit batch -- start-date: the beginning of the period during which this credit batch was - quantified and verified (format: yyyy-mm-dd) -- end-date: the end of the period during which this credit batch was - quantified and verified (format: yyyy-mm-dd)`, - Example: "regen tx ecocredit gen-batch-json regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw C01-001 2 regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf 2020-01-01 2021-01-01", - Args: cobra.ExactArgs(6), - RunE: func(cmd *cobra.Command, args []string) error { - issuanceCount, err := strconv.ParseUint(args[2], 10, 8) - if err != nil { - return err - } - - issuance := make([]*core.BatchIssuance, issuanceCount) - for i := range issuance { - issuance[i] = &core.BatchIssuance{} - } - - startDate, err := types.ParseDate("start date", args[4]) - if err != nil { - return err - } - - endDate, err := types.ParseDate("end date", args[5]) - if err != nil { - return err - } - - msg := &core.MsgCreateBatch{ - Issuer: args[0], - ProjectId: args[1], - Issuance: issuance, - Metadata: args[3], - StartDate: &startDate, - EndDate: &endDate, - } - - // Marshal and output JSON of message - ctx := sdkclient.GetClientContextFromCmd(cmd) - msgJSON, err := ctx.Codec.MarshalJSON(msg) - if err != nil { - return err - } - - var formattedJSON bytes.Buffer - err = json.Indent(&formattedJSON, msgJSON, "", " ") - if err != nil { - return err - } - fmt.Println(formattedJSON.String()) - - return nil - }, - } - - return cmd -} - -// TxCreateBatchCmd returns a transaction command that creates a credit batch. -func TxCreateBatchCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-batch [batch-json]", - Short: "Issues a new credit batch", - Long: `Issues a new credit batch. - -Parameters: - -- batch-json: path to JSON file containing credit batch information`, - Example: `regen tx ecocredit create-batch batch.json - -Example JSON: - -{ - "project_id": "C01-001", - "issuer": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw", - "issuance": [ - { - "recipient": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw", - "tradable_amount": "1000", - "retired_amount": "500", - "retirement_jurisdiction": "US-WA" - }, - { - "recipient": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6", - "tradable_amount": "1000", - "retired_amount": "500", - "retirement_jurisdiction": "US-OR" - } - ], - "metadata": "regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf", - "start_date": "2020-01-01T00:00:00Z", - "end_date": "2021-01-01T00:00:00Z", - "open": false -}`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - // Parse the JSON file representing the request - msg, err := parseMsgCreateBatch(clientCtx, args[0]) - if err != nil { - return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse json: %s", err) - } - - // Get the batch issuer from the --from flag - msg.Issuer = clientCtx.GetFromAddress().String() - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - return txFlags(cmd) -} - -// TxSendCmd returns a transaction command that sends credits from a single batch from one account -// to another. -func TxSendCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "send [amount] [batch-denom] [recipient] [flags]", - Short: "Sends credits from a single batch from the transaction author (--from) to the recipient", - Long: `Sends credits from a single batch from the transaction author (--from) to the recipient. - -By default, the credits will be sent as tradable. Use the --retirement-jurisdiction flag to retire the credits to the recipient address. - -Parameters: - -- amount: the amount of credits to send -- batch-denom: the denomination of the credit batch -- recipient: the recipient account address`, - Example: "regen tx ecocredit send 20 C01-001-20200101-20210101-001 regen18xvpj53vaupyfejpws5sktv5lnas5xj2phm3cf --from myKey", - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - retireTo, err := cmd.Flags().GetString(FlagRetirementJurisdiction) - if err != nil { - return err - } - tradableAmount := args[0] - retiredAmount := "0" - if len(retireTo) > 0 { - tradableAmount = "0" - retiredAmount = args[0] - } - credit := core.MsgSend_SendCredits{ - TradableAmount: tradableAmount, - BatchDenom: args[1], - RetiredAmount: retiredAmount, - RetirementJurisdiction: retireTo, - } - msg := core.MsgSend{ - Sender: clientCtx.GetFromAddress().String(), - Recipient: args[2], - Credits: []*core.MsgSend_SendCredits{&credit}, - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - cmd.Flags().String(FlagRetirementJurisdiction, "", "Jurisdiction to retire the credits to. If empty, credits are not retired. (default empty)") - return txFlags(cmd) -} - -// TxSendBulkCmd returns a transaction command that can send credits from multiple batches from one account -// to another -func TxSendBulkCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "send-bulk [recipient] [credits-json]", - Short: "Sends credits from multiple batches from the transaction author (--from) to the recipient", - Long: `Sends credits from multiple batches from the transaction author (--from) to the recipient. - -Parameters: - -- recipient: the recipient account address -- credits-json: path to JSON file containing credits to send`, - Example: `regen tx ecocredit send-bulk regen18xvpj53vaupyfejpws5sktv5lnas5xj2phm3cf credits.json - -Example JSON: - -[ - { - "batch_denom": "C01-001-20200101-20210101-001", - "tradable_amount": "500" - }, - { - "batch_denom": "C01-001-20200101-20210101-002", - "tradable_amount": "50", - "retired_amount": "100", - "retirement_jurisdiction": "YY-ZZ 12345" - } -]`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - // Parse the JSON file representing the credits - credits, err := parseSendCredits(args[1]) - if err != nil { - return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse json: %s", err) - } - - msg := core.MsgSend{ - Sender: clientCtx.GetFromAddress().String(), - Recipient: args[0], - Credits: credits, - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - return txFlags(cmd) -} - -// TxRetireCmd returns a transaction command that retires credits. -func TxRetireCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "retire [credits] [retirement-jurisdiction]", - Short: "Retires a specified amount of credits from the account of the transaction author (--from)", - Long: `Retires a specified amount of credits from the account of the transaction author (--from) - -Parameters: - -- credits: path to JSON file containing credits to retire -- retirement-jurisdiction: the jurisdiction in which the credit will be retired`, - Example: ` -regen tx ecocredit retire credits.json "US-WA 98225" - -Example JSON: -[ - { - "batch_denom": "C01-001-20200101-20210101-001", - "amount": "5" - }, - { - "batch_denom": "C01-001-20200101-20210101-002", - "amount": "10" - } -]`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - // Parse the JSON file representing the credits - credits, err := parseCredits(args[0]) - if err != nil { - return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse json: %s", err) - } - - msg := core.MsgRetire{ - Owner: clientCtx.GetFromAddress().String(), - Credits: credits, - Jurisdiction: args[1], - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - return txFlags(cmd) -} - -// TxCancelCmd returns a transaction command that cancels credits. -func TxCancelCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "cancel [credits-json] [reason]", - Short: "Cancels a specified amount of credits from the account of the transaction author (--from)", - Long: `Cancels a specified amount of credits from the account of the transaction author (--from) - -Parameters: - -- credits-json: path to JSON file containing credits to retire -- reason: any arbitrary string that specifies the reason for cancelling credits`, - Example: `regen tx ecocredit cancel credits.json "transferring credits to another registry" - -Example JSON: - -[ - { - "batch_denom": "C01-001-20200101-20210101-001", - "amount": "5" - }, - { - "batch_denom": "C01-001-20200101-20210101-002", - "amount": "10" - } -]`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - // Parse the JSON file representing the credits - credits, err := parseCredits(args[0]) - if err != nil { - return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse json: %s", err) - } - - msg := core.MsgCancel{ - Owner: clientCtx.GetFromAddress().String(), - Credits: credits, - Reason: args[1], - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - return txFlags(cmd) -} - -func TxUpdateClassMetadataCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-class-metadata [class-id] [new-metadata]", - Short: "Updates the metadata for a specific credit class", - Long: `Updates the metadata for a specific credit class. - -The '--from' flag must equal the credit class admin. - -Parameters: - -- class-id: the class id that corresponds with the credit class you want to update -- new-metadata: any arbitrary metadata to attach to the credit class`, - Args: cobra.ExactArgs(2), - Example: `regen tx ecocredit update-class-metadata C01 regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf`, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := core.MsgUpdateClassMetadata{ - Admin: clientCtx.GetFromAddress().String(), - ClassId: args[0], - NewMetadata: args[1], - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - return txFlags(cmd) -} - -func TxUpdateClassAdminCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-class-admin [class-id] [new-admin]", - Short: "Updates the admin for a specific credit class", - Long: `Updates the admin for a specific credit class. - -The '--from' flag must equal the current credit class admin. - -WARNING: Updating the admin replaces the current admin. Be sure the new admin account address is entered correctly. - -Parameters: - -- class-id: the ID of the credit class to update -- new-admin: the new admin account address that will overwrite the current admin account address`, - Example: "regen tx ecocredit update-class-admin C01 regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := core.MsgUpdateClassAdmin{ - Admin: clientCtx.GetFromAddress().String(), - ClassId: args[0], - NewAdmin: args[1], - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - return txFlags(cmd) -} - -func TxUpdateClassIssuersCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-class-issuers [class-id]", - Short: "Update the list of issuers for a specific credit class", - Long: `Update the list of issuers for a specific credit class. - -The '--from' flag must equal the current credit class admin. - -Parameters: - -- class-id: the ID of the credit class to update - -Flags: - -- add-issuers: the new list of issuers to add to the class issuers list -- remove-issuers: the new list of issuers to remove from the class issuers list`, - Example: `regen tx ecocredit update-class-issuers C01 --add-issuers addr1,addr2,addr3 -regen tx ecocredit update-class-issuers C01 --add-issuers addr1,addr2 --remove-issuers addr3,addr4`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - - // parse add issuers - addIssuers, err := cmd.Flags().GetStringSlice(FlagAddIssuers) - if err != nil { - return err - } - for i := range addIssuers { - addIssuers[i] = strings.TrimSpace(addIssuers[i]) - } - - // parse remove issuers - removeIssuers, err := cmd.Flags().GetStringSlice(FlagRemoveIssuers) - if err != nil { - return err - } - for i := range removeIssuers { - removeIssuers[i] = strings.TrimSpace(removeIssuers[i]) - } - - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := core.MsgUpdateClassIssuers{ - Admin: clientCtx.GetFromAddress().String(), - ClassId: args[0], - AddIssuers: addIssuers, - RemoveIssuers: removeIssuers, - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - cmd.Flags().StringSlice(FlagAddIssuers, []string{}, "comma separated (no spaces) list of addresses") - cmd.Flags().StringSlice(FlagRemoveIssuers, []string{}, "comma separated (no spaces) list of addresses") - - return txFlags(cmd) -} - -func TxUpdateProjectAdminCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-project-admin [project-id] [new-admin] [flags]", - Short: "Update the project admin address", - Long: `Update the project admin to the provided new_admin_address. - -The '--from' flag must equal the current credit class admin. - -WARNING: Updating the admin replaces the current admin. Be sure the new admin account address is entered correctly. - -Parameters: - -- project-id: the ID of the project to update -- new-admin: the new admin account address that will overwrite the current admin account address`, - Example: "regen tx ecocredit update-project-admin C01-001 regen1ynugxwpp4lfpy0epvfqwqkpuzkz62htnex3op", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := core.MsgUpdateProjectAdmin{ - Admin: clientCtx.GetFromAddress().String(), - NewAdmin: args[1], - ProjectId: args[0], - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - return txFlags(cmd) -} - -func TxUpdateProjectMetadataCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-project-metadata [project-id] [new-metadata]", - Short: "Update the project metadata", - Long: "Update the project metadata, overwriting the project's current metadata.", - Example: "regen tx ecocredit update-project-metadata C01-001 regen:13toVgf5UjYBz6J29x28pLQyjKz5FpcW3f4bT5uRKGxGREWGKjEdXYG.rdf", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := sdkclient.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := core.MsgUpdateProjectMetadata{ - Admin: clientCtx.GetFromAddress().String(), - NewMetadata: args[1], - ProjectId: args[0], - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - return txFlags(cmd) -} diff --git a/x/ecocredit/core/default.go b/x/ecocredit/core/default.go deleted file mode 100644 index af72a8c1c6..0000000000 --- a/x/ecocredit/core/default.go +++ /dev/null @@ -1,37 +0,0 @@ -package core - -import sdk "github.com/cosmos/cosmos-sdk/types" - -// DefaultParams returns a default set of parameters. -func DefaultParams() Params { - return NewParams( - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultCreditClassFee)), - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultBasketFee)), - []string{}, - false, - ) -} - -// DefaultCreditTypes returns a default credit class fees. -func DefaultCreditClassFees() ClassFees { - return ClassFees{ - Fees: []*sdk.Coin{ - { - Denom: sdk.DefaultBondDenom, - Amount: DefaultCreditClassFee, - }, - }, - } -} - -// DefaultCreditTypes returns a default set of credit types. -func DefaultCreditTypes() []CreditType { - return []CreditType{ - { - Name: "carbon", - Abbreviation: "C", - Unit: "metric ton CO2 equivalent", - Precision: PRECISION, - }, - } -} diff --git a/x/ecocredit/genesis/default.go b/x/ecocredit/genesis/default.go index a0774c21ff..60ffb00f70 100644 --- a/x/ecocredit/genesis/default.go +++ b/x/ecocredit/genesis/default.go @@ -2,19 +2,42 @@ package genesis import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" markettypes "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" ) -// DefaultAllowedDenoms returns a default set of allowed denoms. -func DefaultAllowedDenoms() []markettypes.AllowedDenom { - return []markettypes.AllowedDenom{ +// DefaultParams returns a default set of parameters. +func DefaultParams() basetypes.Params { + return basetypes.NewParams( + sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, basetypes.DefaultCreditClassFee)), + sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, basetypes.DefaultBasketFee)), + []string{}, + false, + ) +} + +// DefaultCreditTypes returns a default set of credit basetypes. +func DefaultCreditTypes() []basetypes.CreditType { + return []basetypes.CreditType{ { - BankDenom: sdk.DefaultBondDenom, - DisplayDenom: sdk.DefaultBondDenom, - Exponent: 6, + Name: "carbon", + Abbreviation: "C", + Unit: "metric ton CO2 equivalent", + Precision: basetypes.PRECISION, + }, + } +} + +// DefaultCreditClassFees returns a default credit class fees. +func DefaultCreditClassFees() basetypes.ClassFees { + return basetypes.ClassFees{ + Fees: []*sdk.Coin{ + { + Denom: sdk.DefaultBondDenom, + Amount: basetypes.DefaultCreditClassFee, + }, }, } } @@ -25,8 +48,19 @@ func DefaultBasketFees() baskettypes.BasketFees { Fees: []*sdk.Coin{ { Denom: sdk.DefaultBondDenom, - Amount: core.DefaultBasketFee, + Amount: basetypes.DefaultBasketFee, }, }, } } + +// DefaultAllowedDenoms returns a default set of allowed denoms. +func DefaultAllowedDenoms() []markettypes.AllowedDenom { + return []markettypes.AllowedDenom{ + { + BankDenom: sdk.DefaultBondDenom, + DisplayDenom: sdk.DefaultBondDenom, + Exponent: 6, + }, + } +} diff --git a/x/ecocredit/genesis/genesis.go b/x/ecocredit/genesis/genesis.go index 4a6e366dda..b4fd3c3e0f 100644 --- a/x/ecocredit/genesis/genesis.go +++ b/x/ecocredit/genesis/genesis.go @@ -18,12 +18,12 @@ import ( basketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" marketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/types/ormutil" "github.com/regen-network/regen-ledger/x/ecocredit" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" markettypes "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" ) @@ -36,7 +36,7 @@ import ( // - the retired amount of each credit batch complies with the credit type precision // - the calculated total amount of each credit batch matches the total supply // An error is returned if any of these validation checks fail. -func ValidateGenesis(data json.RawMessage, params core.Params) error { +func ValidateGenesis(data json.RawMessage, params basetypes.Params) error { if err := params.Validate(); err != nil { return err } @@ -55,7 +55,7 @@ func ValidateGenesis(data json.RawMessage, params core.Params) error { } ormCtx := ormtable.WrapContextDefault(backend) - ss, err := api.NewStateStore(ormdb) + ss, err := baseapi.NewStateStore(ormdb) if err != nil { return err } @@ -75,7 +75,7 @@ func ValidateGenesis(data json.RawMessage, params core.Params) error { } abbrevToPrecision := make(map[string]uint32) // map of credit abbreviation to precision - ctItr, err := ss.CreditTypeTable().List(ormCtx, &api.CreditTypePrimaryKey{}) + ctItr, err := ss.CreditTypeTable().List(ormCtx, &baseapi.CreditTypePrimaryKey{}) if err != nil { return err } @@ -88,7 +88,7 @@ func ValidateGenesis(data json.RawMessage, params core.Params) error { } ctItr.Close() - cItr, err := ss.ClassTable().List(ormCtx, api.ClassPrimaryKey{}) + cItr, err := ss.ClassTable().List(ormCtx, baseapi.ClassPrimaryKey{}) if err != nil { return err } @@ -107,7 +107,7 @@ func ValidateGenesis(data json.RawMessage, params core.Params) error { } projectKeyToClassKey := make(map[uint64]uint64) // map of project key to class key - pItr, err := ss.ProjectTable().List(ormCtx, api.ProjectPrimaryKey{}) + pItr, err := ss.ProjectTable().List(ormCtx, baseapi.ProjectPrimaryKey{}) if err != nil { return err } @@ -127,7 +127,7 @@ func ValidateGenesis(data json.RawMessage, params core.Params) error { batchIDToPrecision := make(map[uint64]uint32) // map of batchID to precision batchDenomToIDMap := make(map[string]uint64) // map of batchDenom to batchID - bItr, err := ss.BatchTable().List(ormCtx, api.BatchPrimaryKey{}) + bItr, err := ss.BatchTable().List(ormCtx, baseapi.BatchPrimaryKey{}) if err != nil { return err } @@ -158,7 +158,7 @@ func ValidateGenesis(data json.RawMessage, params core.Params) error { batchIDToCalSupply := make(map[uint64]math.Dec) // map of batchID to calculated supply batchIDToSupply := make(map[uint64]math.Dec) // map of batchID to actual supply - bsItr, err := ss.BatchSupplyTable().List(ormCtx, api.BatchSupplyPrimaryKey{}) + bsItr, err := ss.BatchSupplyTable().List(ormCtx, baseapi.BatchSupplyPrimaryKey{}) if err != nil { return err } @@ -248,74 +248,74 @@ func validateMsg(m proto.Message) error { switch m.(type) { // ecocredit core - case *api.CreditType: - msg := &core.CreditType{} + case *baseapi.CreditType: + msg := &basetypes.CreditType{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.Class: - msg := &core.Class{} + case *baseapi.Class: + msg := &basetypes.Class{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.ClassIssuer: - msg := &core.ClassIssuer{} + case *baseapi.ClassIssuer: + msg := &basetypes.ClassIssuer{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.Project: - msg := &core.Project{} + case *baseapi.Project: + msg := &basetypes.Project{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.Batch: - msg := &core.Batch{} + case *baseapi.Batch: + msg := &basetypes.Batch{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.ClassSequence: - msg := &core.ClassSequence{} + case *baseapi.ClassSequence: + msg := &basetypes.ClassSequence{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.ProjectSequence: - msg := &core.ProjectSequence{} + case *baseapi.ProjectSequence: + msg := &basetypes.ProjectSequence{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.BatchSequence: - msg := &core.BatchSequence{} + case *baseapi.BatchSequence: + msg := &basetypes.BatchSequence{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.BatchBalance: - msg := &core.BatchBalance{} + case *baseapi.BatchBalance: + msg := &basetypes.BatchBalance{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.BatchSupply: - msg := &core.BatchSupply{} + case *baseapi.BatchSupply: + msg := &basetypes.BatchSupply{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.OriginTxIndex: - msg := &core.OriginTxIndex{} + case *baseapi.OriginTxIndex: + msg := &basetypes.OriginTxIndex{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } return msg.Validate() - case *api.BatchContract: - msg := &core.BatchContract{} + case *baseapi.BatchContract: + msg := &basetypes.BatchContract{} if err := ormutil.PulsarToGogoSlow(m, msg); err != nil { return err } @@ -365,8 +365,8 @@ func validateMsg(m proto.Message) error { return nil } -func calculateSupply(ctx context.Context, batchIDToPrecision map[uint64]uint32, ss api.StateStore, batchIDToSupply map[uint64]math.Dec) error { - bbItr, err := ss.BatchBalanceTable().List(ctx, api.BatchBalancePrimaryKey{}) +func calculateSupply(ctx context.Context, batchIDToPrecision map[uint64]uint32, ss baseapi.StateStore, batchIDToSupply map[uint64]math.Dec) error { + bbItr, err := ss.BatchBalanceTable().List(ctx, baseapi.BatchBalancePrimaryKey{}) if err != nil { return err } @@ -473,7 +473,7 @@ func MergeParamsIntoTarget(cdc codec.JSONCodec, message gogoproto.Message, targe } // MergeCreditTypesIntoTarget merges params message into the ormjson.WriteTarget. -func MergeCreditTypesIntoTarget(messages []core.CreditType, target ormjson.WriteTarget) error { +func MergeCreditTypesIntoTarget(messages []basetypes.CreditType, target ormjson.WriteTarget) error { w, err := target.OpenWriter(protoreflect.FullName(gogoproto.MessageName(&messages[0]))) if err != nil { return err @@ -517,7 +517,7 @@ func MergeAllowedDenomsIntoTarget(messages []markettypes.AllowedDenom, target or // MergeCreditClassFeesIntoTarget merges params message into the ormjson.WriteTarget. func MergeCreditClassFeesIntoTarget( cdc codec.JSONCodec, - creditClassFees core.ClassFees, + creditClassFees basetypes.ClassFees, target ormjson.WriteTarget) error { w, err := target.OpenWriter(protoreflect.FullName(gogoproto.MessageName(&creditClassFees))) if err != nil { diff --git a/x/ecocredit/genesis/genesis_test.go b/x/ecocredit/genesis/genesis_test.go index 4e0835d2aa..778028d8f9 100644 --- a/x/ecocredit/genesis/genesis_test.go +++ b/x/ecocredit/genesis/genesis_test.go @@ -7,7 +7,6 @@ import ( "github.com/gogo/protobuf/jsonpb" gogoproto "github.com/gogo/protobuf/proto" - "github.com/regen-network/regen-ledger/types" "github.com/stretchr/testify/require" "google.golang.org/protobuf/reflect/protoreflect" @@ -23,9 +22,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" basketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func TestValidateGenesis(t *testing.T) { @@ -34,10 +34,10 @@ func TestValidateGenesis(t *testing.T) { ormCtx := ormtable.WrapContextDefault(ormtest.NewMemoryBackend()) modDB, err := ormdb.NewModuleDB(&ecocredit.ModuleSchema, ormdb.ModuleDBOptions{}) require.NoError(t, err) - ss, err := api.NewStateStore(modDB) + ss, err := baseapi.NewStateStore(modDB) require.NoError(t, err) - require.NoError(t, ss.CreditTypeTable().Insert(ormCtx, &api.CreditType{ + require.NoError(t, ss.CreditTypeTable().Insert(ormCtx, &baseapi.CreditType{ Abbreviation: "BIO", Name: "biodiversity", Unit: "acres", @@ -45,14 +45,14 @@ func TestValidateGenesis(t *testing.T) { })) require.NoError(t, ss.BatchBalanceTable().Insert(ormCtx, - &api.BatchBalance{ + &baseapi.BatchBalance{ BatchKey: 1, Address: sdk.AccAddress("addr1"), TradableAmount: "90.003", RetiredAmount: "9.997", })) - batches := []*api.Batch{ + batches := []*baseapi.Batch{ { Issuer: sdk.AccAddress("addr2"), ProjectKey: 1, @@ -75,13 +75,13 @@ func TestValidateGenesis(t *testing.T) { } require.NoError(t, ss.BatchSupplyTable().Insert(ormCtx, - &api.BatchSupply{ + &baseapi.BatchSupply{ BatchKey: 1, TradableAmount: "90.003", RetiredAmount: "9.997", })) - classes := []*api.Class{ + classes := []*baseapi.Class{ { Id: "BIO001", Admin: sdk.AccAddress("addr4"), @@ -97,7 +97,7 @@ func TestValidateGenesis(t *testing.T) { require.NoError(t, ss.ClassTable().Insert(ormCtx, c)) } - projects := []*api.Project{ + projects := []*baseapi.Project{ { Id: "P01-001", Admin: sdk.AccAddress("addr6"), @@ -122,7 +122,7 @@ func TestValidateGenesis(t *testing.T) { genesisJSON, err := target.JSON() require.NoError(t, err) - params := core.Params{AllowlistEnabled: true} + params := basetypes.Params{AllowlistEnabled: true} err = ValidateGenesis(genesisJSON, params) require.NoError(t, err) } @@ -130,26 +130,26 @@ func TestValidateGenesis(t *testing.T) { func TestGenesisValidate(t *testing.T) { t.Parallel() - defaultParams := core.DefaultParams() + defaultParams := DefaultParams() addr1 := sdk.AccAddress("foobar") addr2 := sdk.AccAddress("fooBarBaz") testCases := []struct { id string - setupState func(ctx context.Context, ss api.StateStore) - params core.Params + setupState func(ctx context.Context, ss baseapi.StateStore) + params basetypes.Params expectErr bool errorMsg string }{ { "valid: no credit batches", - func(ctx context.Context, ss api.StateStore) { - require.NoError(t, ss.CreditTypeTable().Insert(ctx, &api.CreditType{ + func(ctx context.Context, ss baseapi.StateStore) { + require.NoError(t, ss.CreditTypeTable().Insert(ctx, &baseapi.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "metric ton C02 equivalent", Precision: 6, })) - require.NoError(t, ss.ClassTable().Insert(ctx, &api.Class{ + require.NoError(t, ss.ClassTable().Insert(ctx, &baseapi.Class{ Id: "C01", Admin: addr1, CreditTypeAbbrev: "C", @@ -161,14 +161,14 @@ func TestGenesisValidate(t *testing.T) { }, { "invalid credit type abbreviation", - func(ctx context.Context, ss api.StateStore) { - require.NoError(t, ss.CreditTypeTable().Insert(ctx, &api.CreditType{ + func(ctx context.Context, ss baseapi.StateStore) { + require.NoError(t, ss.CreditTypeTable().Insert(ctx, &baseapi.CreditType{ Abbreviation: "1234", Name: "carbon", Unit: "kg", Precision: 6, })) - require.NoError(t, ss.ClassTable().Insert(ctx, &api.Class{ + require.NoError(t, ss.ClassTable().Insert(ctx, &baseapi.Class{ Id: "C01", Admin: addr1, CreditTypeAbbrev: "C", @@ -180,20 +180,20 @@ func TestGenesisValidate(t *testing.T) { }, { "invalid: credit type param", - func(ctx context.Context, ss api.StateStore) { - require.NoError(t, ss.ClassTable().Insert(ctx, &api.Class{ + func(ctx context.Context, ss baseapi.StateStore) { + require.NoError(t, ss.ClassTable().Insert(ctx, &baseapi.Class{ Id: "C01", Admin: addr1, CreditTypeAbbrev: "C", })) - require.NoError(t, ss.CreditTypeTable().Insert(ctx, &api.CreditType{ + require.NoError(t, ss.CreditTypeTable().Insert(ctx, &baseapi.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "kg", Precision: 7, })) }, - func() core.Params { + func() basetypes.Params { return defaultParams }(), true, @@ -201,10 +201,10 @@ func TestGenesisValidate(t *testing.T) { }, { "invalid: bad addresses in allowlist", - func(ctx context.Context, ss api.StateStore) { + func(ctx context.Context, ss baseapi.StateStore) { }, - func() core.Params { - p := core.DefaultParams() + func() basetypes.Params { + p := DefaultParams() p.AllowlistEnabled = true p.AllowedClassCreators = []string{"-=!?#09)("} return p @@ -214,8 +214,8 @@ func TestGenesisValidate(t *testing.T) { }, { "invalid: type id does not match param id", - func(ctx context.Context, ss api.StateStore) { - require.NoError(t, ss.ClassTable().Insert(ctx, &api.Class{ + func(ctx context.Context, ss baseapi.StateStore) { + require.NoError(t, ss.ClassTable().Insert(ctx, &baseapi.Class{ Id: "C01", Admin: addr1, CreditTypeAbbrev: "F", @@ -227,29 +227,29 @@ func TestGenesisValidate(t *testing.T) { }, { "expect error: balances are missing", - func(ctx context.Context, ss api.StateStore) { - require.NoError(t, ss.CreditTypeTable().Insert(ctx, &api.CreditType{ + func(ctx context.Context, ss baseapi.StateStore) { + require.NoError(t, ss.CreditTypeTable().Insert(ctx, &baseapi.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "metric ton C02 equivalent", Precision: 6, })) denom := "C01-001-00000000-00000000-001" - key, err := ss.ClassTable().InsertReturningID(ctx, &api.Class{ + key, err := ss.ClassTable().InsertReturningID(ctx, &baseapi.Class{ Id: "C01", Admin: addr1, CreditTypeAbbrev: "C", }) require.NoError(t, err) - pKey, err := ss.ProjectTable().InsertReturningID(ctx, &api.Project{ + pKey, err := ss.ProjectTable().InsertReturningID(ctx, &baseapi.Project{ Id: "P01-001", Admin: addr1, ClassKey: key, Jurisdiction: "AQ", }) require.NoError(t, err) - bKey, err := ss.BatchTable().InsertReturningID(ctx, &api.Batch{ + bKey, err := ss.BatchTable().InsertReturningID(ctx, &baseapi.Batch{ Issuer: addr1, ProjectKey: pKey, Denom: denom, @@ -258,7 +258,7 @@ func TestGenesisValidate(t *testing.T) { IssuanceDate: ×tamppb.Timestamp{Seconds: 400}, }) require.NoError(t, err) - require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &api.BatchSupply{ + require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &baseapi.BatchSupply{ BatchKey: bKey, TradableAmount: "400.456", })) @@ -269,22 +269,22 @@ func TestGenesisValidate(t *testing.T) { }, { "expect error: invalid supply", - func(ctx context.Context, ss api.StateStore) { - require.NoError(t, ss.CreditTypeTable().Insert(ctx, &api.CreditType{ + func(ctx context.Context, ss baseapi.StateStore) { + require.NoError(t, ss.CreditTypeTable().Insert(ctx, &baseapi.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "metric ton C02 equivalent", Precision: 6, })) denom := "C01-001-00000000-00000000-001" - cKey, err := ss.ClassTable().InsertReturningID(ctx, &api.Class{ + cKey, err := ss.ClassTable().InsertReturningID(ctx, &baseapi.Class{ Id: "C01", Admin: addr1, CreditTypeAbbrev: "C", }) require.NoError(t, err) - pKey, err := ss.ProjectTable().InsertReturningID(ctx, &api.Project{ + pKey, err := ss.ProjectTable().InsertReturningID(ctx, &baseapi.Project{ Id: "P01-001", Admin: addr1, ClassKey: cKey, @@ -292,7 +292,7 @@ func TestGenesisValidate(t *testing.T) { }) require.NoError(t, err) - bKey, err := ss.BatchTable().InsertReturningID(ctx, &api.Batch{ + bKey, err := ss.BatchTable().InsertReturningID(ctx, &baseapi.Batch{ Issuer: addr1, ProjectKey: pKey, Denom: denom, @@ -301,13 +301,13 @@ func TestGenesisValidate(t *testing.T) { IssuanceDate: ×tamppb.Timestamp{Seconds: 102}, }) require.NoError(t, err) - require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &api.BatchBalance{ + require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &baseapi.BatchBalance{ BatchKey: bKey, Address: addr1, TradableAmount: "100", RetiredAmount: "100", })) - require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &api.BatchSupply{ + require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &baseapi.BatchSupply{ BatchKey: bKey, TradableAmount: "10", RetiredAmount: "", @@ -320,27 +320,27 @@ func TestGenesisValidate(t *testing.T) { }, { "valid test case", - func(ctx context.Context, ss api.StateStore) { - require.NoError(t, ss.CreditTypeTable().Insert(ctx, &api.CreditType{ + func(ctx context.Context, ss baseapi.StateStore) { + require.NoError(t, ss.CreditTypeTable().Insert(ctx, &baseapi.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "metric ton C02 equivalent", Precision: 6, })) - cKey, err := ss.ClassTable().InsertReturningID(ctx, &api.Class{ + cKey, err := ss.ClassTable().InsertReturningID(ctx, &baseapi.Class{ Id: "C01", Admin: addr1, CreditTypeAbbrev: "C", }) require.NoError(t, err) - pKey, err := ss.ProjectTable().InsertReturningID(ctx, &api.Project{ + pKey, err := ss.ProjectTable().InsertReturningID(ctx, &baseapi.Project{ Id: "P01-001", Admin: addr1, ClassKey: cKey, Jurisdiction: "AQ", }) require.NoError(t, err) - bKey, err := ss.BatchTable().InsertReturningID(ctx, &api.Batch{ + bKey, err := ss.BatchTable().InsertReturningID(ctx, &baseapi.Batch{ Issuer: addr1, ProjectKey: pKey, Denom: "C01-001-00000000-00000000-001", @@ -349,20 +349,20 @@ func TestGenesisValidate(t *testing.T) { IssuanceDate: ×tamppb.Timestamp{Seconds: 102}, }) require.NoError(t, err) - require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &api.BatchBalance{ + require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &baseapi.BatchBalance{ BatchKey: bKey, Address: addr1, TradableAmount: "100.123", RetiredAmount: "100.123", EscrowedAmount: "10.000", })) - require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &api.BatchBalance{ + require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &baseapi.BatchBalance{ BatchKey: bKey, Address: addr2, TradableAmount: "100.123", RetiredAmount: "100.123", })) - require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &api.BatchSupply{ + require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &baseapi.BatchSupply{ BatchKey: bKey, TradableAmount: "210.246", RetiredAmount: "200.246", @@ -374,47 +374,47 @@ func TestGenesisValidate(t *testing.T) { }, { "valid test case, multiple classes and credit types", - func(ctx context.Context, ss api.StateStore) { - require.NoError(t, ss.CreditTypeTable().Insert(ctx, &api.CreditType{ + func(ctx context.Context, ss baseapi.StateStore) { + require.NoError(t, ss.CreditTypeTable().Insert(ctx, &baseapi.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "metric ton C02 equivalent", Precision: 6, })) - require.NoError(t, ss.CreditTypeTable().Insert(ctx, &api.CreditType{ + require.NoError(t, ss.CreditTypeTable().Insert(ctx, &baseapi.CreditType{ Abbreviation: "BIO", Name: "biodiversity", Unit: "acres", Precision: 6, })) - cKey, err := ss.ClassTable().InsertReturningID(ctx, &api.Class{ + cKey, err := ss.ClassTable().InsertReturningID(ctx, &baseapi.Class{ Id: "C01", Admin: addr1, CreditTypeAbbrev: "C", }) require.NoError(t, err) - cKeyBIO, err := ss.ClassTable().InsertReturningID(ctx, &api.Class{ + cKeyBIO, err := ss.ClassTable().InsertReturningID(ctx, &baseapi.Class{ Id: "BIO01", Admin: addr1, CreditTypeAbbrev: "BIO", }) require.NoError(t, err) - pKey, err := ss.ProjectTable().InsertReturningID(ctx, &api.Project{ + pKey, err := ss.ProjectTable().InsertReturningID(ctx, &baseapi.Project{ Id: "P01-001", Admin: addr1, ClassKey: cKey, Jurisdiction: "AQ", }) require.NoError(t, err) - pKeyBIO, err := ss.ProjectTable().InsertReturningID(ctx, &api.Project{ + pKeyBIO, err := ss.ProjectTable().InsertReturningID(ctx, &baseapi.Project{ Id: "P02-001", Admin: addr1, ClassKey: cKeyBIO, Jurisdiction: "AQ", }) require.NoError(t, err) - bKey, err := ss.BatchTable().InsertReturningID(ctx, &api.Batch{ + bKey, err := ss.BatchTable().InsertReturningID(ctx, &baseapi.Batch{ Issuer: addr1, ProjectKey: pKey, Denom: "C01-001-00000000-00000000-001", @@ -423,7 +423,7 @@ func TestGenesisValidate(t *testing.T) { IssuanceDate: ×tamppb.Timestamp{Seconds: 102}, }) require.NoError(t, err) - bKeyBIO, err := ss.BatchTable().InsertReturningID(ctx, &api.Batch{ + bKeyBIO, err := ss.BatchTable().InsertReturningID(ctx, &baseapi.Batch{ Issuer: addr1, ProjectKey: pKeyBIO, Denom: "BIO01-001-00000000-00000000-001", @@ -432,7 +432,7 @@ func TestGenesisValidate(t *testing.T) { IssuanceDate: ×tamppb.Timestamp{Seconds: 102}, }) require.NoError(t, err) - bKey2, err := ss.BatchTable().InsertReturningID(ctx, &api.Batch{ + bKey2, err := ss.BatchTable().InsertReturningID(ctx, &baseapi.Batch{ Issuer: addr1, ProjectKey: pKey, Denom: "C01-001-00000000-00000000-002", @@ -441,45 +441,45 @@ func TestGenesisValidate(t *testing.T) { IssuanceDate: ×tamppb.Timestamp{Seconds: 102}, }) require.NoError(t, err) - require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &api.BatchBalance{ + require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &baseapi.BatchBalance{ BatchKey: bKey, Address: addr1, TradableAmount: "100.123", RetiredAmount: "100.123", })) - require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &api.BatchBalance{ + require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &baseapi.BatchBalance{ BatchKey: bKey2, Address: addr2, TradableAmount: "100.123", RetiredAmount: "100.123", })) - require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &api.BatchBalance{ + require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &baseapi.BatchBalance{ BatchKey: bKeyBIO, Address: addr1, TradableAmount: "105.2", EscrowedAmount: "102.2", RetiredAmount: "207.1", })) - require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &api.BatchBalance{ + require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &baseapi.BatchBalance{ BatchKey: bKeyBIO, Address: addr2, TradableAmount: "101.1", RetiredAmount: "404.1", })) - require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &api.BatchSupply{ + require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &baseapi.BatchSupply{ BatchKey: bKey, TradableAmount: "100.123", RetiredAmount: "100.123", CancelledAmount: "", })) - require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &api.BatchSupply{ + require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &baseapi.BatchSupply{ BatchKey: bKey2, TradableAmount: "100.123", RetiredAmount: "100.123", CancelledAmount: "", })) - require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &api.BatchSupply{ + require.NoError(t, ss.BatchSupplyTable().Insert(ctx, &baseapi.BatchSupply{ BatchKey: bKeyBIO, TradableAmount: "308.5", RetiredAmount: "611.2", @@ -512,13 +512,13 @@ func TestValidateGenesisWithBasketBalance(t *testing.T) { ormCtx := ormtable.WrapContextDefault(ormtest.NewMemoryBackend()) modDB, err := ormdb.NewModuleDB(&ecocredit.ModuleSchema, ormdb.ModuleDBOptions{}) require.NoError(t, err) - ss, err := api.NewStateStore(modDB) + ss, err := baseapi.NewStateStore(modDB) require.NoError(t, err) bsktStore, err := basketapi.NewStateStore(modDB) require.NoError(t, err) - require.NoError(t, ss.CreditTypeTable().Insert(ormCtx, &api.CreditType{ + require.NoError(t, ss.CreditTypeTable().Insert(ormCtx, &baseapi.CreditType{ Abbreviation: "BIO", Name: "biodiversity", Unit: "acres", @@ -526,7 +526,7 @@ func TestValidateGenesisWithBasketBalance(t *testing.T) { })) require.NoError(t, ss.BatchBalanceTable().Insert(ormCtx, - &api.BatchBalance{ + &baseapi.BatchBalance{ BatchKey: 1, Address: sdk.AccAddress("addr1"), TradableAmount: "90.003", @@ -534,7 +534,7 @@ func TestValidateGenesisWithBasketBalance(t *testing.T) { })) require.NoError(t, ss.BatchBalanceTable().Insert(ormCtx, - &api.BatchBalance{ + &baseapi.BatchBalance{ BatchKey: 2, Address: sdk.AccAddress("addr1"), TradableAmount: "1.234", @@ -542,7 +542,7 @@ func TestValidateGenesisWithBasketBalance(t *testing.T) { RetiredAmount: "0", })) - batches := []*api.Batch{ + batches := []*baseapi.Batch{ { Issuer: sdk.AccAddress("addr2"), ProjectKey: 1, @@ -565,7 +565,7 @@ func TestValidateGenesisWithBasketBalance(t *testing.T) { } require.NoError(t, ss.BatchSupplyTable().Insert(ormCtx, - &api.BatchSupply{ + &baseapi.BatchSupply{ BatchKey: 1, TradableAmount: "190.003", RetiredAmount: "9.997", @@ -573,21 +573,21 @@ func TestValidateGenesisWithBasketBalance(t *testing.T) { ) require.NoError(t, ss.BatchSupplyTable().Insert(ormCtx, - &api.BatchSupply{ + &baseapi.BatchSupply{ BatchKey: 2, TradableAmount: "12.468", RetiredAmount: "0", }), ) - class := api.Class{ + class := baseapi.Class{ Id: "BIO001", Admin: sdk.AccAddress("addr4"), CreditTypeAbbrev: "BIO", } require.NoError(t, ss.ClassTable().Insert(ormCtx, &class)) - project := api.Project{ + project := baseapi.Project{ Id: "P01-001", Admin: sdk.AccAddress("addr6"), ClassKey: 1, @@ -624,17 +624,17 @@ func TestValidateGenesisWithBasketBalance(t *testing.T) { genesisJSON, err := target.JSON() require.NoError(t, err) - params := core.Params{AllowlistEnabled: true} + params := basetypes.Params{AllowlistEnabled: true} err = ValidateGenesis(genesisJSON, params) require.NoError(t, err) } // setupStateAndExportJSON sets up state as defined in the setupFunc function and then exports the ORM data as JSON. -func setupStateAndExportJSON(t *testing.T, setupFunc func(ctx context.Context, ss api.StateStore)) json.RawMessage { +func setupStateAndExportJSON(t *testing.T, setupFunc func(ctx context.Context, ss baseapi.StateStore)) json.RawMessage { ormCtx := ormtable.WrapContextDefault(ormtest.NewMemoryBackend()) modDB, err := ormdb.NewModuleDB(&ecocredit.ModuleSchema, ormdb.ModuleDBOptions{}) require.NoError(t, err) - ss, err := api.NewStateStore(modDB) + ss, err := baseapi.NewStateStore(modDB) require.NoError(t, err) setupFunc(ormCtx, ss) target := ormjson.NewRawMessageTarget() @@ -653,7 +653,7 @@ func TestMergeClassFeesIntoTarget(t *testing.T) { err = db.DefaultJSON(jsonTarget) assert.NilError(t, err) - classFees := core.DefaultCreditClassFees() + classFees := DefaultCreditClassFees() err = MergeCreditClassFeesIntoTarget(cdc, classFees, jsonTarget) assert.NilError(t, err) @@ -666,7 +666,7 @@ func TestMergeClassFeesIntoTarget(t *testing.T) { r, err := jsonSource.OpenReader(protoreflect.FullName(gogoproto.MessageName(&classFees))) assert.NilError(t, err) - var expected api.ClassFees + var expected baseapi.ClassFees err = (&jsonpb.Unmarshaler{AllowUnknownFields: true}).Unmarshal(r, &expected) assert.NilError(t, err) diff --git a/x/ecocredit/marketplace/keeper/keeper_test.go b/x/ecocredit/marketplace/keeper/keeper_test.go index 2710aa6f5f..006ba570ee 100644 --- a/x/ecocredit/marketplace/keeper/keeper_test.go +++ b/x/ecocredit/marketplace/keeper/keeper_test.go @@ -22,10 +22,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - ecoApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/mocks" "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) @@ -38,7 +38,7 @@ const ( type baseSuite struct { t gocuke.TestingT db ormdb.ModuleDB - coreStore ecoApi.StateStore + coreStore baseapi.StateStore marketStore api.StateStore ctx context.Context k Keeper @@ -56,7 +56,7 @@ func setupBase(t gocuke.TestingT, numAddresses int) *baseSuite { var err error s.db, err = ormdb.NewModuleDB(&ecocredit.ModuleSchema, ormdb.ModuleDBOptions{}) assert.NilError(t, err) - s.coreStore, err = ecoApi.NewStateStore(s.db) + s.coreStore, err = baseapi.NewStateStore(s.db) assert.NilError(t, err) s.marketStore, err = api.NewStateStore(s.db) assert.NilError(t, err) @@ -90,7 +90,7 @@ func setupBase(t gocuke.TestingT, numAddresses int) *baseSuite { } // assertCreditsEscrowed adds orderAmt to tradable, subtracts from escrowed in before balance/supply and checks that it is equal to after balance/supply. -func assertCreditsEscrowed(t gocuke.TestingT, balanceBefore, balanceAfter *ecoApi.BatchBalance, orderAmt math.Dec) { +func assertCreditsEscrowed(t gocuke.TestingT, balanceBefore, balanceAfter *baseapi.BatchBalance, orderAmt math.Dec) { decs, err := utils.GetNonNegativeFixedDecs(6, balanceBefore.TradableAmount, balanceAfter.TradableAmount, balanceBefore.EscrowedAmount, balanceAfter.EscrowedAmount) assert.NilError(t, err) @@ -109,22 +109,22 @@ func assertCreditsEscrowed(t gocuke.TestingT, balanceBefore, balanceAfter *ecoAp } // testSellSetup sets up a batch, class, market, and issues a balance of 100 retired and tradable to the base suite's addr. -func (s *baseSuite) testSellSetup(batchDenom, bankDenom, displayDenom, classID string, start, end *timestamppb.Timestamp, creditType core.CreditType) { +func (s *baseSuite) testSellSetup(batchDenom, bankDenom, displayDenom, classID string, start, end *timestamppb.Timestamp, creditType basetypes.CreditType) { assert.Check(s.t, len(s.addrs) > 0, "When calling `testSellSetup`, the base suite must have a non-empty `addrs`.") - assert.NilError(s.t, s.coreStore.CreditTypeTable().Insert(s.ctx, &ecoApi.CreditType{ + assert.NilError(s.t, s.coreStore.CreditTypeTable().Insert(s.ctx, &baseapi.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "metric ton C02", Precision: 6, })) - assert.NilError(s.t, s.coreStore.ClassTable().Insert(s.ctx, &ecoApi.Class{ + assert.NilError(s.t, s.coreStore.ClassTable().Insert(s.ctx, &baseapi.Class{ Id: classID, Admin: s.addrs[0], Metadata: "", CreditTypeAbbrev: creditType.Abbreviation, })) - assert.NilError(s.t, s.coreStore.BatchTable().Insert(s.ctx, &ecoApi.Batch{ + assert.NilError(s.t, s.coreStore.BatchTable().Insert(s.ctx, &baseapi.Batch{ ProjectKey: 1, Denom: batchDenom, Metadata: "", @@ -142,14 +142,14 @@ func (s *baseSuite) testSellSetup(batchDenom, bankDenom, displayDenom, classID s DisplayDenom: displayDenom, Exponent: 1, })) - assert.NilError(s.t, s.k.coreStore.BatchBalanceTable().Insert(s.ctx, &ecoApi.BatchBalance{ + assert.NilError(s.t, s.k.coreStore.BatchBalanceTable().Insert(s.ctx, &baseapi.BatchBalance{ BatchKey: 1, Address: s.addrs[0], TradableAmount: "100", RetiredAmount: "100", EscrowedAmount: "0", })) - assert.NilError(s.t, s.k.coreStore.BatchSupplyTable().Insert(s.ctx, &ecoApi.BatchSupply{ + assert.NilError(s.t, s.k.coreStore.BatchSupplyTable().Insert(s.ctx, &baseapi.BatchSupply{ BatchKey: 1, TradableAmount: "100", RetiredAmount: "100", diff --git a/x/ecocredit/marketplace/keeper/msg_sell_test.go b/x/ecocredit/marketplace/keeper/msg_sell_test.go index 4e8cff250e..03581c74af 100644 --- a/x/ecocredit/marketplace/keeper/msg_sell_test.go +++ b/x/ecocredit/marketplace/keeper/msg_sell_test.go @@ -18,7 +18,7 @@ import ( coreapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" regentypes "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/testutil" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" types "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" ) @@ -107,8 +107,8 @@ func (s *sellSuite) AnAllowedDenomWithBankDenom(a string) { } func (s *sellSuite) ACreditBatchWithBatchDenom(a string) { - classID := core.GetClassIDFromBatchDenom(a) - creditTypeAbbrev := core.GetCreditTypeAbbrevFromClassID(classID) + classID := base.GetClassIDFromBatchDenom(a) + creditTypeAbbrev := base.GetCreditTypeAbbrevFromClassID(classID) classKey, err := s.coreStore.ClassTable().InsertReturningID(s.ctx, &coreapi.Class{ Id: classID, @@ -142,8 +142,8 @@ func (s *sellSuite) AliceHasATradableBatchBalance() { func (s *sellSuite) AliceHasATradableBatchBalanceWithDenom(a string) { s.batchDenom = a - s.classID = core.GetClassIDFromBatchDenom(s.batchDenom) - s.creditTypeAbbrev = core.GetCreditTypeAbbrevFromClassID(s.classID) + s.classID = base.GetClassIDFromBatchDenom(s.batchDenom) + s.creditTypeAbbrev = base.GetCreditTypeAbbrevFromClassID(s.classID) s.aliceTradableBatchBalance() } @@ -156,8 +156,8 @@ func (s *sellSuite) AliceHasATradableBatchBalanceWithAmount(a string) { func (s *sellSuite) AliceHasATradableBatchBalanceWithDenomAndAmount(a string, b string) { s.batchDenom = a - s.classID = core.GetClassIDFromBatchDenom(s.batchDenom) - s.creditTypeAbbrev = core.GetCreditTypeAbbrevFromClassID(s.classID) + s.classID = base.GetClassIDFromBatchDenom(s.batchDenom) + s.creditTypeAbbrev = base.GetCreditTypeAbbrevFromClassID(s.classID) s.aliceTradableAmount = b s.aliceTradableBatchBalance() diff --git a/x/ecocredit/marketplace/keeper/query_sell_orders_test.go b/x/ecocredit/marketplace/keeper/query_sell_orders_test.go index a11581dcfd..890aa2fcef 100644 --- a/x/ecocredit/marketplace/keeper/query_sell_orders_test.go +++ b/x/ecocredit/marketplace/keeper/query_sell_orders_test.go @@ -12,7 +12,7 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" regentypes "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" types "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" ) @@ -22,7 +22,7 @@ var ( start, end = timestamppb.Now(), timestamppb.Now() validAskDenom = sdk.DefaultBondDenom ask = sdk.NewInt64Coin(validAskDenom, 10) - creditType = core.CreditType{Name: "carbon", Abbreviation: "C", Unit: "tonnes", Precision: 6} + creditType = basetypes.CreditType{Name: "carbon", Abbreviation: "C", Unit: "tonnes", Precision: 6} ) func TestSellOrders(t *testing.T) { diff --git a/x/ecocredit/marketplace/keeper/utils.go b/x/ecocredit/marketplace/keeper/utils.go index cef3f35d99..491e1deae9 100644 --- a/x/ecocredit/marketplace/keeper/utils.go +++ b/x/ecocredit/marketplace/keeper/utils.go @@ -4,13 +4,12 @@ import ( "context" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) @@ -99,7 +98,7 @@ func (k Keeper) fillOrder(ctx context.Context, orderIndex string, sellOrder *api return err } buyerBal.TradableAmount = tradableBalance.String() - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventTransfer{ + if err = sdkCtx.EventManager().EmitTypedEvent(&basetypes.EventTransfer{ Sender: sdk.AccAddress(sellOrder.Seller).String(), Recipient: buyerAcc.String(), BatchDenom: opts.batchDenom, @@ -141,7 +140,7 @@ func (k Keeper) fillOrder(ctx context.Context, orderIndex string, sellOrder *api if err = k.coreStore.BatchSupplyTable().Update(ctx, supply); err != nil { return err } - if err = sdkCtx.EventManager().EmitTypedEvent(&core.EventRetire{ + if err = sdkCtx.EventManager().EmitTypedEvent(&basetypes.EventRetire{ Owner: buyerAcc.String(), BatchDenom: opts.batchDenom, Amount: purchaseQty.String(), diff --git a/x/ecocredit/marketplace/simulation/operations.go b/x/ecocredit/marketplace/simulation/operations.go index 15cb1a463f..55c3fe3c0f 100644 --- a/x/ecocredit/marketplace/simulation/operations.go +++ b/x/ecocredit/marketplace/simulation/operations.go @@ -14,7 +14,7 @@ import ( "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" types "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/simulation/utils" ) @@ -46,7 +46,7 @@ var ( func WeightedOperations( appParams simtypes.AppParams, cdc codec.JSONCodec, ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer, mktQryClient types.QueryServer) simulation.WeightedOperations { + qryClient basetypes.QueryServer, mktQryClient types.QueryServer) simulation.WeightedOperations { var ( weightMsgBuyDirect int @@ -101,7 +101,7 @@ func WeightedOperations( // SimulateMsgBuyDirect generates a Marketplace/MsgBuyDirect with random values. func SimulateMsgBuyDirect(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer, mktQryClient types.QueryServer) simtypes.Operation { + qryClient basetypes.QueryServer, mktQryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -173,7 +173,7 @@ func SimulateMsgBuyDirect(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, // SimulateMsgSell generates a Marketplace/MsgSell with random values. func SimulateMsgSell(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer) simtypes.Operation { + qryClient basetypes.QueryServer) simtypes.Operation { return func( r *rand.Rand, baseApp *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -186,7 +186,7 @@ func SimulateMsgSell(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, return op, nil, err } - batchRes, err := qryClient.BatchesByIssuer(ctx, &core.QueryBatchesByIssuerRequest{Issuer: seller.Address.String()}) + batchRes, err := qryClient.BatchesByIssuer(ctx, &basetypes.QueryBatchesByIssuerRequest{Issuer: seller.Address.String()}) if err != nil { return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgSell, err.Error()), nil, err } @@ -202,7 +202,7 @@ func SimulateMsgSell(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, sellOrders := make([]*types.MsgSell_Order, max) for i := 0; i < max; i++ { - bal, err := qryClient.Balance(ctx, &core.QueryBalanceRequest{Address: sellerAddr, BatchDenom: batches[i].Denom}) + bal, err := qryClient.Balance(ctx, &basetypes.QueryBalanceRequest{Address: sellerAddr, BatchDenom: batches[i].Denom}) if err != nil { return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgSell, err.Error()), nil, err } @@ -268,7 +268,7 @@ func SimulateMsgSell(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, // SimulateMsgUpdateSellOrder generates a Marketplace/MsgUpdateSellOrder with random values. func SimulateMsgUpdateSellOrder(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - coreQryClient core.QueryServer, mktQryClient types.QueryServer) simtypes.Operation { + coreQryClient basetypes.QueryServer, mktQryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -353,7 +353,7 @@ func SimulateMsgUpdateSellOrder(ak ecocredit.AccountKeeper, bk ecocredit.BankKee // SimulateMsgCancelSellOrder generates a Marketplace/MsgCancelSellOrder with random values. func SimulateMsgCancelSellOrder(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, - qryClient core.QueryServer, mktQryClient types.QueryServer) simtypes.Operation { + qryClient basetypes.QueryServer, mktQryClient types.QueryServer) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, sdkCtx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { diff --git a/x/ecocredit/marketplace/types/v1/msg_buy_direct.go b/x/ecocredit/marketplace/types/v1/msg_buy_direct.go index b1f5dc70bd..271e9021f7 100644 --- a/x/ecocredit/marketplace/types/v1/msg_buy_direct.go +++ b/x/ecocredit/marketplace/types/v1/msg_buy_direct.go @@ -3,13 +3,13 @@ package v1 import ( "fmt" - "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgBuyDirect{} @@ -69,7 +69,7 @@ func (m MsgBuyDirect) ValidateBasic() error { } if !order.DisableAutoRetire { - if err := core.ValidateJurisdiction(order.RetirementJurisdiction); err != nil { + if err := base.ValidateJurisdiction(order.RetirementJurisdiction); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("%s: retirement jurisdiction: %s", orderIndex, err) } } diff --git a/x/ecocredit/marketplace/types/v1/msg_sell.go b/x/ecocredit/marketplace/types/v1/msg_sell.go index f83a7db369..955d4fec23 100644 --- a/x/ecocredit/marketplace/types/v1/msg_sell.go +++ b/x/ecocredit/marketplace/types/v1/msg_sell.go @@ -9,7 +9,7 @@ import ( "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) var _ legacytx.LegacyMsg = &MsgSell{} @@ -44,7 +44,7 @@ func (m *MsgSell) ValidateBasic() error { // an individual order in a list of orders fails to process orderIndex := fmt.Sprintf("orders[%d]", i) - if err := core.ValidateBatchDenom(order.BatchDenom); err != nil { + if err := base.ValidateBatchDenom(order.BatchDenom); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("%s: batch denom: %s", orderIndex, err) } diff --git a/x/ecocredit/marketplace/types/v1/state_allowed_denom.go b/x/ecocredit/marketplace/types/v1/state_allowed_denom.go index fd7270ac38..5db6fd8c2e 100644 --- a/x/ecocredit/marketplace/types/v1/state_allowed_denom.go +++ b/x/ecocredit/marketplace/types/v1/state_allowed_denom.go @@ -2,9 +2,9 @@ package v1 import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate performs basic validation of the AllowedDenom state type @@ -25,7 +25,7 @@ func (m *AllowedDenom) Validate() error { return ecocredit.ErrParseFailure.Wrapf("display denom: %s", err) } - if _, err := core.ExponentToPrefix(m.Exponent); err != nil { + if _, err := base.ExponentToPrefix(m.Exponent); err != nil { return err // returns parse error } diff --git a/x/ecocredit/marketplace/types/v1/state_market.go b/x/ecocredit/marketplace/types/v1/state_market.go index 78cb964b02..843a293fb8 100644 --- a/x/ecocredit/marketplace/types/v1/state_market.go +++ b/x/ecocredit/marketplace/types/v1/state_market.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // Validate performs basic validation of the Market state type @@ -15,7 +15,7 @@ func (m *Market) Validate() error { return ecocredit.ErrParseFailure.Wrapf("id cannot be zero") } - if err := core.ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { + if err := base.ValidateCreditTypeAbbreviation(m.CreditTypeAbbrev); err != nil { return errors.Wrap(err, "credit type abbrev") // returns parse error } diff --git a/x/ecocredit/migrations/v3/state.go b/x/ecocredit/migrations/v3/state.go index 915e26ed48..01b530732b 100644 --- a/x/ecocredit/migrations/v3/state.go +++ b/x/ecocredit/migrations/v3/state.go @@ -5,15 +5,14 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" basketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + regentypes "github.com/regen-network/regen-ledger/types" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // MigrateState performs in-place store migrations from ConsensusVersion 2 to 3. -func MigrateState(sdkCtx sdk.Context, coreStore api.StateStore, basketStore basketapi.StateStore, subspace paramtypes.Subspace) error { - - var params core.Params +func MigrateState(sdkCtx sdk.Context, coreStore baseapi.StateStore, basketStore basketapi.StateStore, subspace paramtypes.Subspace) error { + var params basetypes.Params subspace.GetParamSet(sdkCtx, ¶ms) // validate credit class fee @@ -22,15 +21,15 @@ func MigrateState(sdkCtx sdk.Context, coreStore api.StateStore, basketStore bask } // migrate credit class fees - classFees := types.CoinsToProtoCoins(params.CreditClassFee) - if err := coreStore.ClassFeesTable().Save(sdkCtx, &api.ClassFees{ + classFees := regentypes.CoinsToProtoCoins(params.CreditClassFee) + if err := coreStore.ClassFeesTable().Save(sdkCtx, &baseapi.ClassFees{ Fees: classFees, }); err != nil { return err } // migrate credit class allow list - if err := coreStore.AllowListEnabledTable().Save(sdkCtx, &api.AllowListEnabled{ + if err := coreStore.AllowListEnabledTable().Save(sdkCtx, &baseapi.AllowListEnabled{ Enabled: params.AllowlistEnabled, }); err != nil { return err @@ -43,7 +42,7 @@ func MigrateState(sdkCtx sdk.Context, coreStore api.StateStore, basketStore bask return err } - if err := coreStore.AllowedClassCreatorTable().Save(sdkCtx, &api.AllowedClassCreator{ + if err := coreStore.AllowedClassCreatorTable().Save(sdkCtx, &baseapi.AllowedClassCreator{ Address: addr, }); err != nil { return err @@ -56,7 +55,7 @@ func MigrateState(sdkCtx sdk.Context, coreStore api.StateStore, basketStore bask } // migrate basket params - basketFees := types.CoinsToProtoCoins(params.BasketFee) + basketFees := regentypes.CoinsToProtoCoins(params.BasketFee) if err := basketStore.BasketFeesTable().Save(sdkCtx, &basketapi.BasketFees{ Fees: basketFees, }); err != nil { diff --git a/x/ecocredit/migrations/v3/state_test.go b/x/ecocredit/migrations/v3/state_test.go index 3f9895a464..3fe836a1f8 100644 --- a/x/ecocredit/migrations/v3/state_test.go +++ b/x/ecocredit/migrations/v3/state_test.go @@ -3,6 +3,12 @@ package v3_test import ( "testing" + dbm "github.com/tendermint/tm-db" + "gotest.tools/v3/assert" + + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/orm/model/ormdb" "github.com/cosmos/cosmos-sdk/orm/model/ormtable" "github.com/cosmos/cosmos-sdk/orm/testing/ormtest" @@ -11,15 +17,11 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - "gotest.tools/v3/assert" basketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" v3 "github.com/regen-network/regen-ledger/x/ecocredit/migrations/v3" ) @@ -38,25 +40,25 @@ func TestMigrations(t *testing.T) { ormCtx := ormtable.WrapContextDefault(ormtest.NewMemoryBackend()) sdkCtx := sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger()).WithContext(ormCtx) - paramStore.WithKeyTable(core.ParamKeyTable()) + paramStore.WithKeyTable(basetypes.ParamKeyTable()) creator1 := sdk.AccAddress("creator1") creator2 := sdk.AccAddress("creator2") // initialize params - paramStore.SetParamSet(sdkCtx, &core.Params{ + paramStore.SetParamSet(sdkCtx, &basetypes.Params{ CreditClassFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)), sdk.NewCoin("uregen", sdk.NewInt(2000000))), BasketFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)), sdk.NewCoin("uregen", sdk.NewInt(2000000))), AllowedClassCreators: []string{creator1.String(), creator2.String()}, AllowlistEnabled: true, }) - var params core.Params + var params basetypes.Params paramStore.GetParamSet(sdkCtx, ¶ms) ormdb, err := ormdb.NewModuleDB(&ecocredit.ModuleSchema, ormdb.ModuleDBOptions{}) assert.NilError(t, err) - coreStore, err := api.NewStateStore(ormdb) + coreStore, err := baseapi.NewStateStore(ormdb) assert.NilError(t, err) basketStore, err := basketapi.NewStateStore(ormdb) @@ -88,7 +90,7 @@ func TestMigrations(t *testing.T) { assert.NilError(t, err) assert.Equal(t, allowedListEnabled.Enabled, true) - itr, err := coreStore.AllowedClassCreatorTable().List(sdkCtx, api.AllowedClassCreatorPrimaryKey{}) + itr, err := coreStore.AllowedClassCreatorTable().List(sdkCtx, baseapi.AllowedClassCreatorPrimaryKey{}) assert.NilError(t, err) var expected []string diff --git a/x/ecocredit/module/module.go b/x/ecocredit/module/module.go index 1e498ad43c..ed8daaec99 100644 --- a/x/ecocredit/module/module.go +++ b/x/ecocredit/module/module.go @@ -27,10 +27,11 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/regen-network/regen-ledger/x/ecocredit" + basesims "github.com/regen-network/regen-ledger/x/ecocredit/base/simulation" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" + basetypesv1alpha1 "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1alpha1" baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/client" - coretypes "github.com/regen-network/regen-ledger/x/ecocredit/core" - corev1alpha1 "github.com/regen-network/regen-ledger/x/ecocredit/core/v1alpha1" "github.com/regen-network/regen-ledger/x/ecocredit/genesis" markettypes "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/server" @@ -92,7 +93,7 @@ func NewModule( authority sdk.AccAddress, ) *Module { if !legacySubspace.HasKeyTable() { - legacySubspace = legacySubspace.WithKeyTable(coretypes.ParamKeyTable()) + legacySubspace = legacySubspace.WithKeyTable(basetypes.ParamKeyTable()) } return &Module{ @@ -113,17 +114,17 @@ func (a Module) Name() string { func (a Module) RegisterInterfaces(registry types.InterfaceRegistry) { baskettypes.RegisterTypes(registry) - coretypes.RegisterTypes(registry) + basetypes.RegisterTypes(registry) markettypes.RegisterTypes(registry) // legacy types to support querying historical events - corev1alpha1.RegisterTypes(registry) + basetypesv1alpha1.RegisterTypes(registry) } func (a *Module) RegisterServices(cfg module.Configurator) { svr := server.NewServer(a.key, a.legacySubspace, a.accountKeeper, a.bankKeeper, a.authority) - coretypes.RegisterMsgServer(cfg.MsgServer(), svr.CoreKeeper) - coretypes.RegisterQueryServer(cfg.QueryServer(), svr.CoreKeeper) + basetypes.RegisterMsgServer(cfg.MsgServer(), svr.CoreKeeper) + basetypes.RegisterQueryServer(cfg.QueryServer(), svr.CoreKeeper) baskettypes.RegisterMsgServer(cfg.MsgServer(), svr.BasketKeeper) baskettypes.RegisterQueryServer(cfg.QueryServer(), svr.BasketKeeper) @@ -141,9 +142,9 @@ func (a *Module) RegisterServices(cfg module.Configurator) { //nolint:errcheck func (a Module) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux *runtime.ServeMux) { ctx := context.Background() + basetypes.RegisterQueryHandlerClient(ctx, mux, basetypes.NewQueryClient(clientCtx)) baskettypes.RegisterQueryHandlerClient(ctx, mux, baskettypes.NewQueryClient(clientCtx)) markettypes.RegisterQueryHandlerClient(ctx, mux, markettypes.NewQueryClient(clientCtx)) - coretypes.RegisterQueryHandlerClient(ctx, mux, coretypes.NewQueryClient(clientCtx)) } func (a Module) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { @@ -158,13 +159,13 @@ func (a Module) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { panic(err) } - creditTypes := coretypes.DefaultCreditTypes() + creditTypes := genesis.DefaultCreditTypes() err = genesis.MergeCreditTypesIntoTarget(creditTypes, jsonTarget) if err != nil { panic(err) } - creditClassFees := coretypes.DefaultCreditClassFees() + creditClassFees := genesis.DefaultCreditClassFees() err = genesis.MergeCreditClassFeesIntoTarget(cdc, creditClassFees, jsonTarget) if err != nil { panic(err) @@ -206,7 +207,7 @@ func (a Module) ValidateGenesis(cdc codec.JSONCodec, _ sdkclient.TxEncodingConfi return err } - var params coretypes.Params + var params basetypes.Params r, err := jsonSource.OpenReader(protoreflect.FullName(proto.MessageName(¶ms))) if err != nil { return err @@ -237,8 +238,8 @@ func (Module) ConsensusVersion() uint64 { return 3 } /**** DEPRECATED ****/ func (a Module) RegisterRESTRoutes(sdkclient.Context, *mux.Router) {} func (a Module) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + basetypes.RegisterLegacyAminoCodec(cdc) baskettypes.RegisterLegacyAminoCodec(cdc) - coretypes.RegisterLegacyAminoCodec(cdc) markettypes.RegisterLegacyAminoCodec(cdc) } @@ -266,7 +267,7 @@ func (Module) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} // WeightedOperations returns all the ecocredit module operations with their respective weights. func (a Module) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { coreQuerier, basketQuerier, marketQuerier := a.Keeper.QueryServers() - return simulation.WeightedOperations( + return basesims.WeightedOperations( simState.AppParams, simState.Cdc, a.accountKeeper, a.bankKeeper, coreQuerier, diff --git a/x/ecocredit/server/core/msg_toggle_class_allowlist.go b/x/ecocredit/server/core/msg_toggle_class_allowlist.go deleted file mode 100644 index f7c2b90afb..0000000000 --- a/x/ecocredit/server/core/msg_toggle_class_allowlist.go +++ /dev/null @@ -1,23 +0,0 @@ -package core - -import ( - "context" - - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" -) - -func (k Keeper) ToggleCreditClassAllowlist(ctx context.Context, req *core.MsgToggleCreditClassAllowlist) (*core.MsgToggleCreditClassAllowlistResponse, error) { - if k.authority.String() != req.Authority { - return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority: expected %s, got %s", k.authority, req.Authority) - } - - if err := k.stateStore.AllowListEnabledTable().Save(ctx, &ecocreditv1.AllowListEnabled{ - Enabled: req.Enabled, - }); err != nil { - return nil, err - } - - return &core.MsgToggleCreditClassAllowlistResponse{}, nil -} diff --git a/x/ecocredit/server/core/msg_update_class_fee.go b/x/ecocredit/server/core/msg_update_class_fee.go deleted file mode 100644 index 8d7e3ff6b5..0000000000 --- a/x/ecocredit/server/core/msg_update_class_fee.go +++ /dev/null @@ -1,26 +0,0 @@ -package core - -import ( - "context" - - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" -) - -func (k Keeper) UpdateClassFees(ctx context.Context, req *core.MsgUpdateClassFees) (*core.MsgUpdateClassFeesResponse, error) { - if k.authority.String() != req.Authority { - return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority: expected %s, got %s", k.authority, req.Authority) - } - - classFee := types.CoinsToProtoCoins(req.Fees) - if err := k.stateStore.ClassFeesTable().Save(ctx, &ecocreditv1.ClassFees{ - Fees: classFee, - }); err != nil { - return nil, err - } - - return &core.MsgUpdateClassFeesResponse{}, nil -} diff --git a/x/ecocredit/server/core/query_allowlist_enabled_test.go b/x/ecocredit/server/core/query_allowlist_enabled_test.go deleted file mode 100644 index 1fe75863c5..0000000000 --- a/x/ecocredit/server/core/query_allowlist_enabled_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package core - -import ( - "testing" - - ecocreditv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" - "gotest.tools/v3/assert" -) - -func TestQuery_AllowlistEnabledTest(t *testing.T) { - t.Parallel() - s := setupBase(t) - - res, err := s.k.CreditClassAllowlistEnabled(s.ctx, &core.QueryCreditClassAllowlistEnabledRequest{}) - assert.NilError(t, err) - assert.Equal(t, res.AllowlistEnabled, false) - - err = s.stateStore.AllowListEnabledTable().Save(s.ctx, &ecocreditv1.AllowListEnabled{ - Enabled: true, - }) - assert.NilError(t, err) - - res, err = s.k.CreditClassAllowlistEnabled(s.ctx, &core.QueryCreditClassAllowlistEnabledRequest{}) - assert.NilError(t, err) - assert.Equal(t, res.AllowlistEnabled, true) -} diff --git a/x/ecocredit/server/core/query_credit_class_fees.go b/x/ecocredit/server/core/query_credit_class_fees.go deleted file mode 100644 index a44bd3043b..0000000000 --- a/x/ecocredit/server/core/query_credit_class_fees.go +++ /dev/null @@ -1,26 +0,0 @@ -package core - -import ( - "context" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" -) - -// CreditClassFees queries credit class creation fees. -func (k Keeper) CreditClassFees(ctx context.Context, request *core.QueryCreditClassFeesRequest) (*core.QueryCreditClassFeesResponse, error) { - result, err := k.stateStore.ClassFeesTable().Get(ctx) - if err != nil { - return nil, err - } - - classFee, ok := types.ProtoCoinsToCoins(result.Fees) - if !ok { - return nil, sdkerrors.ErrInvalidType.Wrap("credit class fee") - } - - return &core.QueryCreditClassFeesResponse{ - Fees: classFee, - }, nil -} diff --git a/x/ecocredit/server/expected_keepers.go b/x/ecocredit/server/expected_keepers.go index bd3d3f82b5..c871aa094c 100644 --- a/x/ecocredit/server/expected_keepers.go +++ b/x/ecocredit/server/expected_keepers.go @@ -11,8 +11,8 @@ import ( basketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" marketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" markettypes "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" ) @@ -24,6 +24,6 @@ type Keeper interface { RegisterInvariants(sdk.InvariantRegistry) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) ([]types.ValidatorUpdate, error) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) (json.RawMessage, error) - QueryServers() (core.QueryServer, baskettypes.QueryServer, markettypes.QueryServer) + QueryServers() (basetypes.QueryServer, baskettypes.QueryServer, markettypes.QueryServer) GetStateStores() (api.StateStore, basketapi.StateStore, marketapi.StateStore) } diff --git a/x/ecocredit/server/genesis.go b/x/ecocredit/server/genesis.go index 246962cbe2..81a918c8f5 100644 --- a/x/ecocredit/server/genesis.go +++ b/x/ecocredit/server/genesis.go @@ -4,16 +4,17 @@ import ( "bytes" "encoding/json" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/gogo/protobuf/jsonpb" "github.com/gogo/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/orm/types/ormjson" - abci "github.com/tendermint/tendermint/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) // InitGenesis performs genesis initialization for the ecocredit module. It @@ -29,7 +30,7 @@ func (s serverImpl) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. return nil, err } - var params core.Params + var params basetypes.Params r, err := jsonSource.OpenReader(protoreflect.FullName(proto.MessageName(¶ms))) if err != nil { return nil, err @@ -56,7 +57,7 @@ func (s serverImpl) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. // ExportGenesis will dump the ecocredit module state into a serializable GenesisState. func (s serverImpl) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) (json.RawMessage, error) { // Get Params from the store and put them in the genesis state - var params core.Params + var params basetypes.Params s.legacySubspace.GetParamSet(ctx, ¶ms) jsonTarget := ormjson.NewRawMessageTarget() diff --git a/x/ecocredit/server/invariants.go b/x/ecocredit/server/invariants.go index acee8c5410..bc33d5fdff 100644 --- a/x/ecocredit/server/invariants.go +++ b/x/ecocredit/server/invariants.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/server/core" + basekeeper "github.com/regen-network/regen-ledger/x/ecocredit/base/keeper" ) // RegisterInvariants registers the ecocredit module invariants. @@ -21,7 +21,7 @@ func (s serverImpl) batchSupplyInvariant() sdk.Invariant { return err.Error(), true } - msg, broken := core.BatchSupplyInvariant(goCtx, s.CoreKeeper, basketBalances) + msg, broken := basekeeper.BatchSupplyInvariant(goCtx, s.CoreKeeper, basketBalances) return sdk.FormatInvariant(ecocredit.ModuleName, "batch-supply", msg), broken } } diff --git a/x/ecocredit/server/invariants_test.go b/x/ecocredit/server/invariants_test.go index 5bf0992649..1673cb912e 100644 --- a/x/ecocredit/server/invariants_test.go +++ b/x/ecocredit/server/invariants_test.go @@ -6,9 +6,8 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - "gotest.tools/v3/assert" - dbm "github.com/tendermint/tm-db" + "gotest.tools/v3/assert" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" @@ -22,21 +21,21 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" basketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" - marketplaceapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + marketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basekeeper "github.com/regen-network/regen-ledger/x/ecocredit/base/keeper" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/mocks" - coreserver "github.com/regen-network/regen-ledger/x/ecocredit/server/core" ) type baseSuite struct { t *testing.T db ormdb.ModuleDB - stateStore api.StateStore + stateStore baseapi.StateStore ctx context.Context - k coreserver.Keeper + k basekeeper.Keeper ctrl *gomock.Controller bankKeeper *mocks.MockBankKeeper storeKey *storetypes.KVStoreKey @@ -49,7 +48,7 @@ func setupBase(t *testing.T) *baseSuite { var err error s.db, err = ormdb.NewModuleDB(&ecocredit.ModuleSchema, ormdb.ModuleDBOptions{}) assert.NilError(t, err) - s.stateStore, err = api.NewStateStore(s.db) + s.stateStore, err = baseapi.NewStateStore(s.db) assert.NilError(t, err) db := dbm.NewMemDB() @@ -71,9 +70,10 @@ func setupBase(t *testing.T) *baseSuite { basketStore, err := basketapi.NewStateStore(s.db) assert.NilError(t, err) - marketStore, err := marketplaceapi.NewStateStore(s.db) + marketStore, err := marketapi.NewStateStore(s.db) assert.NilError(t, err) - s.k = coreserver.NewKeeper(s.stateStore, s.bankKeeper, moduleAddress, basketStore, marketStore, authorityAddress) + + s.k = basekeeper.NewKeeper(s.stateStore, s.bankKeeper, moduleAddress, basketStore, marketStore, authorityAddress) return s } @@ -84,14 +84,14 @@ func TestBatchSupplyInvariant(t *testing.T) { testCases := []struct { msg string - balances []*core.BatchBalance - supply []*core.BatchSupply + balances []*basetypes.BatchBalance + supply []*basetypes.BatchSupply basketBalance map[uint64]math.Dec expBroken bool }{ { "valid test case", - []*core.BatchBalance{ + []*basetypes.BatchBalance{ { Address: acc1, BatchKey: 1, @@ -99,7 +99,7 @@ func TestBatchSupplyInvariant(t *testing.T) { RetiredAmount: "110", }, }, - []*core.BatchSupply{ + []*basetypes.BatchSupply{ { BatchKey: 1, TradableAmount: "220", @@ -111,7 +111,7 @@ func TestBatchSupplyInvariant(t *testing.T) { }, { "valid test case multiple denom", - []*core.BatchBalance{ + []*basetypes.BatchBalance{ { Address: acc1, BatchKey: 1, @@ -125,7 +125,7 @@ func TestBatchSupplyInvariant(t *testing.T) { RetiredAmount: "100.1234", }, }, - []*core.BatchSupply{ + []*basetypes.BatchSupply{ { BatchKey: 1, TradableAmount: "320.579", @@ -142,7 +142,7 @@ func TestBatchSupplyInvariant(t *testing.T) { }, { "fail with error tradable balance not found", - []*core.BatchBalance{ + []*basetypes.BatchBalance{ { Address: acc1, BatchKey: 1, @@ -154,7 +154,7 @@ func TestBatchSupplyInvariant(t *testing.T) { TradableAmount: "210.456", }, }, - []*core.BatchSupply{ + []*basetypes.BatchSupply{ { BatchKey: 1, TradableAmount: "310.579", @@ -171,7 +171,7 @@ func TestBatchSupplyInvariant(t *testing.T) { }, { "fail with error supply does not match", - []*core.BatchBalance{ + []*basetypes.BatchBalance{ { Address: acc1, BatchKey: 1, @@ -183,7 +183,7 @@ func TestBatchSupplyInvariant(t *testing.T) { TradableAmount: "1234", }, }, - []*core.BatchSupply{ + []*basetypes.BatchSupply{ { BatchKey: 1, TradableAmount: "310.579", @@ -200,7 +200,7 @@ func TestBatchSupplyInvariant(t *testing.T) { }, { "valid case escrowed balance", - []*core.BatchBalance{ + []*basetypes.BatchBalance{ { Address: acc1, BatchKey: 1, @@ -216,7 +216,7 @@ func TestBatchSupplyInvariant(t *testing.T) { EscrowedAmount: "766", }, }, - []*core.BatchSupply{ + []*basetypes.BatchSupply{ { BatchKey: 1, TradableAmount: "110", @@ -233,7 +233,7 @@ func TestBatchSupplyInvariant(t *testing.T) { }, { "valid case multiple account", - []*core.BatchBalance{ + []*basetypes.BatchBalance{ { Address: acc1, BatchKey: 1, @@ -256,7 +256,7 @@ func TestBatchSupplyInvariant(t *testing.T) { EscrowedAmount: "766", }, }, - []*core.BatchSupply{ + []*basetypes.BatchSupply{ { BatchKey: 1, TradableAmount: "2110", @@ -280,7 +280,7 @@ func TestBatchSupplyInvariant(t *testing.T) { initBalances(suite.ctx, t, suite.stateStore, tc.balances) initSupply(suite.ctx, t, suite.stateStore, tc.supply) - msg, broken := coreserver.BatchSupplyInvariant(suite.ctx, suite.k, tc.basketBalance) + msg, broken := basekeeper.BatchSupplyInvariant(suite.ctx, suite.k, tc.basketBalance) if tc.expBroken { require.True(t, broken, msg) } else { @@ -290,12 +290,12 @@ func TestBatchSupplyInvariant(t *testing.T) { } } -func initBalances(ctx context.Context, t *testing.T, ss api.StateStore, balances []*core.BatchBalance) { +func initBalances(ctx context.Context, t *testing.T, ss baseapi.StateStore, balances []*basetypes.BatchBalance) { for _, b := range balances { _, err := math.NewNonNegativeDecFromString(b.TradableAmount) require.NoError(t, err) - require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &api.BatchBalance{ + require.NoError(t, ss.BatchBalanceTable().Insert(ctx, &baseapi.BatchBalance{ Address: b.Address, BatchKey: b.BatchKey, TradableAmount: b.TradableAmount, @@ -305,9 +305,9 @@ func initBalances(ctx context.Context, t *testing.T, ss api.StateStore, balances } } -func initSupply(ctx context.Context, t *testing.T, ss api.StateStore, supply []*core.BatchSupply) { +func initSupply(ctx context.Context, t *testing.T, ss baseapi.StateStore, supply []*basetypes.BatchSupply) { for _, s := range supply { - err := ss.BatchSupplyTable().Insert(ctx, &api.BatchSupply{ + err := ss.BatchSupplyTable().Insert(ctx, &baseapi.BatchSupply{ BatchKey: s.BatchKey, TradableAmount: s.TradableAmount, RetiredAmount: s.RetiredAmount, diff --git a/x/ecocredit/server/server.go b/x/ecocredit/server/server.go index d006113094..ab3fce4f42 100644 --- a/x/ecocredit/server/server.go +++ b/x/ecocredit/server/server.go @@ -10,16 +10,16 @@ import ( basketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" marketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/ormstore" "github.com/regen-network/regen-ledger/x/ecocredit" + basekeeper "github.com/regen-network/regen-ledger/x/ecocredit/base/keeper" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/basket" basketkeeper "github.com/regen-network/regen-ledger/x/ecocredit/basket/keeper" baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - coretypes "github.com/regen-network/regen-ledger/x/ecocredit/core" marketkeeper "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/keeper" markettypes "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/server/core" ) type serverImpl struct { @@ -27,12 +27,12 @@ type serverImpl struct { bankKeeper ecocredit.BankKeeper accountKeeper ecocredit.AccountKeeper - CoreKeeper core.Keeper + CoreKeeper basekeeper.Keeper BasketKeeper basketkeeper.Keeper MarketplaceKeeper marketkeeper.Keeper db ormdb.ModuleDB - stateStore api.StateStore + stateStore baseapi.StateStore basketStore basketapi.StateStore marketplaceStore marketapi.StateStore } @@ -68,15 +68,15 @@ func NewServer(storeKey storetypes.StoreKey, legacySubspace paramtypes.Subspace, s.stateStore = coreStore s.basketStore = basketStore s.marketplaceStore = marketStore - s.CoreKeeper = core.NewKeeper(coreStore, bankKeeper, coreAddr, basketStore, marketStore, authority) + s.CoreKeeper = basekeeper.NewKeeper(coreStore, bankKeeper, coreAddr, basketStore, marketStore, authority) s.BasketKeeper = basketkeeper.NewKeeper(basketStore, coreStore, bankKeeper, s.legacySubspace, basketAddr, authority) s.MarketplaceKeeper = marketkeeper.NewKeeper(marketStore, coreStore, bankKeeper, s.legacySubspace, authority) return s } -func getStateStores(db ormdb.ModuleDB) (api.StateStore, basketapi.StateStore, marketapi.StateStore) { - coreStore, err := api.NewStateStore(db) +func getStateStores(db ormdb.ModuleDB) (baseapi.StateStore, basketapi.StateStore, marketapi.StateStore) { + coreStore, err := baseapi.NewStateStore(db) if err != nil { panic(err) } @@ -91,10 +91,10 @@ func getStateStores(db ormdb.ModuleDB) (api.StateStore, basketapi.StateStore, ma return coreStore, basketStore, marketStore } -func (s serverImpl) QueryServers() (coretypes.QueryServer, baskettypes.QueryServer, markettypes.QueryServer) { +func (s serverImpl) QueryServers() (basetypes.QueryServer, baskettypes.QueryServer, markettypes.QueryServer) { return s.CoreKeeper, s.BasketKeeper, s.MarketplaceKeeper } -func (s serverImpl) GetStateStores() (api.StateStore, basketapi.StateStore, marketapi.StateStore) { +func (s serverImpl) GetStateStores() (baseapi.StateStore, basketapi.StateStore, marketapi.StateStore) { return s.stateStore, s.basketStore, s.marketplaceStore } diff --git a/x/ecocredit/server/server_test.go b/x/ecocredit/server/server_test.go index f0c1eda3b8..19fc9a4fa9 100644 --- a/x/ecocredit/server/server_test.go +++ b/x/ecocredit/server/server_test.go @@ -20,9 +20,9 @@ import ( params "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/regen-network/regen-ledger/types/fixture" - ecocredittypes "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit" "github.com/regen-network/regen-ledger/x/ecocredit/basket" - ecocredit "github.com/regen-network/regen-ledger/x/ecocredit/module" + "github.com/regen-network/regen-ledger/x/ecocredit/module" "github.com/regen-network/regen-ledger/x/ecocredit/server/testsuite" ) @@ -51,7 +51,7 @@ func setup(t *testing.T) (*fixture.Factory, paramstypes.Subspace, bankkeeper.Bas bankKey := sdk.NewKVStoreKey(banktypes.StoreKey) distKey := sdk.NewKVStoreKey(disttypes.StoreKey) paramsKey := sdk.NewKVStoreKey(paramstypes.StoreKey) - ecoKey := sdk.NewKVStoreKey(ecocredittypes.ModuleName) + ecoKey := sdk.NewKVStoreKey(ecocredit.ModuleName) tkey := sdk.NewTransientStoreKey(paramstypes.TStoreKey) baseApp.MountStore(authKey, storetypes.StoreTypeIAVL) @@ -63,11 +63,11 @@ func setup(t *testing.T) (*fixture.Factory, paramstypes.Subspace, bankkeeper.Bas authSubspace := paramstypes.NewSubspace(cdc, amino, paramsKey, tkey, authtypes.ModuleName) bankSubspace := paramstypes.NewSubspace(cdc, amino, paramsKey, tkey, banktypes.ModuleName) - ecocreditSubspace := paramstypes.NewSubspace(cdc, amino, paramsKey, tkey, ecocredittypes.ModuleName) + ecocreditSubspace := paramstypes.NewSubspace(cdc, amino, paramsKey, tkey, ecocredit.ModuleName) maccPerms := map[string][]string{ minttypes.ModuleName: {authtypes.Minter}, - ecocredittypes.ModuleName: {authtypes.Burner}, + ecocredit.ModuleName: {authtypes.Burner}, basket.BasketSubModuleName: {authtypes.Burner, authtypes.Minter}, } @@ -80,7 +80,7 @@ func setup(t *testing.T) (*fixture.Factory, paramstypes.Subspace, bankkeeper.Bas ) authority := authtypes.NewModuleAddress(govtypes.ModuleName) - ecocreditModule := ecocredit.NewModule(ecoKey, ecocreditSubspace, accountKeeper, bankKeeper, authority) + ecocreditModule := module.NewModule(ecoKey, ecocreditSubspace, accountKeeper, bankKeeper, authority) ff.SetModules([]sdkmodule.AppModule{ecocreditModule}) return ff, ecocreditSubspace, bankKeeper, accountKeeper diff --git a/x/ecocredit/server/tests/bridge_test.go b/x/ecocredit/server/tests/bridge_test.go index 73bd6d0a3f..de40270752 100644 --- a/x/ecocredit/server/tests/bridge_test.go +++ b/x/ecocredit/server/tests/bridge_test.go @@ -6,19 +6,19 @@ import ( "strconv" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkmodules "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/gogo/protobuf/jsonpb" "github.com/regen-network/gocuke" "github.com/stretchr/testify/require" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkmodules "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/query" + + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/fixture" "github.com/regen-network/regen-ledger/types/testutil" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) type bridgeSuite struct { @@ -31,8 +31,8 @@ type bridgeSuite struct { } type ecocreditServer struct { - core.MsgClient - core.QueryClient + basetypes.MsgClient + basetypes.QueryClient } func TestBridgeIntegration(t *testing.T) { @@ -52,8 +52,8 @@ func (s *bridgeSuite) Before(t gocuke.TestingT) { s.sdkCtx = sdk.UnwrapSDKContext(s.ctx) s.ecocreditServer = ecocreditServer{ - MsgClient: core.NewMsgClient(s.fixture.TxConn()), - QueryClient: core.NewQueryClient(s.fixture.QueryConn()), + MsgClient: basetypes.NewMsgClient(s.fixture.TxConn()), + QueryClient: basetypes.NewQueryClient(s.fixture.QueryConn()), } } @@ -65,7 +65,7 @@ func (s *bridgeSuite) EcocreditState(a gocuke.DocString) { } func (s *bridgeSuite) BridgeServiceCallsBridgeReceiveWithMessage(a gocuke.DocString) { - var msg core.MsgBridgeReceive + var msg basetypes.MsgBridgeReceive err := jsonpb.UnmarshalString(a.Content, &msg) require.NoError(s.t, err) @@ -77,7 +77,7 @@ func (s *bridgeSuite) BridgeServiceCallsBridgeReceiveWithMessage(a gocuke.DocStr } func (s *bridgeSuite) RecipientCallsBridgeWithMessage(a gocuke.DocString) { - var msg core.MsgBridge + var msg basetypes.MsgBridge err := jsonpb.UnmarshalString(a.Content, &msg) require.NoError(s.t, err) @@ -100,7 +100,7 @@ func (s *bridgeSuite) ExpectTotalCreditBatches(a string) { expected, err := strconv.ParseUint(a, 10, 64) require.NoError(s.t, err) - res, err := s.ecocreditServer.Batches(s.ctx, &core.QueryBatchesRequest{ + res, err := s.ecocreditServer.Batches(s.ctx, &basetypes.QueryBatchesRequest{ Pagination: &query.PageRequest{CountTotal: true}, }) require.NoError(s.t, err) @@ -111,7 +111,7 @@ func (s *bridgeSuite) ExpectTotalProjects(a string) { expected, err := strconv.ParseUint(a, 10, 64) require.NoError(s.t, err) - res, err := s.ecocreditServer.Projects(s.ctx, &core.QueryProjectsRequest{ + res, err := s.ecocreditServer.Projects(s.ctx, &basetypes.QueryProjectsRequest{ Pagination: &query.PageRequest{CountTotal: true}, }) require.NoError(s.t, err) @@ -119,11 +119,11 @@ func (s *bridgeSuite) ExpectTotalProjects(a string) { } func (s *bridgeSuite) ExpectProjectWithProperties(a gocuke.DocString) { - var expected core.Project + var expected basetypes.Project err := jsonpb.UnmarshalString(a.Content, &expected) require.NoError(s.t, err) - req := &core.QueryProjectRequest{ProjectId: expected.Id} + req := &basetypes.QueryProjectRequest{ProjectId: expected.Id} project, err := s.ecocreditServer.Project(s.ctx, req) require.NoError(s.t, err) @@ -133,11 +133,11 @@ func (s *bridgeSuite) ExpectProjectWithProperties(a gocuke.DocString) { } func (s *bridgeSuite) ExpectCreditBatchWithProperties(a gocuke.DocString) { - var expected core.Batch + var expected basetypes.Batch err := jsonpb.UnmarshalString(a.Content, &expected) require.NoError(s.t, err) - req := &core.QueryBatchRequest{BatchDenom: expected.Denom} + req := &basetypes.QueryBatchRequest{BatchDenom: expected.Denom} project, err := s.ecocreditServer.Batch(s.ctx, req) require.NoError(s.t, err) @@ -148,11 +148,11 @@ func (s *bridgeSuite) ExpectCreditBatchWithProperties(a gocuke.DocString) { } func (s *bridgeSuite) ExpectBatchSupplyWithBatchDenom(a string, b gocuke.DocString) { - expected := &api.BatchSupply{} + expected := &baseapi.BatchSupply{} err := jsonpb.UnmarshalString(b.Content, expected) require.NoError(s.t, err) - res, err := s.ecocreditServer.Supply(s.ctx, &core.QuerySupplyRequest{ + res, err := s.ecocreditServer.Supply(s.ctx, &basetypes.QuerySupplyRequest{ BatchDenom: a, }) require.NoError(s.t, err) @@ -163,11 +163,11 @@ func (s *bridgeSuite) ExpectBatchSupplyWithBatchDenom(a string, b gocuke.DocStri } func (s *bridgeSuite) ExpectBatchBalanceWithAddressAndBatchDenom(a, b string, c gocuke.DocString) { - expected := &api.BatchBalance{} + expected := &baseapi.BatchBalance{} err := jsonpb.UnmarshalString(c.Content, expected) require.NoError(s.t, err) - res, err := s.ecocreditServer.Balance(s.ctx, &core.QueryBalanceRequest{ + res, err := s.ecocreditServer.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: a, BatchDenom: b, }) @@ -179,7 +179,7 @@ func (s *bridgeSuite) ExpectBatchBalanceWithAddressAndBatchDenom(a, b string, c } func (s *bridgeSuite) ExpectEventBridgeReceiveWithValues(a gocuke.DocString) { - var expected core.EventBridgeReceive + var expected basetypes.EventBridgeReceive err := jsonpb.UnmarshalString(a.Content, &expected) require.NoError(s.t, err) @@ -191,7 +191,7 @@ func (s *bridgeSuite) ExpectEventBridgeReceiveWithValues(a gocuke.DocString) { } func (s *bridgeSuite) ExpectEventBridgeWithValues(a gocuke.DocString) { - var expected core.EventBridge + var expected basetypes.EventBridge err := jsonpb.UnmarshalString(a.Content, &expected) require.NoError(s.t, err) diff --git a/x/ecocredit/server/testsuite/genesis.go b/x/ecocredit/server/testsuite/genesis.go index 99b4daf45d..db79b88c26 100644 --- a/x/ecocredit/server/testsuite/genesis.go +++ b/x/ecocredit/server/testsuite/genesis.go @@ -11,10 +11,11 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/testutil" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" + "github.com/regen-network/regen-ledger/x/ecocredit/genesis" ) func (s *GenesisTestSuite) TestInitExportGenesis() { @@ -22,14 +23,14 @@ func (s *GenesisTestSuite) TestInitExportGenesis() { ctx := s.genesisCtx // Set the param set to empty values to properly test init - var ecocreditParams core.Params + var ecocreditParams basetypes.Params s.paramSpace.SetParamSet(ctx, &ecocreditParams) - defaultParams := core.DefaultParams() + defaultParams := genesis.DefaultParams() paramsJSON, err := s.fixture.Codec().MarshalJSON(&defaultParams) require.NoError(err) - classIssuers := []api.ClassIssuer{ + classIssuers := []baseapi.ClassIssuer{ {ClassKey: 1, Issuer: sdk.AccAddress("addr1")}, {ClassKey: 1, Issuer: sdk.AccAddress("addr2")}, {ClassKey: 2, Issuer: sdk.AccAddress("addr2")}, @@ -38,62 +39,62 @@ func (s *GenesisTestSuite) TestInitExportGenesis() { classIssuersJSON, err := json.Marshal(classIssuers) require.NoError(err) - classes := []api.Class{ + classes := []baseapi.Class{ {Id: "BIO001", Admin: sdk.AccAddress("addr1"), Metadata: "metadata", CreditTypeAbbrev: "BIO"}, {Id: "BIO002", Admin: sdk.AccAddress("addr2"), Metadata: "metadata", CreditTypeAbbrev: "BIO"}, } classJSON, err := json.Marshal(classes) require.NoError(err) - projects := []api.Project{ + projects := []baseapi.Project{ {Id: "C01-001", Admin: sdk.AccAddress("addr1"), ClassKey: 1, Jurisdiction: "AQ", Metadata: "metadata"}, {Id: "C01-002", Admin: sdk.AccAddress("addr2"), ClassKey: 2, Jurisdiction: "AQ", Metadata: "metadata"}, } projectJSON, err := json.Marshal(projects) require.NoError(err) - batches := []api.Batch{ + batches := []baseapi.Batch{ {Issuer: sdk.AccAddress("addr1"), ProjectKey: 1, Denom: "BIO01-00000000-00000000-001", Metadata: "metadata"}, {Issuer: nil, ProjectKey: 1, Denom: "BIO02-0000000-0000000-001", Metadata: "metadata"}, } batchJSON, err := json.Marshal(batches) require.NoError(err) - balances := []api.BatchBalance{ + balances := []baseapi.BatchBalance{ {Address: sdk.AccAddress("addr1"), BatchKey: 1, TradableAmount: "90.003", RetiredAmount: "9.997", EscrowedAmount: ""}, } batchBalancesJSON, err := json.Marshal(balances) require.NoError(err) - supply := []api.BatchSupply{ + supply := []baseapi.BatchSupply{ {BatchKey: 1, TradableAmount: "90.003", RetiredAmount: "9.997", CancelledAmount: ""}, } batchSupplyJSON, err := json.Marshal(supply) require.NoError(err) - classSeq := []api.ClassSequence{{CreditTypeAbbrev: "BIO", NextSequence: 3}} + classSeq := []baseapi.ClassSequence{{CreditTypeAbbrev: "BIO", NextSequence: 3}} classSeqJSON, err := json.Marshal(classSeq) require.NoError(err) - batchSeq := []api.BatchSequence{{ProjectKey: 1, NextSequence: 3}} + batchSeq := []baseapi.BatchSequence{{ProjectKey: 1, NextSequence: 3}} batchSeqJSON, err := json.Marshal(batchSeq) require.NoError(err) - projectSeq := []api.ProjectSequence{{ClassKey: 1, NextSequence: 3}} + projectSeq := []baseapi.ProjectSequence{{ClassKey: 1, NextSequence: 3}} projectSeqJSON, err := json.Marshal(projectSeq) require.NoError(err) wrapper := map[string]json.RawMessage{} - wrapper[string(proto.MessageName(&api.Class{}))] = classJSON - wrapper[string(proto.MessageName(&api.ClassIssuer{}))] = classIssuersJSON - wrapper[string(proto.MessageName(&api.Project{}))] = projectJSON - wrapper[string(proto.MessageName(&api.Batch{}))] = batchJSON - wrapper[string(proto.MessageName(&api.BatchBalance{}))] = batchBalancesJSON - wrapper[string(proto.MessageName(&api.BatchSupply{}))] = batchSupplyJSON - wrapper[string(proto.MessageName(&api.ClassSequence{}))] = classSeqJSON - wrapper[string(proto.MessageName(&api.BatchSequence{}))] = batchSeqJSON - wrapper[string(proto.MessageName(&api.ProjectSequence{}))] = projectSeqJSON - wrapper[string(proto.MessageName(&api.Params{}))] = paramsJSON + wrapper[string(proto.MessageName(&baseapi.Class{}))] = classJSON + wrapper[string(proto.MessageName(&baseapi.ClassIssuer{}))] = classIssuersJSON + wrapper[string(proto.MessageName(&baseapi.Project{}))] = projectJSON + wrapper[string(proto.MessageName(&baseapi.Batch{}))] = batchJSON + wrapper[string(proto.MessageName(&baseapi.BatchBalance{}))] = batchBalancesJSON + wrapper[string(proto.MessageName(&baseapi.BatchSupply{}))] = batchSupplyJSON + wrapper[string(proto.MessageName(&baseapi.ClassSequence{}))] = classSeqJSON + wrapper[string(proto.MessageName(&baseapi.BatchSequence{}))] = batchSeqJSON + wrapper[string(proto.MessageName(&baseapi.ProjectSequence{}))] = projectSeqJSON + wrapper[string(proto.MessageName(&baseapi.Params{}))] = paramsJSON bz, err := json.Marshal(wrapper) require.NoError(err) diff --git a/x/ecocredit/server/testsuite/suite.go b/x/ecocredit/server/testsuite/suite.go index 18efd19551..329e073af2 100644 --- a/x/ecocredit/server/testsuite/suite.go +++ b/x/ecocredit/server/testsuite/suite.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/suite" dbm "github.com/tendermint/tm-db" - basev1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" + sdkbase "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/orm/model/ormdb" "github.com/cosmos/cosmos-sdk/orm/model/ormtable" @@ -23,13 +23,13 @@ import ( basketApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" marketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" + baseapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/math" "github.com/regen-network/regen-ledger/types/testutil" "github.com/regen-network/regen-ledger/x/ecocredit" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" markettypes "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1" "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) @@ -43,10 +43,10 @@ type IntegrationTestSuite struct { codec *codec.ProtoCodec sdkCtx sdk.Context ctx context.Context - msgClient core.MsgClient + msgClient basetypes.MsgClient marketServer marketServer basketServer basketServer - queryClient core.QueryClient + queryClient basetypes.QueryClient signers []sdk.AccAddress basketFee sdk.Coin @@ -68,7 +68,7 @@ type basketServer struct { } var ( - createClassFee = sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: core.DefaultCreditClassFee} + createClassFee = sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: basetypes.DefaultCreditClassFee} ) func NewIntegrationTestSuite(fixtureFactory testutil.Factory, bankKeeper bankkeeper.BaseKeeper, accountKeeper authkeeper.AccountKeeper) *IntegrationTestSuite { @@ -100,8 +100,8 @@ func (s *IntegrationTestSuite) SetupSuite() { s.basketServer = basketServer{baskettypes.NewQueryClient(s.fixture.QueryConn()), baskettypes.NewMsgClient(s.fixture.TxConn())} s.marketServer = marketServer{markettypes.NewQueryClient(s.fixture.QueryConn()), markettypes.NewMsgClient(s.fixture.TxConn())} - s.msgClient = core.NewMsgClient(s.fixture.TxConn()) - s.queryClient = core.NewQueryClient(s.fixture.QueryConn()) + s.msgClient = basetypes.NewMsgClient(s.fixture.TxConn()) + s.queryClient = basetypes.NewQueryClient(s.fixture.QueryConn()) } func (s *IntegrationTestSuite) ecocreditGenesis() json.RawMessage { @@ -119,7 +119,7 @@ func (s *IntegrationTestSuite) ecocreditGenesis() json.RawMessage { modDB, err := ormdb.NewModuleDB(&ecocredit.ModuleSchema, ormdb.ModuleDBOptions{}) s.Require().NoError(err) ormCtx := ormtable.WrapContextDefault(backend) - ss, err := api.NewStateStore(modDB) + ss, err := baseapi.NewStateStore(modDB) s.Require().NoError(err) ms, err := marketapi.NewStateStore(modDB) s.Require().NoError(err) @@ -130,7 +130,7 @@ func (s *IntegrationTestSuite) ecocreditGenesis() json.RawMessage { }) s.Require().NoError(err) - err = ss.CreditTypeTable().Insert(ormCtx, &api.CreditType{ + err = ss.CreditTypeTable().Insert(ormCtx, &baseapi.CreditType{ Abbreviation: "C", Name: "carbon", Unit: "metric ton C02", @@ -139,11 +139,11 @@ func (s *IntegrationTestSuite) ecocreditGenesis() json.RawMessage { s.Require().NoError(err) // set default credit class fee - err = ss.ClassFeesTable().Save(ormCtx, &api.ClassFees{ - Fees: []*basev1beta1.Coin{ + err = ss.ClassFeesTable().Save(ormCtx, &baseapi.ClassFees{ + Fees: []*sdkbase.Coin{ { Denom: sdk.DefaultBondDenom, - Amount: core.DefaultCreditClassFee.String(), + Amount: basetypes.DefaultCreditClassFee.String(), }, }, }) @@ -153,7 +153,7 @@ func (s *IntegrationTestSuite) ecocreditGenesis() json.RawMessage { s.Require().NoError(err) err = bs.BasketFeesTable().Save(ormCtx, &basketApi.BasketFees{ - Fees: []*basev1beta1.Coin{ + Fees: []*sdkbase.Coin{ { Denom: s.basketFee.Denom, Amount: s.basketFee.Amount.String(), @@ -240,7 +240,7 @@ func (s *IntegrationTestSuite) TestBasketScenario() { require.Equal(basketBalance.Balance, creditAmtDeposited.String()) // make sure user doesn't have any of that credit - should error out - userCreditBalance, err := s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + userCreditBalance, err := s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: user.String(), BatchDenom: batchDenom, }) @@ -331,7 +331,7 @@ func (s *IntegrationTestSuite) TestBasketScenario() { require.Equal(creditsToDeposit.String(), tRes.Credits[0].Amount) // check retired balance, should be equal to the amount we put in - cbRes, err := s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + cbRes, err := s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: user.String(), BatchDenom: batchDenom, }) @@ -344,7 +344,7 @@ func (s *IntegrationTestSuite) createClassAndIssueBatch(admin, recipient sdk.Acc // fund the account so this doesn't fail s.fundAccount(admin, sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 20000000))) - cRes, err := s.msgClient.CreateClass(s.ctx, &core.MsgCreateClass{ + cRes, err := s.msgClient.CreateClass(s.ctx, &basetypes.MsgCreateClass{ Admin: admin.String(), Issuers: []string{admin.String()}, Metadata: "", @@ -357,17 +357,17 @@ func (s *IntegrationTestSuite) createClassAndIssueBatch(admin, recipient sdk.Acc require.NoError(err) end, err := types.ParseDate("end date", endStr) require.NoError(err) - pRes, err := s.msgClient.CreateProject(s.ctx, &core.MsgCreateProject{ + pRes, err := s.msgClient.CreateProject(s.ctx, &basetypes.MsgCreateProject{ Admin: admin.String(), ClassId: classID, Metadata: "", Jurisdiction: "US-NY", }) require.NoError(err) - bRes, err := s.msgClient.CreateBatch(s.ctx, &core.MsgCreateBatch{ + bRes, err := s.msgClient.CreateBatch(s.ctx, &basetypes.MsgCreateBatch{ Issuer: admin.String(), ProjectId: pRes.ProjectId, - Issuance: []*core.BatchIssuance{{Recipient: recipient.String(), TradableAmount: tradableAmount}}, + Issuance: []*basetypes.BatchIssuance{{Recipient: recipient.String(), TradableAmount: tradableAmount}}, Metadata: "", StartDate: &start, EndDate: &end, @@ -390,7 +390,7 @@ func (s *IntegrationTestSuite) TestScenario() { addr5 := acc5.String() // create class with insufficient funds and it should fail - createClsRes, err := s.msgClient.CreateClass(s.ctx, &core.MsgCreateClass{ + createClsRes, err := s.msgClient.CreateClass(s.ctx, &basetypes.MsgCreateClass{ Admin: admin.String(), Issuers: []string{issuer1, issuer2}, Metadata: "", @@ -401,10 +401,10 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().Nil(createClsRes) // create class with sufficient funds and it should succeed - s.fundAccount(admin, sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 4*core.DefaultCreditClassFee.Int64()))) + s.fundAccount(admin, sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 4*basetypes.DefaultCreditClassFee.Int64()))) adminBalanceBefore := s.bankKeeper.GetBalance(s.sdkCtx, admin, sdk.DefaultBondDenom) - createClsRes, err = s.msgClient.CreateClass(s.ctx, &core.MsgCreateClass{ + createClsRes, err = s.msgClient.CreateClass(s.ctx, &basetypes.MsgCreateClass{ Admin: admin.String(), Issuers: []string{issuer1, issuer2}, Metadata: "", @@ -419,7 +419,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().True(adminBalanceBefore.Equal(expectedBalance), "actual balance: %v \t expected: %v", adminBalanceAfter, expectedBalance) // create project - createProjectRes, err := s.msgClient.CreateProject(s.ctx, &core.MsgCreateProject{ + createProjectRes, err := s.msgClient.CreateProject(s.ctx, &basetypes.MsgCreateProject{ ClassId: classID, Admin: issuer1, Metadata: "metadata", @@ -440,12 +440,12 @@ func (s *IntegrationTestSuite) TestScenario() { time2 := time.Now() // Batch creation should succeed with StartDate before EndDate, and valid data - createBatchRes, err := s.msgClient.CreateBatch(s.ctx, &core.MsgCreateBatch{ + createBatchRes, err := s.msgClient.CreateBatch(s.ctx, &basetypes.MsgCreateBatch{ Issuer: issuer1, ProjectId: projectID, StartDate: &time1, EndDate: &time2, - Issuance: []*core.BatchIssuance{ + Issuance: []*basetypes.BatchIssuance{ { Recipient: addr1, TradableAmount: t0, @@ -473,7 +473,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().NotEmpty(batchDenom) // query balances - queryBalanceRes, err := s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + queryBalanceRes, err := s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: addr1, BatchDenom: batchDenom, }) @@ -482,7 +482,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().Equal(t0, queryBalanceRes.Balance.TradableAmount) s.Require().Equal(r0, queryBalanceRes.Balance.RetiredAmount) - queryBalanceRes, err = s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + queryBalanceRes, err = s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: addr2, BatchDenom: batchDenom, }) @@ -491,7 +491,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().Equal(t1, queryBalanceRes.Balance.TradableAmount) s.Require().Equal(r1, queryBalanceRes.Balance.RetiredAmount) - queryBalanceRes, err = s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + queryBalanceRes, err = s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: addr4, BatchDenom: batchDenom, }) @@ -501,7 +501,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().Equal(r2, queryBalanceRes.Balance.RetiredAmount) // if we didn't issue tradable or retired balances, they'll be default to zero. - queryBalanceRes, err = s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + queryBalanceRes, err = s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: addr5, BatchDenom: batchDenom, }) @@ -511,7 +511,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().Equal("0", queryBalanceRes.Balance.RetiredAmount) // query supply - querySupplyRes, err := s.queryClient.Supply(s.ctx, &core.QuerySupplyRequest{BatchDenom: batchDenom}) + querySupplyRes, err := s.queryClient.Supply(s.ctx, &basetypes.QuerySupplyRequest{BatchDenom: batchDenom}) s.Require().NoError(err) s.Require().NotNil(querySupplyRes) s.Require().Equal(tSupply0, querySupplyRes.TradableAmount) @@ -595,9 +595,9 @@ func (s *IntegrationTestSuite) TestScenario() { for _, tc := range cancelCases { s.Run(tc.name, func() { - _, err := s.msgClient.Cancel(s.ctx, &core.MsgCancel{ + _, err := s.msgClient.Cancel(s.ctx, &basetypes.MsgCancel{ Owner: tc.owner, - Credits: []*core.Credits{ + Credits: []*basetypes.Credits{ { BatchDenom: batchDenom, Amount: tc.toCancel, @@ -613,7 +613,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().NoError(err) // query balance - queryBalanceRes, err = s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + queryBalanceRes, err = s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: tc.owner, BatchDenom: batchDenom, }) @@ -623,7 +623,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.assertDecStrEqual(tc.expRetired, queryBalanceRes.Balance.RetiredAmount) // query supply - querySupplyRes, err = s.queryClient.Supply(s.ctx, &core.QuerySupplyRequest{BatchDenom: batchDenom}) + querySupplyRes, err = s.queryClient.Supply(s.ctx, &basetypes.QuerySupplyRequest{BatchDenom: batchDenom}) s.Require().NoError(err) s.Require().NotNil(querySupplyRes) s.assertDecStrEqual(tc.expTradableSupply, querySupplyRes.TradableAmount) @@ -631,7 +631,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.assertDecStrEqual(tc.expAmountCancelled, querySupplyRes.CancelledAmount) // query batch - queryBatchRes, err := s.queryClient.Batch(s.ctx, &core.QueryBatchRequest{BatchDenom: batchDenom}) + queryBatchRes, err := s.queryClient.Batch(s.ctx, &basetypes.QueryBatchRequest{BatchDenom: batchDenom}) s.Require().NoError(err) s.Require().NotNil(queryBatchRes) } @@ -734,9 +734,9 @@ func (s *IntegrationTestSuite) TestScenario() { for _, tc := range retireCases { tc := tc s.Run(tc.name, func() { - _, err := s.msgClient.Retire(s.ctx, &core.MsgRetire{ + _, err := s.msgClient.Retire(s.ctx, &basetypes.MsgRetire{ Owner: addr1, - Credits: []*core.Credits{ + Credits: []*basetypes.Credits{ { BatchDenom: batchDenom, Amount: tc.toRetire, @@ -752,7 +752,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().NoError(err) // query balance - queryBalanceRes, err = s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + queryBalanceRes, err = s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: addr1, BatchDenom: batchDenom, }) @@ -762,7 +762,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.assertDecStrEqual(tc.expRetired, queryBalanceRes.Balance.RetiredAmount) // query supply - querySupplyRes, err = s.queryClient.Supply(s.ctx, &core.QuerySupplyRequest{BatchDenom: batchDenom}) + querySupplyRes, err = s.queryClient.Supply(s.ctx, &basetypes.QuerySupplyRequest{BatchDenom: batchDenom}) s.Require().NoError(err) s.Require().NotNil(querySupplyRes) s.assertDecStrEqual(tc.expTradableSupply, querySupplyRes.TradableAmount) @@ -885,10 +885,10 @@ func (s *IntegrationTestSuite) TestScenario() { for _, tc := range sendCases { tc := tc s.Run(tc.name, func() { - _, err := s.msgClient.Send(s.ctx, &core.MsgSend{ + _, err := s.msgClient.Send(s.ctx, &basetypes.MsgSend{ Sender: addr2, Recipient: addr3, - Credits: []*core.MsgSend_SendCredits{ + Credits: []*basetypes.MsgSend_SendCredits{ { BatchDenom: batchDenom, TradableAmount: tc.sendTradable, @@ -905,7 +905,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.Require().NoError(err) // query sender balance - queryBalanceRes, err = s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + queryBalanceRes, err = s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: addr2, BatchDenom: batchDenom, }) @@ -915,7 +915,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.assertDecStrEqual(tc.expRetiredSender, queryBalanceRes.Balance.RetiredAmount) // query recipient balance - queryBalanceRes, err = s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ + queryBalanceRes, err = s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: addr3, BatchDenom: batchDenom, }) @@ -925,7 +925,7 @@ func (s *IntegrationTestSuite) TestScenario() { s.assertDecStrEqual(tc.expRetiredRecipient, queryBalanceRes.Balance.RetiredAmount) // query supply - querySupplyRes, err = s.queryClient.Supply(s.ctx, &core.QuerySupplyRequest{BatchDenom: batchDenom}) + querySupplyRes, err = s.queryClient.Supply(s.ctx, &basetypes.QuerySupplyRequest{BatchDenom: batchDenom}) s.Require().NoError(err) s.Require().NotNil(querySupplyRes) s.assertDecStrEqual(tc.expTradableSupply, querySupplyRes.TradableAmount) @@ -1086,8 +1086,8 @@ func (s *IntegrationTestSuite) getAccountInfo(addr sdk.AccAddress, batchDenom, b } } -func (s *IntegrationTestSuite) getUserBatchBalance(addr sdk.AccAddress, denom string) *core.BatchBalanceInfo { - bal, err := s.queryClient.Balance(s.ctx, &core.QueryBalanceRequest{ +func (s *IntegrationTestSuite) getUserBatchBalance(addr sdk.AccAddress, denom string) *basetypes.BatchBalanceInfo { + bal, err := s.queryClient.Balance(s.ctx, &basetypes.QueryBalanceRequest{ Address: addr.String(), BatchDenom: denom, }) @@ -1095,7 +1095,7 @@ func (s *IntegrationTestSuite) getUserBatchBalance(addr sdk.AccAddress, denom st return bal.Balance } -func (s *IntegrationTestSuite) getDecimalsFromBalance(bal *core.BatchBalanceInfo) (tradable, retired, escrowed math.Dec) { +func (s *IntegrationTestSuite) getDecimalsFromBalance(bal *basetypes.BatchBalanceInfo) (tradable, retired, escrowed math.Dec) { decs, err := utils.GetNonNegativeFixedDecs(6, bal.TradableAmount, bal.RetiredAmount, bal.EscrowedAmount) s.Require().NoError(err) return decs[0], decs[1], decs[2] diff --git a/x/ecocredit/server/utils/utils.go b/x/ecocredit/server/utils/utils.go index e97a31fa1f..0b92885b2c 100644 --- a/x/ecocredit/server/utils/utils.go +++ b/x/ecocredit/server/utils/utils.go @@ -9,12 +9,12 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // GetCreditTypeFromBatchDenom extracts the classID from a batch denom string, then retrieves it from the params. func GetCreditTypeFromBatchDenom(ctx context.Context, store api.StateStore, denom string) (*api.CreditType, error) { - classID := core.GetClassIDFromBatchDenom(denom) + classID := base.GetClassIDFromBatchDenom(denom) classInfo, err := store.ClassTable().GetById(ctx, classID) if err != nil { return nil, sdkerrors.ErrInvalidRequest.Wrapf("could not get class with ID %s: %s", classID, err.Error()) diff --git a/x/ecocredit/simulation/genesis.go b/x/ecocredit/simulation/genesis.go index 3f0c506402..dc8957574f 100644 --- a/x/ecocredit/simulation/genesis.go +++ b/x/ecocredit/simulation/genesis.go @@ -5,6 +5,7 @@ import ( "encoding/json" "math/rand" + dbm "github.com/tendermint/tm-db" "google.golang.org/protobuf/types/known/timestamppb" basev1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" @@ -15,12 +16,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - dbm "github.com/tendermint/tm-db" marketplaceapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/base" ) // genCreditClassFee randomized CreditClassFee @@ -333,7 +333,7 @@ func genGenesisState(ctx context.Context, simState *module.SimulationState, ss a if err != nil { return err } - denom, err := core.FormatBatchDenom("C01-001", batchSeq, &startDate, &endDate) + denom, err := base.FormatBatchDenom("C01-001", batchSeq, &startDate, &endDate) if err != nil { return err } @@ -357,7 +357,7 @@ func genGenesisState(ctx context.Context, simState *module.SimulationState, ss a if err != nil { return err } - denom, err = core.FormatBatchDenom("C02-001", batchSeq, &startDate, &endDate) + denom, err = base.FormatBatchDenom("C02-001", batchSeq, &startDate, &endDate) if err != nil { return err } diff --git a/x/ecocredit/simulation/utils/utils.go b/x/ecocredit/simulation/utils/utils.go index 2d1507364d..35bb8ee053 100644 --- a/x/ecocredit/simulation/utils/utils.go +++ b/x/ecocredit/simulation/utils/utils.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/core" + basetypes "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1" ) func RandomExponent(r *rand.Rand, precision uint32) uint32 { @@ -83,20 +83,20 @@ func GenAndDeliverTx(r *rand.Rand, txCtx simulation.OperationInput, fees sdk.Coi return simtypes.NewOperationMsg(txCtx.Msg, true, "", txCtx.Cdc), nil, nil } -func GetClasses(sdkCtx sdk.Context, r *rand.Rand, qryClient core.QueryServer, msgType string) ([]*core.ClassInfo, simtypes.OperationMsg, error) { +func GetClasses(sdkCtx sdk.Context, r *rand.Rand, qryClient basetypes.QueryServer, msgType string) ([]*basetypes.ClassInfo, simtypes.OperationMsg, error) { ctx := sdk.WrapSDKContext(sdkCtx) - res, err := qryClient.Classes(ctx, &core.QueryClassesRequest{}) + res, err := qryClient.Classes(ctx, &basetypes.QueryClassesRequest{}) if err != nil { if ormerrors.IsNotFound(err) { - return []*core.ClassInfo{}, simtypes.NoOpMsg(ecocredit.ModuleName, msgType, "no classes"), nil + return []*basetypes.ClassInfo{}, simtypes.NoOpMsg(ecocredit.ModuleName, msgType, "no classes"), nil } - return []*core.ClassInfo{}, simtypes.NoOpMsg(ecocredit.ModuleName, msgType, err.Error()), err + return []*basetypes.ClassInfo{}, simtypes.NoOpMsg(ecocredit.ModuleName, msgType, err.Error()), err } return res.Classes, simtypes.NoOpMsg(ecocredit.ModuleName, msgType, ""), nil } -func GetRandomClass(sdkCtx sdk.Context, r *rand.Rand, qryClient core.QueryServer, msgType string) (*core.ClassInfo, simtypes.OperationMsg, error) { +func GetRandomClass(sdkCtx sdk.Context, r *rand.Rand, qryClient basetypes.QueryServer, msgType string) (*basetypes.ClassInfo, simtypes.OperationMsg, error) { classes, op, err := GetClasses(sdkCtx, r, qryClient, msgType) if len(classes) == 0 { return nil, op, err