diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6f4bac4f..a621353f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,22 +19,22 @@ jobs: runs-on: ubuntu-latest name: build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - run: go build ./... tidy: runs-on: ubuntu-latest name: tidy steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - run: | go mod tidy CHANGES_IN_REPO=$(git status --porcelain) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml deleted file mode 100644 index 1be551252..000000000 --- a/.github/workflows/build_docker.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Build Docker Image on PR - -on: - push: - paths: - - "**docker**" - - "**.sh" - - "**.bash" - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build without push - uses: docker/build-push-action@v4 - with: - context: . - platforms: linux/amd64 - push: false - build-args: arch=x86_64 \ No newline at end of file diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1a631167a..04a790f94 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -23,10 +23,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + uses: actions/checkout@v4 + - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/goreleaser-latest.yml b/.github/workflows/goreleaser-latest.yml new file mode 100644 index 000000000..584185881 --- /dev/null +++ b/.github/workflows/goreleaser-latest.yml @@ -0,0 +1,49 @@ +name: goreleaser-latest + +on: + push: + branches: + - main + - develop + +permissions: + contents: write + packages: write + +jobs: + goreleaser-latest: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Fetch all tags + run: git fetch --force --tags + + - name: Release (snapshot) + run: make release-snapshot + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to GHCR container register + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push versioned image + uses: docker/build-push-action@v5 + with: + file: contrib/docker/goreleaser.Dockerfile + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ghcr.io/composablefi/composable-cosmos:latest diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 000000000..89257a838 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,55 @@ +name: goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + packages: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Fetch all tags + run: git fetch --force --tags + + - name: Release + run: make release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get version + id: get_version + uses: battila7/get-version-action@v2 + + - name: Login to GHCR container register + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push versioned image + uses: docker/build-push-action@v5 + with: + file: contrib/docker/goreleaser.Dockerfile + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: | + ghcr.io/composablefi/composable-cosmos:${{ steps.get_version.outputs.version }} + ghcr.io/composablefi/composable-cosmos:v${{ steps.get_version.outputs.major }} + ghcr.io/composablefi/composable-cosmos:v${{ steps.get_version.outputs.major }}.${{ steps.get_version.outputs.minor }} diff --git a/.github/workflows/interchaintest.yml b/.github/workflows/interchaintest.yml index 4529d0fed..2febd9bdd 100644 --- a/.github/workflows/interchaintest.yml +++ b/.github/workflows/interchaintest.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - main + - develop permissions: contents: read @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to GitHub Container Registry @@ -33,18 +33,18 @@ jobs: push: true platforms: linux/amd64 tags: | - ghcr.io/notional-labs/centauri-ictest:latest + ghcr.io/composablefi/centauri-ictest:latest test-start-cosmos-chain: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.19 - uses: actions/setup-go@v3 + - name: Set up Go 1.20 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-start-cosmos env: @@ -54,13 +54,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.19 - uses: actions/setup-go@v3 + - name: Set up Go 1.20 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-upgrade env: @@ -70,13 +70,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.19 - uses: actions/setup-go@v3 + - name: Set up Go 1.20 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-start-polkadot env: @@ -86,13 +86,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.19 - uses: actions/setup-go@v3 + - name: Set up Go 1.20 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-validator env: @@ -102,13 +102,13 @@ jobs: # runs-on: ubuntu-latest # needs: build-and-push-image # steps: - # - name: Set up Go 1.19 - # uses: actions/setup-go@v3 + # - name: Set up Go 1.20 + # uses: actions/setup-go@v4 # with: - # go-version: 1.19 + # go-version: 1.20 # - name: checkout code - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # - run: make ictest-ibc # env: @@ -118,13 +118,13 @@ jobs: # runs-on: ubuntu-latest # needs: build-and-push-image # steps: - # - name: Set up Go 1.19 - # uses: actions/setup-go@v3 + # - name: Set up Go 1.20 + # uses: actions/setup-go@v4 # with: - # go-version: 1.19 + # go-version: 1.20 # - name: checkout code - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # - run: make ictest-push-wasm # env: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3188ae602..0c27618f5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,10 +15,10 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: - go-version: 1.19 - - uses: actions/checkout@v3 + go-version: '1.20' + - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/.github/workflows/push_docker_images.yml b/.github/workflows/push_docker_images.yml deleted file mode 100644 index 74a6f871a..000000000 --- a/.github/workflows/push_docker_images.yml +++ /dev/null @@ -1,65 +0,0 @@ -# This workflow pushes new centauri docker images on every new tag. -# -# On every new `vX.Y.Z` tag the following images are pushed: -# -# composablefi/composable-cosmos:X.Y.Z # is pushed -# composablefi/composable-cosmos:X.Y # is updated to X.Y.Z -# composablefi/composable-cosmos:X # is updated to X.Y.Z -# -# All the images above have support for linux/amd64 and linux/arm64. -# -# Due to QEMU virtualization used to build multi-platform docker images -# this workflow might take a while to complete. - -name: Push Docker Images - -on: - release: - types: [published, created, edited] - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc - -permissions: - contents: read - packages: write - -jobs: - feeapp-images: - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Parse tag - id: tag - run: | - VERSION=$(echo ${{ github.ref_name }} | sed "s/v//") - MAJOR_VERSION=$(echo $VERSION | cut -d '.' -f 1) - MINOR_VERSION=$(echo $VERSION | cut -d '.' -f 2) - PATCH_VERSION=$(echo $VERSION | cut -d '.' -f 3) - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV - echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV - echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV - - name: Build and push - id: build_push_image - uses: docker/build-push-action@v3 - with: - file: Dockerfile - context: . - push: true - platforms: linux/amd64,linux/arm64 - tags: | - ghcr.io/composablefi/composable-cosmos:${{ env.MAJOR_VERSION }} - ghcr.io/composablefi/composable-cosmos:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }} - ghcr.io/composablefi/composable-cosmos:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index fe3f3c597..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,45 +0,0 @@ ---- - name: Release Binary - - on: - release: - types: [created] - - permissions: - contents: read - packages: write - - jobs: - release: - permissions: write-all - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Docker compose - run: docker-compose up -d - - - name: Copy binary - run: docker cp composable-centauri_node_1:/bin/centaurid ./centaurid - - - name: Save sha256 sum - run: sha256sum ./centaurid > ./centaurid_sha256.txt - - - name: Release - uses: softprops/action-gh-release@v1 - with: - token: ${{ github.token }} - files: | - centaurid - centaurid_sha256.txt - - - name: Dump docker logs on failure - if: failure() - uses: jwalton/gh-docker-logs@v2 \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b78394d8b..55a2a0b76 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,10 +12,10 @@ jobs: name: test steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Test run: go test ./... \ No newline at end of file diff --git a/.gitignore b/.gitignore index 003f7ba8e..bd65a4ba1 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,9 @@ scripts/temp.sh wasm_client* vue/* bin/* + +dist/ + # Test binary, built with `go test -c` *.test diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..181b7e9ea --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,81 @@ +# .goreleaser.yml + +project_name: centaurid + +env: + - CGO_ENABLED=1 + +builds: + - id: linux + main: ./cmd/centaurid + binary: centaurid + hooks: + pre: + - cmd: bash scripts/release_pre_linux.sh + output: false # enable for debug + env: + - TARGET={{ .Target }} + goos: + - linux + goarch: + - amd64 + - arm64 + env: + - CC_linux_amd64=x86_64-linux-gnu-gcc + - CC_linux_arm64=aarch64-linux-gnu-gcc + - 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}' + flags: + - -mod=readonly + - -trimpath + ldflags: + - -X github.com/cosmos/cosmos-sdk/version.Name=centauri + - -X github.com/cosmos/cosmos-sdk/version.AppName=centaurid + - -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} + - -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} + - -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc" + - -w -s + - -linkmode=external + - -extldflags '-static -lm -lbz2' + tags: + - netgo + - ledger + - muslc + - static + - static_wasm + + # - id: darwin + # main: ./cmd/centaurid + # binary: centaurid + # hooks: + # pre: + # - cmd: bash scripts/release_pre_darwin.sh + # output: false # enable for debug + # env: + # - TARGET={{ .Target }} + # goos: + # - darwin + # goarch: + # - amd64 + # - arm64 + # env: + # - CC_darwin_amd64=o64-clang + # - CC_darwin_arm64=oa64-clang + # - 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}' + # flags: + # - -mod=readonly + # - -trimpath + # ldflags: + # - -X github.com/cosmos/cosmos-sdk/version.Name=centauri + # - -X github.com/cosmos/cosmos-sdk/version.AppName=centaurid + # - -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} + # - -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} + # - -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc" + # - -w -s + # - -linkmode=external + # - -extldflags '-static -lm -lbz2' + # tags: + # - netgo + # - ledger + # - muslc + # - static + # - static_wasm diff --git a/Dockerfile b/Dockerfile index 2c129d821..6598b8e1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ARG RUNNER_IMAGE="gcr.io/distroless/static-debian11" # Builder # -------------------------------------------------------- -FROM golang:${GO_VERSION}-alpine as builder +FROM golang:${GO_VERSION}-alpine3.18 as builder ARG GIT_VERSION ARG GIT_COMMIT diff --git a/Makefile b/Makefile index cde284ab7..d2191acdc 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ build: go build $(BUILD_FLAGS) -o bin/centaurid ./cmd/centaurid docker-build-debug: - @DOCKER_BUILDKIT=1 docker build -t centauri:debug -f Dockerfile . + @DOCKER_BUILDKIT=1 docker build -t centauri:local -f Dockerfile . lint: @find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -name '*.gw.go' | xargs go run mvdan.cc/gofumpt -w . @@ -158,3 +158,5 @@ ictest-push-wasm: cd tests/interchaintest && go test -race -v -run TestPushWasmClientCode . .PHONY: ictest-start-cosmos ictest-start-polkadot ictest-ibc ictest-push-wasm ictest-all + +include contrib/make/release.mk \ No newline at end of file diff --git a/README.md b/README.md index d2e721e98..9b8415a16 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Cosmos blockchain with IBC-v7 and wasm client enable. ## Quick start -Requires [Go 1.19](https://go.dev/doc/install) or higher. +Requires [Go 1.20](https://go.dev/doc/install) or higher. ```bash make install diff --git a/app/app.go b/app/app.go index 067fe7ca1..9f78d19d5 100644 --- a/app/app.go +++ b/app/app.go @@ -36,7 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/notional-labs/composable/v6/app/keepers" - v6_4 "github.com/notional-labs/composable/v6/app/upgrades/v6_4" + "github.com/notional-labs/composable/v6/app/upgrades/v6_4_91" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -87,6 +87,7 @@ import ( ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + customibctransfer "github.com/notional-labs/composable/v6/custom/ibc-transfer" customstaking "github.com/notional-labs/composable/v6/custom/staking" "github.com/spf13/cast" icq "github.com/strangelove-ventures/async-icq/v7" @@ -101,6 +102,7 @@ import ( custombankmodule "github.com/notional-labs/composable/v6/custom/bank" "github.com/notional-labs/composable/v6/app/ante" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware" "github.com/notional-labs/composable/v6/x/stakingmiddleware" transfermiddleware "github.com/notional-labs/composable/v6/x/transfermiddleware" transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types" @@ -126,6 +128,7 @@ import ( wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" upgrades "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" stakingmiddlewaretypes "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" ) @@ -144,7 +147,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_4.Upgrade} + Upgrades = []upgrades.Upgrade{v6_4_91.Upgrade} Forks = []upgrades.Fork{} ) @@ -226,6 +229,7 @@ var ( consensus.AppModuleBasic{}, alliancemodule.AppModuleBasic{}, stakingmiddleware.AppModuleBasic{}, + ibctransfermiddleware.AppModuleBasic{}, // this line is used by starport scaffolding # stargate/app/moduleBasic ) @@ -334,7 +338,8 @@ func NewComposableApp( enabledProposals, ) - transferModule := transfer.NewAppModule(app.TransferKeeper) + // transferModule := transfer.NewAppModule(app.TransferKeeper) + transferModule := customibctransfer.NewAppModule(appCodec, app.TransferKeeper, app.BankKeeper) routerModule := router.NewAppModule(app.RouterKeeper) transfermiddlewareModule := transfermiddleware.NewAppModule(&app.TransferMiddlewareKeeper) txBoundaryModule := txBoundary.NewAppModule(appCodec, app.TxBoundaryKeepper) @@ -369,6 +374,7 @@ func NewComposableApp( distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), customstaking.NewAppModule(appCodec, *app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), stakingmiddleware.NewAppModule(appCodec, app.StakingMiddlewareKeeper), + ibctransfermiddleware.NewAppModule(appCodec, app.IbcTransferMiddlewareKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(app.EvidenceKeeper), @@ -425,6 +431,7 @@ func NewComposableApp( wasm.ModuleName, alliancemoduletypes.ModuleName, stakingmiddlewaretypes.ModuleName, + ibctransfermiddlewaretypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers ) @@ -460,6 +467,7 @@ func NewComposableApp( wasm.ModuleName, alliancemoduletypes.ModuleName, stakingmiddlewaretypes.ModuleName, + ibctransfermiddlewaretypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -499,6 +507,7 @@ func NewComposableApp( wasm.ModuleName, alliancemoduletypes.ModuleName, stakingmiddlewaretypes.ModuleName, + ibctransfermiddlewaretypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis ) @@ -589,7 +598,7 @@ func (app *ComposableApp) GetStakingKeeper() ibctestingtypes.StakingKeeper { // GetIBCKeeper implements the TestingApp interface. func (app *ComposableApp) GetTransferKeeper() *ibctransferkeeper.Keeper { - return &app.TransferKeeper + return &app.TransferKeeper.Keeper } // GetIBCKeeper implements the TestingApp interface. diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 34df21b0f..563aea083 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -57,12 +57,13 @@ import ( icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + customibctransferkeeper "github.com/notional-labs/composable/v6/custom/ibc-transfer/keeper" icq "github.com/strangelove-ventures/async-icq/v7" icqkeeper "github.com/strangelove-ventures/async-icq/v7/keeper" icqtypes "github.com/strangelove-ventures/async-icq/v7/types" @@ -95,16 +96,20 @@ import ( minttypes "github.com/notional-labs/composable/v6/x/mint/types" "github.com/CosmWasm/wasmd/x/wasm" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" wasm08Keeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper" - wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" ibc_hooks "github.com/notional-labs/composable/v6/x/ibc-hooks" ibchookskeeper "github.com/notional-labs/composable/v6/x/ibc-hooks/keeper" ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" stakingmiddlewaretypes "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" + + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/keeper" + ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) const ( @@ -132,7 +137,7 @@ type AppKeepers struct { ParamsKeeper paramskeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly EvidenceKeeper evidencekeeper.Keeper - TransferKeeper ibctransferkeeper.Keeper + TransferKeeper customibctransferkeeper.Keeper ICQKeeper icqkeeper.Keeper ICAHostKeeper icahostkeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper @@ -151,12 +156,13 @@ type AppKeepers struct { ScopedRateLimitKeeper capabilitykeeper.ScopedKeeper ConsensusParamsKeeper consensusparamkeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration - TransferMiddlewareKeeper transfermiddlewarekeeper.Keeper - TxBoundaryKeepper txBoundaryKeeper.Keeper - RouterKeeper *routerkeeper.Keeper - RatelimitKeeper ratelimitmodulekeeper.Keeper - AllianceKeeper alliancemodulekeeper.Keeper - StakingMiddlewareKeeper stakingmiddleware.Keeper + TransferMiddlewareKeeper transfermiddlewarekeeper.Keeper + TxBoundaryKeepper txBoundaryKeeper.Keeper + RouterKeeper *routerkeeper.Keeper + RatelimitKeeper ratelimitmodulekeeper.Keeper + AllianceKeeper alliancemodulekeeper.Keeper + StakingMiddlewareKeeper stakingmiddleware.Keeper + IbcTransferMiddlewareKeeper ibctransfermiddleware.Keeper } // InitNormalKeepers initializes all 'normal' keepers. @@ -188,7 +194,17 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.AccountKeeper, ) - appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + appKeepers.IbcTransferMiddlewareKeeper = ibctransfermiddleware.NewKeeper(appCodec, appKeepers.keys[ibctransfermiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String(), + []string{"centauri1ay9y5uns9khw2kzaqr3r33v2pkuptfnnr93j5j", + "centauri14lz7gaw92valqjearnye4shex7zg2p05mlx9q0", + "centauri1r2zlh2xn85v8ljmwymnfrnsmdzjl7k6w6lytan", + "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m", + + "centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9", + + // "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs", + }) appKeepers.StakingKeeper = customstaking.NewKeeper( appCodec, appKeepers.keys[stakingtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), &appKeepers.StakingMiddlewareKeeper, @@ -203,6 +219,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appCodec, appKeepers.keys[distrtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + appKeepers.StakingKeeper.RegisterKeepers(appKeepers.DistrKeeper, appKeepers.MintKeeper) appKeepers.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, cdc, appKeepers.keys[slashingtypes.StoreKey], appKeepers.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -238,7 +255,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers( ) appKeepers.BankKeeper.RegisterKeepers(appKeepers.AllianceKeeper, appKeepers.StakingKeeper) - appKeepers.StakingMiddlewareKeeper.RegisterKeepers(appKeepers.StakingKeeper) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks appKeepers.StakingKeeper.SetHooks( @@ -252,7 +268,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appCodec, appKeepers.keys[ibchost.StoreKey], appKeepers.GetSubspace(ibchost.ModuleName), appKeepers.StakingKeeper, appKeepers.UpgradeKeeper, appKeepers.ScopedIBCKeeper, ) - appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasmtypes.StoreKey], authorityAddress, homePath, &appKeepers.IBCKeeper.ClientKeeper) + appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], authorityAddress, homePath, &appKeepers.IBCKeeper.ClientKeeper) // ICA Host keeper appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper( @@ -288,7 +304,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.GetSubspace(transfermiddlewaretypes.ModuleName), appCodec, &appKeepers.RatelimitKeeper, - &appKeepers.TransferKeeper, + &appKeepers.TransferKeeper.Keeper, appKeepers.BankKeeper, authorityAddress, ) @@ -299,7 +315,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( authorityAddress, ) - appKeepers.TransferKeeper = ibctransferkeeper.NewKeeper( + appKeepers.TransferKeeper = customibctransferkeeper.NewKeeper( appCodec, appKeepers.keys[ibctransfertypes.StoreKey], appKeepers.GetSubspace(ibctransfertypes.ModuleName), &appKeepers.TransferMiddlewareKeeper, // ICS4Wrapper @@ -308,13 +324,14 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.ScopedTransferKeeper, + &appKeepers.IbcTransferMiddlewareKeeper, ) appKeepers.RouterKeeper = routerkeeper.NewKeeper( appCodec, appKeepers.keys[routertypes.StoreKey], appKeepers.GetSubspace(routertypes.ModuleName), - appKeepers.TransferKeeper, + appKeepers.TransferKeeper.Keeper, appKeepers.IBCKeeper.ChannelKeeper, &appKeepers.DistrKeeper, appKeepers.BankKeeper, @@ -334,7 +351,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - transferIBCModule := transfer.NewIBCModule(appKeepers.TransferKeeper) + transferIBCModule := transfer.NewIBCModule(appKeepers.TransferKeeper.Keeper) scopedICQKeeper := appKeepers.CapabilityKeeper.ScopeToModule(icqtypes.ModuleName) appKeepers.ICQKeeper = icqkeeper.NewKeeper( @@ -372,12 +389,15 @@ func (appKeepers *AppKeepers) InitNormalKeepers( panic(fmt.Sprintf("error while reading wasm config: %s", err)) } + // increase default wasm size in all wasmd related codes (as on Neutorn/Osmosis) + wasmtypes.MaxWasmSize *= 2 + // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks availableCapabilities := strings.Join(AllCapabilities(), ",") appKeepers.WasmKeeper = wasm.NewKeeper( appCodec, - appKeepers.keys[wasm.StoreKey], + appKeepers.keys[wasmtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, @@ -386,7 +406,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.IBCKeeper.ChannelKeeper, &appKeepers.IBCKeeper.PortKeeper, appKeepers.ScopedWasmKeeper, - appKeepers.TransferKeeper, + appKeepers.TransferKeeper.Keeper, bApp.MsgServiceRouter(), bApp.GRPCQueryRouter(), wasmDir, @@ -484,6 +504,7 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac paramsKeeper.Subspace(wasm.ModuleName) paramsKeeper.Subspace(transfermiddlewaretypes.ModuleName) paramsKeeper.Subspace(stakingmiddlewaretypes.ModuleName) + paramsKeeper.Subspace(ibctransfermiddlewaretypes.ModuleName) return paramsKeeper } @@ -493,7 +514,9 @@ func (appKeepers *AppKeepers) BlacklistedModuleAccountAddrs(maccPerms map[string modAccAddrs := make(map[string]bool) // DO NOT REMOVE: StringMapKeys fixes non-deterministic map iteration for acc := range maccPerms { - modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + if acc != authtypes.FeeCollectorName { + modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + } } return modAccAddrs } diff --git a/app/keepers/keys.go b/app/keepers/keys.go index a0dc2e358..606b8f21d 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -45,6 +45,8 @@ import ( // customstakingtypes "github.com/notional-labs/composable/v6/custom/staking/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" + + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) // GenerateKeys generates new keys (KV Store, Transient store, and memory store). @@ -55,7 +57,7 @@ func (appKeepers *AppKeepers) GenerateKeys() { authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icqtypes.StoreKey, capabilitytypes.StoreKey, consensusparamtypes.StoreKey, wasm08types.StoreKey, - authzkeeper.StoreKey, stakingmiddleware.StoreKey, + authzkeeper.StoreKey, stakingmiddleware.StoreKey, ibctransfermiddleware.StoreKey, crisistypes.StoreKey, routertypes.StoreKey, transfermiddlewaretypes.StoreKey, group.StoreKey, minttypes.StoreKey, alliancemoduletypes.StoreKey, wasm.StoreKey, ibchookstypes.StoreKey, icahosttypes.StoreKey, ratelimitmoduletypes.StoreKey, txBoundaryTypes.StoreKey, ) diff --git a/app/test_access.go b/app/test_access.go index 88fb03c52..a97c63b34 100644 --- a/app/test_access.go +++ b/app/test_access.go @@ -63,7 +63,7 @@ func (s TestSupport) GovKeeper() govkeeper.Keeper { } func (s TestSupport) TransferKeeper() ibctransferkeeper.Keeper { - return s.app.TransferKeeper + return s.app.TransferKeeper.Keeper } func (s TestSupport) Wasm08Keeper() wasm08.Keeper { diff --git a/app/upgrades/v6_4_4/constants.go b/app/upgrades/v6_4_4/constants.go new file mode 100644 index 000000000..dac6950a1 --- /dev/null +++ b/app/upgrades/v6_4_4/constants.go @@ -0,0 +1,15 @@ +package v6_4_4 + +import ( + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_47" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, +} diff --git a/app/upgrades/v6_4_4/upgrade.go b/app/upgrades/v6_4_4/upgrade.go new file mode 100644 index 000000000..b3273193a --- /dev/null +++ b/app/upgrades/v6_4_4/upgrade.go @@ -0,0 +1,23 @@ +package v6_4_4 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/app/upgrades/v6_4_5/constants.go b/app/upgrades/v6_4_5/constants.go new file mode 100644 index 000000000..55b602bb3 --- /dev/null +++ b/app/upgrades/v6_4_5/constants.go @@ -0,0 +1,15 @@ +package v6_4_5 + +import ( + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_55" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, +} diff --git a/app/upgrades/v6_4_5/upgrade.go b/app/upgrades/v6_4_5/upgrade.go new file mode 100644 index 000000000..72dbebe02 --- /dev/null +++ b/app/upgrades/v6_4_5/upgrade.go @@ -0,0 +1,27 @@ +package v6_4_5 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + BrokenProposals := [3]uint64{2, 6, 11} + for _, proposal := range BrokenProposals { + keepers.GovKeeper.DeleteProposal(ctx, proposal) + } + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/app/upgrades/v6_4_6/constants.go b/app/upgrades/v6_4_6/constants.go new file mode 100644 index 000000000..cbb8a3658 --- /dev/null +++ b/app/upgrades/v6_4_6/constants.go @@ -0,0 +1,22 @@ +package v6_4_6 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_5" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{ibctransfermiddleware.StoreKey}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_6/upgrade.go b/app/upgrades/v6_4_6/upgrade.go new file mode 100644 index 000000000..183e63e80 --- /dev/null +++ b/app/upgrades/v6_4_6/upgrade.go @@ -0,0 +1,28 @@ +package v6_4_6 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + // Add params for custom middleware + custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() + keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) + + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/app/upgrades/v6_4_7/constants.go b/app/upgrades/v6_4_7/constants.go new file mode 100644 index 000000000..549c1e41e --- /dev/null +++ b/app/upgrades/v6_4_7/constants.go @@ -0,0 +1,21 @@ +package v6_4_7 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_6" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_7/upgrade.go b/app/upgrades/v6_4_7/upgrade.go new file mode 100644 index 000000000..682c58a62 --- /dev/null +++ b/app/upgrades/v6_4_7/upgrade.go @@ -0,0 +1,23 @@ +package v6_4_7 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/app/upgrades/v6_4_8/constants.go b/app/upgrades/v6_4_8/constants.go new file mode 100644 index 000000000..bb164f5ca --- /dev/null +++ b/app/upgrades/v6_4_8/constants.go @@ -0,0 +1,21 @@ +package v6_4_8 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_8" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{ibctransfermiddleware.StoreKey}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_8/upgrade.go b/app/upgrades/v6_4_8/upgrade.go new file mode 100644 index 000000000..58fe2a14d --- /dev/null +++ b/app/upgrades/v6_4_8/upgrade.go @@ -0,0 +1,47 @@ +package v6_4_8 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() + keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) + + // remove broken proposals + BrokenProposals := [3]uint64{2, 6, 11} + for _, proposal_id := range BrokenProposals { + _, ok := keepers.GovKeeper.GetProposal(ctx, proposal_id) + if ok { + keepers.GovKeeper.DeleteProposal(ctx, proposal_id) + } + + } + + // burn extra ppica in escrow account + // this ppica is unused because it is a native token stored in escrow account + // it was unnecessarily minted to match pica escrowed on picasso to ppica minted + // in genesis, to make initial native ppica transferrable to picasso + amount, ok := sdk.NewIntFromString("1066669217167120000000") + if ok { + coins := sdk.Coins{sdk.NewCoin("ppica", amount)} + keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32("centauri12k2pyuylm9t7ugdvz67h9pg4gmmvhn5vmvgw48"), "gov", coins) + keepers.BankKeeper.BurnCoins(ctx, "gov", coins) + } + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/app/upgrades/v6_4_9/constants.go b/app/upgrades/v6_4_9/constants.go new file mode 100644 index 000000000..4572af53f --- /dev/null +++ b/app/upgrades/v6_4_9/constants.go @@ -0,0 +1,20 @@ +package v6_4_9 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_9" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_9/upgrade.go b/app/upgrades/v6_4_9/upgrade.go new file mode 100644 index 000000000..70b06b6a6 --- /dev/null +++ b/app/upgrades/v6_4_9/upgrade.go @@ -0,0 +1,23 @@ +package v6_4_9 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/app/upgrades/v6_4_91/constants.go b/app/upgrades/v6_4_91/constants.go new file mode 100644 index 000000000..83a2fb7f7 --- /dev/null +++ b/app/upgrades/v6_4_91/constants.go @@ -0,0 +1,20 @@ +package v6_4_91 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_91" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_91/upgrade.go b/app/upgrades/v6_4_91/upgrade.go new file mode 100644 index 000000000..a1888ea62 --- /dev/null +++ b/app/upgrades/v6_4_91/upgrade.go @@ -0,0 +1,23 @@ +package v6_4_91 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/contrib/docker/goreleaser.Dockerfile b/contrib/docker/goreleaser.Dockerfile new file mode 100644 index 000000000..1793b262a --- /dev/null +++ b/contrib/docker/goreleaser.Dockerfile @@ -0,0 +1,33 @@ +FROM golang:1.20 AS builder + +WORKDIR /root +COPY ./dist/ /root/ + +ARG TARGETARCH +RUN if [ "${TARGETARCH}" = "arm64" ]; then \ + cp linux_linux_arm64/centaurid /root/centaurid; \ + else \ + cp linux_linux_amd64_v1/centaurid /root/centaurid; \ + fi + +FROM alpine:latest + +RUN apk --no-cache add ca-certificates jq +COPY --from=builder /root/centaurid /usr/local/bin/centaurid + +RUN addgroup --gid 1025 -S composable && adduser --uid 1025 -S composable -G composable + +WORKDIR /home/composable +USER composable + +# rest server +EXPOSE 1317 +# tendermint p2p +EXPOSE 26656 +# tendermint rpc +EXPOSE 26657 +# grpc +EXPOSE 9090 + +ENTRYPOINT ["centaurid"] +CMD [ "start" ] diff --git a/contrib/make/release.mk b/contrib/make/release.mk new file mode 100644 index 000000000..1ce0ee899 --- /dev/null +++ b/contrib/make/release.mk @@ -0,0 +1,32 @@ +############################################################################### +### Release ### +############################################################################### + +PACKAGE_NAME := github.com/composable-cosmos/composable-cosmos +GOLANG_CROSS_VERSION ?= v1.20 + +# The `make release` command is running a Docker container with the image +# `gorelease/goreleaser-cross:${GOLANG_CROSS_VERSION}`. This command: +# `-v "$(CURDIR)":/go/src/$(PACKAGE_NAME)`: mounts the current directory +# `release --clean`: executes the release inside the directory +release: + docker run \ + --rm \ + --platform linux/amd64 \ + -v "$(CURDIR)":/go/src/$(PACKAGE_NAME) \ + -w /go/src/$(PACKAGE_NAME) \ + -e CGO_ENABLED=1 \ + -e GITHUB_TOKEN=${GITHUB_TOKEN} \ + goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ + release --clean + +release-snapshot: + docker run \ + --rm \ + --platform linux/amd64 \ + -v /tmp:/tmp \ + -v "$(CURDIR)":/go/src/$(PACKAGE_NAME) \ + -w /go/src/$(PACKAGE_NAME) \ + -e CGO_ENABLED=1 \ + goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ + release --clean --snapshot \ No newline at end of file diff --git a/custom/bank/keeper/keeper.go b/custom/bank/keeper/keeper.go index a7c312c6d..5422ac308 100644 --- a/custom/bank/keeper/keeper.go +++ b/custom/bank/keeper/keeper.go @@ -18,7 +18,6 @@ import ( transfermiddlewarekeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" alliancekeeper "github.com/terra-money/alliance/x/alliance/keeper" - alliancetypes "github.com/terra-money/alliance/x/alliance/types" ) type Keeper struct { @@ -68,16 +67,6 @@ func (k Keeper) SupplyOf(c context.Context, req *types.QuerySupplyOfRequest) (*t ctx := sdk.UnwrapSDKContext(c) supply := k.GetSupply(ctx, req.Denom) - if req.Denom == k.sk.BondDenom(ctx) { - assets := k.ak.GetAllAssets(ctx) - totalRewardWeights := sdk.ZeroDec() - for _, asset := range assets { - totalRewardWeights = totalRewardWeights.Add(asset.RewardWeight) - } - allianceBonded := k.ak.GetAllianceBondedAmount(ctx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) - supply.Amount = supply.Amount.Sub(allianceBonded) - } - return &types.QuerySupplyOfResponse{Amount: sdk.NewCoin(req.Denom, supply.Amount)}, nil } @@ -93,11 +82,5 @@ func (k Keeper) TotalSupply(ctx context.Context, req *types.QueryTotalSupplyRequ duplicateCoins := k.tfmk.GetTotalEscrowedToken(sdkCtx) totalSupply = totalSupply.Sub(duplicateCoins...) - allianceBonded := k.ak.GetAllianceBondedAmount(sdkCtx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) - bondDenom := k.sk.BondDenom(sdkCtx) - if totalSupply.AmountOf(bondDenom).IsPositive() { - totalSupply = totalSupply.Sub(sdk.NewCoin(bondDenom, allianceBonded)) - } - return &types.QueryTotalSupplyResponse{Supply: totalSupply, Pagination: pageRes}, nil } diff --git a/custom/ibc-transfer/keeper/keeper.go b/custom/ibc-transfer/keeper/keeper.go new file mode 100644 index 000000000..cc4bc6773 --- /dev/null +++ b/custom/ibc-transfer/keeper/keeper.go @@ -0,0 +1,39 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/codec" + ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" + "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/keeper" +) + +type Keeper struct { + ibctransferkeeper.Keeper + cdc codec.BinaryCodec + IbcTransfermiddleware *ibctransfermiddleware.Keeper +} + +func NewKeeper( + cdc codec.BinaryCodec, + key storetypes.StoreKey, + paramSpace paramtypes.Subspace, + ics4Wrapper porttypes.ICS4Wrapper, + channelKeeper types.ChannelKeeper, + portKeeper types.PortKeeper, + authKeeper types.AccountKeeper, + bk types.BankKeeper, + scopedKeeper exported.ScopedKeeper, + ibcTransfermiddleware *ibctransfermiddleware.Keeper, +) Keeper { + keeper := Keeper{ + Keeper: ibctransferkeeper.NewKeeper(cdc, key, paramSpace, ics4Wrapper, channelKeeper, portKeeper, authKeeper, bk, scopedKeeper), + IbcTransfermiddleware: ibcTransfermiddleware, + cdc: cdc, + } + return keeper +} diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go new file mode 100644 index 000000000..4826edfc8 --- /dev/null +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -0,0 +1,112 @@ +package keeper + +import ( + "context" + "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper" + ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +type msgServer struct { + Keeper + bank types.BankKeeper + msgServer types.MsgServer +} + +var _ types.MsgServer = msgServer{} + +func NewMsgServerImpl(ibcKeeper Keeper, bankKeeper custombankkeeper.Keeper) types.MsgServer { + return &msgServer{Keeper: ibcKeeper, bank: bankKeeper, msgServer: ibcKeeper.Keeper} +} + +// Transfer is the server API around the Transfer method of the IBC transfer module. +// It checks if the sender is allowed to transfer the token and if the channel has fees. +// If the channel has fees, it will charge the sender and send the fees to the fee address. +// If the sender is not allowed to transfer the token because this tokens does not exists in the allowed tokens list, it just return without doing anything. +// If the sender is allowed to transfer the token, it will call the original transfer method. +// If the transfer amount is less than the minimum fee, it will charge the full transfer amount. +// If the transfer amount is greater than the minimum fee, it will charge the minimum fee and the percentage fee. +func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + params := k.Keeper.IbcTransfermiddleware.GetParams(ctx) + if params.ChannelFees != nil && len(params.ChannelFees) > 0 { + channelFee := findChannelParams(params.ChannelFees, msg.SourceChannel) + if channelFee != nil { + if channelFee.MinTimeoutTimestamp > 0 { + + goCtx := sdk.UnwrapSDKContext(goCtx) + blockTime := goCtx.BlockTime() + + timeoutTimeInFuture := time.Unix(0, int64(msg.TimeoutTimestamp)) + if timeoutTimeInFuture.Before(blockTime) { + return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer. timeout timestamp is in the past") + } + + difference := timeoutTimeInFuture.Sub(blockTime).Nanoseconds() + if difference < channelFee.MinTimeoutTimestamp { + return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer. too soon") + } + } + coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom) + if coin == nil { + return nil, fmt.Errorf("token not allowed to be transferred in this channel") + } + minFee := coin.MinFee.Amount + charge := minFee + if charge.GT(msg.Token.Amount) { + charge = msg.Token.Amount + } + + newAmount := msg.Token.Amount.Sub(charge) + + if newAmount.IsPositive() { + percentageCharge := newAmount.QuoRaw(coin.Percentage) + newAmount = newAmount.Sub(percentageCharge) + charge = charge.Add(percentageCharge) + } + + msgSender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + feeAddress, err := sdk.AccAddressFromBech32(channelFee.FeeAddress) + if err != nil { + return nil, err + } + + send_err := k.bank.SendCoins(ctx, msgSender, feeAddress, sdk.NewCoins(sdk.NewCoin(msg.Token.Denom, charge))) + if send_err != nil { + return nil, send_err + } + + if newAmount.LTE(sdk.ZeroInt()) { + return &types.MsgTransferResponse{}, nil + } + msg.Token.Amount = newAmount + } + } + return k.msgServer.Transfer(goCtx, msg) +} + +func findChannelParams(channelFees []*ibctransfermiddlewaretypes.ChannelFee, targetChannelID string) *ibctransfermiddlewaretypes.ChannelFee { + for _, fee := range channelFees { + if fee.Channel == targetChannelID { + return fee + } + } + return nil // If the channel is not found +} + +func findCoinByDenom(allowedTokens []*ibctransfermiddlewaretypes.CoinItem, denom string) *ibctransfermiddlewaretypes.CoinItem { + for _, coin := range allowedTokens { + if coin.MinFee.Denom == denom { + return coin + } + } + return nil // If the denom is not found +} diff --git a/custom/ibc-transfer/module.go b/custom/ibc-transfer/module.go new file mode 100644 index 000000000..dd34f0716 --- /dev/null +++ b/custom/ibc-transfer/module.go @@ -0,0 +1,51 @@ +package bank + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/types/module" + + ibctransfermodule "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper" + customibctransferkeeper "github.com/notional-labs/composable/v6/custom/ibc-transfer/keeper" +) + +// AppModule wraps around the bank module and the bank keeper to return the right total supply +type AppModule struct { + ibctransfermodule.AppModule + keeper customibctransferkeeper.Keeper + bank custombankkeeper.Keeper + // subspace exported.Subspace + msgServer types.MsgServer +} + +// NewAppModule creates a new AppModule object +func NewAppModule(cdc codec.Codec, keeper customibctransferkeeper.Keeper, bank custombankkeeper.Keeper) AppModule { + ibctransferModule := ibctransfermodule.NewAppModule(keeper.Keeper) + return AppModule{ + AppModule: ibctransferModule, + keeper: keeper, + bank: bank, + // subspace: ss, + msgServer: keeper.Keeper, + } +} + +// RegisterServices registers module services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + msgServer := customibctransferkeeper.NewMsgServerImpl(am.keeper, am.bank) + types.RegisterMsgServer(cfg.MsgServer(), msgServer) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper.Keeper) + + m := ibctransferkeeper.NewMigrator(am.keeper.Keeper) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.MigrateTraces); err != nil { + panic(fmt.Sprintf("failed to migrate transfer app from version 1 to 2: %v", err)) + } + + if err := cfg.RegisterMigration(types.ModuleName, 2, m.MigrateTotalEscrowForDenom); err != nil { + panic(fmt.Sprintf("failed to migrate transfer app from version 2 to 3: %v", err)) + } +} diff --git a/custom/staking/keeper/keeper.go b/custom/staking/keeper/keeper.go index 2c5b6a5dd..4f9fde1fd 100644 --- a/custom/staking/keeper/keeper.go +++ b/custom/staking/keeper/keeper.go @@ -1,13 +1,19 @@ package keeper import ( + "fmt" + + "cosmossdk.io/math" abcicometbft "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/cosmos/cosmos-sdk/x/staking/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + distkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/cosmos/cosmos-sdk/x/staking/types" + mintkeeper "github.com/notional-labs/composable/v6/x/mint/keeper" + minttypes "github.com/notional-labs/composable/v6/x/mint/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" ) @@ -16,6 +22,9 @@ type Keeper struct { cdc codec.BinaryCodec Stakingmiddleware *stakingmiddleware.Keeper authority string + mintKeeper mintkeeper.Keeper + distrKeeper distkeeper.Keeper + authKeeper minttypes.AccountKeeper } func (k Keeper) BlockValidatorUpdates(ctx sdk.Context, height int64) []abcicometbft.ValidatorUpdate { @@ -117,6 +126,39 @@ func NewKeeper( authority: authority, Stakingmiddleware: stakingmiddleware, cdc: cdc, + mintKeeper: mintkeeper.Keeper{}, + distrKeeper: distkeeper.Keeper{}, + authKeeper: ak, } return &keeper } + +func (k *Keeper) RegisterKeepers(dk distkeeper.Keeper, mk mintkeeper.Keeper) { + k.distrKeeper = dk + k.mintKeeper = mk +} + +// SlashWithInfractionReason send coins to community pool +func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, slashFactor sdk.Dec, _ types.Infraction) math.Int { + // keep slashing logic the same + amountBurned := k.Slash(ctx, consAddr, infractionHeight, power, slashFactor) + // after usual slashing and burning is done, mint burned coinds into community pool + coins := sdk.NewCoins(sdk.NewCoin(k.BondDenom(ctx), amountBurned)) + err := k.mintKeeper.MintCoins(ctx, coins) + if err != nil { + k.Logger(ctx).Error("Failed to mint slashed coins: ", amountBurned) + } else { + err = k.distrKeeper.FundCommunityPool(ctx, coins, k.authKeeper.GetModuleAddress(minttypes.ModuleName)) + if err != nil { + k.Logger(ctx).Error(fmt.Sprintf("Failed to fund community pool. Tokens minted to the staking module account: %d. ", amountBurned)) + } else { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + minttypes.EventTypeMintSlashed, + sdk.NewAttribute(sdk.AttributeKeyAmount, amountBurned.String()), + ), + ) + } + } + return amountBurned +} diff --git a/go.mod b/go.mod index bafa84462..959c4fae2 100644 --- a/go.mod +++ b/go.mod @@ -332,7 +332,7 @@ replace ( github.com/cosmos/cosmos-sdk v0.47.5 => github.com/rust-ninja/cosmos-sdk v0.47.5-patch-validators-trim-tag - github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9 + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/ComposableFi/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240320115741-f32994360827 // ibc-go with wasm client github.com/cosmos/ibc-go/v7 => github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f diff --git a/go.sum b/go.sum index 8d9694860..de6ea89d6 100644 --- a/go.sum +++ b/go.sum @@ -221,6 +221,8 @@ github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/ComposableFi/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240320115741-f32994360827 h1:PkDT2gEjAgttuF9lZTP+niYjcXutnmqHHK2UaAL9bLs= +github.com/ComposableFi/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240320115741-f32994360827/go.mod h1:3PHOr4UiPNtnZJutT22fm5+pjIefTlDEgtWGoOJg3A0= github.com/CosmWasm/wasmd v0.40.1 h1:LxbO78t/6S8TkeQlUrJ0m5O87HtAwLx4RGHq3rdrOEU= github.com/CosmWasm/wasmd v0.40.1/go.mod h1:6EOwnv7MpuFaEqxcUOdFV9i4yvrdOciaY6VQ1o7A3yg= github.com/CosmWasm/wasmvm v1.2.6 h1:QmOaiJUyeh8+pPCjJBTgWrbi/hCzCuWewduDO85Pcpc= @@ -968,8 +970,6 @@ github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= github.com/notional-labs/alliance v1.0.1-0.20231106184124-5cc1ff759647 h1:vCSokMIO60u0td51l7NB+pikUChJozIwIb4u8UeqTKI= github.com/notional-labs/alliance v1.0.1-0.20231106184124-5cc1ff759647/go.mod h1:GFQ8TsXDMTpu7kif0Dwddz6rxazy0ZJQHfN38ZmAodI= -github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9 h1:4rte3LTbrQnlu0Gnw6gouj2voGwgjweORA1dcgnQxlU= -github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9/go.mod h1:3PHOr4UiPNtnZJutT22fm5+pjIefTlDEgtWGoOJg3A0= github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f h1:Uw35VHCdLTsQf8B4UGTjHCR6HqcYFF6dwPW8uJzS0f4= github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f/go.mod h1:hjcl3RPLSDf0LSXrFyk2iTQCCFs5pfLbJb8h/5gJ2Vg= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= diff --git a/go.work.example b/go.work.example index 46219ac3b..9d174bce0 100644 --- a/go.work.example +++ b/go.work.example @@ -1,4 +1,4 @@ -go 1.19 +go 1.20 use ( ./ diff --git a/proto/composable/ibctransfermiddleware/v1beta1/genesis.proto b/proto/composable/ibctransfermiddleware/v1beta1/genesis.proto new file mode 100644 index 000000000..20f491b2c --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/genesis.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +import "gogoproto/gogo.proto"; +import "composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto"; +import "amino/amino.proto"; + + +option go_package = "x/ibctransfermiddleware/types"; + +// GenesisState defines the ibctransfermiddleware module's genesis state. +message GenesisState { + Params params = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto new file mode 100644 index 000000000..f789dee2f --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +option go_package = "x/ibctransfermiddleware/types"; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; + +// Params holds parameters for the ibctransfermiddleware module. +message Params { + repeated ChannelFee channel_fees = 1; +} + +message ChannelFee{ + string channel = 1; + repeated CoinItem allowed_tokens = 2; + string fee_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + int64 min_timeout_timestamp = 4; +} + +message CoinItem{ + cosmos.base.v1beta1.Coin min_fee = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + int64 percentage = 2; +} + diff --git a/proto/composable/ibctransfermiddleware/v1beta1/query.proto b/proto/composable/ibctransfermiddleware/v1beta1/query.proto new file mode 100644 index 000000000..7f0f5c45c --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/query.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto"; + +option go_package = "x/ibctransfermiddleware/types"; + +// Query provides defines the gRPC querier service. +service Query { + // Params returns the total set of minting parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/composable/ibctransfermiddleware/params"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto new file mode 100644 index 000000000..a25506804 --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto @@ -0,0 +1,138 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto"; + +option go_package = "x/ibctransfermiddleware/types"; + +// Msg defines the x/ibctransfermiddleware Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + rpc UpdateCustomIbcParams(MsgUpdateCustomIbcParams) returns (MsgUpdateParamsCustomIbcResponse); + + rpc AddIBCFeeConfig(MsgAddIBCFeeConfig) + returns (MsgAddIBCFeeConfigResponse); + rpc RemoveIBCFeeConfig(MsgRemoveIBCFeeConfig) + returns (MsgRemoveIBCFeeConfigResponse); + + rpc AddAllowedIbcToken(MsgAddAllowedIbcToken) + returns (MsgAddAllowedIbcTokenResponse); + rpc RemoveAllowedIbcToken(MsgRemoveAllowedIbcToken) + returns (MsgRemoveAllowedIbcTokenResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateCustomIbcParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "composable/x/ibctransfermiddleware/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/ibctransfermiddleware parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParamsCustomIbcResponse {} + + +// MsgAddParachainInfo represents a message to add new parachain info. +message MsgAddIBCFeeConfig { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (gogoproto.moretags) = "yaml:\"authority\"" ]; + + string channel_id = 2 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "ChannelID" + ]; + string fee_address = 3 [ (gogoproto.moretags) = "yaml:\"rly_address\"" ]; + + int64 min_timeout_timestamp = 4; +} + +message MsgAddIBCFeeConfigResponse {} + +// MsgRemoveParachainIBCTokenInfo represents a message to remove new parachain +// info. +message MsgRemoveIBCFeeConfig { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (gogoproto.moretags) = "yaml:\"authority\"" ]; + ; + + string channel_id = 2 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "ChannelID" + ]; +} + +message MsgRemoveIBCFeeConfigResponse {} + + + +// MsgAddParachainInfo represents a message to add new parachain info. +message MsgAddAllowedIbcToken { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (gogoproto.moretags) = "yaml:\"authority\"" ]; + + string channel_id = 2 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "ChannelID" + ]; + + string denom = 3 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "Denom" + ]; + + int64 amount = 4; + + int64 percentage = 5; +} + +message MsgAddAllowedIbcTokenResponse {} + + +message MsgRemoveAllowedIbcToken { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (gogoproto.moretags) = "yaml:\"authority\"" ]; + ; + + string channel_id = 2 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "ChannelID" + ]; + + string denom = 3 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "Denom" + ]; +} + +message MsgRemoveAllowedIbcTokenResponse {} diff --git a/proto/composable/stakingmiddleware/v1beta1/tx.proto b/proto/composable/stakingmiddleware/v1beta1/tx.proto index 9e1c20f3e..ff1431f74 100644 --- a/proto/composable/stakingmiddleware/v1beta1/tx.proto +++ b/proto/composable/stakingmiddleware/v1beta1/tx.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package composable.stakingmiddleware.v1beta1; -import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; import "gogoproto/gogo.proto"; @@ -15,7 +14,6 @@ service Msg { option (cosmos.msg.v1.service) = true; rpc UpdateEpochParams(MsgUpdateEpochParams) returns (MsgUpdateParamsEpochResponse); - rpc AddRevenueFundsToStaking(MsgAddRevenueFundsToStakingParams) returns (MsgAddRevenueFundsToStakingResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -41,16 +39,3 @@ message MsgUpdateEpochParams { // // Since: cosmos-sdk 0.47 message MsgUpdateParamsEpochResponse {} - -message MsgAddRevenueFundsToStakingParams { - option (cosmos.msg.v1.signer) = "from_address"; - - string from_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - repeated cosmos.base.v1beta1.Coin amount = 3 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} - -message MsgAddRevenueFundsToStakingResponse {} diff --git a/scripts/release_pre_darwin.sh b/scripts/release_pre_darwin.sh new file mode 100644 index 000000000..8e85ce826 --- /dev/null +++ b/scripts/release_pre_darwin.sh @@ -0,0 +1,15 @@ +#!/usr/env/bin bash +# +# This runs in the "hooks.pre" block of .goreleaser.yml. +# We do this because it enables us to dynamically set the $WASMVM_VERSION based +# on go.mod. +# +# It's intended to be used with: +# ```bash +# make release-snapshot +# ``` +set -e + +WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{sub(/^v/, "", $2); print $2}') + +flock -x /tmp/wasmvm-lock -c "wget -c https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvmstatic_darwin.a -O /tmp/libwasmvmstatic_darwin.a && [ ! -f /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a ] && cp /tmp/libwasmvmstatic_darwin.a /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a; echo 'libwasmvm installed'" diff --git a/scripts/release_pre_linux.sh b/scripts/release_pre_linux.sh new file mode 100644 index 000000000..f9d39d397 --- /dev/null +++ b/scripts/release_pre_linux.sh @@ -0,0 +1,29 @@ +#!/usr/env/bin bash +# +# This runs in the "hooks.pre" block of .goreleaser.yml. +# We do this because it enables us to dynamically set the $WASMVM_VERSION based +# on go.mod. +# +# It's intended to be used with: +# ```bash +# make release-snapshot +# ``` +set -e + +WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{sub(/^v/, "", $2); print $2}') + +flock -x /tmp/apt-lock -c "[ \"$(ls -A /var/lib/apt/lists)\" ] || apt-get update" + +if [ "$TARGET" == "linux_amd64_v1" ]; then + echo "executing ${TARGET}" + apt-get -o DPkg::Lock::Timeout=60 install --no-install-recommends -y libzstd-dev:amd64 libsnappy-dev:amd64 liblz4-dev:amd64 libbz2-dev:amd64 zlib1g-dev:amd64 + + wget -c https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a -O /tmp/libwasmvm_muslc.x86_64.a + cp /tmp/libwasmvm_muslc.x86_64.a /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a +else + echo "executing ${TARGET}" + apt-get -o DPkg::Lock::Timeout=60 install --no-install-recommends -y libzstd-dev:arm64 libsnappy-dev:arm64 liblz4-dev:arm64 libbz2-dev:arm64 zlib1g-dev:arm64 + + wget -c https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a -O /tmp/libwasmvm_muslc.aarch64.a + cp /tmp/libwasmvm_muslc.aarch64.a /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a +fi \ No newline at end of file diff --git a/tests/interchaintest/go.mod b/tests/interchaintest/go.mod index dffbe962d..6d80d135e 100644 --- a/tests/interchaintest/go.mod +++ b/tests/interchaintest/go.mod @@ -1,6 +1,6 @@ module github.com/notional-labs/composable-testnet/tests/interchaintest -go 1.19 +go 1.20 require ( github.com/cosmos/ibc-go/v7 v7.0.0 diff --git a/tests/interchaintest/go.sum b/tests/interchaintest/go.sum index 24b3b43e9..8c60906fb 100644 --- a/tests/interchaintest/go.sum +++ b/tests/interchaintest/go.sum @@ -229,7 +229,7 @@ github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2B github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/sarama v1.20.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StirlingMarketingGroup/go-namecase v1.0.0 h1:2CzaNtCzc4iNHirR+5ru9OzGg8rQp860gqLBFqRI02Y= @@ -839,7 +839,7 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= @@ -1597,7 +1597,7 @@ google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnp google.golang.org/genproto v0.0.0-20230301171018-9ab4bdc49ad5 h1:/cadn7taPtPlCgiWNetEPsle7jgnlad2R7gR5MXB6dM= google.golang.org/genproto v0.0.0-20230301171018-9ab4bdc49ad5/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index 74e6b338c..be7fe8df1 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -2,14 +2,13 @@ package interchaintest import ( "os" - "strings" "github.com/strangelove-ventures/interchaintest/v7/ibc" ) var ( - CentauriMainRepo = "ghcr.io/notional-labs/centauri" - CentauriICTestRepo = "ghcr.io/notional-labs/centauri-ictest" + CentauriMainRepo = "ghcr.io/composablefi/composable-cosmos" + CentauriICTestRepo = "ghcr.io/composablefi/centauri-ictest" repo, version = GetDockerImageInfo() @@ -46,10 +45,7 @@ func GetDockerImageInfo() (repo, version string) { if !found { // make local-image repo = "centauri" - branchVersion = "debug" + branchVersion = "local" } - - // github converts / to - for pushed docker images - branchVersion = strings.ReplaceAll(branchVersion, "/", "-") return repo, branchVersion } diff --git a/tests/interchaintest/upgrade_chain_test.go b/tests/interchaintest/upgrade_chain_test.go index acd90d172..a71e92bbe 100644 --- a/tests/interchaintest/upgrade_chain_test.go +++ b/tests/interchaintest/upgrade_chain_test.go @@ -20,7 +20,7 @@ const ( func TestCentauriUpgrade(t *testing.T) { repo, version := GetDockerImageInfo() - CosmosChainUpgradeTest(t, repo, version, "v6") + CosmosChainUpgradeTest(t, repo, version, "v6_4_5") } func CosmosChainUpgradeTest(t *testing.T, upgradeContainerRepo, upgradeVersion, upgradeName string) { @@ -38,8 +38,8 @@ func CosmosChainUpgradeTest(t *testing.T, upgradeContainerRepo, upgradeVersion, ChainID: "centaurid", Images: []ibc.DockerImage{ { - Repository: "ghcr.io/notional-labs/centauri", - Version: "6.0", + Repository: "ghcr.io/composablefi/composable-cosmos", + Version: "6.4.4", UidGid: "1025:1025", }, }, diff --git a/x/ibctransfermiddleware/client/cli/query.go b/x/ibctransfermiddleware/client/cli/query.go new file mode 100644 index 000000000..7edb40544 --- /dev/null +++ b/x/ibctransfermiddleware/client/cli/query.go @@ -0,0 +1,55 @@ +package cli + +import ( + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +// GetQueryCmd returns the cli query commands for the staking middleware module. +func GetQueryCmd() *cobra.Command { + ibctransfermiddlewareParamsQueryCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the staking middleware module", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + ibctransfermiddlewareParamsQueryCmd.AddCommand( + GetCmdQueryParams(), + ) + + return ibctransfermiddlewareParamsQueryCmd +} + +// GetCmdQueryParams implements a command to return the current staking middleware's params +// parameters. +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query the current ibc middleware parameters", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryParamsRequest{} + res, err := queryClient.Params(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(&res.Params) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ibctransfermiddleware/client/cli/tx.go b/x/ibctransfermiddleware/client/cli/tx.go new file mode 100644 index 000000000..1d212ff83 --- /dev/null +++ b/x/ibctransfermiddleware/client/cli/tx.go @@ -0,0 +1,189 @@ +package cli + +import ( + "fmt" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/version" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" + "github.com/spf13/cobra" +) + +// GetTxCmd returns the tx commands for staking middleware module. +func GetTxCmd() *cobra.Command { + txCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Exp transaction subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + txCmd.AddCommand( + AddIBCFeeConfig(), + RemoveIBCFeeConfig(), + AddAllowedIbcToken(), + RemoveAllowedIbcToken(), + ) + + return txCmd +} + +func AddIBCFeeConfig() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-config [channel] [feeAddress] [minTimeoutTimestamp]", + Short: "add ibc fee config", + Args: cobra.MatchAll(cobra.ExactArgs(3), cobra.OnlyValidArgs), + Example: fmt.Sprintf("%s tx ibctransfermiddleware add-config [channel] [feeAddress] [minTimeoutTimestamp]", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + channel := args[0] + feeAddress := args[1] + minTimeoutTimestamp := args[2] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + fromAddress := clientCtx.GetFromAddress().String() + + minTimeoutTimestampInt, err := strconv.ParseInt(minTimeoutTimestamp, 10, 64) + if err != nil { + return err + } + + msg := types.NewMsgAddIBCFeeConfig( + fromAddress, + channel, + feeAddress, + minTimeoutTimestampInt, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func AddAllowedIbcToken() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-allowed-ibc-token [channel] [denom] [amount] [percentage]", + Short: "add allowed ibc token", + Args: cobra.MatchAll(cobra.ExactArgs(4), cobra.OnlyValidArgs), + Example: fmt.Sprintf("%s tx ibctransfermiddleware add-allowed-ibc-token [channel] [denom] [amount] [percentage] (percentage '5' means 1/5 of amount will be taken as fee) ", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + channel := args[0] + denom := args[1] + amount := args[2] + percentage := args[3] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + fromAddress := clientCtx.GetFromAddress().String() + + amountInt, err := strconv.ParseInt(amount, 10, 64) + if err != nil { + return err + } + + percentageInt, errPercentage := strconv.ParseInt(percentage, 10, 64) + if errPercentage != nil { + return errPercentage + } + + msg := types.NewMsgAddAllowedIbcToken( + fromAddress, + channel, + denom, + amountInt, + percentageInt, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func RemoveIBCFeeConfig() *cobra.Command { + cmd := &cobra.Command{ + Use: "remove-config [channel]", + Short: "remove ibc fee config", + Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), + Example: fmt.Sprintf("%s tx ibctransfermiddleware remove-config [channel]", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + channel := args[0] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + fromAddress := clientCtx.GetFromAddress().String() + + msg := types.NewMsgRemoveIBCFeeConfig( + fromAddress, + channel, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func RemoveAllowedIbcToken() *cobra.Command { + cmd := &cobra.Command{ + Use: "remove-allowed-ibc-token [channel] [denom]", + Short: "remove allowed ibc token", + Args: cobra.MatchAll(cobra.ExactArgs(2), cobra.OnlyValidArgs), + Example: fmt.Sprintf("%s tx ibctransfermiddleware remove-allowed-ibc-token [channel] [denom]", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + channel := args[0] + denom := args[1] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + fromAddress := clientCtx.GetFromAddress().String() + + msg := types.NewMsgRemoveAllowedIbcToken( + fromAddress, + channel, + denom, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ibctransfermiddleware/keeper/genesis.go b/x/ibctransfermiddleware/keeper/genesis.go new file mode 100644 index 000000000..82b22a6f9 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/genesis.go @@ -0,0 +1,19 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +// InitGenesis new stake middleware genesis +func (keeper Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { + if err := keeper.SetParams(ctx, data.Params); err != nil { + panic(err) + } +} + +// ExportGenesis returns a GenesisState for a given context and keeper. +func (keeper Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + params := keeper.GetParams(ctx) + return types.NewGenesisState(params) +} diff --git a/x/ibctransfermiddleware/keeper/grpc_query.go b/x/ibctransfermiddleware/keeper/grpc_query.go new file mode 100644 index 000000000..b95c1d2f6 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/grpc_query.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +var _ types.QueryServer = Keeper{} + +// Params returns params of the staking middleware module. +func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/ibctransfermiddleware/keeper/keeper.go b/x/ibctransfermiddleware/keeper/keeper.go new file mode 100644 index 000000000..a43bdb4b9 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/keeper.go @@ -0,0 +1,66 @@ +package keeper + +import ( + "github.com/cometbft/cometbft/libs/log" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" + + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Keeper of the staking middleware store +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + addresses []string +} + +// NewKeeper creates a new middleware Keeper instance +func NewKeeper( + cdc codec.BinaryCodec, + key storetypes.StoreKey, + authority string, + addresses []string, +) Keeper { + return Keeper{ + cdc: cdc, + storeKey: key, + authority: authority, + addresses: addresses, + } +} + +// GetAuthority returns the x/ibctransfermiddleware module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", "x/"+types.ModuleName) +} + +// SetParams sets the x/ibctransfermiddleware module parameters. +func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&p) + store.Set(types.ParamsKey, bz) + return nil +} + +// GetParams returns the current x/ibctransfermiddleware module parameters. +func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return p + } + + k.cdc.MustUnmarshal(bz, &p) + return p +} diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go new file mode 100644 index 000000000..f3fc4daa3 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -0,0 +1,191 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +var _ types.MsgServer = msgServer{} + +// msgServer is a wrapper of Keeper. +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the x/ibctransfermiddleware MsgServer interface. +func NewMsgServerImpl(k Keeper) types.MsgServer { + return &msgServer{ + Keeper: k, + } +} + +// UpdateParams updates the params. +func (ms msgServer) UpdateCustomIbcParams(goCtx context.Context, req *types.MsgUpdateCustomIbcParams) (*types.MsgUpdateParamsCustomIbcResponse, error) { + if ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := ms.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsCustomIbcResponse{}, nil +} + +// AddIBCFeeConfig(MsgAddIBCFeeConfig) returns (MsgAddIBCFeeConfigResponse); +func (ms msgServer) AddIBCFeeConfig(goCtx context.Context, req *types.MsgAddIBCFeeConfig) (*types.MsgAddIBCFeeConfigResponse, error) { + if !contains(ms.addresses, req.Authority) && ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected of this addresses from list: %s, got %s", ms.addresses, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + _, err := sdk.AccAddressFromBech32(req.FeeAddress) + if err != nil { + return nil, err + } + + params := ms.Keeper.GetParams(ctx) + channelFee := findChannelParams(params.ChannelFees, req.ChannelID) + if channelFee != nil { + channelFee.FeeAddress = req.FeeAddress + channelFee.MinTimeoutTimestamp = req.MinTimeoutTimestamp + } else { + channelFee := &types.ChannelFee{ + Channel: req.ChannelID, + FeeAddress: req.FeeAddress, + MinTimeoutTimestamp: req.MinTimeoutTimestamp, + AllowedTokens: []*types.CoinItem{}, + } + params.ChannelFees = append(params.ChannelFees, channelFee) + } + errSetParams := ms.Keeper.SetParams(ctx, params) + if errSetParams != nil { + return nil, errSetParams + } + return &types.MsgAddIBCFeeConfigResponse{}, nil +} + +func (ms msgServer) RemoveIBCFeeConfig(goCtx context.Context, req *types.MsgRemoveIBCFeeConfig) (*types.MsgRemoveIBCFeeConfigResponse, error) { + if !contains(ms.addresses, req.Authority) && ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected of this addresses from list: %s, got %s", ms.addresses, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params := ms.Keeper.GetParams(ctx) + for i, fee := range params.ChannelFees { + if fee.Channel == req.ChannelID { + params.ChannelFees = append(params.ChannelFees[:i], params.ChannelFees[i+1:]...) + break + } + } + errSetParams := ms.Keeper.SetParams(ctx, params) + if errSetParams != nil { + return nil, errSetParams + } + + return &types.MsgRemoveIBCFeeConfigResponse{}, nil +} + +func (ms msgServer) AddAllowedIbcToken(goCtx context.Context, req *types.MsgAddAllowedIbcToken) (*types.MsgAddAllowedIbcTokenResponse, error) { + if !contains(ms.addresses, req.Authority) && ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected of this addresses from list: %s, got %s", ms.addresses, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params := ms.Keeper.GetParams(ctx) + channelFee := findChannelParams(params.ChannelFees, req.ChannelID) + if channelFee != nil { + coin := findCoinByDenom(channelFee.AllowedTokens, req.Denom) + if coin != nil { + coin_c := sdk.Coin{ + Denom: req.Denom, + Amount: sdk.NewInt(req.Amount), + } + coin.MinFee = coin_c + coin.Percentage = req.Percentage + } else { + coin_c := sdk.Coin{ + Denom: req.Denom, + Amount: sdk.NewInt(req.Amount), + } + coin := &types.CoinItem{ + MinFee: coin_c, + Percentage: req.Percentage, + } + channelFee.AllowedTokens = append(channelFee.AllowedTokens, coin) + } + } else { + return nil, errorsmod.Wrapf(types.ErrChannelFeeNotFound, "channel fee not found for channel %s", req.ChannelID) + } + errSetParams := ms.Keeper.SetParams(ctx, params) + if errSetParams != nil { + return nil, errSetParams + } + + return &types.MsgAddAllowedIbcTokenResponse{}, nil +} + +func (ms msgServer) RemoveAllowedIbcToken(goCtx context.Context, req *types.MsgRemoveAllowedIbcToken) (*types.MsgRemoveAllowedIbcTokenResponse, error) { + if !contains(ms.addresses, req.Authority) && ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected of this addresses from list: %s, got %s", ms.addresses, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params := ms.Keeper.GetParams(ctx) + channelFee := findChannelParams(params.ChannelFees, req.ChannelID) + if channelFee != nil { + for i, coin := range channelFee.AllowedTokens { + if coin.MinFee.Denom == req.Denom { + channelFee.AllowedTokens = append(channelFee.AllowedTokens[:i], channelFee.AllowedTokens[i+1:]...) + break + } + } + } else { + return nil, errorsmod.Wrapf(types.ErrChannelFeeNotFound, "channel fee not found for channel %s", req.ChannelID) + } + + errSetParams := ms.Keeper.SetParams(ctx, params) + if errSetParams != nil { + return nil, errSetParams + } + + return &types.MsgRemoveAllowedIbcTokenResponse{}, nil +} + +func findChannelParams(channelFees []*types.ChannelFee, targetChannelID string) *types.ChannelFee { + for _, fee := range channelFees { + if fee.Channel == targetChannelID { + return fee + } + } + return nil // If the channel is not found +} + +func findCoinByDenom(allowedTokens []*types.CoinItem, denom string) *types.CoinItem { + for _, coin := range allowedTokens { + if coin.MinFee.Denom == denom { + return coin + } + } + return nil // If the denom is not found +} + +func contains(arr []string, element string) bool { + for _, v := range arr { + if v == element { + return true + } + } + return false +} + +// rpc AddAllowedIbcToken(MsgAddAllowedIbcToken) +// returns (MsgAddAllowedIbcTokenResponse); +// rpc RemoveAllowedIbcToken(MsgRemoveAllowedIbcToken) +// returns (MsgRemoveAllowedIbcTokenResponse); diff --git a/x/ibctransfermiddleware/module.go b/x/ibctransfermiddleware/module.go new file mode 100644 index 000000000..1f46d6364 --- /dev/null +++ b/x/ibctransfermiddleware/module.go @@ -0,0 +1,156 @@ +package ibctransfermiddleware + +import ( + "context" + "encoding/json" + "fmt" + + abci "github.com/cometbft/cometbft/abci/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/client/cli" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/keeper" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleSimulation = AppModule{} +) + +// AppModuleBasic defines the basic application module used by the staking middleware module. +type AppModuleBasic struct { + cdc codec.Codec +} + +var _ module.AppModuleBasic = AppModuleBasic{} + +// Name returns the staking middleware module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the staking middleware module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module interface +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns default genesis state as raw bytes for the staking middleware +// module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis performs genesis state validation for the staking middleware module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var data types.GenesisState + if err := cdc.UnmarshalJSON(bz, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return types.ValidateGenesis(data) +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking middleware module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd returns no root tx command for the staking middleware module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the root query command for the staking middleware module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// AppModule implements an application module for the staking middleware module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +// NewAppModule creates a new AppModule object. If the InflationCalculationFn +// argument is nil, then the SDK's default inflation function will be used. +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{cdc: cdc}, + keeper: keeper, + } +} + +// Name returns the staking middleware module's name. +func (AppModule) Name() string { + return types.ModuleName +} + +// RegisterInvariants registers the staking middleware module invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// RegisterServices registers a gRPC query service to respond to the +// module-specific gRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) +} + +// InitGenesis performs genesis initialization for the staking middleware module. It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + cdc.MustUnmarshalJSON(data, &genesisState) + + am.keeper.InitGenesis(ctx, &genesisState) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the exported genesis state as raw bytes for the staking middleware +// module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(gs) +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock returns the begin blocker for the staking middleware module. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + // BeginBlocker(ctx, am.keeper) ??? +} + +// AppModuleSimulation functions +// GenerateGenesisState creates a randomized GenState of the staking middleware module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { + return nil +} + +// RegisterStoreDecoder registers a decoder for staking middleware module's types. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// WeightedOperations doesn't return any staking middleware module operation. +func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { + return nil +} diff --git a/x/ibctransfermiddleware/types/codec.go b/x/ibctransfermiddleware/types/codec.go new file mode 100644 index 000000000..e22a34195 --- /dev/null +++ b/x/ibctransfermiddleware/types/codec.go @@ -0,0 +1,45 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/types/msgservice" + authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" + govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" + groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// RegisterLegacyAminoCodec registers the account interfaces and concrete types on the +// provided LegacyAmino codec. These types are used for Amino JSON serialization +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &MsgUpdateCustomIbcParams{}, "composable/MsgUpdateCustomIbcParams") +} + +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateCustomIbcParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + sdk.RegisterLegacyAminoCodec(amino) + + // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be + // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances + RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(govcodec.Amino) + RegisterLegacyAminoCodec(groupcodec.Amino) +} diff --git a/x/ibctransfermiddleware/types/errors.go b/x/ibctransfermiddleware/types/errors.go new file mode 100644 index 000000000..929a6801d --- /dev/null +++ b/x/ibctransfermiddleware/types/errors.go @@ -0,0 +1,10 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" +) + +// x/ratelimit module sentinel errors +var ( + ErrChannelFeeNotFound = errorsmod.Register(ModuleName, 1, "channel fee not found for channel") +) diff --git a/x/ibctransfermiddleware/types/genesis.go b/x/ibctransfermiddleware/types/genesis.go new file mode 100644 index 000000000..6abd71d14 --- /dev/null +++ b/x/ibctransfermiddleware/types/genesis.go @@ -0,0 +1,21 @@ +package types + +// NewGenesisState creates a new GenesisState object +func NewGenesisState(params Params) *GenesisState { + return &GenesisState{ + Params: params, + } +} + +// DefaultGenesisState creates a default GenesisState object +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: Params{ChannelFees: []*ChannelFee{}}, + } +} + +// ValidateGenesis validates the provided genesis state to ensure the +// expected invariants holds. +func ValidateGenesis(data GenesisState) error { + return nil +} diff --git a/x/ibctransfermiddleware/types/genesis.pb.go b/x/ibctransfermiddleware/types/genesis.pb.go new file mode 100644 index 000000000..d75c5c1bd --- /dev/null +++ b/x/ibctransfermiddleware/types/genesis.pb.go @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the ibctransfermiddleware module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_ab9a6edd8a683ba6, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "composable.ibctransfermiddleware.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/genesis.proto", fileDescriptor_ab9a6edd8a683ba6) +} + +var fileDescriptor_ab9a6edd8a683ba6 = []byte{ + // 213 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4b, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, + 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0xd2, 0x40, 0xe8, 0xd3, 0xc3, 0xaa, 0x4f, 0x0f, 0xaa, 0x4f, 0x4a, 0x24, 0x3d, + 0x3f, 0x3d, 0x1f, 0xac, 0x49, 0x1f, 0xc4, 0x82, 0xe8, 0x97, 0x72, 0x21, 0xda, 0x5e, 0xec, 0xa6, + 0x43, 0x4c, 0x11, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x21, 0xa5, 0x38, 0x2e, + 0x1e, 0x77, 0x88, 0x4b, 0x83, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0xfc, 0xb8, 0xd8, 0x0a, 0x12, 0x8b, + 0x12, 0x73, 0x8b, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x0c, 0xf4, 0x88, 0x75, 0xb9, 0x5e, + 0x00, 0x58, 0x9f, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0x53, 0x9c, 0xcc, 0x4f, 0x3c, + 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, + 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0xb6, 0x02, 0x87, 0x4f, 0x4a, 0x2a, 0x0b, + 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xee, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x64, 0x36, + 0x5f, 0x72, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go new file mode 100644 index 000000000..e58115dcd --- /dev/null +++ b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go @@ -0,0 +1,876 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params holds parameters for the ibctransfermiddleware module. +type Params struct { + ChannelFees []*ChannelFee `protobuf:"bytes,1,rep,name=channel_fees,json=channelFees,proto3" json:"channel_fees,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetChannelFees() []*ChannelFee { + if m != nil { + return m.ChannelFees + } + return nil +} + +type ChannelFee struct { + Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"` + AllowedTokens []*CoinItem `protobuf:"bytes,2,rep,name=allowed_tokens,json=allowedTokens,proto3" json:"allowed_tokens,omitempty"` + FeeAddress string `protobuf:"bytes,3,opt,name=fee_address,json=feeAddress,proto3" json:"fee_address,omitempty"` + MinTimeoutTimestamp int64 `protobuf:"varint,4,opt,name=min_timeout_timestamp,json=minTimeoutTimestamp,proto3" json:"min_timeout_timestamp,omitempty"` +} + +func (m *ChannelFee) Reset() { *m = ChannelFee{} } +func (m *ChannelFee) String() string { return proto.CompactTextString(m) } +func (*ChannelFee) ProtoMessage() {} +func (*ChannelFee) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{1} +} +func (m *ChannelFee) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChannelFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChannelFee.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ChannelFee) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelFee.Merge(m, src) +} +func (m *ChannelFee) XXX_Size() int { + return m.Size() +} +func (m *ChannelFee) XXX_DiscardUnknown() { + xxx_messageInfo_ChannelFee.DiscardUnknown(m) +} + +var xxx_messageInfo_ChannelFee proto.InternalMessageInfo + +func (m *ChannelFee) GetChannel() string { + if m != nil { + return m.Channel + } + return "" +} + +func (m *ChannelFee) GetAllowedTokens() []*CoinItem { + if m != nil { + return m.AllowedTokens + } + return nil +} + +func (m *ChannelFee) GetFeeAddress() string { + if m != nil { + return m.FeeAddress + } + return "" +} + +func (m *ChannelFee) GetMinTimeoutTimestamp() int64 { + if m != nil { + return m.MinTimeoutTimestamp + } + return 0 +} + +type CoinItem struct { + MinFee types.Coin `protobuf:"bytes,1,opt,name=min_fee,json=minFee,proto3" json:"min_fee"` + Percentage int64 `protobuf:"varint,2,opt,name=percentage,proto3" json:"percentage,omitempty"` +} + +func (m *CoinItem) Reset() { *m = CoinItem{} } +func (m *CoinItem) String() string { return proto.CompactTextString(m) } +func (*CoinItem) ProtoMessage() {} +func (*CoinItem) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{2} +} +func (m *CoinItem) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CoinItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CoinItem.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CoinItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_CoinItem.Merge(m, src) +} +func (m *CoinItem) XXX_Size() int { + return m.Size() +} +func (m *CoinItem) XXX_DiscardUnknown() { + xxx_messageInfo_CoinItem.DiscardUnknown(m) +} + +var xxx_messageInfo_CoinItem proto.InternalMessageInfo + +func (m *CoinItem) GetMinFee() types.Coin { + if m != nil { + return m.MinFee + } + return types.Coin{} +} + +func (m *CoinItem) GetPercentage() int64 { + if m != nil { + return m.Percentage + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "composable.ibctransfermiddleware.v1beta1.Params") + proto.RegisterType((*ChannelFee)(nil), "composable.ibctransfermiddleware.v1beta1.ChannelFee") + proto.RegisterType((*CoinItem)(nil), "composable.ibctransfermiddleware.v1beta1.CoinItem") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto", fileDescriptor_1193893bc248bc1b) +} + +var fileDescriptor_1193893bc248bc1b = []byte{ + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x41, 0x8b, 0xd4, 0x30, + 0x14, 0xc7, 0x27, 0x3b, 0x32, 0xeb, 0x66, 0x54, 0xb0, 0xae, 0x98, 0x5d, 0x30, 0x0e, 0x73, 0x1a, + 0x04, 0x5b, 0xa6, 0x0a, 0xe2, 0xc1, 0x83, 0xa3, 0x08, 0xde, 0xa4, 0x0e, 0x88, 0x5e, 0x4a, 0xda, + 0xbe, 0xd6, 0x60, 0x93, 0x94, 0x24, 0xee, 0xea, 0xb7, 0xf0, 0x63, 0x78, 0xf4, 0xe0, 0x87, 0xd8, + 0xe3, 0xe2, 0xc9, 0x93, 0xc8, 0xcc, 0xc1, 0xab, 0x1f, 0x41, 0x9a, 0x64, 0x1c, 0x85, 0x15, 0xf4, + 0xd2, 0xe4, 0xbd, 0x5f, 0xff, 0xef, 0xfd, 0x93, 0x3c, 0xfc, 0xa8, 0x54, 0xa2, 0x53, 0x86, 0x15, + 0x2d, 0x24, 0xbc, 0x28, 0xad, 0x66, 0xd2, 0xd4, 0xa0, 0x05, 0xaf, 0xaa, 0x16, 0x8e, 0x99, 0x86, + 0xe4, 0x68, 0x5e, 0x80, 0x65, 0xf3, 0xb3, 0x69, 0xdc, 0x69, 0x65, 0x55, 0x34, 0xdb, 0x56, 0x89, + 0xcf, 0xfe, 0x2f, 0x54, 0x39, 0xdc, 0x6f, 0x54, 0xa3, 0x9c, 0x28, 0xe9, 0x77, 0x5e, 0x7f, 0x78, + 0x50, 0x2a, 0x23, 0x94, 0xc9, 0x3d, 0xf0, 0x41, 0x40, 0xd4, 0x47, 0x49, 0xc1, 0xcc, 0xd6, 0x4b, + 0xa9, 0xb8, 0x0c, 0xfc, 0x32, 0x13, 0x5c, 0xaa, 0xc4, 0x7d, 0x43, 0xea, 0x5a, 0x90, 0x08, 0xd3, + 0x24, 0x47, 0xf3, 0x7e, 0xf1, 0x60, 0xca, 0xf0, 0xe8, 0x29, 0xd3, 0x4c, 0x98, 0xe8, 0x39, 0xbe, + 0x50, 0xbe, 0x62, 0x52, 0x42, 0x9b, 0xd7, 0x00, 0x86, 0xa0, 0xc9, 0x70, 0x36, 0x4e, 0xef, 0xc4, + 0xff, 0x7a, 0x8e, 0xf8, 0xa1, 0x57, 0x3f, 0x06, 0xc8, 0xc6, 0xe5, 0xaf, 0xbd, 0x99, 0xfe, 0x40, + 0x18, 0x6f, 0x59, 0x44, 0xf0, 0x6e, 0xa0, 0x04, 0x4d, 0xd0, 0x6c, 0x2f, 0xdb, 0x84, 0xd1, 0x0b, + 0x7c, 0x89, 0xb5, 0xad, 0x3a, 0x86, 0x2a, 0xb7, 0xea, 0x35, 0x48, 0x43, 0x76, 0x9c, 0x87, 0xf4, + 0x3f, 0x3c, 0x28, 0x2e, 0x9f, 0x58, 0x10, 0xd9, 0xc5, 0x50, 0x69, 0xe9, 0x0a, 0x45, 0xf7, 0xf0, + 0xb8, 0x06, 0xc8, 0x59, 0x55, 0x69, 0x30, 0x86, 0x0c, 0xfb, 0xc6, 0x0b, 0xf2, 0xf9, 0xd3, 0xad, + 0xfd, 0x70, 0xb3, 0x0f, 0x3c, 0x79, 0x66, 0x35, 0x97, 0x4d, 0x86, 0x6b, 0x80, 0x90, 0x89, 0x52, + 0x7c, 0x55, 0x70, 0x99, 0x5b, 0x2e, 0x40, 0xbd, 0xb1, 0x6e, 0x35, 0x96, 0x89, 0x8e, 0x9c, 0x9b, + 0xa0, 0xd9, 0x30, 0xbb, 0x22, 0xb8, 0x5c, 0x7a, 0xb6, 0xdc, 0xa0, 0x29, 0xc7, 0xe7, 0x37, 0x4e, + 0xa2, 0xfb, 0x78, 0xb7, 0xd7, 0xd7, 0x00, 0xee, 0xbc, 0xe3, 0xf4, 0x20, 0x0e, 0x3d, 0xfb, 0xf7, + 0xfb, 0xc3, 0xf9, 0x62, 0xef, 0xe4, 0xeb, 0x8d, 0xc1, 0x87, 0xef, 0x1f, 0x6f, 0xa2, 0x6c, 0x24, + 0xb8, 0xec, 0xaf, 0x8b, 0x62, 0xdc, 0x81, 0x2e, 0x41, 0x5a, 0xd6, 0x00, 0xd9, 0x71, 0x3d, 0x7f, + 0xcb, 0x2c, 0xee, 0x9e, 0xac, 0x28, 0x3a, 0x5d, 0x51, 0xf4, 0x6d, 0x45, 0xd1, 0xfb, 0x35, 0x1d, + 0x9c, 0xae, 0xe9, 0xe0, 0xcb, 0x9a, 0x0e, 0x5e, 0x5e, 0x7f, 0xfb, 0x97, 0xf1, 0xb5, 0xef, 0x3a, + 0x30, 0xc5, 0xc8, 0x0d, 0xc0, 0xed, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x69, 0x03, 0x6b, 0xef, + 0xef, 0x02, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ChannelFees) > 0 { + for iNdEx := len(m.ChannelFees) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ChannelFees[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ChannelFee) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChannelFee) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChannelFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinTimeoutTimestamp != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.MinTimeoutTimestamp)) + i-- + dAtA[i] = 0x20 + } + if len(m.FeeAddress) > 0 { + i -= len(m.FeeAddress) + copy(dAtA[i:], m.FeeAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.FeeAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.AllowedTokens) > 0 { + for iNdEx := len(m.AllowedTokens) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AllowedTokens[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Channel) > 0 { + i -= len(m.Channel) + copy(dAtA[i:], m.Channel) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.Channel))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CoinItem) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CoinItem) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CoinItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Percentage != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.Percentage)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.MinFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintIbctransfermiddleware(dAtA []byte, offset int, v uint64) int { + offset -= sovIbctransfermiddleware(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ChannelFees) > 0 { + for _, e := range m.ChannelFees { + l = e.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + } + return n +} + +func (m *ChannelFee) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Channel) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + if len(m.AllowedTokens) > 0 { + for _, e := range m.AllowedTokens { + l = e.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + } + l = len(m.FeeAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + if m.MinTimeoutTimestamp != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.MinTimeoutTimestamp)) + } + return n +} + +func (m *CoinItem) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MinFee.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + if m.Percentage != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.Percentage)) + } + return n +} + +func sovIbctransfermiddleware(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozIbctransfermiddleware(x uint64) (n int) { + return sovIbctransfermiddleware(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelFees", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelFees = append(m.ChannelFees, &ChannelFee{}) + if err := m.ChannelFees[len(m.ChannelFees)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChannelFee) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ChannelFee: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChannelFee: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Channel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Channel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowedTokens", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowedTokens = append(m.AllowedTokens, &CoinItem{}) + if err := m.AllowedTokens[len(m.AllowedTokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinTimeoutTimestamp", wireType) + } + m.MinTimeoutTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinTimeoutTimestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CoinItem) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CoinItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CoinItem: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Percentage", wireType) + } + m.Percentage = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Percentage |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipIbctransfermiddleware(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthIbctransfermiddleware + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIbctransfermiddleware + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthIbctransfermiddleware + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthIbctransfermiddleware = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIbctransfermiddleware = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIbctransfermiddleware = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibctransfermiddleware/types/keys.go b/x/ibctransfermiddleware/types/keys.go new file mode 100644 index 000000000..353130e94 --- /dev/null +++ b/x/ibctransfermiddleware/types/keys.go @@ -0,0 +1,17 @@ +package types + +// ParamsKey is the key to use for the keeper store. +var ( + ParamsKey = []byte{0x01} // key for global staking middleware params in the keeper store +) + +const ( + // module name + ModuleName = "ibctransferparamsmodule" + + // StoreKey is the default store key for ibctransfermiddleware module that store params when apply validator set changes and when allow to unbond/redelegate + + StoreKey = "customibcparams" // not using the module name because of collisions with key "staking" + + RouterKey = ModuleName +) diff --git a/x/ibctransfermiddleware/types/msg.go b/x/ibctransfermiddleware/types/msg.go new file mode 100644 index 000000000..fbb9d4593 --- /dev/null +++ b/x/ibctransfermiddleware/types/msg.go @@ -0,0 +1,179 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgAddIBCFeeConfig{} + +const ( + TypeMsgAddIBCFeeConfig = "add_config" + TypeMsgRemoveIBCFeeConfig = "remove_config" + TypeMsgAddAllowedIbcToken = "add_allowed_ibc_token" + TypeMsgRemoveAllowedIbcToken = "remove_allowed_ibc_token" +) + +func NewMsgAddIBCFeeConfig( + authority string, + channelID string, + feeAddress string, + minTimeoutTimestamp int64, +) *MsgAddIBCFeeConfig { + return &MsgAddIBCFeeConfig{ + Authority: authority, + ChannelID: channelID, + FeeAddress: feeAddress, + MinTimeoutTimestamp: minTimeoutTimestamp, + } +} + +// Route Implements Msg. +func (msg MsgAddIBCFeeConfig) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgAddIBCFeeConfig) Type() string { return TypeMsgAddIBCFeeConfig } + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgAddIBCFeeConfig) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgAddParachainIBCTokenInfo message. +func (msg *MsgAddIBCFeeConfig) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgAddIBCFeeConfig) ValidateBasic() error { + // validate authority + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + return nil +} + +var _ sdk.Msg = &MsgRemoveIBCFeeConfig{} + +func NewMsgRemoveIBCFeeConfig( + authority string, + channelID string, +) *MsgRemoveIBCFeeConfig { + return &MsgRemoveIBCFeeConfig{ + Authority: authority, + ChannelID: channelID, + } +} + +// Route Implements Msg. +func (msg MsgRemoveIBCFeeConfig) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgRemoveIBCFeeConfig) Type() string { return TypeMsgRemoveIBCFeeConfig } + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgRemoveIBCFeeConfig) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgRemoveParachainIBCTokenInfo message. +func (msg *MsgRemoveIBCFeeConfig) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgRemoveIBCFeeConfig) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + return nil +} + +var _ sdk.Msg = &MsgAddAllowedIbcToken{} + +func NewMsgAddAllowedIbcToken( + authority string, + channelID string, + denom string, + amount int64, + percentage int64, +) *MsgAddAllowedIbcToken { + return &MsgAddAllowedIbcToken{ + Authority: authority, + ChannelID: channelID, + Denom: denom, + Amount: amount, + Percentage: percentage, + } +} + +// Route Implements Msg. +func (msg MsgAddAllowedIbcToken) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgAddAllowedIbcToken) Type() string { return TypeMsgAddAllowedIbcToken } + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgAddAllowedIbcToken) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgAddParachainIBCTokenInfo message. +func (msg *MsgAddAllowedIbcToken) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgAddAllowedIbcToken) ValidateBasic() error { + // validate authority + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + return nil +} + +var _ sdk.Msg = &MsgRemoveAllowedIbcToken{} + +func NewMsgRemoveAllowedIbcToken( + authority string, + channelID string, + denom string, +) *MsgRemoveAllowedIbcToken { + return &MsgRemoveAllowedIbcToken{ + Authority: authority, + ChannelID: channelID, + Denom: denom, + } +} + +// Route Implements Msg. +func (msg MsgRemoveAllowedIbcToken) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgRemoveAllowedIbcToken) Type() string { return TypeMsgRemoveAllowedIbcToken } + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgRemoveAllowedIbcToken) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgRemoveParachainIBCTokenInfo message. +func (msg *MsgRemoveAllowedIbcToken) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgRemoveAllowedIbcToken) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + return nil +} diff --git a/x/ibctransfermiddleware/types/msgs.go b/x/ibctransfermiddleware/types/msgs.go new file mode 100644 index 000000000..c4ceec79a --- /dev/null +++ b/x/ibctransfermiddleware/types/msgs.go @@ -0,0 +1,28 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateCustomIbcParams{} + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgUpdateCustomIbcParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (m *MsgUpdateCustomIbcParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateCustomIbcParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrapf(err, "invalid authority address") + } + + return nil +} diff --git a/x/ibctransfermiddleware/types/query.pb.go b/x/ibctransfermiddleware/types/query.pb.go new file mode 100644 index 000000000..3781ce2b7 --- /dev/null +++ b/x/ibctransfermiddleware/types/query.pb.go @@ -0,0 +1,537 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_488b65e78926913a, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_488b65e78926913a, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "composable.ibctransfermiddleware.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "composable.ibctransfermiddleware.v1beta1.QueryParamsResponse") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/query.proto", fileDescriptor_488b65e78926913a) +} + +var fileDescriptor_488b65e78926913a = []byte{ + // 286 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x49, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, + 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0xd2, 0x40, 0xe8, 0xd2, 0xc3, 0xaa, 0x4b, 0x0f, 0xaa, 0x4b, 0x4a, 0x24, 0x3d, 0x3f, 0x3d, + 0x1f, 0xac, 0x49, 0x1f, 0xc4, 0x82, 0xe8, 0x97, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, + 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, + 0xca, 0xba, 0x10, 0xed, 0x26, 0xec, 0x76, 0x83, 0x4d, 0x51, 0x12, 0xe1, 0x12, 0x0a, 0x04, 0x39, + 0x39, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x38, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x29, 0x95, + 0x4b, 0x18, 0x45, 0xb4, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0xc8, 0x8f, 0x8b, 0xad, 0x00, 0x2c, + 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x64, 0xa0, 0x47, 0xac, 0x0f, 0xf5, 0x20, 0x26, 0x39, + 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x35, 0xc5, 0xe8, 0x20, 0x23, 0x17, 0x2b, 0xd8, 0x1e, + 0xa1, 0xed, 0x8c, 0x5c, 0x6c, 0x10, 0x25, 0x42, 0x36, 0xc4, 0x1b, 0x8a, 0xe9, 0x72, 0x29, 0x5b, + 0x32, 0x75, 0x43, 0x7c, 0xa8, 0x64, 0xd0, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x2d, 0x21, 0x0d, 0x7d, + 0x82, 0xa1, 0x0b, 0xf1, 0x83, 0x93, 0xf9, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, + 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, + 0x44, 0xc9, 0x56, 0xe0, 0xd0, 0x59, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x00, 0x63, + 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x68, 0x06, 0x43, 0xc4, 0x5c, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Params returns the total set of minting parameters. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params returns the total set of minting parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "composable.ibctransfermiddleware.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "composable/ibctransfermiddleware/v1beta1/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibctransfermiddleware/types/query.pb.gw.go b/x/ibctransfermiddleware/types/query.pb.gw.go new file mode 100644 index 000000000..fcde2bfcb --- /dev/null +++ b/x/ibctransfermiddleware/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"composable", "ibctransfermiddleware", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/ibctransfermiddleware/types/tx.pb.go b/x/ibctransfermiddleware/types/tx.pb.go new file mode 100644 index 000000000..feeca5b08 --- /dev/null +++ b/x/ibctransfermiddleware/types/tx.pb.go @@ -0,0 +1,2399 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateCustomIbcParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/ibctransfermiddleware parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateCustomIbcParams) Reset() { *m = MsgUpdateCustomIbcParams{} } +func (m *MsgUpdateCustomIbcParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCustomIbcParams) ProtoMessage() {} +func (*MsgUpdateCustomIbcParams) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{0} +} +func (m *MsgUpdateCustomIbcParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateCustomIbcParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateCustomIbcParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateCustomIbcParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCustomIbcParams.Merge(m, src) +} +func (m *MsgUpdateCustomIbcParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateCustomIbcParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCustomIbcParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateCustomIbcParams proto.InternalMessageInfo + +func (m *MsgUpdateCustomIbcParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateCustomIbcParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsCustomIbcResponse struct { +} + +func (m *MsgUpdateParamsCustomIbcResponse) Reset() { *m = MsgUpdateParamsCustomIbcResponse{} } +func (m *MsgUpdateParamsCustomIbcResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsCustomIbcResponse) ProtoMessage() {} +func (*MsgUpdateParamsCustomIbcResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{1} +} +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsCustomIbcResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsCustomIbcResponse.Merge(m, src) +} +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsCustomIbcResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsCustomIbcResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsCustomIbcResponse proto.InternalMessageInfo + +// MsgAddParachainInfo represents a message to add new parachain info. +type MsgAddIBCFeeConfig struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + FeeAddress string `protobuf:"bytes,3,opt,name=fee_address,json=feeAddress,proto3" json:"fee_address,omitempty" yaml:"rly_address"` + MinTimeoutTimestamp int64 `protobuf:"varint,4,opt,name=min_timeout_timestamp,json=minTimeoutTimestamp,proto3" json:"min_timeout_timestamp,omitempty"` +} + +func (m *MsgAddIBCFeeConfig) Reset() { *m = MsgAddIBCFeeConfig{} } +func (m *MsgAddIBCFeeConfig) String() string { return proto.CompactTextString(m) } +func (*MsgAddIBCFeeConfig) ProtoMessage() {} +func (*MsgAddIBCFeeConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{2} +} +func (m *MsgAddIBCFeeConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddIBCFeeConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddIBCFeeConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddIBCFeeConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddIBCFeeConfig.Merge(m, src) +} +func (m *MsgAddIBCFeeConfig) XXX_Size() int { + return m.Size() +} +func (m *MsgAddIBCFeeConfig) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddIBCFeeConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddIBCFeeConfig proto.InternalMessageInfo + +func (m *MsgAddIBCFeeConfig) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgAddIBCFeeConfig) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgAddIBCFeeConfig) GetFeeAddress() string { + if m != nil { + return m.FeeAddress + } + return "" +} + +func (m *MsgAddIBCFeeConfig) GetMinTimeoutTimestamp() int64 { + if m != nil { + return m.MinTimeoutTimestamp + } + return 0 +} + +type MsgAddIBCFeeConfigResponse struct { +} + +func (m *MsgAddIBCFeeConfigResponse) Reset() { *m = MsgAddIBCFeeConfigResponse{} } +func (m *MsgAddIBCFeeConfigResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddIBCFeeConfigResponse) ProtoMessage() {} +func (*MsgAddIBCFeeConfigResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{3} +} +func (m *MsgAddIBCFeeConfigResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddIBCFeeConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddIBCFeeConfigResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddIBCFeeConfigResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddIBCFeeConfigResponse.Merge(m, src) +} +func (m *MsgAddIBCFeeConfigResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddIBCFeeConfigResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddIBCFeeConfigResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddIBCFeeConfigResponse proto.InternalMessageInfo + +// MsgRemoveParachainIBCTokenInfo represents a message to remove new parachain +// info. +type MsgRemoveIBCFeeConfig struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` +} + +func (m *MsgRemoveIBCFeeConfig) Reset() { *m = MsgRemoveIBCFeeConfig{} } +func (m *MsgRemoveIBCFeeConfig) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveIBCFeeConfig) ProtoMessage() {} +func (*MsgRemoveIBCFeeConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{4} +} +func (m *MsgRemoveIBCFeeConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveIBCFeeConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveIBCFeeConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveIBCFeeConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveIBCFeeConfig.Merge(m, src) +} +func (m *MsgRemoveIBCFeeConfig) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveIBCFeeConfig) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveIBCFeeConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveIBCFeeConfig proto.InternalMessageInfo + +func (m *MsgRemoveIBCFeeConfig) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgRemoveIBCFeeConfig) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +type MsgRemoveIBCFeeConfigResponse struct { +} + +func (m *MsgRemoveIBCFeeConfigResponse) Reset() { *m = MsgRemoveIBCFeeConfigResponse{} } +func (m *MsgRemoveIBCFeeConfigResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveIBCFeeConfigResponse) ProtoMessage() {} +func (*MsgRemoveIBCFeeConfigResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{5} +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveIBCFeeConfigResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveIBCFeeConfigResponse.Merge(m, src) +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveIBCFeeConfigResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveIBCFeeConfigResponse proto.InternalMessageInfo + +// MsgAddParachainInfo represents a message to add new parachain info. +type MsgAddAllowedIbcToken struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty" yaml:"channel_id"` + Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` + Percentage int64 `protobuf:"varint,5,opt,name=percentage,proto3" json:"percentage,omitempty"` +} + +func (m *MsgAddAllowedIbcToken) Reset() { *m = MsgAddAllowedIbcToken{} } +func (m *MsgAddAllowedIbcToken) String() string { return proto.CompactTextString(m) } +func (*MsgAddAllowedIbcToken) ProtoMessage() {} +func (*MsgAddAllowedIbcToken) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{6} +} +func (m *MsgAddAllowedIbcToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAllowedIbcToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAllowedIbcToken.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddAllowedIbcToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAllowedIbcToken.Merge(m, src) +} +func (m *MsgAddAllowedIbcToken) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAllowedIbcToken) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAllowedIbcToken.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAllowedIbcToken proto.InternalMessageInfo + +func (m *MsgAddAllowedIbcToken) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgAddAllowedIbcToken) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgAddAllowedIbcToken) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *MsgAddAllowedIbcToken) GetAmount() int64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *MsgAddAllowedIbcToken) GetPercentage() int64 { + if m != nil { + return m.Percentage + } + return 0 +} + +type MsgAddAllowedIbcTokenResponse struct { +} + +func (m *MsgAddAllowedIbcTokenResponse) Reset() { *m = MsgAddAllowedIbcTokenResponse{} } +func (m *MsgAddAllowedIbcTokenResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddAllowedIbcTokenResponse) ProtoMessage() {} +func (*MsgAddAllowedIbcTokenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{7} +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAllowedIbcTokenResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAllowedIbcTokenResponse.Merge(m, src) +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAllowedIbcTokenResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAllowedIbcTokenResponse proto.InternalMessageInfo + +type MsgRemoveAllowedIbcToken struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty" yaml:"channel_id"` +} + +func (m *MsgRemoveAllowedIbcToken) Reset() { *m = MsgRemoveAllowedIbcToken{} } +func (m *MsgRemoveAllowedIbcToken) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveAllowedIbcToken) ProtoMessage() {} +func (*MsgRemoveAllowedIbcToken) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{8} +} +func (m *MsgRemoveAllowedIbcToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveAllowedIbcToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveAllowedIbcToken.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveAllowedIbcToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveAllowedIbcToken.Merge(m, src) +} +func (m *MsgRemoveAllowedIbcToken) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveAllowedIbcToken) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveAllowedIbcToken.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveAllowedIbcToken proto.InternalMessageInfo + +func (m *MsgRemoveAllowedIbcToken) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgRemoveAllowedIbcToken) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgRemoveAllowedIbcToken) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type MsgRemoveAllowedIbcTokenResponse struct { +} + +func (m *MsgRemoveAllowedIbcTokenResponse) Reset() { *m = MsgRemoveAllowedIbcTokenResponse{} } +func (m *MsgRemoveAllowedIbcTokenResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveAllowedIbcTokenResponse) ProtoMessage() {} +func (*MsgRemoveAllowedIbcTokenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{9} +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveAllowedIbcTokenResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveAllowedIbcTokenResponse.Merge(m, src) +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveAllowedIbcTokenResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveAllowedIbcTokenResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateCustomIbcParams)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateCustomIbcParams") + proto.RegisterType((*MsgUpdateParamsCustomIbcResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateParamsCustomIbcResponse") + proto.RegisterType((*MsgAddIBCFeeConfig)(nil), "composable.ibctransfermiddleware.v1beta1.MsgAddIBCFeeConfig") + proto.RegisterType((*MsgAddIBCFeeConfigResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgAddIBCFeeConfigResponse") + proto.RegisterType((*MsgRemoveIBCFeeConfig)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveIBCFeeConfig") + proto.RegisterType((*MsgRemoveIBCFeeConfigResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveIBCFeeConfigResponse") + proto.RegisterType((*MsgAddAllowedIbcToken)(nil), "composable.ibctransfermiddleware.v1beta1.MsgAddAllowedIbcToken") + proto.RegisterType((*MsgAddAllowedIbcTokenResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgAddAllowedIbcTokenResponse") + proto.RegisterType((*MsgRemoveAllowedIbcToken)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveAllowedIbcToken") + proto.RegisterType((*MsgRemoveAllowedIbcTokenResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveAllowedIbcTokenResponse") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/tx.proto", fileDescriptor_bf5c053de6965bca) +} + +var fileDescriptor_bf5c053de6965bca = []byte{ + // 729 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xb1, 0x6f, 0xd3, 0x4a, + 0x18, 0x8f, 0xdb, 0x97, 0x48, 0xb9, 0x4a, 0xef, 0xbd, 0xfa, 0xb5, 0x7d, 0xc1, 0xa2, 0x76, 0xe4, + 0x29, 0xaa, 0x44, 0x4c, 0x02, 0xa2, 0x52, 0x85, 0x54, 0xc5, 0x09, 0xa0, 0x54, 0x8a, 0x84, 0xdc, + 0xb2, 0xb0, 0x44, 0x17, 0xfb, 0xe2, 0x5a, 0xf8, 0x7c, 0x96, 0xef, 0xd2, 0x36, 0x1b, 0x62, 0x42, + 0x88, 0x81, 0x85, 0xb5, 0x2b, 0x8c, 0x1d, 0x98, 0xf8, 0x0b, 0x3a, 0x56, 0x2c, 0x30, 0x45, 0x28, + 0x1d, 0xba, 0x31, 0xf4, 0x2f, 0x40, 0xf1, 0x39, 0x4e, 0x9b, 0x38, 0x52, 0xd3, 0x0e, 0xc0, 0x12, + 0xfb, 0xbe, 0xef, 0xbe, 0x9f, 0x7f, 0xdf, 0xef, 0x8b, 0x7f, 0x67, 0x50, 0x32, 0x09, 0xf6, 0x09, + 0x85, 0x2d, 0x17, 0x69, 0x4e, 0xcb, 0x64, 0x01, 0xf4, 0x68, 0x1b, 0x05, 0xd8, 0xb1, 0x2c, 0x17, + 0xed, 0xc3, 0x00, 0x69, 0x7b, 0xa5, 0x16, 0x62, 0xb0, 0xa4, 0xb1, 0x83, 0xa2, 0x1f, 0x10, 0x46, + 0xc4, 0xc2, 0xa8, 0xa4, 0x98, 0x58, 0x52, 0x8c, 0x4a, 0xa4, 0xff, 0x4d, 0x42, 0x31, 0xa1, 0x1a, + 0xa6, 0xb6, 0xb6, 0x57, 0x1a, 0x5c, 0x38, 0x84, 0xb4, 0x08, 0xb1, 0xe3, 0x11, 0x2d, 0xfc, 0x8d, + 0x42, 0x4b, 0x36, 0xb1, 0x49, 0x78, 0xab, 0x0d, 0xee, 0xa2, 0xe8, 0x2d, 0x8e, 0xd0, 0xe4, 0x09, + 0xbe, 0x88, 0x52, 0xb5, 0x2b, 0x33, 0x4f, 0x26, 0x19, 0xa2, 0xa8, 0x3f, 0x04, 0x90, 0x6b, 0x50, + 0xfb, 0x99, 0x6f, 0x41, 0x86, 0xaa, 0x1d, 0xca, 0x08, 0xae, 0xb7, 0xcc, 0xa7, 0x30, 0x80, 0x98, + 0x8a, 0x0f, 0x40, 0x16, 0x76, 0xd8, 0x2e, 0x09, 0x1c, 0xd6, 0xcd, 0x09, 0x79, 0xa1, 0x90, 0xd5, + 0x73, 0x5f, 0x3e, 0xdd, 0x59, 0x8a, 0x78, 0x54, 0x2c, 0x2b, 0x40, 0x94, 0x6e, 0xb3, 0xc0, 0xf1, + 0x6c, 0x63, 0xb4, 0x55, 0xdc, 0x06, 0x19, 0x3f, 0x44, 0xc8, 0xcd, 0xe5, 0x85, 0xc2, 0x42, 0xf9, + 0x6e, 0xf1, 0xaa, 0x92, 0x15, 0xf9, 0x93, 0xf5, 0xec, 0x71, 0x4f, 0x49, 0x7d, 0x3c, 0x3b, 0x5a, + 0x13, 0x8c, 0x08, 0x6a, 0xe3, 0xd1, 0xab, 0xb3, 0xa3, 0xb5, 0xd1, 0x43, 0xde, 0x9c, 0x1d, 0xad, + 0x95, 0x2f, 0x48, 0x70, 0x30, 0x45, 0x84, 0xb8, 0x39, 0x8e, 0xac, 0xaa, 0x20, 0x3f, 0x16, 0x8a, + 0xbb, 0x36, 0x10, 0xf5, 0x89, 0x47, 0x91, 0xfa, 0x7a, 0x0e, 0x88, 0x0d, 0x6a, 0x57, 0x2c, 0xab, + 0xae, 0x57, 0x1f, 0x23, 0x54, 0x25, 0x5e, 0xdb, 0xb1, 0xc5, 0xf2, 0xa4, 0x1c, 0x4b, 0xe7, 0x3d, + 0xe5, 0xdf, 0x2e, 0xc4, 0xee, 0x86, 0x1a, 0xa7, 0xd4, 0x8b, 0x52, 0x54, 0x00, 0x30, 0x77, 0xa1, + 0xe7, 0x21, 0xb7, 0xe9, 0x58, 0xa1, 0x1c, 0x59, 0x5d, 0xed, 0xf7, 0x94, 0x6c, 0x95, 0x47, 0xeb, + 0xb5, 0xf3, 0x9e, 0xb2, 0xc8, 0x11, 0x46, 0x1b, 0x55, 0x23, 0x1b, 0x2d, 0xea, 0x96, 0xb8, 0x0e, + 0x16, 0xda, 0x08, 0x35, 0x21, 0x57, 0x3b, 0x37, 0x1f, 0x62, 0xac, 0x9c, 0xf7, 0x14, 0x91, 0x97, + 0x05, 0x6e, 0x77, 0x98, 0x54, 0x0d, 0xd0, 0x46, 0x28, 0x9a, 0x8b, 0x58, 0x06, 0xcb, 0xd8, 0xf1, + 0x9a, 0xcc, 0xc1, 0x88, 0x74, 0x58, 0x78, 0xa5, 0x0c, 0x62, 0x3f, 0xf7, 0x57, 0x5e, 0x28, 0xcc, + 0x1b, 0xff, 0x61, 0xc7, 0xdb, 0xe1, 0xb9, 0x9d, 0x61, 0x6a, 0xe3, 0xef, 0xcb, 0x2a, 0xab, 0xb7, + 0x81, 0x34, 0xa9, 0x44, 0x2c, 0xd4, 0xa1, 0x00, 0x96, 0x1b, 0xd4, 0x36, 0x10, 0x26, 0x7b, 0xe8, + 0x37, 0xd0, 0x6a, 0x82, 0xbe, 0x02, 0x56, 0x13, 0xf9, 0xc5, 0x1d, 0xbc, 0x9d, 0x0b, 0x3b, 0xa8, + 0x58, 0x56, 0xc5, 0x75, 0xc9, 0x3e, 0xb2, 0xea, 0x2d, 0x73, 0x87, 0xbc, 0x40, 0xde, 0xaf, 0x9a, + 0xf6, 0x7d, 0x90, 0xb6, 0x90, 0x47, 0x70, 0x34, 0x67, 0xb9, 0xdf, 0x53, 0xd2, 0xb5, 0x41, 0x20, + 0xb9, 0x92, 0x6f, 0x16, 0x57, 0x40, 0x06, 0x62, 0xd2, 0xf1, 0x58, 0x34, 0xdb, 0x68, 0x25, 0xca, + 0x00, 0xf8, 0x28, 0x30, 0x91, 0xc7, 0xa0, 0x8d, 0x72, 0xe9, 0x30, 0x77, 0x21, 0x32, 0x45, 0xaf, + 0x49, 0x35, 0x62, 0xbd, 0xbe, 0x72, 0xbf, 0xe0, 0x8a, 0xfe, 0xc9, 0x92, 0x4d, 0xb4, 0xce, 0x8d, + 0x21, 0xb1, 0xb1, 0x61, 0xf7, 0xe5, 0xcf, 0x19, 0x30, 0xdf, 0xa0, 0xb6, 0xf8, 0x41, 0x00, 0xcb, + 0xc9, 0x96, 0xa9, 0x5f, 0xdd, 0xea, 0xa6, 0xd9, 0xae, 0xb4, 0x75, 0x0d, 0x8c, 0x29, 0x56, 0x26, + 0xbe, 0x17, 0xc0, 0x3f, 0xe3, 0x3e, 0xf6, 0x70, 0x26, 0xfc, 0xb1, 0x6a, 0xa9, 0x76, 0x93, 0xea, + 0x98, 0xd7, 0xa1, 0x00, 0xc4, 0x04, 0xdb, 0xd8, 0x9c, 0x09, 0x7c, 0x12, 0x40, 0x7a, 0x72, 0x43, + 0x80, 0x4b, 0x04, 0x13, 0x5c, 0x61, 0x73, 0xd6, 0xee, 0xc7, 0x00, 0x66, 0x24, 0x38, 0xfd, 0x4d, + 0x0c, 0xff, 0x83, 0xc9, 0xaf, 0xa1, 0x7e, 0x0d, 0x0d, 0xc6, 0x69, 0x6e, 0xdd, 0x1c, 0x63, 0xc8, + 0x54, 0x4a, 0xbf, 0x1c, 0x1c, 0xe4, 0xfa, 0xfa, 0x71, 0x5f, 0x16, 0x4e, 0xfa, 0xb2, 0xf0, 0xbd, + 0x2f, 0x0b, 0xef, 0x4e, 0xe5, 0xd4, 0xc9, 0xa9, 0x9c, 0xfa, 0x76, 0x2a, 0xa7, 0x9e, 0xaf, 0x4e, + 0x3b, 0xbc, 0x59, 0xd7, 0x47, 0xb4, 0x95, 0x09, 0x3f, 0x55, 0xee, 0xfd, 0x0c, 0x00, 0x00, 0xff, + 0xff, 0x87, 0x62, 0x58, 0x5e, 0xac, 0x09, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + UpdateCustomIbcParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) + AddIBCFeeConfig(ctx context.Context, in *MsgAddIBCFeeConfig, opts ...grpc.CallOption) (*MsgAddIBCFeeConfigResponse, error) + RemoveIBCFeeConfig(ctx context.Context, in *MsgRemoveIBCFeeConfig, opts ...grpc.CallOption) (*MsgRemoveIBCFeeConfigResponse, error) + AddAllowedIbcToken(ctx context.Context, in *MsgAddAllowedIbcToken, opts ...grpc.CallOption) (*MsgAddAllowedIbcTokenResponse, error) + RemoveAllowedIbcToken(ctx context.Context, in *MsgRemoveAllowedIbcToken, opts ...grpc.CallOption) (*MsgRemoveAllowedIbcTokenResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateCustomIbcParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) { + out := new(MsgUpdateParamsCustomIbcResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateCustomIbcParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) AddIBCFeeConfig(ctx context.Context, in *MsgAddIBCFeeConfig, opts ...grpc.CallOption) (*MsgAddIBCFeeConfigResponse, error) { + out := new(MsgAddIBCFeeConfigResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/AddIBCFeeConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveIBCFeeConfig(ctx context.Context, in *MsgRemoveIBCFeeConfig, opts ...grpc.CallOption) (*MsgRemoveIBCFeeConfigResponse, error) { + out := new(MsgRemoveIBCFeeConfigResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/RemoveIBCFeeConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) AddAllowedIbcToken(ctx context.Context, in *MsgAddAllowedIbcToken, opts ...grpc.CallOption) (*MsgAddAllowedIbcTokenResponse, error) { + out := new(MsgAddAllowedIbcTokenResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/AddAllowedIbcToken", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveAllowedIbcToken(ctx context.Context, in *MsgRemoveAllowedIbcToken, opts ...grpc.CallOption) (*MsgRemoveAllowedIbcTokenResponse, error) { + out := new(MsgRemoveAllowedIbcTokenResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/RemoveAllowedIbcToken", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + UpdateCustomIbcParams(context.Context, *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) + AddIBCFeeConfig(context.Context, *MsgAddIBCFeeConfig) (*MsgAddIBCFeeConfigResponse, error) + RemoveIBCFeeConfig(context.Context, *MsgRemoveIBCFeeConfig) (*MsgRemoveIBCFeeConfigResponse, error) + AddAllowedIbcToken(context.Context, *MsgAddAllowedIbcToken) (*MsgAddAllowedIbcTokenResponse, error) + RemoveAllowedIbcToken(context.Context, *MsgRemoveAllowedIbcToken) (*MsgRemoveAllowedIbcTokenResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateCustomIbcParams(ctx context.Context, req *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCustomIbcParams not implemented") +} +func (*UnimplementedMsgServer) AddIBCFeeConfig(ctx context.Context, req *MsgAddIBCFeeConfig) (*MsgAddIBCFeeConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddIBCFeeConfig not implemented") +} +func (*UnimplementedMsgServer) RemoveIBCFeeConfig(ctx context.Context, req *MsgRemoveIBCFeeConfig) (*MsgRemoveIBCFeeConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveIBCFeeConfig not implemented") +} +func (*UnimplementedMsgServer) AddAllowedIbcToken(ctx context.Context, req *MsgAddAllowedIbcToken) (*MsgAddAllowedIbcTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddAllowedIbcToken not implemented") +} +func (*UnimplementedMsgServer) RemoveAllowedIbcToken(ctx context.Context, req *MsgRemoveAllowedIbcToken) (*MsgRemoveAllowedIbcTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveAllowedIbcToken not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateCustomIbcParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateCustomIbcParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateCustomIbcParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateCustomIbcParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateCustomIbcParams(ctx, req.(*MsgUpdateCustomIbcParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_AddIBCFeeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddIBCFeeConfig) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddIBCFeeConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/AddIBCFeeConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddIBCFeeConfig(ctx, req.(*MsgAddIBCFeeConfig)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveIBCFeeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveIBCFeeConfig) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveIBCFeeConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/RemoveIBCFeeConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveIBCFeeConfig(ctx, req.(*MsgRemoveIBCFeeConfig)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_AddAllowedIbcToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddAllowedIbcToken) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddAllowedIbcToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/AddAllowedIbcToken", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddAllowedIbcToken(ctx, req.(*MsgAddAllowedIbcToken)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveAllowedIbcToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveAllowedIbcToken) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveAllowedIbcToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/RemoveAllowedIbcToken", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveAllowedIbcToken(ctx, req.(*MsgRemoveAllowedIbcToken)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "composable.ibctransfermiddleware.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateCustomIbcParams", + Handler: _Msg_UpdateCustomIbcParams_Handler, + }, + { + MethodName: "AddIBCFeeConfig", + Handler: _Msg_AddIBCFeeConfig_Handler, + }, + { + MethodName: "RemoveIBCFeeConfig", + Handler: _Msg_RemoveIBCFeeConfig_Handler, + }, + { + MethodName: "AddAllowedIbcToken", + Handler: _Msg_AddAllowedIbcToken_Handler, + }, + { + MethodName: "RemoveAllowedIbcToken", + Handler: _Msg_RemoveAllowedIbcToken_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "composable/ibctransfermiddleware/v1beta1/tx.proto", +} + +func (m *MsgUpdateCustomIbcParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateCustomIbcParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateCustomIbcParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsCustomIbcResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsCustomIbcResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsCustomIbcResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgAddIBCFeeConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddIBCFeeConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddIBCFeeConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinTimeoutTimestamp != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MinTimeoutTimestamp)) + i-- + dAtA[i] = 0x20 + } + if len(m.FeeAddress) > 0 { + i -= len(m.FeeAddress) + copy(dAtA[i:], m.FeeAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FeeAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddIBCFeeConfigResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddIBCFeeConfigResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddIBCFeeConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRemoveIBCFeeConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveIBCFeeConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveIBCFeeConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveIBCFeeConfigResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveIBCFeeConfigResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveIBCFeeConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgAddAllowedIbcToken) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddAllowedIbcToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAllowedIbcToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Percentage != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Percentage)) + i-- + dAtA[i] = 0x28 + } + if m.Amount != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddAllowedIbcTokenResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddAllowedIbcTokenResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAllowedIbcTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRemoveAllowedIbcToken) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveAllowedIbcToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveAllowedIbcToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveAllowedIbcTokenResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveAllowedIbcTokenResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveAllowedIbcTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateCustomIbcParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsCustomIbcResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgAddIBCFeeConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.FeeAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.MinTimeoutTimestamp != 0 { + n += 1 + sovTx(uint64(m.MinTimeoutTimestamp)) + } + return n +} + +func (m *MsgAddIBCFeeConfigResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveIBCFeeConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveIBCFeeConfigResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgAddAllowedIbcToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovTx(uint64(m.Amount)) + } + if m.Percentage != 0 { + n += 1 + sovTx(uint64(m.Percentage)) + } + return n +} + +func (m *MsgAddAllowedIbcTokenResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveAllowedIbcToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveAllowedIbcTokenResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateCustomIbcParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateCustomIbcParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsCustomIbcResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddIBCFeeConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddIBCFeeConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddIBCFeeConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinTimeoutTimestamp", wireType) + } + m.MinTimeoutTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinTimeoutTimestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddIBCFeeConfigResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddIBCFeeConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveIBCFeeConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveIBCFeeConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveIBCFeeConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveIBCFeeConfigResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveIBCFeeConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddAllowedIbcToken) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddAllowedIbcToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddAllowedIbcToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Percentage", wireType) + } + m.Percentage = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Percentage |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddAllowedIbcTokenResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddAllowedIbcTokenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddAllowedIbcTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveAllowedIbcToken) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveAllowedIbcToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveAllowedIbcToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveAllowedIbcTokenResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveAllowedIbcTokenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveAllowedIbcTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/mint/abci.go b/x/mint/abci.go index c24f80747..42964667d 100644 --- a/x/mint/abci.go +++ b/x/mint/abci.go @@ -25,7 +25,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, ic types.InflationCalculatio minter.AnnualProvisions = minter.NextAnnualProvisions(params, totalStakingSupply) k.SetMinter(ctx, minter) - // mint coins, update supply + // calculate how many we would mint, but we dont mint them, we take them from the prefunded account mintedCoin := minter.BlockProvision(params) mintedCoins := sdk.NewCoins(mintedCoin) @@ -41,10 +41,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, ic types.InflationCalculatio ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeMint, - sdk.NewAttribute(types.AttributeKeyBondedRatio, bondedRatio.String()), - sdk.NewAttribute(types.AttributeKeyInflation, minter.Inflation.String()), - sdk.NewAttribute(types.AttributeKeyAnnualProvisions, minter.AnnualProvisions.String()), + types.EventTypeReward, sdk.NewAttribute(sdk.AttributeKeyAmount, mintedCoin.Amount.String()), ), ) diff --git a/x/mint/types/events.go b/x/mint/types/events.go index 891f50768..92d52efac 100644 --- a/x/mint/types/events.go +++ b/x/mint/types/events.go @@ -3,6 +3,8 @@ package types // Minting module event types const ( EventTypeMint = ModuleName + EventTypeReward = "reward_distributed" + EventTypeMintSlashed = "mint_slashed_into_comminity_pool" EventAddAllowedFundAddress = "add_allowed_fund" AttributeKeyBondedRatio = "bonded_ratio" diff --git a/x/stakingmiddleware/client/cli/tx.go b/x/stakingmiddleware/client/cli/tx.go index 093158519..04b162b50 100644 --- a/x/stakingmiddleware/client/cli/tx.go +++ b/x/stakingmiddleware/client/cli/tx.go @@ -2,9 +2,6 @@ package cli import ( "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" "github.com/spf13/cobra" ) @@ -19,37 +16,7 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - txCmd.AddCommand( - GetCmdAddRevenueFundsToStaking(), - ) + txCmd.AddCommand() return txCmd } - -func GetCmdAddRevenueFundsToStaking() *cobra.Command { - cmd := &cobra.Command{ - Use: "add-revenue [amount]", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - coins, err := sdk.ParseCoinsNormalized(args[0]) - if err != nil { - return err - } - - msg := &types.MsgAddRevenueFundsToStakingParams{ - FromAddress: clientCtx.GetFromAddress().String(), - Amount: coins, - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/stakingmiddleware/keeper/keeper.go b/x/stakingmiddleware/keeper/keeper.go index 83660b572..4580cb017 100644 --- a/x/stakingmiddleware/keeper/keeper.go +++ b/x/stakingmiddleware/keeper/keeper.go @@ -9,17 +9,12 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - banktypes "github.com/notional-labs/composable/v6/custom/bank/types" ) // Keeper of the staking middleware store type Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - stakingKeeper banktypes.StakingKeeper + cdc codec.BinaryCodec + storeKey storetypes.StoreKey // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string @@ -29,24 +24,15 @@ type Keeper struct { func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, - ak types.AccountKeeper, - bk types.BankKeeper, authority string, ) Keeper { return Keeper{ - cdc: cdc, - storeKey: key, - accountKeeper: ak, - bankKeeper: bk, - stakingKeeper: stakingkeeper.Keeper{}, - authority: authority, + cdc: cdc, + storeKey: key, + authority: authority, } } -func (k *Keeper) RegisterKeepers(sk banktypes.StakingKeeper) { - k.stakingKeeper = sk -} - // GetAuthority returns the x/stakingmiddleware module's authority. func (k Keeper) GetAuthority() string { return k.authority @@ -88,8 +74,3 @@ func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { k.cdc.MustUnmarshal(bz, &p) return p } - -func (k Keeper) GetModuleAccountAccAddress(ctx sdk.Context) sdk.AccAddress { - moduleAccount := k.accountKeeper.GetModuleAccount(ctx, types.RewardModuleName) - return moduleAccount.GetAddress() -} diff --git a/x/stakingmiddleware/keeper/msg_server.go b/x/stakingmiddleware/keeper/msg_server.go index 47f3e2509..95de74ad9 100644 --- a/x/stakingmiddleware/keeper/msg_server.go +++ b/x/stakingmiddleware/keeper/msg_server.go @@ -36,31 +36,3 @@ func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdat return &types.MsgUpdateParamsEpochResponse{}, nil } - -// UpdateParams updates the params. -func (ms msgServer) AddRevenueFundsToStaking(goCtx context.Context, req *types.MsgAddRevenueFundsToStakingParams) (*types.MsgAddRevenueFundsToStakingResponse, error) { - // Unwrap context - ctx := sdk.UnwrapSDKContext(goCtx) - - // Check sender address - sender, err := sdk.AccAddressFromBech32(req.FromAddress) - if err != nil { - return nil, err - } - - rewardDenom := ms.Keeper.stakingKeeper.BondDenom(ctx) - - // Check that reward is 1 coin rewardDenom - if len(req.Amount.Denoms()) != 1 || req.Amount[0].Denom != rewardDenom { - return nil, errorsmod.Wrapf(types.ErrInvalidCoin, "Invalid coin") - } - - // Send Fund to account module - moduleAccountAccAddress := ms.GetModuleAccountAccAddress(ctx) - err = ms.bankKeeper.SendCoins(ctx, sender, moduleAccountAccAddress, req.Amount) - if err != nil { - return nil, err - } - - return &types.MsgAddRevenueFundsToStakingResponse{}, nil -} diff --git a/x/stakingmiddleware/types/errors.go b/x/stakingmiddleware/types/errors.go deleted file mode 100644 index c2b334aab..000000000 --- a/x/stakingmiddleware/types/errors.go +++ /dev/null @@ -1,7 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" -) - -var ErrInvalidCoin = errorsmod.Register(ModuleName, 1, "invalid coin") diff --git a/x/stakingmiddleware/types/expected_keepers.go b/x/stakingmiddleware/types/expected_keepers.go deleted file mode 100644 index 382d678dd..000000000 --- a/x/stakingmiddleware/types/expected_keepers.go +++ /dev/null @@ -1,17 +0,0 @@ -package types // noalias - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the contract required for account APIs. -type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) types.ModuleAccountI -} - -// BankKeeper defines the contract needed to be fulfilled for banking and supply -// dependencies. -type BankKeeper interface { - SendCoins(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error -} diff --git a/x/stakingmiddleware/types/keys.go b/x/stakingmiddleware/types/keys.go index 28f5b9aba..a4f667e69 100644 --- a/x/stakingmiddleware/types/keys.go +++ b/x/stakingmiddleware/types/keys.go @@ -7,8 +7,7 @@ var ( const ( // module name - ModuleName = "stakingmiddleware" - RewardModuleName = "fee_collector" + ModuleName = "stakingmiddleware" // StoreKey is the default store key for stakingmiddleware module that store params when apply validator set changes and when allow to unbond/redelegate diff --git a/x/stakingmiddleware/types/msgs.go b/x/stakingmiddleware/types/msgs.go index a2ea12a5a..4418aa784 100644 --- a/x/stakingmiddleware/types/msgs.go +++ b/x/stakingmiddleware/types/msgs.go @@ -26,23 +26,3 @@ func (m *MsgUpdateEpochParams) ValidateBasic() error { return nil } - -// GetSignBytes implements the LegacyMsg interface. -func (m MsgAddRevenueFundsToStakingParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -// GetSigners returns the expected signers for a MsgUpdateParams message. -func (m *MsgAddRevenueFundsToStakingParams) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(m.FromAddress) - return []sdk.AccAddress{addr} -} - -// ValidateBasic does a sanity check on the provided data. -func (m *MsgAddRevenueFundsToStakingParams) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(m.FromAddress); err != nil { - return errorsmod.Wrapf(err, "invalid address") - } - - return nil -} diff --git a/x/stakingmiddleware/types/tx.pb.go b/x/stakingmiddleware/types/tx.pb.go index fb5d7e8f6..5bf477a33 100644 --- a/x/stakingmiddleware/types/tx.pb.go +++ b/x/stakingmiddleware/types/tx.pb.go @@ -7,8 +7,6 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -133,99 +131,9 @@ func (m *MsgUpdateParamsEpochResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsEpochResponse proto.InternalMessageInfo -type MsgAddRevenueFundsToStakingParams struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` -} - -func (m *MsgAddRevenueFundsToStakingParams) Reset() { *m = MsgAddRevenueFundsToStakingParams{} } -func (m *MsgAddRevenueFundsToStakingParams) String() string { return proto.CompactTextString(m) } -func (*MsgAddRevenueFundsToStakingParams) ProtoMessage() {} -func (*MsgAddRevenueFundsToStakingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_4ef8bcd16d104cd6, []int{2} -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddRevenueFundsToStakingParams.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddRevenueFundsToStakingParams.Merge(m, src) -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_Size() int { - return m.Size() -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddRevenueFundsToStakingParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddRevenueFundsToStakingParams proto.InternalMessageInfo - -func (m *MsgAddRevenueFundsToStakingParams) GetFromAddress() string { - if m != nil { - return m.FromAddress - } - return "" -} - -func (m *MsgAddRevenueFundsToStakingParams) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Amount - } - return nil -} - -type MsgAddRevenueFundsToStakingResponse struct { -} - -func (m *MsgAddRevenueFundsToStakingResponse) Reset() { *m = MsgAddRevenueFundsToStakingResponse{} } -func (m *MsgAddRevenueFundsToStakingResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAddRevenueFundsToStakingResponse) ProtoMessage() {} -func (*MsgAddRevenueFundsToStakingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4ef8bcd16d104cd6, []int{3} -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddRevenueFundsToStakingResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddRevenueFundsToStakingResponse.Merge(m, src) -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddRevenueFundsToStakingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddRevenueFundsToStakingResponse proto.InternalMessageInfo - func init() { proto.RegisterType((*MsgUpdateEpochParams)(nil), "composable.stakingmiddleware.v1beta1.MsgUpdateEpochParams") proto.RegisterType((*MsgUpdateParamsEpochResponse)(nil), "composable.stakingmiddleware.v1beta1.MsgUpdateParamsEpochResponse") - proto.RegisterType((*MsgAddRevenueFundsToStakingParams)(nil), "composable.stakingmiddleware.v1beta1.MsgAddRevenueFundsToStakingParams") - proto.RegisterType((*MsgAddRevenueFundsToStakingResponse)(nil), "composable.stakingmiddleware.v1beta1.MsgAddRevenueFundsToStakingResponse") } func init() { @@ -233,40 +141,30 @@ func init() { } var fileDescriptor_4ef8bcd16d104cd6 = []byte{ - // 522 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x4d, 0x8f, 0xd2, 0x40, - 0x18, 0x66, 0x96, 0x48, 0xc2, 0xe0, 0x85, 0x86, 0xc4, 0xd2, 0x98, 0x2e, 0xa2, 0x26, 0x84, 0x48, - 0x1b, 0xd8, 0xe8, 0x01, 0xbd, 0x50, 0xa3, 0xc6, 0x03, 0xd1, 0xb0, 0x7a, 0xf1, 0xb2, 0x99, 0xd2, - 0xb1, 0x34, 0xbb, 0x9d, 0x69, 0xfa, 0x4e, 0x71, 0xf7, 0x66, 0x3c, 0x7a, 0x32, 0xf1, 0x4f, 0x18, - 0x0f, 0x86, 0x83, 0x3f, 0x62, 0x8f, 0x1b, 0xbd, 0x78, 0xf1, 0x23, 0x70, 0xe0, 0x6f, 0x98, 0x76, - 0x66, 0x17, 0x15, 0x44, 0xcc, 0x5e, 0x98, 0xe1, 0xfd, 0x78, 0xde, 0x79, 0x9e, 0xe7, 0x2d, 0x6e, - 0x0d, 0x79, 0x18, 0x71, 0x20, 0xee, 0x01, 0xb5, 0x41, 0x90, 0xfd, 0x80, 0xf9, 0x61, 0xe0, 0x79, - 0x07, 0xf4, 0x05, 0x89, 0xa9, 0x3d, 0x6e, 0xbb, 0x54, 0x90, 0xb6, 0x2d, 0x0e, 0xad, 0x28, 0xe6, - 0x82, 0x6b, 0xd7, 0x16, 0xe5, 0xd6, 0x52, 0xb9, 0xa5, 0xca, 0x0d, 0x73, 0xc8, 0x21, 0xe4, 0x60, - 0xbb, 0x04, 0x16, 0x18, 0x43, 0x1e, 0x30, 0x89, 0x62, 0x5c, 0x52, 0xf9, 0x10, 0x7c, 0x7b, 0xdc, - 0x4e, 0x0f, 0x95, 0x28, 0x93, 0x30, 0x60, 0xdc, 0xce, 0x7e, 0x55, 0xa8, 0xe2, 0x73, 0x9f, 0x67, - 0x57, 0x3b, 0xbd, 0xa9, 0x68, 0x55, 0x22, 0xec, 0xc9, 0x84, 0xfc, 0xa3, 0x52, 0x77, 0x36, 0x62, - 0xb4, 0xfc, 0xf8, 0xac, 0xbb, 0x3e, 0x45, 0xb8, 0xd2, 0x07, 0xff, 0x69, 0xe4, 0x11, 0x41, 0xef, - 0x45, 0x7c, 0x38, 0x7a, 0x4c, 0x62, 0x12, 0x82, 0x76, 0x0b, 0x17, 0x49, 0x22, 0x46, 0x3c, 0x0e, - 0xc4, 0x91, 0x8e, 0x6a, 0xa8, 0x51, 0x74, 0xf4, 0x4f, 0x1f, 0x5b, 0x15, 0x35, 0xbb, 0xe7, 0x79, - 0x31, 0x05, 0xd8, 0x15, 0x71, 0xc0, 0xfc, 0xc1, 0xa2, 0x54, 0x7b, 0x84, 0x0b, 0x51, 0x86, 0xa0, - 0x6f, 0xd5, 0x50, 0xa3, 0xd4, 0xb9, 0x61, 0x6d, 0x22, 0xa1, 0x25, 0xa7, 0x3a, 0xc5, 0xe3, 0x6f, - 0xdb, 0xb9, 0x77, 0xf3, 0x49, 0x13, 0x0d, 0x14, 0x4c, 0xb7, 0xf7, 0x6a, 0x3e, 0x69, 0x2e, 0x06, - 0xbc, 0x9e, 0x4f, 0x9a, 0xbf, 0x40, 0xda, 0x87, 0x2b, 0x48, 0x9f, 0x11, 0x92, 0xa8, 0x75, 0x13, - 0x5f, 0xfe, 0x23, 0x94, 0x31, 0x1d, 0x50, 0x88, 0x38, 0x03, 0x5a, 0xff, 0x8a, 0xf0, 0x95, 0x3e, - 0xf8, 0x3d, 0xcf, 0x1b, 0xd0, 0x31, 0x65, 0x09, 0xbd, 0x9f, 0x30, 0x0f, 0x9e, 0xf0, 0x5d, 0x89, - 0xac, 0x14, 0xb9, 0x8d, 0x2f, 0x3e, 0x8f, 0x79, 0xb8, 0x47, 0x24, 0xf5, 0x7f, 0x8a, 0x52, 0x4a, - 0xab, 0x55, 0x48, 0x1b, 0xe1, 0x02, 0x09, 0x79, 0xc2, 0x84, 0x9e, 0xaf, 0xe5, 0x1b, 0xa5, 0x4e, - 0xd5, 0x52, 0x3d, 0xe9, 0xce, 0x9c, 0xa9, 0x70, 0x97, 0x07, 0xcc, 0xb9, 0x99, 0x6a, 0xf0, 0xfe, - 0xfb, 0x76, 0xc3, 0x0f, 0xc4, 0x28, 0x71, 0x53, 0xb2, 0xca, 0x71, 0x75, 0xb4, 0xc0, 0xdb, 0xb7, - 0xc5, 0x51, 0x44, 0x21, 0x6b, 0x00, 0xa5, 0x97, 0xc4, 0xef, 0x96, 0x53, 0xbd, 0x7e, 0x7b, 0x69, - 0xfd, 0x3a, 0xbe, 0xba, 0x86, 0xde, 0xa9, 0x0c, 0x9d, 0xcf, 0x5b, 0x38, 0xdf, 0x07, 0x5f, 0x7b, - 0x8b, 0x70, 0x79, 0x79, 0x21, 0xba, 0x9b, 0x19, 0xb9, 0x6a, 0x99, 0x0c, 0xe7, 0x3f, 0x7b, 0x57, - 0x98, 0xa4, 0x7d, 0x40, 0x58, 0xff, 0x1b, 0x05, 0xed, 0xc1, 0xc6, 0x03, 0xd6, 0x9b, 0x6c, 0x3c, - 0x3c, 0x37, 0xd0, 0xe9, 0x83, 0x8d, 0x0b, 0x2f, 0x53, 0x5f, 0x9c, 0x9d, 0xe3, 0xa9, 0x89, 0x4e, - 0xa6, 0x26, 0xfa, 0x31, 0x35, 0xd1, 0x9b, 0x99, 0x99, 0x3b, 0x99, 0x99, 0xb9, 0x2f, 0x33, 0x33, - 0xf7, 0xac, 0xba, 0x6a, 0x77, 0x33, 0x5f, 0xdd, 0x42, 0xf6, 0x75, 0xee, 0xfc, 0x0c, 0x00, 0x00, - 0xff, 0xff, 0x00, 0xe0, 0x13, 0xf7, 0xaf, 0x04, 0x00, 0x00, + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4d, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0x2f, 0x2e, 0x49, 0xcc, 0xce, 0xcc, 0x4b, 0xcf, 0xcd, + 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x41, 0x28, 0xd7, 0xc3, 0x50, + 0xae, 0x07, 0x55, 0x2e, 0x25, 0x9e, 0x9c, 0x5f, 0x9c, 0x9b, 0x5f, 0xac, 0x9f, 0x5b, 0x9c, 0xae, + 0x5f, 0x66, 0x08, 0xa2, 0x20, 0xda, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, + 0x54, 0x48, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xcc, 0xd4, 0x07, 0xb1, 0xa0, 0xa2, 0x92, 0x10, 0x13, + 0xe2, 0x21, 0x12, 0x10, 0x0e, 0x54, 0xca, 0x86, 0x28, 0x17, 0x63, 0x3a, 0x0e, 0xac, 0x5b, 0xe9, + 0x11, 0x23, 0x97, 0x88, 0x6f, 0x71, 0x7a, 0x68, 0x41, 0x4a, 0x62, 0x49, 0xaa, 0x6b, 0x41, 0x7e, + 0x72, 0x46, 0x40, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x90, 0x19, 0x17, 0x67, 0x62, 0x69, 0x49, 0x46, + 0x7e, 0x51, 0x66, 0x49, 0xa5, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xc4, 0xa5, 0x2d, 0xba, + 0x22, 0x50, 0xbb, 0x1d, 0x53, 0x52, 0x8a, 0x52, 0x8b, 0x8b, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, + 0x83, 0x10, 0x4a, 0x85, 0xfc, 0xb9, 0xd8, 0x0a, 0xc0, 0x26, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, + 0x1b, 0xe9, 0xe8, 0x11, 0x13, 0x44, 0x7a, 0x10, 0x5b, 0x9d, 0x38, 0x4f, 0xdc, 0x93, 0x67, 0x58, + 0xf1, 0x7c, 0x83, 0x16, 0x63, 0x10, 0xd4, 0x18, 0x2b, 0xc7, 0xa6, 0xe7, 0x1b, 0xb4, 0x10, 0x16, + 0x74, 0x3d, 0xdf, 0xa0, 0x85, 0x64, 0xa4, 0x7e, 0x05, 0x16, 0x4f, 0xc3, 0x3d, 0x04, 0x31, 0x55, + 0x49, 0x8e, 0x4b, 0x06, 0x4d, 0x08, 0xec, 0xd3, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, + 0xa3, 0x45, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x93, 0x19, 0xb9, 0x04, 0x31, 0x43, 0xc2, + 0x8a, 0x38, 0x1f, 0x60, 0x0b, 0x45, 0x29, 0x27, 0x12, 0xf5, 0x62, 0x71, 0x9d, 0x14, 0x6b, 0x03, + 0x28, 0x3c, 0x9c, 0x8c, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, + 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x12, + 0x5b, 0x18, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x63, 0xd9, 0x18, 0x10, 0x00, 0x00, + 0xff, 0xff, 0xc4, 0xc6, 0x61, 0xc6, 0xd7, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -282,7 +180,6 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) - AddRevenueFundsToStaking(ctx context.Context, in *MsgAddRevenueFundsToStakingParams, opts ...grpc.CallOption) (*MsgAddRevenueFundsToStakingResponse, error) } type msgClient struct { @@ -302,19 +199,9 @@ func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochPar return out, nil } -func (c *msgClient) AddRevenueFundsToStaking(ctx context.Context, in *MsgAddRevenueFundsToStakingParams, opts ...grpc.CallOption) (*MsgAddRevenueFundsToStakingResponse, error) { - out := new(MsgAddRevenueFundsToStakingResponse) - err := c.cc.Invoke(ctx, "/composable.stakingmiddleware.v1beta1.Msg/AddRevenueFundsToStaking", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // MsgServer is the server API for Msg service. type MsgServer interface { UpdateEpochParams(context.Context, *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) - AddRevenueFundsToStaking(context.Context, *MsgAddRevenueFundsToStakingParams) (*MsgAddRevenueFundsToStakingResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -324,9 +211,6 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateEpochParams not implemented") } -func (*UnimplementedMsgServer) AddRevenueFundsToStaking(ctx context.Context, req *MsgAddRevenueFundsToStakingParams) (*MsgAddRevenueFundsToStakingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddRevenueFundsToStaking not implemented") -} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -350,24 +234,6 @@ func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Msg_AddRevenueFundsToStaking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAddRevenueFundsToStakingParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AddRevenueFundsToStaking(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/composable.stakingmiddleware.v1beta1.Msg/AddRevenueFundsToStaking", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AddRevenueFundsToStaking(ctx, req.(*MsgAddRevenueFundsToStakingParams)) - } - return interceptor(ctx, in, info, handler) -} - var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "composable.stakingmiddleware.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -376,10 +242,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateEpochParams", Handler: _Msg_UpdateEpochParams_Handler, }, - { - MethodName: "AddRevenueFundsToStaking", - Handler: _Msg_AddRevenueFundsToStaking_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "composable/stakingmiddleware/v1beta1/tx.proto", @@ -448,73 +310,6 @@ func (m *MsgUpdateParamsEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *MsgAddRevenueFundsToStakingParams) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgAddRevenueFundsToStakingParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddRevenueFundsToStakingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgAddRevenueFundsToStakingResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgAddRevenueFundsToStakingResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddRevenueFundsToStakingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -550,34 +345,6 @@ func (m *MsgUpdateParamsEpochResponse) Size() (n int) { return n } -func (m *MsgAddRevenueFundsToStakingParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgAddRevenueFundsToStakingResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -749,172 +516,6 @@ func (m *MsgUpdateParamsEpochResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddRevenueFundsToStakingParams) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgAddRevenueFundsToStakingParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddRevenueFundsToStakingParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAddRevenueFundsToStakingResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgAddRevenueFundsToStakingResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddRevenueFundsToStakingResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/transfermiddleware/ibc_ante_test.go b/x/transfermiddleware/ibc_ante_test.go index 0ba0b9c33..bbf739a8c 100644 --- a/x/transfermiddleware/ibc_ante_test.go +++ b/x/transfermiddleware/ibc_ante_test.go @@ -15,7 +15,12 @@ import ( customibctesting "github.com/notional-labs/composable/v6/app/ibctesting" ) -var govAuthorityAddress = "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m" // convert from: centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m +// NOTE: This is the address of the gov authority on the chain that is being tested. +// This means that we need to check bech32 .... everywhere. +var govAuthorityAddress = "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m" + +// ORIGINAL NOTES: +// convert from: centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m type TransferTestSuite struct { suite.Suite @@ -55,7 +60,9 @@ func (suite *TransferTestSuite) SetupTest() { suite.wasmKeeper = suite.chainB.GetTestSupport().Wasm08Keeper() msg := wasmtypes.NewMsgPushNewWasmCode(govAuthorityAddress, wasmContract) + response, err := suite.wasmKeeper.PushNewWasmCode(suite.ctx, msg) + suite.Require().NoError(err) suite.Require().NotNil(response.CodeId) suite.coordinator.CodeID = response.CodeId